Convert gulpfile.coffee to javascript

Change-type: patch
This commit is contained in:
Pagan Gazzard 2020-04-30 17:41:01 +01:00
parent 14c5b27cdd
commit ab526c9ed8
9 changed files with 21 additions and 192 deletions

View File

@ -1,5 +1,2 @@
coffee_script:
config_file: coffeelint.json
javascript:
enabled: false

View File

@ -25,12 +25,7 @@ const ROOT = path.normalize(path.join(__dirname, '..'));
/**
* Compare the timestamp of cli.markdown with the timestamp of staged files,
* issuing an error if cli.markdown is older. Besides the purpose of ensuring
* that cli.markdown is updated, it effectively also ensures that coffeelint
* is executed (via `npm run build` or `npm test`) on the developers laptop,
* so that there is at least a chance that the developer will spot any linter
* warnings (that could reveal bugs) sooner than later. (The CI does not
* currently fail in case of coffeelint warnings.)
* issuing an error if cli.markdown is older.
* If cli.markdown does not require updating and the developer cannot run
* `npm run build` on their laptop, the error message suggests a workaround
* using `touch`.

View File

@ -1,127 +0,0 @@
{
"coffeescript_error": {
"level": "error"
},
"arrow_spacing": {
"name": "arrow_spacing",
"level": "error"
},
"no_tabs": {
"name": "no_tabs",
"level": "ignore"
},
"no_trailing_whitespace": {
"name": "no_trailing_whitespace",
"level": "error",
"allowed_in_comments": false,
"allowed_in_empty_lines": false
},
"max_line_length": {
"name": "max_line_length",
"value": 120,
"level": "error",
"limitComments": true
},
"line_endings": {
"name": "line_endings",
"level": "ignore",
"value": "unix"
},
"no_trailing_semicolons": {
"name": "no_trailing_semicolons",
"level": "error"
},
"indentation": {
"name": "indentation",
"value": 1,
"level": "error"
},
"camel_case_classes": {
"name": "camel_case_classes",
"level": "error"
},
"colon_assignment_spacing": {
"name": "colon_assignment_spacing",
"level": "error",
"spacing": {
"left": 0,
"right": 1
}
},
"no_implicit_braces": {
"name": "no_implicit_braces",
"level": "ignore",
"strict": false
},
"no_plusplus": {
"name": "no_plusplus",
"level": "ignore"
},
"no_throwing_strings": {
"name": "no_throwing_strings",
"level": "error"
},
"no_backticks": {
"name": "no_backticks",
"level": "error"
},
"no_implicit_parens": {
"name": "no_implicit_parens",
"strict": false,
"level": "ignore"
},
"no_empty_param_list": {
"name": "no_empty_param_list",
"level": "error"
},
"no_stand_alone_at": {
"name": "no_stand_alone_at",
"level": "ignore"
},
"space_operators": {
"name": "space_operators",
"level": "error"
},
"duplicate_key": {
"name": "duplicate_key",
"level": "error"
},
"empty_constructor_needs_parens": {
"name": "empty_constructor_needs_parens",
"level": "ignore"
},
"cyclomatic_complexity": {
"name": "cyclomatic_complexity",
"value": 10,
"level": "ignore"
},
"newlines_after_classes": {
"name": "newlines_after_classes",
"value": 3,
"level": "ignore"
},
"no_unnecessary_fat_arrows": {
"name": "no_unnecessary_fat_arrows",
"level": "error"
},
"missing_fat_arrows": {
"name": "missing_fat_arrows",
"level": "ignore"
},
"non_empty_constructor_needs_parens": {
"name": "non_empty_constructor_needs_parens",
"level": "ignore"
},
"no_unnecessary_double_quotes": {
"name": "no_unnecessary_double_quotes",
"level": "error"
},
"no_debugger": {
"name": "no_debugger",
"level": "warn"
},
"no_interpolation_in_single_quotes": {
"name": "no_interpolation_in_single_quotes",
"level": "error"
}
}

View File

@ -1,25 +0,0 @@
path = require('path')
gulp = require('gulp')
inlinesource = require('gulp-inline-source')
shell = require('gulp-shell')
packageJSON = require('./package.json')
OPTIONS =
files:
coffee: [ 'gulpfile.coffee' ]
tests: 'tests/**/*.spec.js'
pages: 'lib/auth/pages/*.ejs'
directories:
build: 'build/'
gulp.task 'pages', ->
gulp.src(OPTIONS.files.pages)
.pipe(inlinesource())
.pipe(gulp.dest('build/auth/pages'))
gulp.task 'build', gulp.series [
'pages'
]
gulp.task 'watch', gulp.series [ 'build' ], ->
gulp.watch([ OPTIONS.files.coffee ], [ 'build' ])

