Skip to content

Commit 218f0f8

Browse files
committed
Merge remote-tracking branch 'origin/master' into gulp-deploy
2 parents 1c8e2c1 + c1f748f commit 218f0f8

File tree

15 files changed

+80
-67
lines changed

15 files changed

+80
-67
lines changed

.eslintrc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@
1010
"extends": "eslint:recommended",
1111
"env": {
1212
// Enables all ES6 features except modules.
13-
"es6": true
13+
"es6": true,
1414
},
1515
"ecmaFeatures": {
1616
// Enable ES6 modules to have all language features covered.
17-
"modules": true
18-
}
17+
"modules": true,
18+
},
19+
"rules": {
20+
// Require dangling comma at the end of any multiline list/object. This is to be consistent
21+
// with backend code.
22+
"comma-dangle": [2, "always-multiline"],
23+
// No spacing in object literals nor in imports/exports.
24+
"object-curly-spacing": [2, "never"],
25+
},
1926
}

build/.eslintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
"env": {
33
// Build files are written in node.
44
"node": true
5+
},
6+
"rules": {
7+
// This folder contains Node code, so using console is fine.
8+
"no-console": 0
59
}
610
}

build/backend.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import conf from './conf';
3131
*/
3232
const goBackendDependencies = [
3333
'github.com/golang/glog',
34-
'github.com/spf13/pflag'
34+
'github.com/spf13/pflag',
3535
];
3636

3737

