Skip to content

Commit 8b056e6

Browse files
committed
Fixing comments
1 parent 7800a52 commit 8b056e6

File tree

5 files changed

+27
-13
lines changed

5 files changed

+27
-13
lines changed

tools/gulp/gulpfile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ import './tasks/e2e';
77
import './tasks/lint';
88
import './tasks/release';
99
import './tasks/serve';
10-
import './tasks/spec';
10+
import './tasks/unit-test';

tools/gulp/task_helpers.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,15 @@ export function sassBuildTask(dest: string, root: string, includePaths: string[]
6868
}
6969

7070

71-
/** Create a Gulp task that executes a process. */
71+
/** Options that can be passed to execTask or execNodeTask. */
7272
export interface ExecTaskOptions {
73+
// Whether to output to STDERR and STDOUT.
7374
silent?: boolean;
75+
// If an error happens, this will replace the standard error.
7476
errMessage?: string;
7577
}
7678

79+
/** Create a task that executes a binary as if from the command line. */
7780
export function execTask(binPath: string, args: string[], options: ExecTaskOptions = {}) {
7881
return (done: (err?: string) => void) => {
7982
const childProcess = child_process.spawn(binPath, args);
@@ -95,14 +98,20 @@ export function execTask(binPath: string, args: string[], options: ExecTaskOptio
9598
} else {
9699
done(options.errMessage);
97100
}
98-
return;
101+
} else {
102+
done();
99103
}
100-
done();
101104
});
102105
}
103106
}
104107

105-
export function execNodeTask(packageName: string, executable: string[] | string, args?: string[]) {
108+
/**
109+
* Create a task that executes an NPM Bin, by resolving the binary path then executing it. These are
110+
* binaries that are normally in the `./node_modules/.bin` directory, but their name might differ
111+
* from the package. Examples are typescript, ngc and gulp itself.
112+
*/
113+
export function execNodeTask(packageName: string, executable: string | string[], args?: string[],
114+
options: ExecTaskOptions = {}) {
106115
if (!args) {
107116
args = <string[]>executable;
108117
executable = undefined;
@@ -111,12 +120,11 @@ export function execNodeTask(packageName: string, executable: string[] | string,
111120
return (done: (err: any) => void) => {
112121
resolveBin(packageName, { executable: executable }, (err: any, binPath: string) => {
113122
if (err) {
114-
console.error(err);
115-
return done(err);
123+
done(err);
124+
} else {
125+
// Forward to execTask.
126+
execTask(binPath, args, options)(done);
116127
}
117-
118-
// Forward to execTask.
119-
execTask(binPath, args)(done);
120128
});
121129
}
122130
}

tools/gulp/tasks/ci.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import {task} from 'gulp';
22

33

44
task('ci:lint', ['ci:forbidden-identifiers', 'lint']);
5-
task('ci:test', ['test:single-run']);
6-
task('ci:e2e', ['e2e']);
5+
76
task('ci:extract-metadata', [':build:components:ngc']);
87
task('ci:forbidden-identifiers', function() {
98
require('../../../scripts/ci/forbidden-identifiers.js');
109
});
10+
11+
// Travis sometimes does not exit the process and times out. This is to prevent that.
12+
task('ci:test', ['test:single-run'], () => process.exit(0));
13+
// Travis sometimes does not exit the process and times out. This is to prevent that.
14+
task('ci:e2e', ['e2e'], () => process.exit(0));

tools/gulp/tasks/release.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ task(':publish:whoami', execTask('npm', ['whoami'], {
2828
task(':publish:logout', execTask('npm', ['logout']));
2929

3030
task(':publish', function() {
31+
const label = process.argv.slice(2)[1]; // [0] would be ':publish'
32+
const labelArg = label ? `--tag ${label}` : '';
3133
const currentDir = process.cwd();
3234

3335
readdirSync(DIST_COMPONENTS_ROOT)
@@ -40,7 +42,7 @@ task(':publish', function() {
4042
}
4143

4244
process.chdir(componentPath);
43-
execSync('npm publish');
45+
execSync(`npm publish --access public ${labelArg}`);
4446
});
4547
process.chdir(currentDir);
4648
});
File renamed without changes.

0 commit comments

Comments
 (0)