15
gulpfile.js Normal file
View File

@ -0,0 +1,15 @@
const gulp = require('gulp');
const inlinesource = require('gulp-inline-source');
const OPTIONS = {
files: {
pages: 'lib/auth/pages/*.ejs',
},
};
gulp.task('pages', () =>
gulp
.src(OPTIONS.files.pages)
.pipe(inlinesource())
.pipe(gulp.dest('build/auth/pages')),
);

View File

@ -214,7 +214,7 @@ let BluebirdConfigured = false;
/**
* Configure Bluebird and assign it as the global promise library.
* Modules like `stream-to-promise` will otherwise produce native promises,
* which leads to errors as much of the CLI CoffeeScript code expects Bluebird
* which leads to errors as much of the CLI JavaScript code expects Bluebird
* promises.
*/
export function configureBluebird() {

25
npm-shrinkwrap.json generated
View File

@ -3526,11 +3526,6 @@
"globals": "^10.1.0"
}
},
"coffeescript": {
"version": "1.12.7",
"resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-1.12.7.tgz",
"integrity": "sha512-pLXHFxQMPklVoEekowk8b3erNynC+DVJzChxS/LCBBgR6/8AJkHivkm//zbowcfc7BTCAjryuhx6gPqPRfsFoA=="
},
"collection-map": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/collection-map/-/collection-map-1.0.0.tgz",
@ -7038,26 +7033,6 @@
"through2": "~2.0.0"
}
},
"gulp-shell": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/gulp-shell/-/gulp-shell-0.5.2.tgz",
"integrity": "sha1-pJWcoGUa0ce7/nCy0K27tOGuqY0=",
"dev": true,
"requires": {
"async": "^1.5.0",
"gulp-util": "^3.0.7",
"lodash": "^4.0.0",
"through2": "^2.0.0"
},
"dependencies": {
"async": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=",
"dev": true
}
}
},
"gulp-util": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.8.tgz",

View File

@ -45,7 +45,7 @@
"prebuild": "rimraf build/ build-bin/",
"build": "npm run build:src && npm run catch-uncommitted",
"build:src": "npm run lint && npm run build:fast && npm run build:test && npm run build:doc",
"build:fast": "gulp build && tsc",
"build:fast": "gulp pages && tsc",
"build:test": "tsc -P ./tsconfig.dev.json --noEmit && tsc -P ./tsconfig.js.json --noEmit",
"build:doc": "mkdirp doc/ && ts-node --transpile-only automation/capitanodoc/index.ts > doc/cli.markdown",
"build:standalone": "ts-node --transpile-only automation/run.ts build:standalone",
@ -58,7 +58,7 @@
"catch-uncommitted": "ts-node --transpile-only automation/run.ts catch-uncommitted",
"ci": "npm run test && npm run catch-uncommitted",
"watch": "gulp watch",
"lint": "balena-lint -e ts -e js --typescript --fix automation/ lib/ typings/ tests/",
"lint": "balena-lint -e ts -e js --typescript --fix automation/ lib/ typings/ tests/ gulpfile.js",
"update": "ts-node --transpile-only ./automation/update-module.ts",
"prepublishOnly": "npm run build"
},
@ -149,7 +149,6 @@
"fs-extra": "^8.0.1",
"gulp": "^4.0.1",
"gulp-inline-source": "^2.1.0",
"gulp-shell": "^0.5.2",
"husky": "^4.2.5",
"intercept-stdout": "^0.1.2",
"mocha": "^6.2.3",
@ -190,7 +189,6 @@
"chalk": "^3.0.0",
"chokidar": "^2.1.8",
"cli-truncate": "^1.1.0",
"coffeescript": "^1.12.6",
"color-hash": "^1.0.3",
"columnify": "^1.5.2",
"common-tags": "^1.7.2",

View File

@ -4,6 +4,7 @@
"./automation/**/*",
"./lib/**/*",
"./tests/**/*",
"./typings/**/*"
"./typings/**/*",
"gulpfile.js"
]
}