From b3ab56cb57d54d0e3eaa18cc96bceb7c20490c2a Mon Sep 17 00:00:00 2001 From: John Hill Date: Fri, 7 Jan 2022 11:39:25 -0800 Subject: [PATCH] Move off node10 and add intellisense (#4643) * Move off node10 and bring in node16 * Update engine lock * update webpack and add the output.hashFunction option to avoid a potential issue with Node 17 in case the config changes closer to defaults At the moment there is no error with Node 17 because the config strays from the defaults and avoids the common case. Also add a tsconfig.json file that enables VS Code and other IDEs to perform type checking on the side. For example now the webpack config file is type checked. This does not impact any existing processes, our build scripts are left untouched and only IDEs will use it for live intellisense and type checking when viewing files (f.e. showing helpful red squiggly underlines on type errors) * mini-css-extract-plugin * Update webpack.prod.js * Update webpack.prod.js * 15 * Update config.yml * Updated config.yml * Updated config.yml * Updated config.yml * Update package.json * comment and EOF Co-authored-by: Joe Pea Co-authored-by: Joe Pea Co-authored-by: Andrew Henry --- .circleci/config.yml | 19 ++++++++----------- package.json | 8 ++++---- tsconfig.json | 13 +++++++++++++ webpack.common.js | 8 +++++++- 4 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 tsconfig.json diff --git a/.circleci/config.yml b/.circleci/config.yml index ded3baf46d..047f4d6638 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -76,14 +76,14 @@ jobs: node-version: <> - run: npm audit --audit-level=low - generate_and_store_version_and_filesystem_artifacts - node10-lint: + node14-lint: + parameters: + node-version: + type: string executor: pw-focal-development steps: - - checkout - - node/install: - install-npm: false #Cannot install latest npm version with node10. - node-version: lts/dubnium - - run: npm install + - build_and_install: + node-version: <> - run: npm run lint - generate_and_store_version_and_filesystem_artifacts unit-test: @@ -141,7 +141,8 @@ jobs: workflows: overall-circleci-commit-status: #These jobs run on every commit jobs: - - node10-lint + - node14-lint: + node-version: lts/fermium - unit-test: name: node12-chrome node-version: lts/erbium @@ -158,10 +159,6 @@ workflows: suite: ci the-nightly: #These jobs do not run on PRs, but against master at night jobs: - - unit-test: - name: node10-chrome-nightly - node-version: lts/dubnium - browser: ChromeHeadless - unit-test: name: node12-firefoxESR-nightly node-version: lts/erbium diff --git a/package.json b/package.json index 0fbda6f121..163ae06e31 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "babel-eslint": "10.1.0", "comma-separated-values": "^3.6.4", "concurrently": "^3.6.1", - "copy-webpack-plugin": "^9.0.0", + "copy-webpack-plugin": "^10.2.0", "cross-env": "^6.0.3", "css-loader": "^4.0.0", "d3-axis": "1.0.x", @@ -51,7 +51,7 @@ "lodash": "^4.17.12", "markdown-toc": "^0.11.7", "marked": "^0.3.5", - "mini-css-extract-plugin": "^1.6.0", + "mini-css-extract-plugin": "2.4.5", "minimist": "^1.2.5", "moment": "2.25.3", "moment-duration-format": "^2.2.2", @@ -76,7 +76,7 @@ "vue-eslint-parser": "8.0.1", "vue-loader": "15.9.8", "vue-template-compiler": "2.5.6", - "webpack": "^5.53.0", + "webpack": "^5.65.0", "webpack-cli": "^4.0.0", "webpack-dev-middleware": "^3.1.3", "webpack-hot-middleware": "^2.22.3", @@ -112,7 +112,7 @@ "url": "https://github.com/nasa/openmct.git" }, "engines": { - "node": ">=10.12.2 <16.0.0" + "node": ">=12.0.1 <15.0.0" }, "author": "", "license": "Apache-2.0", diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000000..1f8f562233 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,13 @@ +/* Note: Open MCT does not intend to support the entire Typescript ecosystem at this time. + * This file is intended to add Intellisense for IDEs like VSCode. For more information + * about Typescript, please discuss in https://github.com/nasa/openmct/discussions/4693 +*/ +{ + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "strict": true, + "module": "esnext", + "moduleResolution": "node" + } +} diff --git a/webpack.common.js b/webpack.common.js index d12ded1860..adb7f25b54 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -1,3 +1,5 @@ +/* global __dirname */ + const path = require('path'); const packageDefinition = require('./package.json'); const CopyWebpackPlugin = require('copy-webpack-plugin'); @@ -12,7 +14,8 @@ const gitBranch = require('child_process') .execSync('git rev-parse --abbrev-ref HEAD') .toString().trim(); -module.exports = { +/** @type {import('webpack').Configuration} */ +const config = { entry: { openmct: './openmct.js', couchDBChangesFeed: './src/plugins/persistence/couch/CouchChangesFeed.js', @@ -27,6 +30,7 @@ module.exports = { library: '[name]', libraryTarget: 'umd', publicPath: '', + hashFunction: 'xxhash64', clean: true }, resolve: { @@ -129,3 +133,5 @@ module.exports = { }, stats: 'errors-warnings' }; + +module.exports = config;