@@ -45,7 +45,7 @@ const goBackendDependencies = [
4545
*/
4646
function spawnGoProcess(args, doneFn, opt_env) {
4747
let goTask = child.spawn('go', args, {
48-
env: lodash.merge(process.env, {GOPATH: conf.paths.backendTmp}, opt_env || {})
48+
env: lodash.merge(process.env, {GOPATH: conf.paths.backendTmp}, opt_env || {}),
4949
});
5050

5151
// Call Gulp callback on task exit. This has to be done to make Gulp dependency management
@@ -76,7 +76,7 @@ gulp.task('backend', ['backend-dependencies'], function(doneFn) {
7676
spawnGoProcess([
7777
'build',
7878
'-o', path.join(conf.paths.serve, 'console'),
79-
path.join(conf.paths.backendSrc, 'console.go')
79+
path.join(conf.paths.backendSrc, 'console.go'),
8080
], doneFn);
8181
});
8282

@@ -98,12 +98,12 @@ gulp.task('backend:prod', ['backend-dependencies'], function(doneFn) {
9898
'-a',
9999
'-installsuffix', 'cgo',
100100
'-o', outputBinaryPath,
101-
path.join(conf.paths.backendSrc, 'console.go')
101+
path.join(conf.paths.backendSrc, 'console.go'),
102102
], doneFn, {
103103
// Disable cgo package. Required to run on scratch docker image.
104104
CGO_ENABLED: '0',
105105
// Scratch docker image is linux.
106-
GOOS: 'linux'
106+
GOOS: 'linux',
107107
});
108108
}, function(error) {
109109
doneFn(error);

build/build.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@
1717
*/
1818
import del from 'del';
1919
import gulp from 'gulp';
20-
import gulpEslint from 'gulp-eslint';
2120
import gulpFilter from 'gulp-filter';
22-
import gulpInject from 'gulp-inject';
2321
import gulpMinifyCss from 'gulp-minify-css';
2422
import gulpMinifyHtml from 'gulp-minify-html';
2523
import gulpUglify from 'gulp-uglify';
2624
import gulpUseref from 'gulp-useref';
2725
import gulpRev from 'gulp-rev';
2826
import gulpRevReplace from 'gulp-rev-replace';
2927
import gulpSize from 'gulp-size';
30-
import gulpSourcemaps from 'gulp-sourcemaps';
3128
import uglifySaveLicense from 'uglify-save-license';
3229
import path from 'path';
3330

@@ -55,8 +52,8 @@ gulp.task('build', ['index:prod', 'assets'], function () {
5552
// To resolve local paths.
5653
conf.paths.prodTmp,
5754
// To resolve bower_components/... paths.
58-
conf.paths.base
59-
]
55+
conf.paths.base,
56+
],
6057
}))
6158
.pipe(vendorCssFilter)
6259
.pipe(gulpMinifyCss())
@@ -72,7 +69,7 @@ gulp.task('build', ['index:prod', 'assets'], function () {
7269
.pipe(gulpMinifyHtml({
7370
empty: true,
7471
spare: true,
75-
quotes: true
72+
quotes: true,
7673
}))
7774
.pipe(htmlFilter.restore)
7875
.pipe(gulp.dest(conf.paths.dist))

build/conf.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ export default {
3838
imageName: 'kubernetes/console',
3939
},
4040

41+
/**
42+
* Frontend application constants.
43+
*/
44+
frontend: {
45+
/**
46+
* The name of the root Angular module, i.e., the module that bootstraps the application.
47+
*/
48+
rootModuleName: 'kubernetesConsole',
49+
},
50+
4151
/**
4252
* Absolute paths to known directories, e.g., to source directory.
4353
*/
@@ -62,16 +72,6 @@ export default {
6272
protractorConf: path.join(basePath, 'build/protractor.conf.js'),
6373
serve: path.join(basePath, '.tmp/serve'),
6474
src: path.join(basePath, 'src'),
65-
tmp: path.join(basePath, '.tmp')
75+
tmp: path.join(basePath, '.tmp'),
6676
},
67-
68-
/**
69-
* Frontend application constants.
70-
*/
71-
frontend: {
72-
/**
73-
* The name of the root Angular module, i.e., the module that bootstraps the application.
74-
*/
75-
rootModuleName: 'kubernetesConsole'
76-
}
7777
};

build/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ import conf from './conf';
3030
* @param {string} indexPath
3131
*/
3232
function createIndexFile(indexPath) {
33-
let injectStyles = gulp.src(path.join(indexPath, '**/*.css'), { read: false });
33+
let injectStyles = gulp.src(path.join(indexPath, '**/*.css'), {read: false});
3434

35-
let injectScripts = gulp.src(path.join(indexPath, '**/*.js'), { read: false });
35+
let injectScripts = gulp.src(path.join(indexPath, '**/*.js'), {read: false});
3636

3737
let injectOptions = {
3838
// Make the dependencies relative to the deps directory.
3939
ignorePath: [path.relative(conf.paths.base, indexPath)],
4040
addRootSlash: false,
41-
quiet: true
41+
quiet: true,
4242
};
4343

4444
let wiredepOptions = {
4545
// Make wiredep dependencies begin with "bower_components/" not "../../...".
46-
ignorePath: path.relative(conf.paths.frontendSrc, indexPath) + '/'
46+
ignorePath: path.relative(conf.paths.frontendSrc, indexPath) + '/',
4747
};
4848

4949
return gulp.src(path.join(conf.paths.frontendSrc, 'index.html'))

build/karma.conf.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ function getFileList() {
3333
// All app dependencies are required for tests. Include them.
3434
let wiredepOptions = {
3535
dependencies: true,
36-
devDependencies: true
36+
devDependencies: true,
3737
};
3838

3939
return wiredep(wiredepOptions).js
4040
.concat([
4141
path.join(conf.paths.frontendTest, '**/*.js'),
4242
path.join(conf.paths.frontendSrc, '**/*.js'),
43-
path.join(conf.paths.frontendSrc, '**/*.html')
43+
path.join(conf.paths.frontendSrc, '**/*.html'),
4444
]);
4545
}
4646

@@ -71,7 +71,7 @@ export default function(config) {
7171
'karma-jasmine',
7272
'karma-ng-html2js-preprocessor',
7373
'karma-sourcemap-loader',
74-
'karma-browserify'
74+
'karma-browserify',
7575
],
7676

7777
// karma-browserify plugin config.
@@ -82,15 +82,15 @@ export default function(config) {
8282
paths: [conf.paths.frontendSrc, conf.paths.frontendTest],
8383
transform: [
8484
// Transform ES6 code into ES5 so that browsers can digest it.
85-
'babelify'
86-
]
85+
'babelify',
86+
],
8787
},
8888

8989
// karma-ng-html2js-preprocessor plugin config.
9090
ngHtml2JsPreprocessor: {
9191
stripPrefix: conf.paths.frontendSrc + '/',
92-
moduleName: conf.frontend.moduleName
93-
}
92+
moduleName: conf.frontend.moduleName,
93+
},
9494
};
9595

9696
// Convert all JS code written ES6 with modules to ES5 bundles that browsers can digest.

build/protractor.conf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ var path = require('path');
2929
*/
3030
exports.config = {
3131
capabilities: {
32-
'browserName': 'chrome'
32+
'browserName': 'chrome',
3333
},
3434

3535
baseUrl: 'http://localhost:3000',
3636

37-
specs: [path.join(conf.paths.integrationTest, '**/*.js')]
37+
specs: [path.join(conf.paths.integrationTest, '**/*.js')],
3838
};

