diff --git a/packages/angular-cli/commands/help.ts b/packages/angular-cli/commands/help.ts index 06c5773ba1c2..b87c2cd9bbde 100644 --- a/packages/angular-cli/commands/help.ts +++ b/packages/angular-cli/commands/help.ts @@ -15,12 +15,14 @@ const commandsToIgnore = [ const HelpCommand = Command.extend({ name: 'help', description: 'Shows help for the CLI', - works: 'outsideProject', + works: 'everywhere', availableOptions: [], run: function (commandOptions: any) { let commandFiles = fs.readdirSync(__dirname) + // Remove files that are not JavaScript + .filter(file => file.match(/\.js$/)) .map(file => path.parse(file).name) .map(file => file.toLowerCase()); diff --git a/scripts/publish/build.js b/scripts/publish/build.js index 01a79a91f804..b5bda9d3a951 100755 --- a/scripts/publish/build.js +++ b/scripts/publish/build.js @@ -55,7 +55,7 @@ Promise.resolve() }, Promise.resolve()); }) .then(() => console.log('Copying uncompiled resources...')) - .then(() => glob(path.join(packagesRoot, '**/*'))) + .then(() => glob(path.join(packagesRoot, '**/*'), { dot: true })) .then(files => { console.log(` Found ${files.length} files...`); return files @@ -88,8 +88,8 @@ Promise.resolve() // The only remaining file we want to ignore is tsconfig and spec files. return !(/tsconfig\.json$/.test(fileName)) - && !(/\.spec\./.test(fileName)) - && !(/[\/\\]tests[\/\\]/.test(fileName)); + && !(/\.spec\./.test(fileName)) + && !(/[\/\\]tests[\/\\]/.test(fileName)); }) .map((fileName) => { const source = path.join(packagesRoot, fileName); diff --git a/tests/e2e/setup/100-npm-link.ts b/tests/e2e/setup/100-npm-link.ts index c53dabd511b1..fbe66d23b70c 100644 --- a/tests/e2e/setup/100-npm-link.ts +++ b/tests/e2e/setup/100-npm-link.ts @@ -1,8 +1,19 @@ +import {join} from 'path'; import {npm, exec} from '../utils/process'; export default function (argv: any) { return Promise.resolve() - .then(() => argv.nolink || npm('link')) + .then(() => { + if (argv.nolink) { + return; + } + + const distAngularCli = join(__dirname, '../../../dist/angular-cli'); + const oldCwd = process.cwd(); + process.chdir(distAngularCli); + return npm('link') + .then(() => process.chdir(oldCwd)); + }) .then(() => exec(process.platform.startsWith('win') ? 'where' : 'which', 'ng')); } diff --git a/tests/e2e/setup/500-create-project.ts b/tests/e2e/setup/500-create-project.ts index 5ac58970a25e..dd7fb0481a26 100644 --- a/tests/e2e/setup/500-create-project.ts +++ b/tests/e2e/setup/500-create-project.ts @@ -25,11 +25,10 @@ export default function(argv: any) { return Promise.resolve() .then(() => createProject) .then(() => updateJsonFile('package.json', json => { - const dist = '../../../dist/'; - json['devDependencies']['angular-cli'] = join(__dirname, dist, 'angular-cli'); - json['devDependencies']['@angular-cli/ast-tools'] = join(__dirname, dist, 'ast-tools'); - json['devDependencies']['@angular-cli/base-href-webpack'] = - join(__dirname, dist, 'base-href-webpack'); + const dist = join(__dirname, '../../../dist/'); + json['devDependencies']['angular-cli'] = join(dist, 'angular-cli'); + json['devDependencies']['@angular-cli/ast-tools'] = join(dist, 'ast-tools'); + json['devDependencies']['@angular-cli/base-href-webpack'] = join(dist, 'base-href-webpack'); })) .then(() => { if (argv.nightly) { diff --git a/tests/e2e/tests/commands/help.ts b/tests/e2e/tests/commands/help.ts new file mode 100644 index 000000000000..ad268b78ab64 --- /dev/null +++ b/tests/e2e/tests/commands/help.ts @@ -0,0 +1,11 @@ +import {silentNg} from '../../utils/process'; + + +export default function() { + const projectDir = process.cwd(); + return Promise.resolve() + .then(() => silentNg('help')) + .then(() => process.chdir('/')) + .then(() => silentNg('help')) + .then(() => process.chdir(projectDir)); +} diff --git a/tests/e2e/utils/process.ts b/tests/e2e/utils/process.ts index 75543f58180a..d8d9a69be1d8 100644 --- a/tests/e2e/utils/process.ts +++ b/tests/e2e/utils/process.ts @@ -13,6 +13,7 @@ let _processes: child_process.ChildProcess[] = []; function _exec(options: ExecOptions, cmd: string, args: string[]): Promise { let stdout = ''; + let stderr = ''; const cwd = process.cwd(); console.log(white( ` ==========================================================================================` @@ -42,9 +43,7 @@ function _exec(options: ExecOptions, cmd: string, args: string[]): Promise console.log(' ' + line)); }); npmProcess.stderr.on('data', (data: Buffer) => { - if (options.silent) { - return; - } + stderr += data.toString('utf-8'); data.toString('utf-8') .split(/[\n\r]+/) .filter(line => line !== '') @@ -62,7 +61,7 @@ function _exec(options: ExecOptions, cmd: string, args: string[]): Promise