Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/angular-cli/commands/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
6 changes: 3 additions & 3 deletions scripts/publish/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
13 changes: 12 additions & 1 deletion tests/e2e/setup/100-npm-link.ts
Original file line number Diff line number Diff line change
@@ -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'));
}
9 changes: 4 additions & 5 deletions tests/e2e/setup/500-create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
11 changes: 11 additions & 0 deletions tests/e2e/tests/commands/help.ts
Original file line number Diff line number Diff line change
@@ -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));
}
13 changes: 8 additions & 5 deletions tests/e2e/utils/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ let _processes: child_process.ChildProcess[] = [];

function _exec(options: ExecOptions, cmd: string, args: string[]): Promise<string> {
let stdout = '';
let stderr = '';
const cwd = process.cwd();
console.log(white(
` ==========================================================================================`
Expand Down Expand Up @@ -42,9 +43,7 @@ function _exec(options: ExecOptions, cmd: string, args: string[]): Promise<strin
.forEach(line => 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 !== '')
Expand All @@ -62,7 +61,7 @@ function _exec(options: ExecOptions, cmd: string, args: string[]): Promise<strin
if (!error) {
resolve(stdout);
} else {
err.message += `${error}...`;
err.message += `${error}...\n\nSTDOUT:\n${stdout}\n`;
reject(err);
}
});
Expand Down Expand Up @@ -96,12 +95,16 @@ export function silentExecAndWaitForOutputToMatch(cmd: string, args: string[], m

export function ng(...args: string[]) {
if (args[0] == 'build') {
return _exec({silent: true}, 'ng', args);
return silentNg(...args);
} else {
return _exec({}, 'ng', args);
}
}

export function silentNg(...args: string[]) {
return _exec({silent: true}, 'ng', args);
}

export function silentNpm(...args: string[]) {
return _exec({silent: true}, 'npm', args);
}
Expand Down