Skip to content

Commit cf269d9

Browse files
vicbchuckjaz
authored andcommitted
refactor: add license header to JS files & format files (angular#12081)
1 parent 5fa5ffb commit cf269d9

File tree

72 files changed

+1165
-945
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1165
-945
lines changed

browser-providers.conf.js

+112-272
Large diffs are not rendered by default.

gulpfile.js

+85-61
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
19
'use strict';
210

311
// THIS CHECK SHOULD BE THE FIRST THING IN THIS FILE
@@ -13,28 +21,31 @@ const os = require('os');
1321

1422
// clang-format entry points
1523
const srcsToFmt = [
16-
'modules/@angular/**/*.ts',
17-
'modules/benchmarks/**/*.ts',
18-
'modules/e2e_util/**/*.ts',
19-
'modules/playground/**/*.ts',
20-
'tools/**/*.ts',
24+
'modules/@angular/**/*.{js,ts}',
25+
'modules/benchmarks/**/*.{js,ts}',
26+
'modules/e2e_util/**/*.{js,ts}',
27+
'modules/playground/**/*.{js,ts}',
28+
'tools/**/*.{js,ts}',
2129
'!tools/public_api_guard/**/*.d.ts',
30+
'./*.{js,ts}',
31+
'!shims_for_IE.js',
2232
];
2333

2434
// Check source code for formatting errors (clang-format)
2535
gulp.task('format:enforce', () => {
2636
const format = require('gulp-clang-format');
2737
const clangFormat = require('clang-format');
2838
return gulp.src(srcsToFmt).pipe(
29-
format.checkFormat('file', clangFormat, {verbose: true, fail: true}));
39+
format.checkFormat('file', clangFormat, {verbose: true, fail: true}));
3040
});
3141

3242
// Format the source code with clang-format (see .clang-format)
3343
gulp.task('format', () => {
3444
const format = require('gulp-clang-format');
3545
const clangFormat = require('clang-format');
36-
return gulp.src(srcsToFmt, { base: '.' }).pipe(
37-
format.format('file', clangFormat)).pipe(gulp.dest('.'));
46+
return gulp.src(srcsToFmt, {base: '.'})
47+
.pipe(format.format('file', clangFormat))
48+
.pipe(gulp.dest('.'));
3849
});
3950

