From ab526c9ed825e2b4a44a8280dc6f4bda1a023c0a Mon Sep 17 00:00:00 2001 From: Pagan Gazzard Date: Thu, 30 Apr 2020 17:41:01 +0100 Subject: [PATCH] Convert gulpfile.coffee to javascript Change-type: patch --- .hound.yml | 3 - automation/check-doc.js | 7 +-- coffeelint.json | 127 ---------------------------------------- gulpfile.coffee | 25 -------- gulpfile.js | 15 +++++ lib/app-common.ts | 2 +- npm-shrinkwrap.json | 25 -------- package.json | 6 +- tsconfig.dev.json | 3 +- 9 files changed, 21 insertions(+), 192 deletions(-) delete mode 100644 coffeelint.json delete mode 100644 gulpfile.coffee create mode 100644 gulpfile.js diff --git a/.hound.yml b/.hound.yml index 91dcc7b8..05646107 100644 --- a/.hound.yml +++ b/.hound.yml @@ -1,5 +1,2 @@ -coffee_script: - config_file: coffeelint.json - javascript: enabled: false diff --git a/automation/check-doc.js b/automation/check-doc.js index 7b60e968..caa52867 100644 --- a/automation/check-doc.js +++ b/automation/check-doc.js @@ -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`. diff --git a/coffeelint.json b/coffeelint.json deleted file mode 100644 index 51fc109c..00000000 --- a/coffeelint.json +++ /dev/null @@ -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" - } -} diff --git a/gulpfile.coffee b/gulpfile.coffee deleted file mode 100644 index c5623375..00000000 --- a/gulpfile.coffee +++ /dev/null @@ -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' ]) diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 00000000..287116de --- /dev/null +++ b/gulpfile.js @@ -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')), +); diff --git a/lib/app-common.ts b/lib/app-common.ts index c59ec66e..6bf712da 100644 --- a/lib/app-common.ts +++ b/lib/app-common.ts @@ -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() { diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 91c753bb..53948d94 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -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", diff --git a/package.json b/package.json index ab8816ba..1b48704d 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tsconfig.dev.json b/tsconfig.dev.json index 6a172666..cf48128b 100644 --- a/tsconfig.dev.json +++ b/tsconfig.dev.json @@ -4,6 +4,7 @@ "./automation/**/*", "./lib/**/*", "./tests/**/*", - "./typings/**/*" + "./typings/**/*", + "gulpfile.js" ] }