build/script.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import gulp from 'gulp';
1919
import gulpAngularTemplatecache from 'gulp-angular-templatecache';
2020
import gulpClosureCompiler from 'gulp-closure-compiler';
21+
import gulpEslint from 'gulp-eslint';
2122
import gulpMinifyHtml from 'gulp-minify-html';
2223
import lodash from 'lodash';
2324
import path from 'path';
@@ -38,11 +39,11 @@ const closureCompilerBaseConfig = {
3839
js_module_root: conf.paths.frontendSrc,
3940
language_in: 'ECMASCRIPT6_STRICT',
4041
language_out: 'ECMASCRIPT3',
41-
manage_closure_dependencies: true
42+
manage_closure_dependencies: true,
4243
},
4344
compilerPath: path.join(conf.paths.nodeModules, 'google-closure-compiler/compiler.jar'),
4445
// This makes the compiler faster. Requires Java 7+.
45-
tieredCompilation: true
46+
tieredCompilation: true,
4647
};
4748

4849

@@ -66,8 +67,8 @@ gulp.task('scripts', ['create-serve-folders'], function() {
6667
// Make source map URLs relative to frontend source directory.
6768
source_map_location_mapping: path.relative(conf.paths.base, conf.paths.frontendSrc) + '|',
6869
// Include source map in the output bundle.
69-
output_wrapper: '%output%\n//# sourceMappingURL=' + `${bundleBaseName}.js.map`
70-
}
70+
output_wrapper: '%output%\n//# sourceMappingURL=' + `${bundleBaseName}.js.map`,
71+
},
7172
}, closureCompilerBaseConfig);
7273

7374
return gulp.src(path.join(conf.paths.frontendSrc, '**/*.js'))
@@ -81,8 +82,6 @@ gulp.task('scripts', ['create-serve-folders'], function() {
8182
* directory.
8283
*/
8384
gulp.task('scripts:prod', ['angular-templates'], function() {
84-
let bundleBaseName = 'app';
85-
8685
let closureCompilerConfig = lodash.merge({
8786
fileName: 'app.js',
8887
compilerFlags: {
@@ -103,10 +102,10 @@ gulp.task('scripts', ['create-serve-folders'], function() {
103102
// This check does not work correctly with ES6.
104103
'inferredConstCheck',
105104
// Let ESLint handle all lint checks.
106-
'lintChecks'
105+
'lintChecks',
107106
],
108-
use_types_for_optimization: null
109-
}
107+
use_types_for_optimization: null,
108+
},
110109
}, closureCompilerBaseConfig);
111110

112111
return gulp.src([
@@ -116,7 +115,7 @@ gulp.task('scripts', ['create-serve-folders'], function() {
116115
path.join(conf.paths.partials, '**/*.js'),
117116
// Include base.js to enable some compiler functions, e.g., @export annotation handling.
118117
path.join(conf.paths.bowerComponents,
119-
'google-closure-library/closure/goog/base.js')
118+
'google-closure-library/closure/goog/base.js'),
120119
])
121120
.pipe(gulpClosureCompiler(closureCompilerConfig))
122121
.pipe(gulp.dest(conf.paths.prodTmp));
@@ -131,10 +130,10 @@ gulp.task('angular-templates', function () {
131130
.pipe(gulpMinifyHtml({
132131
empty: true,
133132
spare: true,
134-
quotes: true
133+
quotes: true,
135134
}))
136135
.pipe(gulpAngularTemplatecache('angular-templates.js', {
137-
module: conf.frontend.rootModuleName
136+
module: conf.frontend.rootModuleName,
138137
}))
139138
.pipe(gulp.dest(conf.paths.partials));
140139
});

build/serve.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ import conf from './conf';
3131
function browserSyncInit(baseDir) {
3232
// Enable custom support for Angular apps, e.g., history management.
3333
browserSync.use(browserSyncSpa({
34-
selector: '[ng-app]'
34+
selector: '[ng-app]',
3535
}));
3636

3737
browserSync.instance = browserSync.init({
3838
startPath: '/',
3939
server: {
40-
baseDir: baseDir
40+
baseDir: baseDir,
4141
},
42-
browser: [] // Needed so that the browser does not auto-launch.
42+
browser: [], // Needed so that the browser does not auto-launch.
4343
});
4444
}
4545

@@ -52,7 +52,7 @@ gulp.task('serve', ['watch'], function () {
5252
conf.paths.serve,
5353
conf.paths.frontendSrc, // For angular templates to work.
5454
conf.paths.app, // For assets to work.
55-
conf.paths.base // For bower dependencies to work.
55+
conf.paths.base, // For bower dependencies to work.
5656
]);
5757
});
5858

@@ -72,7 +72,7 @@ gulp.task('watch', ['index'], function () {
7272
gulp.watch([path.join(conf.paths.frontendSrc, 'index.html'), 'bower.json'], ['index']);
7373

7474
gulp.watch([
75-
path.join(conf.paths.frontendSrc, '**/*.scss')
75+
path.join(conf.paths.frontendSrc, '**/*.scss'),
7676
], function(event) {
7777
if(event.type === 'changed') {
7878
// If this is a file change, rebuild only styles - nothing more is needed.

0 commit comments

Comments
 (0)