4051
const entrypoints = [
@@ -62,12 +73,18 @@ const entrypoints = [
6273
];
6374
const publicApiDir = path.normalize('tools/public_api_guard');
6475
const publicApiArgs = [
65-
'--rootDir', 'dist/packages-dist',
66-
'--stripExportPattern', '^__',
67-
'--allowModuleIdentifiers', 'jasmine',
68-
'--allowModuleIdentifiers', 'protractor',
69-
'--allowModuleIdentifiers', 'angular',
70-
'--onStabilityMissing', 'error',
76+
'--rootDir',
77+
'dist/packages-dist',
78+
'--stripExportPattern',
79+
'^__',
80+
'--allowModuleIdentifiers',
81+
'jasmine',
82+
'--allowModuleIdentifiers',
83+
'protractor',
84+
'--allowModuleIdentifiers',
85+
'angular',
86+
'--onStabilityMissing',
87+
'error',
7188
].concat(entrypoints);
7289

7390
// Build angular
@@ -83,38 +100,42 @@ gulp.task('public-api:enforce', (done) => {
83100
const childProcess = require('child_process');
84101

85102
childProcess
86-
.spawn(
87-
path.join(__dirname, platformScriptPath(`/node_modules/.bin/ts-api-guardian`)),
88-
['--verifyDir', publicApiDir].concat(publicApiArgs), {stdio: 'inherit'})
89-
.on('close', (errorCode) => {
90-
if (errorCode !== 0) {
91-
done(new Error(
92-
'Public API differs from golden file. Please run `gulp public-api:update`.'));
93-
} else {
94-
done();
95-
}
96-
});
103+
.spawn(
104+
path.join(__dirname, platformScriptPath(`/node_modules/.bin/ts-api-guardian`)),
105+
['--verifyDir', publicApiDir].concat(publicApiArgs), {stdio: 'inherit'})
106+
.on('close', (errorCode) => {
107+
if (errorCode !== 0) {
108+
done(new Error(
109+
'Public API differs from golden file. Please run `gulp public-api:update`.'));
110+
} else {
111+
done();
112+
}
113+
});
97114
});
98115

99116
// Generate the public API golden files
100117
gulp.task('public-api:update', ['build.sh'], (done) => {
101118
const childProcess = require('child_process');
102119

103120
childProcess
104-
.spawn(
105-
path.join(__dirname, platformScriptPath(`/node_modules/.bin/ts-api-guardian`)),
106-
['--outDir', publicApiDir].concat(publicApiArgs), {stdio: 'inherit'})
107-
.on('close', done);
121+
.spawn(
122+
path.join(__dirname, platformScriptPath(`/node_modules/.bin/ts-api-guardian`)),
123+
['--outDir', publicApiDir].concat(publicApiArgs), {stdio: 'inherit'})
124+
.on('close', done);
108125
});
109126

110-
// Checks tests for presence of ddescribe, fdescribe, fit, iit and fails the build if one of the focused tests is found.
111-
// Currently xdescribe and xit are _not_ reported as errors since there are a couple of excluded tests in our code base.
127+
// Checks tests for presence of ddescribe, fdescribe, fit, iit and fails the build if one of the
128+
// focused tests is found.
129+
// Currently xdescribe and xit are _not_ reported as errors since there are a couple of excluded
130+
// tests in our code base.
112131
gulp.task('check-tests', function() {
113132
const ddescribeIit = require('gulp-ddescribe-iit');
114-
return gulp.src([
115-
'modules/**/*.spec.ts',
116-
'modules/**/*_spec.ts',
117-
]).pipe(ddescribeIit({allowDisabledTests: true}));
133+
return gulp
134+
.src([
135+
'modules/**/*.spec.ts',
136+
'modules/**/*_spec.ts',
137+
])
138+
.pipe(ddescribeIit({allowDisabledTests: true}));
118139
});
119140

120141
// Check the coding standards and programming errors
@@ -123,14 +144,21 @@ gulp.task('lint', ['check-tests', 'format:enforce', 'tools:build'], () => {
123144
// Built-in rules are at
124145
// https://github.com/palantir/tslint#supported-rules
125146
const tslintConfig = require('./tslint.json');
126-
return gulp.src(['modules/@angular/**/*.ts', 'modules/benchpress/**/*.ts'])
127-
.pipe(tslint({
128-
tslint: require('tslint').default,
129-
configuration: tslintConfig,
130-
rulesDirectory: 'dist/tools/tslint',
131-
formatter: 'prose',
132-
}))
133-
.pipe(tslint.report({emitError: true}));
147+
return gulp
148+
.src([
149+
// todo(vicb): add .js files when supported
150+
// see https://github.com/palantir/tslint/pull/1515
151+
'modules/@angular/**/*.ts',
152+
'modules/benchpress/**/*.ts',
153+
'./*.ts',
154+
])
155+
.pipe(tslint({
156+
tslint: require('tslint').default,
157+
configuration: tslintConfig,
158+
rulesDirectory: 'dist/tools/tslint',
159+
formatter: 'prose',
160+
}))
161+
.pipe(tslint.report({emitError: true}));
134162
});
135163

136164
gulp.task('tools:build', (done) => { tsc('tools/', done); });
@@ -142,7 +170,7 @@ gulp.task('check-cycle', (done) => {
142170
const dependencyObject = madge(['dist/all/'], {
143171
format: 'cjs',
144172
extensions: ['.js'],
145-
onParseFile: function(data) { data.src = data.src.replace(/\/\* circular \*\//g, "//"); }
173+
onParseFile: function(data) { data.src = data.src.replace(/\/\* circular \*\//g, '//'); }
146174
});
147175
const circularDependencies = dependencyObject.circular().getArray();
148176
if (circularDependencies.length > 0) {
@@ -173,11 +201,11 @@ gulp.task('serve-examples', () => {
173201
const cors = require('cors');
174202

175203
connect.server({
176-
root: `${__dirname}/dist/examples`,
177-
port: 8001,
178-
livereload: false,
179-
open: false,
180-
middleware: (connect, opt) => [cors()],
204+
root: `${__dirname}/dist/examples`,
205+
port: 8001,
206+
livereload: false,
207+
open: false,
208+
middleware: (connect, opt) => [cors()],
181209
});
182210
});
183211

@@ -187,16 +215,13 @@ gulp.task('changelog', () => {
187215
const conventionalChangelog = require('gulp-conventional-changelog');
188216

189217
return gulp.src('CHANGELOG.md')
190-
.pipe(conventionalChangelog({
191-
preset: 'angular',
192-
releaseCount: 1
193-
}, {
194-
// Conventional Changelog Context
195-
// We have to manually set version number so it doesn't get prefixed with `v`
196-
// See https://github.com/conventional-changelog/conventional-changelog-core/issues/10
197-
currentTag: require('./package.json').version
198-
}))
199-
.pipe(gulp.dest('./'));
218+
.pipe(conventionalChangelog({preset: 'angular', releaseCount: 1}, {
219+
// Conventional Changelog Context
220+
// We have to manually set version number so it doesn't get prefixed with `v`
221+
// See https://github.com/conventional-changelog/conventional-changelog-core/issues/10
222+
currentTag: require('./package.json').version
223+
}))
224+
.pipe(gulp.dest('./'));
200225
});
201226

202227
function tsc(projectPath, done) {
@@ -205,8 +230,7 @@ function tsc(projectPath, done) {
205230
childProcess
206231
.spawn(
207232
path.normalize(platformScriptPath(`${__dirname}/node_modules/.bin/tsc`)),
208-
['-p', path.join(__dirname, projectPath)],
209-
{stdio: 'inherit'})
233+
['-p', path.join(__dirname, projectPath)], {stdio: 'inherit'})
210234
.on('close', done);
211235
}
212236

karma-js.conf.js

+33-23
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
19
var browserProvidersConf = require('./browser-providers.conf.js');
210
var internalAngularReporter = require('./tools/karma/reporter.js');
311

@@ -17,24 +25,25 @@ module.exports = function(config) {
1725
// include Angular v1 for upgrade module testing
1826
'node_modules/angular/angular.min.js',
1927

20-
'node_modules/zone.js/dist/zone.js',
21-
'node_modules/zone.js/dist/long-stack-trace-zone.js',
22-
'node_modules/zone.js/dist/proxy.js',
23-
'node_modules/zone.js/dist/sync-test.js',
24-
'node_modules/zone.js/dist/jasmine-patch.js',
25-
'node_modules/zone.js/dist/async-test.js',
28+
'node_modules/zone.js/dist/zone.js', 'node_modules/zone.js/dist/long-stack-trace-zone.js',
29+
'node_modules/zone.js/dist/proxy.js', 'node_modules/zone.js/dist/sync-test.js',
30+
'node_modules/zone.js/dist/jasmine-patch.js', 'node_modules/zone.js/dist/async-test.js',
2631
'node_modules/zone.js/dist/fake-async-test.js',
2732

2833
// Including systemjs because it defines `__eval`, which produces correct stack traces.
29-
'shims_for_IE.js',
30-
'node_modules/systemjs/dist/system.src.js',
34+
'shims_for_IE.js', 'node_modules/systemjs/dist/system.src.js',
3135
{pattern: 'node_modules/rxjs/**', included: false, watched: false, served: true},
32-
'node_modules/reflect-metadata/Reflect.js',
33-
'tools/build/file2modulename.js',
34-
'test-main.js',
35-
{pattern: 'dist/all/empty.*', included: false, watched: false},
36-
{pattern: 'modules/@angular/platform-browser/test/static_assets/**', included: false, watched: false},
37-
{pattern: 'modules/@angular/platform-browser/test/browser/static_assets/**', included: false, watched: false}
36+
'node_modules/reflect-metadata/Reflect.js', 'tools/build/file2modulename.js', 'test-main.js',
37+
{pattern: 'dist/all/empty.*', included: false, watched: false}, {
38+
pattern: 'modules/@angular/platform-browser/test/static_assets/**',
39+
included: false,
40+
watched: false
41+
},
42+
{
43+
pattern: 'modules/@angular/platform-browser/test/browser/static_assets/**',
44+
included: false,
45+
watched: false,
46+
}
3847
],
3948

4049
exclude: [
@@ -44,7 +53,7 @@ module.exports = function(config) {
4453
'dist/all/@angular/benchpress/**',
4554
'dist/all/angular1_router.js',
4655
'dist/all/@angular/platform-browser/testing/e2e_util.js',
47-
'dist/examples/**/e2e_test/**'
56+
'dist/examples/**/e2e_test/**',
4857
],
4958

5059
customLaunchers: browserProvidersConf.customLaunchers,
@@ -55,11 +64,11 @@ module.exports = function(config) {
5564
'karma-sauce-launcher',
5665
'karma-chrome-launcher',
5766
'karma-sourcemap-loader',
58-
internalAngularReporter
67+
internalAngularReporter,
5968
],
6069

6170
preprocessors: {
62-
'**/*.js': ['sourcemap']
71+
'**/*.js': ['sourcemap'],
6372
},
6473

6574
reporters: ['internal-angular'],
@@ -73,7 +82,7 @@ module.exports = function(config) {
7382
'selenium-version': '2.53.0',
7483
'command-timeout': 600,
7584
'idle-timeout': 600,
76-
'max-duration': 5400
85+
'max-duration': 5400,
7786
}
7887
},
7988

@@ -82,20 +91,21 @@ module.exports = function(config) {
8291
startTunnel: false,
8392
retryLimit: 3,
8493
timeout: 600,
85-
pollingTimeout: 10000
94+
pollingTimeout: 10000,
8695
},
8796

8897
browsers: ['Chrome'],
8998

9099
port: 9876,
91100
captureTimeout: 60000,
92-
browserDisconnectTimeout : 60000,
93-
browserDisconnectTolerance : 3,
94-
browserNoActivityTimeout : 60000,
101+
browserDisconnectTimeout: 60000,
102+
browserDisconnectTolerance: 3,
103+
browserNoActivityTimeout: 60000,
95104
});
96105

97106
if (process.env.TRAVIS) {
98-
var buildId = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')';
107+
var buildId =
108+
'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')';
99109
if (process.env.CI_MODE.startsWith('saucelabs')) {
100110
config.sauceLabs.build = buildId;
101111
config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;

modules/@angular/common/rollup-testing.config.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
18

29
export default {
310
entry: '../../../dist/packages-dist/common/testing/index.js',
@@ -10,4 +17,4 @@ export default {
1017
'rxjs/Observable': 'Rx',
1118
'rxjs/Subject': 'Rx'
1219
}
13-
}
20+
};
+9-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
18

29
export default {
310
entry: '../../../dist/packages-dist/common/index.js',
@@ -7,6 +14,6 @@ export default {
714
globals: {
815
'@angular/core': 'ng.core',
916
'rxjs/Observable': 'Rx',
10-
'rxjs/Subject': 'Rx'
17+
'rxjs/Subject': 'Rx',
1118
}
12-
}
19+
};
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
19
module.exports = {
210
target: 'node',
311
entry: './test/all_spec.js',
4-
output: {
5-
filename: './all_spec.js'
6-
},
7-
resolve: {
8-
extensions: ['.js']
9-
},
12+
output: {filename: './all_spec.js'},
13+
resolve: {extensions: ['.js']},
1014
};

0 commit comments

Comments
 (0)