Skip to content

Commit c7fc51a

Browse files
authored
chore(public api): run build.sh before generating the api doc (angular#9889)
1 parent b7e69bc commit c7fc51a

File tree

1 file changed

+31
-23
lines changed

1 file changed

+31
-23
lines changed

gulpfile.js

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,30 +59,38 @@ const publicApiArgs = [
5959
'--onStabilityMissing', 'error'
6060
].concat(entrypoints);
6161

62+
gulp.task('build.sh', (done) => {
63+
const childProcess = require('child_process');
64+
65+
childProcess.exec(path.join(__dirname, 'build.sh'), error => done(error));
66+
});
67+
6268
// Note that these two commands work on built d.ts files instead of the source
6369
gulp.task('public-api:enforce', (done) => {
64-
const child_process = require('child_process');
65-
child_process
66-
.spawn(
67-
path.join(__dirname, `/node_modules/.bin/ts-api-guardian${/^win/.test(os.platform()) ? '.cmd' : ''}`),
68-
['--verifyDir', publicApiDir].concat(publicApiArgs), {stdio: 'inherit'})
69-
.on('close', (errorCode) => {
70-
if (errorCode !== 0) {
71-
done(new Error(
72-
'Public API differs from golden file. Please run `gulp public-api:update`.'));
73-
} else {
74-
done();
75-
}
76-
});
70+
const childProcess = require('child_process');
71+
72+
childProcess
73+
.spawn(
74+
path.join(__dirname, `/node_modules/.bin/ts-api-guardian${/^win/.test(os.platform()) ? '.cmd' : ''}`),
75+
['--verifyDir', publicApiDir].concat(publicApiArgs), {stdio: 'inherit'})
76+
.on('close', (errorCode) => {
77+
if (errorCode !== 0) {
78+
done(new Error(
79+
'Public API differs from golden file. Please run `gulp public-api:update`.'));
80+
} else {
81+
done();
82+
}
83+
});
7784
});
7885

79-
gulp.task('public-api:update', (done) => {
80-
const child_process = require('child_process');
81-
child_process
82-
.spawn(
83-
path.join(__dirname, `/node_modules/.bin/ts-api-guardian${/^win/.test(os.platform()) ? '.cmd' : ''}`),
84-
['--outDir', publicApiDir].concat(publicApiArgs), {stdio: 'inherit'})
85-
.on('close', (errorCode) => done(errorCode));
86+
gulp.task('public-api:update', ['build.sh'], (done) => {
87+
const childProcess = require('child_process');
88+
89+
childProcess
90+
.spawn(
91+
path.join(__dirname, `/node_modules/.bin/ts-api-guardian${/^win/.test(os.platform()) ? '.cmd' : ''}`),
92+
['--outDir', publicApiDir].concat(publicApiArgs), {stdio: 'inherit'})
93+
.on('close', (errorCode) => done(errorCode));
8694
});
8795

8896
gulp.task('lint', ['format:enforce', 'tools:build'], () => {
@@ -102,7 +110,7 @@ gulp.task('lint', ['format:enforce', 'tools:build'], () => {
102110
gulp.task('tools:build', (done) => { tsc('tools/', done); });
103111

104112
gulp.task('check-cycle', (done) => {
105-
var madge = require('madge');
113+
const madge = require('madge');
106114

107115
var dependencyObject = madge(['dist/all/'], {
108116
format: 'cjs',
@@ -149,9 +157,9 @@ gulp.task('changelog', () => {
149157
});
150158

151159
function tsc(projectPath, done) {
152-
let child_process = require('child_process');
160+
const childProcess = require('child_process');
153161

154-
child_process
162+
childProcess
155163
.spawn(
156164
path.normalize(`${__dirname}/node_modules/.bin/tsc`) + (/^win/.test(os.platform()) ? '.cmd' : ''),
157165
['-p', path.join(__dirname, projectPath)],

0 commit comments

Comments
 (0)