diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 72009cef1f8..00000000000 --- a/.babelrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "targets": { - "node": "current" - } - } - ] - ] -} diff --git a/.codecov.yml b/.codecov.yml index 58598d7c0e6..9f22d86e981 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,15 +1,20 @@ -comment: off +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "50...100" parsers: - javascript: - enable_partials: yes + gcov: + branch_detection: + conditional: yes + loop: yes + method: no + macro: no -coverage: - status: - project: - default: - threshold: 4% - if_not_found: success - patch: - default: - if_not_found: success +comment: + layout: "reach,diff,flags,files,footer" + behavior: default + require_changes: no diff --git a/.cz-config.js b/.cz-config.js deleted file mode 100644 index 36c25512e7c..00000000000 --- a/.cz-config.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @license Copyright 2017 Google Inc. All Rights Reserved. - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by - * applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - * OF ANY KIND, either express or implied. See the License for the specific - * language governing permissions and limitations under the License. - */ -// Based on https://github.com/GoogleChrome/lighthouse/blob/master/.cz-config.js - -'use strict'; - -module.exports = { - allowBreakingChanges: ['ast'], - allowCustomScopes: true, - scopes: [], - // sort type values in asc - types: [ - { value: 'ast', name: 'ast: init, migrate, add, etc' }, - { value: 'break', name: 'break: Changes that break the behaviour of the cli' }, - { value: 'chore', name: 'chore: Updating deps, docs, linting, etc' }, - { value: 'cli', name: 'cli: Core CLI things' }, - { value: 'docs', name: 'docs: Documentation' }, - { value: 'feat', name: 'feat: A new feature' }, - { value: 'fix', name: 'fix: Bugs, typos, etc' }, - { value: 'misc', name: 'misc: Other formats like tweaks and such' }, - { value: 'tests', name: 'tests: Tests, jest, etc' }, - { value: 'refactor', name: 'refactor: A code change that neither fixes a bug nor adds a feature' }, - ], -}; diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000000..2af70d687af --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,4 @@ +FROM node:12 + +# Add global instances of prettier and eslint for vscode +RUN npm install -g eslint prettier \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..264b218cf9b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,10 @@ +{ + "name": "webpack-cli", + "dockerFile": "Dockerfile", + "runArgs": ["-u", "node"], + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + "postCreateCommand": "yarn install && yarn bootstrap && yarn build", + "extensions": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"] +} diff --git a/.eslintignore b/.eslintignore index aafbffa5401..d14956aa89a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,30 +1,17 @@ -__testfixtures__ coverage +.nyc_output node_modules -packages/generate-loader/lib -packages/generate-plugin/lib +dist +packages/configtest/lib packages/generators/lib packages/info/lib -packages/init/lib -packages/migrate/lib packages/serve/lib -packages/utils/lib -packages/webpack-scaffold/lib test/**/dist/ test/**/bin/ test/**/binary/ test/**/index.js -test/typescript/webpack.config.ts -test/plugin/test-plugin/test/test-utils.js -test/plugin/test-plugin/test/functional.test.js -test/plugin/test-plugin/examples/simple/src/static-esm-module.js -test/plugin/test-plugin/examples/simple/src/lazy-module.js -test/plugin/test-plugin/examples/simple/webpack.config.js -test/loader/test-loader/test/unit.test.js -test/loader/test-loader/test/test-utils.js -test/loader/test-loader/test/functional.test.js -test/loader/test-loader/examples/simple/webpack.config.js -test/loader/test-loader/examples/simple/src/static-esm-module.js -test/loader/test-loader/examples/simple/src/lazy-module.js -test/loader/test-loader/examples/simple/example_dist/** -lib/test/loader/error-test/src/index.d.ts +test/build/config/error-commonjs/syntax-error.js +test/build/config/error-mjs/syntax-error.mjs +test/build/config/error-array/webpack.config.js +test/configtest/with-config-path/syntax-error.config.js +packages/generators/src/utils/__tests__/recursive-parser/__testfixtures__ diff --git a/.eslintrc.js b/.eslintrc.js index e07032771a8..282964570ca 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,12 +1,17 @@ module.exports = { root: true, reportUnusedDisableDirectives: true, - extends: ['eslint:recommended', 'plugin:node/recommended', 'plugin:prettier/recommended', 'prettier'], - parserOptions: { ecmaVersion: 2018, sourceType: 'script' }, - plugins: ['node'], + extends: [ + "eslint:recommended", + "plugin:node/recommended", + "plugin:prettier/recommended", + "prettier", + ], + parserOptions: { ecmaVersion: 2018, sourceType: "script" }, + plugins: ["node"], settings: { node: { - allowModules: ['@webpack-cli/generators', '@webpack-cli/webpack-scaffold', '@webpack-cli/utils'], + allowModules: ["@webpack-cli/generators"], }, }, env: { @@ -15,30 +20,31 @@ module.exports = { jest: true, }, rules: { - quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }], - 'no-process-exit': 'off', - 'no-template-curly-in-string': 'error', - 'no-caller': 'error', - 'no-extra-bind': 'error', - 'no-loop-func': 'error', + "no-process-exit": "off", + "no-template-curly-in-string": "error", + "no-caller": "error", + "no-extra-bind": "error", + "no-loop-func": "error", + "no-undef": "error", + "prefer-const": "error", }, overrides: [ { settings: { node: { - tryExtensions: ['.ts', '.tsx', '.js', '.jsx', '.json'], + tryExtensions: [".ts", ".tsx", ".js", ".jsx", ".json"], }, }, - files: ['**/*.ts'], + files: ["**/*.ts"], extends: [ - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended', - 'prettier/@typescript-eslint', + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "prettier", ], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], + parser: "@typescript-eslint/parser", + plugins: ["@typescript-eslint"], rules: { - 'node/no-unsupported-features/es-syntax': 'off', + "node/no-unsupported-features/es-syntax": "off", }, }, ], diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 267f4227d61..0b85fbb6c8c 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -23,10 +23,6 @@ Table of Contents - [Submitting a good Pull Request](#submitting-a-good-pull-request) - [Commit message](#commit-message) - [Commit Message Format](#commit-message-format) -- [Migrate with the CLI](#migrate-with-the-cli) - - [How it's being done](#how-its-being-done) - - [Structure of a transform](#structure-of-a-transform) - - [Further Work](#further-work) - [Contributor License Agreement](#contributor-license-agreement) - [Documentation](#documentation) - [Releasing](#releasing) @@ -48,7 +44,7 @@ that include your `webpack.config.js` and relevant files. This way you help othe First of all, you will need to create an issue in Github for the feature or bugfix that you want to work on. When you open a new issue, there will be a template that will be automatically added to the text of the issue, which you would need to fill in. Doing this will help us to understand better what the ticket is about. -After you've created the issue, we will have a look, and provide feedback to your ticket. +After you've created an issue, we will have a look, and provide feedback to your ticket. In case it is a bug that you want to fix, we might help you with background information about the issue, so you can make an informed fix. @@ -76,10 +72,12 @@ In case you are suggesting a new feature, we will match your idea with our curre - Bootstrap all the submodules before building for the first time ```bash - yarn bootstrap + yarn lerna bootstrap yarn build ``` +> If you are a Docker and Visual Studio Code user, you can quickstart development using [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) Extension + ## Running Tests ### Using yarn @@ -191,8 +189,6 @@ In case you've got a small change in most of the cases, your pull request would Our commit messages format follows the [angular.js commits format](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits). -You can use `yarn commit` script to have an interactive way of making commits that follow our guidelines. - We don't use the scope. The template of a commit would look like this: ### Commit Message Format @@ -200,10 +196,9 @@ We don't use the scope. The template of a commit would look like this: Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a **type** and a **subject**: -```md +``` : -