mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
cb57c6c6bf
Currently building Angular Material with gulp inside of directories that include spaces, does not work because `child_process.spawnSync` does not properly treat the whole path as binary and just considers everything after the first space as command line argument. We can fix these issues by ensuring that the binary is always located in the working directory. Also we would need to make sure that we wrap all `child_process` arguments with explict quotes because otherwise NodeJS would treat them as individual arguments (e.g. `path/to/my project/ -> ["path/to/my", "project"]) -- **TL;DR**: As this is just too much work for something we will eventually replace with Bazel, we are just printing an error message.
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
'use strict';
|
|
/**
|
|
* Load the TypeScript compiler, then load the TypeScript gulpfile which simply loads all
|
|
* the tasks. The tasks are really inside tools/gulp/tasks.
|
|
*/
|
|
|
|
const path = require('path');
|
|
|
|
const projectDir = __dirname;
|
|
const tsconfigPath = path.join(projectDir, 'tools/gulp/tsconfig.json');
|
|
const tsconfig = require(tsconfigPath);
|
|
|
|
if (projectDir.includes(' ')) {
|
|
console.error('Error: Cannot run the Angular Material build tasks if the project is ' +
|
|
'located in a directory with spaces in between. Please rename your project directory.');
|
|
process.exit(1);
|
|
}
|
|
|
|
// Register TS compilation.
|
|
require('ts-node').register({
|
|
project: tsconfigPath
|
|
});
|
|
|
|
// The gulp tsconfig file maps specific imports to relative paths. In combination with ts-node
|
|
// this doesn't work because the JavaScript output will still refer to the imports instead of
|
|
// to the relative path. Tsconfig-paths can be used to support path mapping inside of Node.
|
|
require('tsconfig-paths').register({
|
|
baseUrl: path.dirname(tsconfigPath),
|
|
paths: tsconfig.compilerOptions.paths
|
|
});
|
|
|
|
require('./tools/gulp/gulpfile');
|