Socket
Socket
Sign inDemoInstall

webpack-cli

Package Overview
Dependencies
385
Maintainers
4
Versions
123
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0-beta.3 to 4.0.0-beta.6

lib/commands/ExternalCommand.js

30

bin/cli.js
#!/usr/bin/env node
'use strict';
require('v8-compile-cache');
const execa = require('execa');
const importLocal = require('import-local');
// eslint-disable-next-line node/no-unpublished-require
const logger = require('../lib/utils/logger');
// eslint-disable-next-line node/no-unpublished-require
const parseArgs = require('../lib/utils/parse-args');

@@ -21,28 +15,4 @@

const updateNotifier = require('update-notifier');
const packageJson = require('../package.json');
const notifier = updateNotifier({
pkg: packageJson,
updateCheckInterval: 1000 * 60 * 60 * 24 * 30, // 1 month
});
if (notifier.update) {
logger.info(`Update available: ${notifier.update.latest}`);
}
const semver = require('semver');
const version = packageJson.engines.node;
if (!semver.satisfies(process.version, version)) {
const rawVersion = version.replace(/[^\d\.]*/, '');
logger.error(`webpack CLI requires at least Node v ${rawVersion}. You have ${process.version}.`);
logger.error('See https://webpack.js.org/ for migration help and similar.');
process.exit(1);
}
const [, , ...rawArgs] = process.argv;
const { cliArgs, nodeArgs } = parseArgs(rawArgs);
// eslint-disable-next-line node/no-unpublished-require
const bootstrapPath = require.resolve('../lib/bootstrap');

@@ -49,0 +19,0 @@

255

CHANGELOG.md

@@ -1,252 +0,19 @@

# Changelog
# Change Log
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [4.0.0-beta.2](https://github.com/webpack/webpack-cli/compare/v3.3.5...v4.0.0-beta.2) (2020-02-11)
# [4.0.0-beta.6](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.0.0-beta.5...webpack-cli@4.0.0-beta.6) (2020-02-23)
### Features
**Note:** Version bump only for package webpack-cli
- 0cjs for array configs ([e233ed6](https://github.com/webpack/webpack-cli/commit/e233ed6661ea6453d7e6b005b73c6ecd05c871ac))
- **chore:** refactor code to eliminate redundancy ([12cf389](https://github.com/webpack/webpack-cli/commit/12cf389f4550298c4646d99c9ac431658bb8ba8e))
- **cli:** add helper to check if arg is the command name or alias ([28d303b](https://github.com/webpack/webpack-cli/commit/28d303bced6810a18a4f7bc6d8a0dba487f79433))
- remove unneeded color ([b4cd29f](https://github.com/webpack/webpack-cli/commit/b4cd29fbad26e291687e90d10b3087331193b9f4))
- **cli:** adds standard output flag ([#1206](https://github.com/webpack/webpack-cli/issues/1206)) ([b05e5eb](https://github.com/webpack/webpack-cli/commit/b05e5ebf918576ddd5a304dc86be0aed02352bfa))
- add codeowners file ([1070038](https://github.com/webpack/webpack-cli/commit/10700386046bb1be908dfc48384d77aad44bf93f))
- add mjs support ([5f38764](https://github.com/webpack/webpack-cli/commit/5f387641839419d3f536bb99ad6741f701b953de))
- add-badge ([751ae5a](https://github.com/webpack/webpack-cli/commit/751ae5a4d3fb4895ffb8d28ef61b99c8454a438c))
- always spawn a process for cli ([#1198](https://github.com/webpack/webpack-cli/issues/1198)) ([06171b3](https://github.com/webpack/webpack-cli/commit/06171b3c7c030985d4c6cf32e7512cb3795f73ba))
- better defaults, cleanup ([1a467b6](https://github.com/webpack/webpack-cli/commit/1a467b67d937ac564a7f32f324107e1e1cdfd812))
- create commands.js ([2c0c221](https://github.com/webpack/webpack-cli/commit/2c0c221e5f8774efa98cffb279abff164fe4898a))
- drop extraneous block ([fa3aa2b](https://github.com/webpack/webpack-cli/commit/fa3aa2b86a2d938477b1b66b95614cd54cc95c9b))
- env based config defaults ([be28c78](https://github.com/webpack/webpack-cli/commit/be28c782fb0b8f357acc6e41264d0d04c8b4236d))
- help for commands ([0feefb3](https://github.com/webpack/webpack-cli/commit/0feefb3a77fd9452ee747e6f6fcc2d6405619f67))
- help for core flags ([#1141](https://github.com/webpack/webpack-cli/issues/1141)) ([8f92cb9](https://github.com/webpack/webpack-cli/commit/8f92cb97f5877893c4f962855801e808bfe4f17b)), closes [#1168](https://github.com/webpack/webpack-cli/issues/1168)
- merge ouputCommand into outputHelp ([5ab0024](https://github.com/webpack/webpack-cli/commit/5ab0024a8397bc681524727cbc2edc6bd59d33f2))
- minor tweak ([7c273dc](https://github.com/webpack/webpack-cli/commit/7c273dc3ad786ba4b806ab55ddabc6be19f253dd))
- refactor ([0505d05](https://github.com/webpack/webpack-cli/commit/0505d052ec41942efcf0b5f42f4ceed5cd9449d8))
- refactor ([002a785](https://github.com/webpack/webpack-cli/commit/002a78576ee7f209042e7a49afbb76795e609422))
- refactor ([ad7fe98](https://github.com/webpack/webpack-cli/commit/ad7fe986b9e556d2e52a025b77755cd860a0992c))
- refactor ([cb8968d](https://github.com/webpack/webpack-cli/commit/cb8968d8a0f0d154aa50b9108be42910f3b73ea7))
- refactor ([16c368f](https://github.com/webpack/webpack-cli/commit/16c368f9a88198ff497afee4598553cb1f800d23))
- refactor ([07a2961](https://github.com/webpack/webpack-cli/commit/07a2961c1b0eedb80f49535ab52030d619761a1c))
- refactor ([c991733](https://github.com/webpack/webpack-cli/commit/c991733dba068d1c397d09ab3dcc99e9bf21de74))
- refactor ([4858fde](https://github.com/webpack/webpack-cli/commit/4858fdef6c42220b518e6fd412a34c03c8ccacbf))
- refactor ([2b1ea4c](https://github.com/webpack/webpack-cli/commit/2b1ea4c3ba85d6c43d628b4141b51fd2b70d9ce1))
- refactor ([dee2884](https://github.com/webpack/webpack-cli/commit/dee288441c7de4c117addc53876e8864e2c4a14f))
- refactor group-helper ([807bcb4](https://github.com/webpack/webpack-cli/commit/807bcb426b2fb2fbb781cae871cd0a0f234c5a55))
- refactor groups-config ([4bf86bc](https://github.com/webpack/webpack-cli/commit/4bf86bc196b3ee6334ccc3f32fdeedf5857b9491))
- refactor groups-config ([00acc50](https://github.com/webpack/webpack-cli/commit/00acc50514b1782dc3c91a62d7214b2b6e9c022f))
- refactor logic ([3efe4bb](https://github.com/webpack/webpack-cli/commit/3efe4bbb52c5db6876c33b2f68d04d5e09052ee4))
- refactor test-utils ([d4873ad](https://github.com/webpack/webpack-cli/commit/d4873ad149bb4c90ba2077db7c1311d1f9c7931b))
- Support `export default` from configuration files. ([0f23d03](https://github.com/webpack/webpack-cli/commit/0f23d03e6832a8571ed65044a50271f5fe253671))
- support array-configs ([fa9d5c2](https://github.com/webpack/webpack-cli/commit/fa9d5c22b41458a71b91e73bfe48924a61ba6e3e))
- support array-configs ([76ced4a](https://github.com/webpack/webpack-cli/commit/76ced4ab3324745a09237957e21e278cbdc7f0dc))
- support negated flags ([239a67e](https://github.com/webpack/webpack-cli/commit/239a67ea4fa32b3da180f374732d4c4a761dc4ac))
- **interpret:** use interpret ([31c856f](https://github.com/webpack/webpack-cli/commit/31c856f1c9db7a186a4ae32fa1f70396999b41cd))
- tweak ([79021e3](https://github.com/webpack/webpack-cli/commit/79021e347d616df277484d79927085a0e08fc9a4))
- update notify period ([0d83e49](https://github.com/webpack/webpack-cli/commit/0d83e493def6d5515b3f3537e73cbacd4c4a4516))
- **init:** add as req dep ([fec5b25](https://github.com/webpack/webpack-cli/commit/fec5b25453d8035712e1ec2c81a8f10bc27e76be))
- update outputCommand ([4f19ad4](https://github.com/webpack/webpack-cli/commit/4f19ad4fbf3d12cd46f6dd7faaea1d6db02ec197))
- **cli:** make serve use webpack cli compiler ([ab862d2](https://github.com/webpack/webpack-cli/commit/ab862d2ab72be3e0c73d1a35e31c81cde3d3e006))
- **defaults:** set entry obj defaults and add default flag ([4608167](https://github.com/webpack/webpack-cli/commit/4608167fd5ff7a9b201843bd050294da9eccfbdf))
- **init:** write file correct, better defaults and write babelrc file ([3814d44](https://github.com/webpack/webpack-cli/commit/3814d44d97d519f0b0eae2cc5e400b1899848e37))
- **serve:** add all flags, improve args parsing ([46ca4de](https://github.com/webpack/webpack-cli/commit/46ca4de11b16a3b29d800a150edf90b7562455ea))
- **serve:** pass socket or port if no socket ([4668ea7](https://github.com/webpack/webpack-cli/commit/4668ea78e125a698e0988ead30c82bec0f9bb8e3))
- **silent:** add new flag ([fcdc3f4](https://github.com/webpack/webpack-cli/commit/fcdc3f41f3aa55681b18fb5083279dbd91441d68))
- Update README.md ([b3dc27e](https://github.com/webpack/webpack-cli/commit/b3dc27e8b9d93221ef57ff013018a532254dc989))
- use jspluginswebpack ([da8fce2](https://github.com/webpack/webpack-cli/commit/da8fce23894315fc9921c51dfb58d77fbf35e8c9))
# [4.0.0-beta.5](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.0.0-beta.4...webpack-cli@4.0.0-beta.5) (2020-02-23)
### Bug Fixes
**Note:** Version bump only for package webpack-cli
- various tests are now working ([#1168](https://github.com/webpack/webpack-cli/issues/1168)) ([287d8ee](https://github.com/webpack/webpack-cli/commit/287d8ee28afc69c8310828b0fa0919d40b6131af))
- array to object check ([2398249](https://github.com/webpack/webpack-cli/commit/2398249dcf23232b15c22d330681ca19f442e394))
- badge url placement ([8d33d15](https://github.com/webpack/webpack-cli/commit/8d33d15f7439e35696f354a9f057fa4550893648))
- changed the path resolver call ([0080ce2](https://github.com/webpack/webpack-cli/commit/0080ce297482b83fb1f7dfdc0328e1734aa1713e))
- config lookup ([762e3b9](https://github.com/webpack/webpack-cli/commit/762e3b9141503521d82a997a9f36f9d4612f0abf))
- correct jscodeshift import ([0c67103](https://github.com/webpack/webpack-cli/commit/0c67103644ce6f51b0e43a48c80f76883de24b5d))
- enable colors in ci ([7c9e0df](https://github.com/webpack/webpack-cli/commit/7c9e0df74cb88b4907e513c53218db9478cacc79))
- extend notify period ([aff8352](https://github.com/webpack/webpack-cli/commit/aff8352eaa2419a356b13e19a2ad1168001cebca))
- grammar within comment ([d482677](https://github.com/webpack/webpack-cli/commit/d4826774a628f12aeed4deb9382d390e5d800914))
- ignore failing test case ([c643626](https://github.com/webpack/webpack-cli/commit/c6436261ccaa659ecad1e4f29104d860e4f6219c))
- ignore failing tests ([444355a](https://github.com/webpack/webpack-cli/commit/444355aa22d0efc9eb0e887560d04a125061e321))
- improve local configRegister file resolution ([32cc513](https://github.com/webpack/webpack-cli/commit/32cc513eb62abf6dd7e18d8bacf6d0400cc9020e)), closes [#746](https://github.com/webpack/webpack-cli/issues/746)
- make init reolve linked packges ([#1006](https://github.com/webpack/webpack-cli/issues/1006)) ([187045a](https://github.com/webpack/webpack-cli/commit/187045a5cdfa7c32659c73b867587d0a2c1c29e1))
- minor fix ([0d9aa9a](https://github.com/webpack/webpack-cli/commit/0d9aa9ac7868f0154209eb119b6244df55859af7))
- **cli:** await external command execution, fix lint ([ce8f284](https://github.com/webpack/webpack-cli/commit/ce8f2840267c627539813f3b06956b9bf89584a3))
- **cli:** missing package, fixed function call ([4ee4d41](https://github.com/webpack/webpack-cli/commit/4ee4d41afc82f28545bc6e6482f034bc13cdd0d7))
- **create:** add default sw in create template ([#1153](https://github.com/webpack/webpack-cli/issues/1153)) ([edf65c2](https://github.com/webpack/webpack-cli/commit/edf65c2f0430c1c76d4f7004b338e46f56be35f2)), closes [#1152](https://github.com/webpack/webpack-cli/issues/1152) [#1152](https://github.com/webpack/webpack-cli/issues/1152) [#1152](https://github.com/webpack/webpack-cli/issues/1152)
- **create:** handle create package errors gracefully ([#1159](https://github.com/webpack/webpack-cli/issues/1159)) ([aa6d82b](https://github.com/webpack/webpack-cli/commit/aa6d82b649c9a1f4c54566b80597576d9bb554b4)), closes [#1151](https://github.com/webpack/webpack-cli/issues/1151) [#1151](https://github.com/webpack/webpack-cli/issues/1151) [#1151](https://github.com/webpack/webpack-cli/issues/1151) [#1151](https://github.com/webpack/webpack-cli/issues/1151)
- **deps:** add missing cz-customizable dep to allow committing ([68b1bbe](https://github.com/webpack/webpack-cli/commit/68b1bbe8f93685727ef5973b81dbe73e3fe0c3c7)), closes [#1040](https://github.com/webpack/webpack-cli/issues/1040)
- **info:** minor fix in the info function ([7a5cc51](https://github.com/webpack/webpack-cli/commit/7a5cc511ff78177c71c17e91619320933014f157))
- **init:** check defaults more precisely ([51831c7](https://github.com/webpack/webpack-cli/commit/51831c79bb701b7a21778ae7c90f7753a270c24d))
- use includes instead ([76671cb](https://github.com/webpack/webpack-cli/commit/76671cb9b6b9e753c7872a31a836bbd69d9c4ce1))
- **init:** fixed package template to include name param ([#1203](https://github.com/webpack/webpack-cli/issues/1203)) ([83c0056](https://github.com/webpack/webpack-cli/commit/83c0056999e82496ad24a1e965157491287ad895))
- minor refactor ([a30a027](https://github.com/webpack/webpack-cli/commit/a30a02716c50b1c52c223c42eabe5dd1cbe29577))
- minor tweak ([d21d6d3](https://github.com/webpack/webpack-cli/commit/d21d6d338fa7169929363d4fe60b8d7b8b39fcd1))
- minor typo ([85d1a7c](https://github.com/webpack/webpack-cli/commit/85d1a7c26499400a65b88274b466818899b36da8))
- plugin val ([b835e71](https://github.com/webpack/webpack-cli/commit/b835e711f5a7d96bf609161ba7b58bdd6acba426))
- promise configurations ([ae3ec9b](https://github.com/webpack/webpack-cli/commit/ae3ec9bef7da3c06020d3b4cab877ede19f0d631))
- refactor redundant code ([c7b77a0](https://github.com/webpack/webpack-cli/commit/c7b77a08d3fad0ba93605e69f21b939614c383e5))
- remove else block ([2b36987](https://github.com/webpack/webpack-cli/commit/2b36987ce2aa030a476a58bb80737e881926528d))
- remove extra ternary operator ([115709e](https://github.com/webpack/webpack-cli/commit/115709e4107f7c5e0ff0bfaf5183b6df7d87fdac))
- remove failing test case ([e3e46b6](https://github.com/webpack/webpack-cli/commit/e3e46b6c58f45286a2194105d1fb92deb67d9c53))
- remove for now the default value of the target ([#1171](https://github.com/webpack/webpack-cli/issues/1171)) ([2d56f79](https://github.com/webpack/webpack-cli/commit/2d56f790cfd6ed076c80afb0a6d613e56169c5c5))
- Remove redundant await ([6910877](https://github.com/webpack/webpack-cli/commit/691087774f4c453ae597e7b67343b75a41027036))
- remove unused variable ([b5510d8](https://github.com/webpack/webpack-cli/commit/b5510d882bf60a2249e0022d573b2a2fb2a06dad))
- rephrase comment ([e11c1c8](https://github.com/webpack/webpack-cli/commit/e11c1c8012cad266a41b5fc810384c9b6fe90065))
- revert ([b51df6a](https://github.com/webpack/webpack-cli/commit/b51df6aa2e3de60bf8a57e6b223fd64b48501436))
- revert ([75f56c5](https://github.com/webpack/webpack-cli/commit/75f56c5478a1177fcfcbbf189de4fc101431e055))
- revert ([f44d8a5](https://github.com/webpack/webpack-cli/commit/f44d8a57b29a77a897eccfb95df71edd9db75b32))
- spread args to mono-repo ([7499dd3](https://github.com/webpack/webpack-cli/commit/7499dd37f116a4d65bf0983e742943d03c351ee7))
- tweak ([b5add43](https://github.com/webpack/webpack-cli/commit/b5add43af0a742a925fee6200727f4358eb34749))
- tweak ([d74efde](https://github.com/webpack/webpack-cli/commit/d74efde1352790bd7e854df61884d51a0c667e3e))
- typo ([10618de](https://github.com/webpack/webpack-cli/commit/10618de2f2f91698dd5b7a9d12f74865ac4a1ecb))
- typo fix ([dc3a5e6](https://github.com/webpack/webpack-cli/commit/dc3a5e64fd94a26338f7ba1bc36fc100ddbb4f9d))
- update badge url ([0b1bbd7](https://github.com/webpack/webpack-cli/commit/0b1bbd7ac277a757fe0c8cde3773f6bda7a51467))
- update comments ([7553ae7](https://github.com/webpack/webpack-cli/commit/7553ae76b6a2f84cb5cb69f73f1eb3613020775f))
- Use ES6 object initializer shorthand ([f4cf9b1](https://github.com/webpack/webpack-cli/commit/f4cf9b198d0cf53ce1cb3251e24507be51b34f8b))
- use webpack-log ([9bfb79c](https://github.com/webpack/webpack-cli/commit/9bfb79c54020ef5e93c2417b2bee2feb7bcce31b))
- warn on unknown, plugin ([ae725c8](https://github.com/webpack/webpack-cli/commit/ae725c86a5c131470f6aee65cd6e6744264dea80))
- **serve:** add flag to ext-dep list ([1277cc9](https://github.com/webpack/webpack-cli/commit/1277cc9173d9bfa0afb312097e2a4f611491f4ae))
- warnings on lint ([b402179](https://github.com/webpack/webpack-cli/commit/b402179759f02310b60a026329d57b7c5b49a97e))
- warnings on lint ([76db13c](https://github.com/webpack/webpack-cli/commit/76db13c22006dc17819447b34c1be9906b3492fe))
- **init:** fixes config resolution on generating new configuration ([44fa20c](https://github.com/webpack/webpack-cli/commit/44fa20c5b4f791c44e2e3993f8c613d16dcc1bcd))
- **progress:** make boolean ([49bc0a4](https://github.com/webpack/webpack-cli/commit/49bc0a47c28cda87abce314bcc828a1e229be7b5))
- **serve:** add newline at helper end ([25071ce](https://github.com/webpack/webpack-cli/commit/25071ceae3bddcb8e05be8f2064dbbdc174cbe34))
- **serve:** disable for now ([fcf6e3e](https://github.com/webpack/webpack-cli/commit/fcf6e3e0016422310674c70c371a0ed2bd12b37f))
- **serve:** fix gitignore, fix lint problems ([18636c3](https://github.com/webpack/webpack-cli/commit/18636c3ef422e1dc2d3cfbe3ca368b1cef560a50))
- **serve:** handle serve args as an array ([#1174](https://github.com/webpack/webpack-cli/issues/1174)) ([8aa1b7d](https://github.com/webpack/webpack-cli/commit/8aa1b7d5cd69d8ae1bcf98aad7f03618c6609fc7))
- **serve:** relative imports ([1d9c2bc](https://github.com/webpack/webpack-cli/commit/1d9c2bc626dc97ba7e42b85e5b58f99af24a64ac))
# 4.0.0-beta.4 (2020-02-23)
### Chores
### Features
- **actions:** add webpack version ([#1150](https://github.com/webpack/webpack-cli/issues/1150)) ([c1e8fdf](https://github.com/webpack/webpack-cli/commit/c1e8fdf622070ccca34bababe63c081e9e277b8f))
- **bootstrap:** refactor code ([#1037](https://github.com/webpack/webpack-cli/issues/1037)) ([0bc9081](https://github.com/webpack/webpack-cli/commit/0bc90811644e37863a8b86c674b7ca807636540a))
- **ci:** remove node 8 from the CI ([#1182](https://github.com/webpack/webpack-cli/issues/1182)) ([dae9982](https://github.com/webpack/webpack-cli/commit/dae998229c70f7775476ad9fb172d380d92896d4))
- **ci:** update webpack installation ([#1170](https://github.com/webpack/webpack-cli/issues/1170)) ([25a2c6b](https://github.com/webpack/webpack-cli/commit/25a2c6b2488e4e01f2e950b7f7373cb7b25fc8a3))
- **cli:** better group handling ([#1204](https://github.com/webpack/webpack-cli/issues/1204)) ([5e9639f](https://github.com/webpack/webpack-cli/commit/5e9639fb3349ffaddf5b604912e9775b99043d15))
- **cli:** fix helper to use includes for dashed flag stripping ([9da9db4](https://github.com/webpack/webpack-cli/commit/9da9db49863fe7db8df6408229201a015da47bb7))
- **cli:** fix var name to make more sense ([1e10979](https://github.com/webpack/webpack-cli/commit/1e10979a1ff18d7f177184df2b6780dbf166866c))
- **cli:** it restores inquirer for prompting external commands ([#1201](https://github.com/webpack/webpack-cli/issues/1201)) ([70c04ea](https://github.com/webpack/webpack-cli/commit/70c04eac1bb6f8918b135117c30b554131642db6))
- **cli:** show help when invalid flag is supplied ([#1051](https://github.com/webpack/webpack-cli/issues/1051)) ([6663e94](https://github.com/webpack/webpack-cli/commit/6663e94c20d69a9e8555bec015cab59311eddaac)), closes [#1046](https://github.com/webpack/webpack-cli/issues/1046) [#1046](https://github.com/webpack/webpack-cli/issues/1046)
- **cli:** updated package lock ([f6381d1](https://github.com/webpack/webpack-cli/commit/f6381d19f5df4b321290bd67bf6f5a6ba1c13f90))
- **compiler:** refactor emoji rendering in compiler ([012382c](https://github.com/webpack/webpack-cli/commit/012382c7521b30150c3ce7e32b9fbf1c1a6fb964))
- **deps:** bump eslint-utils from 1.4.0 to 1.4.2 ([#1068](https://github.com/webpack/webpack-cli/issues/1068)) ([1f73911](https://github.com/webpack/webpack-cli/commit/1f73911593c2387a870fdb9264bcb58a10d006e6))
- **deps:** bump handlebars from 4.1.2 to 4.7.2 in /packages/migrate ([#1180](https://github.com/webpack/webpack-cli/issues/1180)) ([5f37086](https://github.com/webpack/webpack-cli/commit/5f370868ccf1b07735b4ad0e731388fffc4e1048))
- **deps:** bump handlebars from 4.1.2 to 4.7.2 in /packages/utils ([#1181](https://github.com/webpack/webpack-cli/issues/1181)) ([f2972e5](https://github.com/webpack/webpack-cli/commit/f2972e5dcb0fc1f7753b48c5075a3588a7d5bcb9))
- **deps:** bump lodash from 4.17.11 to 4.17.15 in /packages/init ([95146fe](https://github.com/webpack/webpack-cli/commit/95146fe8c15fecdd15cb29aeec5b1e30417cc6d6))
- **deps:** bump lodash from 4.17.11 to 4.17.15 in /packages/serve ([d1ad9f3](https://github.com/webpack/webpack-cli/commit/d1ad9f371e2a400c0d1bf562ad73d136dc070251))
- **deps:** bump lodash from 4.17.11 to 4.17.15 in /packages/serve ([b3d7013](https://github.com/webpack/webpack-cli/commit/b3d7013805bfeb7679596748afc317a6376dd99b))
- **deps:** bump lodash from 4.17.11 to 4.17.15 in /packages/utils ([7fe5fd4](https://github.com/webpack/webpack-cli/commit/7fe5fd486843928e5607658c4f5293180500059f))
- **deps:** bump lodash in /packages/generate-loader ([87f9e9b](https://github.com/webpack/webpack-cli/commit/87f9e9b8da834e5cf6dfd79c97b7947556db7a29))
- **deps:** bump lodash in /packages/generate-plugin ([a8ecb31](https://github.com/webpack/webpack-cli/commit/a8ecb31387a3d090dc455cafc002d6907fd37301))
- **deps:** bump lodash in /packages/webpack-scaffold ([29de664](https://github.com/webpack/webpack-cli/commit/29de664f105d46736f06dbab534f7f559545b632))
- **deps:** update deps and remove old type ([5af7e7a](https://github.com/webpack/webpack-cli/commit/5af7e7a17105adf455b3b8907910976cf3deb5f8))
- **deps:** update sec vuln patches ([d2c6228](https://github.com/webpack/webpack-cli/commit/d2c62285add3e96894e94472b169f01557b2ef35))
- **grammer:** changes depracated to removed ([732a80a](https://github.com/webpack/webpack-cli/commit/732a80ab2f6d47fbdf18a50f9880e6681c737a54))
- **help:** refactor help for more cleaner code ([94a1ce0](https://github.com/webpack/webpack-cli/commit/94a1ce06ddd150a4ebf6ae54dfb8b4e8767e935d))
- **info:** changes base ([a58c286](https://github.com/webpack/webpack-cli/commit/a58c286ba869811b63ebb604e1a9e796a2b06f22))
- **init:** upgrade yeoman in generators/utils, slight generator error handling changes ([#1205](https://github.com/webpack/webpack-cli/issues/1205)) ([0255657](https://github.com/webpack/webpack-cli/commit/0255657cfe67fffb8583601fd2d4a334ab9a89da))
- **lib:** refactored lib utils and groups ([#1140](https://github.com/webpack/webpack-cli/issues/1140)) ([237887b](https://github.com/webpack/webpack-cli/commit/237887b4847bcfad2239dbea70b6e08f276db3a4))
- **lint:** auto linting ([8668783](https://github.com/webpack/webpack-cli/commit/8668783f259465131da0a6e7b2461c4dc0b75bd0))
- **linting:** renable linting ([1e596d3](https://github.com/webpack/webpack-cli/commit/1e596d320b54d031e6b8373ab2233e600f094428))
- **readme:** change of language ([41ee8ca](https://github.com/webpack/webpack-cli/commit/41ee8ca2d873f1ff8eb9a7aa804e90dbe4812171))
- **ref:** fix code ([d213809](https://github.com/webpack/webpack-cli/commit/d2138096b2c2b0d7a2daa9f6b36af8404dd2840a))
- **refactor:** rm logs ([e7a64d6](https://github.com/webpack/webpack-cli/commit/e7a64d68258bd08f623e67303f9aeebbe8d79c3c))
- **register:** remove register in favor for logging ([da29064](https://github.com/webpack/webpack-cli/commit/da29064084d931a2baea890de4b198cbb1674ea2))
- **serve:** allow js in serve package ([7e38b31](https://github.com/webpack/webpack-cli/commit/7e38b318576922cc5874297f771b369754e3f7b2))
- **serve:** made dev server optional peer dep ([f580b8f](https://github.com/webpack/webpack-cli/commit/f580b8f06631a52e4a7bd3e990692484d38a1188))
- **serve:** make dev server peer dep again ([6237d6c](https://github.com/webpack/webpack-cli/commit/6237d6cb3dffc3037eb055f50c22948da217c8ec))
- **serve:** move dev server back to normal dependencies ([c2bf27d](https://github.com/webpack/webpack-cli/commit/c2bf27dc5430c455685ded6f2b3a977ab9c5eb22))
- **serve:** refactor code to be more concise ([d2e3e80](https://github.com/webpack/webpack-cli/commit/d2e3e808ab63e2030acc0b76baafe68a4df66524))
- **serve:** remove allowjs from tsconfig ([3c92b0a](https://github.com/webpack/webpack-cli/commit/3c92b0abad54b92bee947fa630f9a90c393ae4f5))
- **serve:** remove dev server as an optional peer dep in favor of normal dep ([305a1dd](https://github.com/webpack/webpack-cli/commit/305a1dd7d3230a4106af3848cc53c47e251106f9))
- **serve:** remove promise return from serve package ([#1091](https://github.com/webpack/webpack-cli/issues/1091)) ([2144a1b](https://github.com/webpack/webpack-cli/commit/2144a1b9aff842589617f4a968c0084d1a4c3ed1))
- **serve:** update package lock ([1ddcf4a](https://github.com/webpack/webpack-cli/commit/1ddcf4a80765799df74ad26abdfdacd6150025aa))
- **serve:** updated dev server and fixed newline problem ([b29ec8f](https://github.com/webpack/webpack-cli/commit/b29ec8f7c2b43419563a382c9414b1e314f17041))
- **serve:** use cli flags from dev server package ([9b385f9](https://github.com/webpack/webpack-cli/commit/9b385f993e64d3c78f42ef38456b578ec7c94be4))
- **utils:** fixes typo in scaffold ([bd5c1ce](https://github.com/webpack/webpack-cli/commit/bd5c1ce08a998f55e305876fc4ecabd90acf4bf8))
- changed the split seperator ([078a1e4](https://github.com/webpack/webpack-cli/commit/078a1e4bbe8a6515ab8239859110d8a4967a1154))
- add deps ([b19b233](https://github.com/webpack/webpack-cli/commit/b19b233e30b21c65499c4e79a6df87403c5dccd3))
- add deps ([5b6cd4b](https://github.com/webpack/webpack-cli/commit/5b6cd4b17119dcfbae4a4bd8d314e35fcbb2e3af))
- add flags for commands ([f1eb2b7](https://github.com/webpack/webpack-cli/commit/f1eb2b78524ebf81e296710f62472d161c0b301c))
- add footer for consistency ([d22734c](https://github.com/webpack/webpack-cli/commit/d22734c7578cc847b5b6c3fd122d1c76d3f773db))
- add links to cli flags info ([#1178](https://github.com/webpack/webpack-cli/issues/1178)) ([dcec3ae](https://github.com/webpack/webpack-cli/commit/dcec3ae4b0115c5f80e1612213ee200c426fea0f))
- add more detailed test ([e02eac4](https://github.com/webpack/webpack-cli/commit/e02eac4f6a1ec2f7d9b0736dccbf860c996b577f))
- add strict checks ([3edee26](https://github.com/webpack/webpack-cli/commit/3edee260fdc95ae1140e467811f7623fb8d9d38e))
- add v3 as a tmp dep for dev-server ([425c590](https://github.com/webpack/webpack-cli/commit/425c590dc040835ab3f79be98824e5fefe09073a))
- Added test case for providing unknown flags along with -… ([#1197](https://github.com/webpack/webpack-cli/issues/1197)) ([f25c557](https://github.com/webpack/webpack-cli/commit/f25c5570fa6057ecaad33a9580ff391f7af9491a))
- added test for --json simple usecases ([aa5197b](https://github.com/webpack/webpack-cli/commit/aa5197b1ee1d12608f7aadb5e18f20961ae1a26b))
- added tests with different config type ([3a84813](https://github.com/webpack/webpack-cli/commit/3a84813e68f51aae95b12141596b2ab58afeb1a4))
- better output ([#1196](https://github.com/webpack/webpack-cli/issues/1196)) ([d72f9f8](https://github.com/webpack/webpack-cli/commit/d72f9f8d412fa0efbc3d5e9e556b40733afc767b))
- bump webpack v ([e1a3410](https://github.com/webpack/webpack-cli/commit/e1a341033591d51ac9d9fcf2daf20efa3982aaae))
- change arg in testutil ([11447ee](https://github.com/webpack/webpack-cli/commit/11447eeaf6ba3cf43d00c2552dd481f0a1fa5f5e))
- change arg in testutil ([0005910](https://github.com/webpack/webpack-cli/commit/0005910975289c0fa6029d8dce9647aa048d7bcc))
- changed the .bin to bin in entry test ([a4f735a](https://github.com/webpack/webpack-cli/commit/a4f735a903f2e0e5f571c26add47ba607b334f5e))
- changed the outDir to entry test ([016db0c](https://github.com/webpack/webpack-cli/commit/016db0c411641a195281696ae0238fce03a1fcbc))
- check for existing arr ([b46efe6](https://github.com/webpack/webpack-cli/commit/b46efe609ce7f3754b5c4efd7c866a2a29aad5e2))
- expression ([bd6b787](https://github.com/webpack/webpack-cli/commit/bd6b787c502bd02b9a8e0ec274a961205add0262))
- expression func ([ccbb7f2](https://github.com/webpack/webpack-cli/commit/ccbb7f2ea514c9e3e22c5ccdd95807aae60d63b6))
- expression func ([ce968e4](https://github.com/webpack/webpack-cli/commit/ce968e40555495977fe4085cc525c2220a3dd434))
- expression func ([721914b](https://github.com/webpack/webpack-cli/commit/721914ba1b4b8a3482ef67ccf2830a109c09b448))
- fix sec issues ([6f8dd13](https://github.com/webpack/webpack-cli/commit/6f8dd1389083b64536479fbaad67fd22474005b1))
- include comments ([941da90](https://github.com/webpack/webpack-cli/commit/941da90ebfcb6aa5ba07430465bf2d53a2c54c4f))
- make src more readable ([2d10684](https://github.com/webpack/webpack-cli/commit/2d10684fff0d0971019d3e3dd4d2200bd1a400dc))
- Minor code refactor adhering to ES6 semantics ([#1122](https://github.com/webpack/webpack-cli/issues/1122)) ([aed9b9e](https://github.com/webpack/webpack-cli/commit/aed9b9ebcc156d2ebf0eb4e91baea6fb1af5d916))
- minor code refactoring ([#1105](https://github.com/webpack/webpack-cli/issues/1105)) ([a43940d](https://github.com/webpack/webpack-cli/commit/a43940d29977b64d9d7c662e5d5b94a00534513a))
- minor code refactors ([517e756](https://github.com/webpack/webpack-cli/commit/517e756d6e5419de1cc80952fcbf20f5ca9a0ccb))
- Minor typographical fixes ([#1183](https://github.com/webpack/webpack-cli/issues/1183)) ([a0ac134](https://github.com/webpack/webpack-cli/commit/a0ac134ff0d0a17c10387da99f5e96443e48bb15))
- monorepo version update ([8097c5c](https://github.com/webpack/webpack-cli/commit/8097c5cf0fb6d2fa533168b4d97fbb373fa806ce))
- move away from var ([ed3e868](https://github.com/webpack/webpack-cli/commit/ed3e868bac193b7616b17ee5c3bd1722f64b7772))
- moved logger inside a module instead of having it inside the process ([#1179](https://github.com/webpack/webpack-cli/issues/1179)) ([e7cc639](https://github.com/webpack/webpack-cli/commit/e7cc63952a814de5b2b3690e31e4d2df3aa91f4b))
- only output message on error ([90868f2](https://github.com/webpack/webpack-cli/commit/90868f2c83e000ac42f93162e4b3ea2485e9da9a))
- pre-release ([4ca0de0](https://github.com/webpack/webpack-cli/commit/4ca0de0abd15a2b08297101a80ba49c2096178ce))
- pre-release ([f64e37c](https://github.com/webpack/webpack-cli/commit/f64e37c9d96218291bb2273455f3cddb6a3a5013))
- prevent weird behaviour of pre-commit hook ([#973](https://github.com/webpack/webpack-cli/issues/973)) ([ba471f8](https://github.com/webpack/webpack-cli/commit/ba471f87ba4ecc51fb532e864e5e21b88f22c5c9))
- readd deps and fix linting ([82407e5](https://github.com/webpack/webpack-cli/commit/82407e5e1fee2ce7e8dd4cfa9596b99ed0cde4fc))
- rebase ([652caf8](https://github.com/webpack/webpack-cli/commit/652caf8f86b4f95c4d5710afaf3d3aa2f0baec35))
- rebase ([38524ec](https://github.com/webpack/webpack-cli/commit/38524ec7930b58ba1b03cded85f2e7200a84f44b))
- rebase ([79137d0](https://github.com/webpack/webpack-cli/commit/79137d0800a161cb810236f384be48b5365e1a77))
- rebase ([2cd4e65](https://github.com/webpack/webpack-cli/commit/2cd4e654efec6d85e8bf65330231ae9503217b89))
- rebase ([8141e0e](https://github.com/webpack/webpack-cli/commit/8141e0e7b429ebd09b1c6e8bc61a4f065cf72dc3))
- rebase ([b5fcf78](https://github.com/webpack/webpack-cli/commit/b5fcf784829eded844c30be196eb434dd16e8f5e))
- rebase against next branch ([3812ea1](https://github.com/webpack/webpack-cli/commit/3812ea142a3116d577878ac98691c5fb904e5d7a))
- refactor webpack-cli ([8a8bc72](https://github.com/webpack/webpack-cli/commit/8a8bc72c392602284bd99e01f8ac1fa63d514594))
- remove debug flag ([d79cc45](https://github.com/webpack/webpack-cli/commit/d79cc45ccf542e2ae086ba83149d9d7be67de7ec))
- remove disable line ([88df722](https://github.com/webpack/webpack-cli/commit/88df722cf53e6af77375683c6527af5142f2ec64))
- remove old tests ([b131230](https://github.com/webpack/webpack-cli/commit/b1312304f3f9de9d7534c5968626be9255a77eec))
- Remove redundant multiple property ([ecf4a38](https://github.com/webpack/webpack-cli/commit/ecf4a380509a8165dc5e38f4eef24b99368cb7bb))
- removed the single depth folder search in gitignore ([3a3fb81](https://github.com/webpack/webpack-cli/commit/3a3fb8107feb8f8e6b0067e2f73f6c79867c3061))
- removed the snapshot testing, added custom checks ([6e40a1b](https://github.com/webpack/webpack-cli/commit/6e40a1bdcabdfac9f981532789523db2f2f4d564))
- rename flags to options ([ff532f4](https://github.com/webpack/webpack-cli/commit/ff532f4a3822f25d8be8763cd54d2d42c8094a39))
- sec patch ([2f818ef](https://github.com/webpack/webpack-cli/commit/2f818ef6ec088df7af63b2cb7cfca1671bcd61b9))
- sec patches ([020b1bf](https://github.com/webpack/webpack-cli/commit/020b1bf32df5c674e6e4cdb80ff64a3dbe19e05d))
- set fallback devtool ([080c44c](https://github.com/webpack/webpack-cli/commit/080c44c241cf6e796388369edf11e1607efab0df))
- update commands ([bf32074](https://github.com/webpack/webpack-cli/commit/bf32074472ecb0d4baf0fa16cc557f618cc83879))
- update console logs to webpack-logs ([dc4c89c](https://github.com/webpack/webpack-cli/commit/dc4c89cfc63e4e9eb8011ab7c27f98ba58c3185c))
- update dependences ([0f8a7f7](https://github.com/webpack/webpack-cli/commit/0f8a7f766789e13dd759bb9386d73bd39ae5be60))
- update dependences ([915c9f3](https://github.com/webpack/webpack-cli/commit/915c9f39be93eb46aca441e5f32d7dc23818080e)), closes [#1148](https://github.com/webpack/webpack-cli/issues/1148)
- update deps ([02d653f](https://github.com/webpack/webpack-cli/commit/02d653faba89a3114c715362547864f6b9eb291f))
- update deps ([8b75e1c](https://github.com/webpack/webpack-cli/commit/8b75e1c7565bc3b121a45a0f7078b5e0774d5cdf))
- update lockfiles ([f8ed0c6](https://github.com/webpack/webpack-cli/commit/f8ed0c62cc32d76af7fe0f32d8ebb01639c7e30c))
- **utils:** move jest to dev-deps (closes [#1190](https://github.com/webpack/webpack-cli/issues/1190)) ([#1194](https://github.com/webpack/webpack-cli/issues/1194)) ([fb6e3fe](https://github.com/webpack/webpack-cli/commit/fb6e3fe941094e8f0ee65f5ab71567729d659643))
- Update lib/bootstrap.js ([fa658b8](https://github.com/webpack/webpack-cli/commit/fa658b8214baa3fa11579dd6218de56437db0650))
- update lockfiles ([44df902](https://github.com/webpack/webpack-cli/commit/44df902637a0ef2ae226c53d449774ac1b236737))
- update lockfiles ([6b5ed74](https://github.com/webpack/webpack-cli/commit/6b5ed748bf28885814dd0709a29785bf17abd519))
- update terser-webpack-plugin to the latest version ([#1172](https://github.com/webpack/webpack-cli/issues/1172)) ([9222016](https://github.com/webpack/webpack-cli/commit/9222016ba3872b255893efe7aec2f5dd6f9de7e0))
- update test statements ([48f1cb5](https://github.com/webpack/webpack-cli/commit/48f1cb5f02b46d3289d643423c190428f98379ab))
- update to webpack v5 ([e59bcd7](https://github.com/webpack/webpack-cli/commit/e59bcd7739cc2a8d41c795788c9738e2453dbea7))
- update variable to be understandable ([9792c81](https://github.com/webpack/webpack-cli/commit/9792c8183cf8d7628d3e18b09101390a558079ca))
- use filter instead ([c71a9f0](https://github.com/webpack/webpack-cli/commit/c71a9f05eca87afb3a9a792a6aa4fc04b5ea60f1))
- use Object.keys in commands ([51af1e1](https://github.com/webpack/webpack-cli/commit/51af1e1453de30bc1a897f9e5a29c4877d2f4ed5))
- use webpack next ([2030f69](https://github.com/webpack/webpack-cli/commit/2030f69cf1221af060988ec1ec899a20f5f30ff3))
- wip ([641064a](https://github.com/webpack/webpack-cli/commit/641064a4bb40b9c845e921f538e0d886b2c32509))
### Documentation
- remove deprecated packages description ([#979](https://github.com/webpack/webpack-cli/issues/979)) ([49e4adc](https://github.com/webpack/webpack-cli/commit/49e4adcd98dba87866d4b29216cad447e1223b0c))
- **create:** migrate init package docs ([#1155](https://github.com/webpack/webpack-cli/issues/1155)) ([a9940bd](https://github.com/webpack/webpack-cli/commit/a9940bd44f97496606b51cecc361f3d03c99c513))
- **readme:** adds deprecated warning and commands ([da13744](https://github.com/webpack/webpack-cli/commit/da13744e14fe02664ab2e7107cc52e6529e7378a))
- **readme:** adds issue resolution time shield ([6cd4cb4](https://github.com/webpack/webpack-cli/commit/6cd4cb45b866c55548714535e864b7eb2d6cefba))
- **webpack-scaffold:** remove unrelated links ([#1092](https://github.com/webpack/webpack-cli/issues/1092)) ([9f5d8b6](https://github.com/webpack/webpack-cli/commit/9f5d8b6056482376a6848ee069e2f7b4ad7184af))
- Updated information regarding migrate command and a typo fix ([#1187](https://github.com/webpack/webpack-cli/issues/1187)) ([861e9f8](https://github.com/webpack/webpack-cli/commit/861e9f8b3453ca9dfc2b8f9abda86b248cdf80a5))
- **webpack-cli:** add progress bar for progress flag ([#1238](https://github.com/webpack/webpack-cli/issues/1238)) ([06129a1](https://github.com/webpack/webpack-cli/commit/06129a19a39495f54cbf1b123d24f1216b4cc0d9))
- **webpack-cli:** added mode argument ([#1253](https://github.com/webpack/webpack-cli/issues/1253)) ([7a5b33d](https://github.com/webpack/webpack-cli/commit/7a5b33dcd5aa5a8ea37062ae93d1fc38cdb5464c))
const WebpackCLI = require('./webpack-cli');
const { core, commands } = require('./utils/cli-flags');
const cmdArgs = require('command-line-args');
const logger = require('./utils/logger');

@@ -64,3 +63,3 @@

try {
args = cmdArgs(core, { stopAtFirstUnknown: false, partial: true });
args = cli.commandLineArgs(core, { stopAtFirstUnknown: false, partial: true });
if (args._unknown) {

@@ -102,3 +101,3 @@ resolveNegatedArgs(args);

process.argv = newArgKeys;
args = cmdArgs(core, { stopAtFirstUnknown: false, partial: true });
args = cli.commandLineArgs(core, { stopAtFirstUnknown: false, partial: true });

@@ -105,0 +104,0 @@ await cli.run(args, core);

const { existsSync } = require('fs');
const { resolve, sep, dirname, parse } = require('path');
const { extensions } = require('interpret');
const { logger } = require('@webpack-cli/logger');
const { packageExists, promptInstallation } = require('@webpack-cli/package-utils');
const GroupHelper = require('../utils/GroupHelper');
const chalk = require('chalk');
const rechoir = require('rechoir');

@@ -15,2 +18,8 @@ const DEFAULT_CONFIG_LOC = [

const fileTypes = {
'.babel.js': ['@babel/register', 'babel-register', 'babel-core/register', 'babel/register'],
'.babel.ts': ['@babel/register'],
'.ts': ['ts-node/register', 'tsconfig-paths/register'],
};
const getDefaultConfigFiles = () => {

@@ -48,31 +57,26 @@ return DEFAULT_CONFIG_LOC.map(filename => {

requireModule(path, cb) {
const result = cb(path);
if (result && result.__esModule && result.default) {
return {
content: result.default,
path: path,
};
requireLoader(extension, path) {
try {
rechoir.prepare(extensions, path, process.cwd());
} catch (e) {
throw e;
}
return {
path: path,
content: result,
};
}
requireConfig(configModule) {
if (!configModule.module) {
return this.requireModule(configModule.path, require);
} else if (Array.isArray(configModule.module)) {
configModule.module.forEach(mod => {
const moduleRequire = require(mod.module);
return this.requireModule(configModule.path, moduleRequire);
});
} else if (typeof configModule.module === 'string') {
const moduleRequire = require(configModule.module);
return this.requireModule(configModule.path, moduleRequire);
} else {
const moduleRequire = require(configModule.module.module)(module);
return this.requireModule(configModule.path, moduleRequire);
const extension = Object.keys(fileTypes).find(t => configModule.ext.endsWith(t));
if (extension) {
this.requireLoader(extension, configModule.path);
}
let config = require(configModule.path);
if (config.default) {
config = config.default;
}
return {
content: config,
path: configModule.path,
};
}

@@ -79,0 +83,0 @@

@@ -43,3 +43,3 @@ const chalk = require('chalk');

outputVersion() {
const pkgJSON = require('../../package.json');
const pkgJSON = require('../../../../package.json');
const webpack = require('webpack');

@@ -46,0 +46,0 @@ process.stdout.write(`\nwebpack-cli ${pkgJSON.version}`);

const GroupHelper = require('../utils/GroupHelper');
const { logger } = require('@webpack-cli/logger');
const PRODUCTION = 'production';
const DEVELOPMENT = 'development';
/**

@@ -16,10 +19,23 @@ * ZeroConfigGroup creates a zero configuration based on the environment

getEnvFromOptionsAndMode() {
if (process.env.NODE_ENV && (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'development')) {
if (process.env.NODE_ENV && (process.env.NODE_ENV === PRODUCTION || process.env.NODE_ENV === DEVELOPMENT)) {
return process.env.NODE_ENV;
} else if (this.args.prod) {
return 'production';
} else if (this.args.dev) {
return 'development';
} else {
if (this.args.mode && (this.args.dev || this.args.prod)) {
logger.warn(
`You provided both mode and ${
this.args.prod ? '--prod' : '--dev'
} arguments. You should provide just one. "mode" will be used`,
);
return this.args.mode;
}
if (this.args.mode) {
return this.args.mode;
}
if (this.args.prod) {
return PRODUCTION;
} else if (this.args.dev) {
return DEVELOPMENT;
}
return PRODUCTION;
}
return 'production';
}

@@ -29,9 +45,14 @@

const defaultConfigType = this.getEnvFromOptionsAndMode();
const defaultConfig = require(`./${defaultConfigType}-config`)();
let defaultConfig;
if (defaultConfigType === PRODUCTION) {
defaultConfig = require('../utils/production-config')();
} else {
defaultConfig = require('../utils/development-config')();
}
const isEntryObject = defaultConfig.entry && defaultConfig.entry instanceof Object;
const isOutputDefined = defaultConfig.output && defaultConfig.output.filename;
const isConflictingOutput = isEntryObject && isOutputDefined && defaultConfig.output.filename === 'bundle.js';
const isConflictingOutput = isEntryObject && isOutputDefined && defaultConfig.output.filename === 'main.js';
if (isConflictingOutput) {
defaultConfig.output.filename = '[name].bundle.js';
defaultConfig.output.filename = '[name].main.js';
}

@@ -38,0 +59,0 @@ this.opts.options = defaultConfig;

@@ -21,6 +21,6 @@ const HELP_GROUP = 'help';

{
name: 'create',
name: 'init',
alias: 'c',
type: String,
usage: 'create | create <scaffold>',
usage: 'init | init <scaffold>',
description: 'Initialize a new webpack configuration',

@@ -288,2 +288,11 @@ },

{
name: 'mode',
usage: '--mode <development | production>',
type: String,
group: ZERO_CONFIG_GROUP,
description: 'Defines the mode to pass to webpack',
link: 'https://webpack.js.org/concepts/#mode',
acceptedValues: ["development", "production"]
},
{
name: 'version',

@@ -290,0 +299,0 @@ usage: '--version',

const webpack = require('webpack');
const logger = require('./logger');
const { cyanBright, greenBright } = require('chalk');
const { CompilerOutput } = require('./CompilerOutput');

@@ -18,13 +19,22 @@

if (outputOptions.progress) {
let tmpMsg;
process.stdout.write('\n');
const defaultProgressPluginHandler = (percent, msg) => {
percent = Math.floor(percent * 100);
if (percent === 100) {
msg = 'Compilation completed';
process.stdout.clearLine();
process.stdout.cursorTo(0);
if (percent !== undefined) {
process.stdout.write(' (');
for (let i = 0; i <= 100; i += 10) {
if (i <= percent) {
process.stdout.write(greenBright('#'));
} else {
process.stdout.write('#');
}
}
process.stdout.write(`) ${percent}% : `);
process.stdout.write(`${cyanBright(msg)}`);
if (percent === 100) {
process.stdout.write(`${cyanBright('Complilation completed\n')}`);
}
}
if (msg && tmpMsg != msg) {
logger.info(percent + '% ' + msg);
}
tmpMsg = msg;
};

@@ -31,0 +41,0 @@ if (!progressPluginExists) {

@@ -11,4 +11,4 @@ const { join, resolve } = require('path');

path: defaultOutputPath,
filename: 'bundle.js',
filename: 'main.js',
},
});

@@ -1,5 +0,3 @@

const logger = require('webpack-log')({
name: 'webpack',
});
const { logger } = require('@webpack-cli/logger');
module.exports = logger;

@@ -12,3 +12,3 @@ const { join, resolve } = require('path');

path: defaultOutputPath,
filename: 'bundle.js',
filename: 'main.js',
},

@@ -15,0 +15,0 @@ optimization: {

@@ -26,5 +26,5 @@ function getEnvFromOptionsAndMode(mode, optionsObject) {

const isOutputDefined = newConfig.output && newConfig.output.filename;
const isConflictingOutput = isEntryObject && isOutputDefined && newConfig.output.filename === 'bundle.js';
const isConflictingOutput = isEntryObject && isOutputDefined && newConfig.output.filename === 'main.js';
if (isConflictingOutput) {
newConfig.output.filename = '[name].bundle.js';
newConfig.output.filename = '[name].main.js';
}

@@ -31,0 +31,0 @@ return newConfig;

@@ -5,7 +5,8 @@ const { resolve, parse } = require('path');

const { Compiler } = require('./utils/Compiler');
const { groups } = require('./utils/cli-flags');
const { groups, core } = require('./utils/cli-flags');
const webpackMerge = require('webpack-merge');
const commandArgs = require('command-line-args');
const defaultCommands = {
create: 'init',
init: 'init',
loader: 'generate-loader',

@@ -54,3 +55,2 @@ plugin: 'generate-plugin',

}
checkDefaults(options, outputOptions) {

@@ -87,2 +87,12 @@ if (Array.isArray(options)) {

/**
* It exposes "command-line-args" function
*/
commandLineArgs(...args) {
return commandArgs(...args);
}
getCoreFlags() {
return core;
}
/**
* Based on the parsed keys, the function will import and create

@@ -224,3 +234,3 @@ * a group that handles respective values

* Responsible for applying defaults, if necessary
* @private
* @private\
* @returns {void}

@@ -280,3 +290,3 @@ */

// TODO: rename and depreciate init
return await require('./commands/external').run(defaultCommands[command.name], ...args);
return await require('./commands/ExternalCommand').run(defaultCommands[command.name], ...args);
}

@@ -283,0 +293,0 @@

{
"name": "webpack-cli",
"version": "4.0.0-beta.3",
"version": "4.0.0-beta.6",
"description": "CLI for webpack & friends",

@@ -13,3 +13,3 @@ "license": "MIT",

},
"main": "bin/cli.js",
"main": "./lib/webpack-cli.js",
"engines": {

@@ -30,129 +30,5 @@ "node": ">=10.13.0"

],
"scripts": {
"bootstrap": "npm run clean:all && npm install && lerna bootstrap",
"build": "tsc",
"clean:all": "rimraf node_modules packages/*/{node_modules}",
"commit": "git-cz",
"docs": "typedoc",
"format": "eslint --fix . --ext .js,.ts",
"lint": "eslint . --ext .js,.ts",
"pretest": "npm run build && npm run lint",
"reportCoverage": "nyc report --reporter=json && codecov -f coverage/coverage-final.json --disable=gcov",
"smoketest": "./smoketests/smoketests.sh",
"test": "nyc jest --maxWorkers=4 --reporters=default --reporters=jest-junit",
"test:cli": "nyc jest test/ --maxWorkers=4 --reporters=default --reporters=jest-junit",
"test:packages": "nyc jest packages/ --maxWorkers=4 --reporters=default --reporters=jest-junit",
"test:ci": "npm run test:cli && npm run test:packages",
"travis:integration": "npm run build && npm run test && npm run reportCoverage",
"travis:lint": "npm run build && npm run lint",
"test:watch": "jest test/ packages/ --watch",
"watch": "npm run build && tsc -w",
"publish:monorepo": "npm run format && npm run test && npm run build && lerna publish -m \"chore: monorepo version update\""
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"*.md": [
"prettier --parser markdown --write",
"git add"
],
"{packages,lib}/**/!(__testfixtures__)/**.js": [
"eslint --fix",
"git add"
],
"*.ts": [
"npm run format",
"git add"
],
"*.js": [
"npm run format",
"git add"
]
},
"standard-version": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Chores",
"hidden": false
},
{
"type": "docs",
"section": "Documentation",
"hidden": false
},
{
"type": "style",
"hidden": true
},
{
"type": "refactor",
"hidden": true
},
{
"type": "perf",
"hidden": true
},
{
"type": "test",
"hidden": true
}
]
},
"jest": {
"testPathIgnorePatterns": [
"/node_modules/"
],
"testEnvironment": "node",
"collectCoverage": true,
"coverageReporters": [
"json",
"html",
"cobertura"
],
"transform": {
"^.+\\.(ts)?$": "ts-jest"
},
"testRegex": [
"/__tests__/.*\\.(test.js|test.ts)$",
"/test/.*\\.(test.js|test.ts)$"
],
"moduleFileExtensions": [
"ts",
"js",
"json"
]
},
"nyc": {
"include": [
"./cli.js",
"lib/**.js",
"packages/**/*.js"
],
"reporter": [
"lcov"
],
"all": true
},
"config": {
"commitizen": {
"path": "./node_modules/cz-customizable"
},
"cz-customizable": {
"config": "./.cz-config.js"
}
},
"dependencies": {
"@webpack-cli/logger": "^1.0.1-alpha.2",
"@webpack-cli/package-utils": "^1.0.1-alpha.2",
"ansi-escapes": "^4.2.1",

@@ -163,11 +39,7 @@ "chalk": "^3.0.0",

"command-line-usage": "^6.1.0",
"conventional-changelog": "^3.1.18",
"enquirer": "^2.3.4",
"execa": "^3.2.0",
"import-local": "^3.0.2",
"inquirer": "^7.0.4",
"interpret": "^2.0.0",
"semver": "^7.1.1",
"standard-version": "^7.1.0",
"terser-webpack-plugin": "^2.3.2",
"update-notifier": "^3.0.1",
"rechoir": "^0.7.0",
"v8-compile-cache": "^2.1.0",

@@ -178,35 +50,8 @@ "webpack-log": "^3.0.1",

"peerDependencies": {
"webpack": "5.x.x"
"webpack": "^5.0.0-beta.12"
},
"devDependencies": {
"@babel/preset-env": "^7.7.1",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-lerna-scopes": "^8.2.0",
"@types/jest": "^24.0.22",
"@typescript-eslint/eslint-plugin": "^2.17.0",
"@typescript-eslint/parser": "^2.17.0",
"commitlint": "^8.2.0",
"commitlint-config-cz": "^0.12.1",
"cz-customizable": "^6.2.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.9.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.1.2",
"execa": "^3.2.0",
"husky": "^3.0.9",
"jest": "^25.1.0",
"jest-cli": "^25.1.0",
"jest-junit": "^10.0.0",
"jest-serializer-ansi": "^1.0.3",
"lerna": "^3.20.2",
"lint-staged": "^9.4.2",
"nyc": "^14.1.1",
"prettier": "1.18.2",
"ts-jest": "^24.1.0",
"typedoc": "^0.15.0",
"typescript": "^3.7.2",
"webpack": "^5.0.0-beta.12",
"yeoman-test": "^2.1.0",
"readable-stream": "^3.5.0"
}
"@webpack-cli/info": "^1.0.1-alpha.3"
},
"gitHead": "2ea31742bdd4657a14735a0b4776a4a76137fa69"
}

@@ -1,39 +0,3 @@

<div align="center">
<a href="https://github.com/webpack/webpack-cli">
<img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg">
</a>
</div>
# `webpack-cli`
<h1 align="center">webpack CLI</h1>
<p align="center">
The official CLI of webpack
</p>
<br>
[![npm][npm]][npm-url]
[![Build Status][build-status]][build-status-url]
[![Build2 Status][build-status-azure]][build-status-azure-url]
[![deps][deps]][deps-url]
[![Code Climate][maintainability]][maintainability-url]
[![chat on gitter][chat]][chat-url]
[![Install Size][size]][size-url]
[![Downloads][downloads]][downloads-url]
[![lerna][lerna]][lerna-url]
[![GitHub contributors][contributors]][contributors-url]
[![Issue resolution][issue-resolution]][issue-resolution-url]
[![PR's welcome][pr-welcome]][pr-welcome-url]
## Table of Contents
- [About](#about)
- [How to install](#how-to-install)
- [Packages](#packages)
- [Commands](#commands)
- [Utilities](#utilities)
- [Getting started](#getting-started)
- [webpack CLI Scaffolds](#webpack-cli-scaffolds)
- [Contributing and Internal Documentation](#contributing-and-internal-documentation)
- [Open Collective](#open-collective)
## About

@@ -43,85 +7,59 @@

### How to install
## How to install
When you have followed the [Getting Started](https://webpack.js.org/guides/getting-started/) guide of webpack then webpack CLI is already installed!
Otherwise `npm install --save-dev webpack-cli` or `yarn add webpack-cli --dev` will install it.
Otherwise
## Packages
```bash
npm install --save-dev webpack-cli
```
We organize webpack CLI as a multi-package repository using [lerna](https://github.com/lerna/lerna). Every command has a dedicated subfolder in the `packages` Folder. Here's a summary of commands provided by the CLI.
or
### Commands
```bash
yarn add webpack-cli --dev
```
Supporting developers is an important task for webpack CLI. Thus, webpack CLI provides different commands for many common tasks.
## Supported arguments and commands
- [`webpack-cli create`](./packages/init/README.md#webpack-cli-create) - Create a new webpack configuration.
- [`webpack-cli info`](./packages/info/README.md#webpack-cli-info) - Returns information related to the local environment.
- [`webpack-cli migrate`](./packages/migrate/README.md#webpack-cli-migrate) - Migrate project from one version to another.
- [`webpack-cli generate-plugin`](./packages/generate-plugin/README.md#webpack-cli-generate-plugin) - Initiate new plugin project.
- [`webpack-cli generate-loader`](./packages/generate-loader/README.md#webpack-cli-generate-loader) - Initiate new loader project.
- [`webpack-cli serve`](./packages/serve/README.md#webpack-cli-serve) - Use webpack with a development server that provides live reloading.
```
> Removed commands since v3.3.3
Available Commands
- `webpack-cli add` - Add new properties to a webpack configuration file.
- `webpack-cli remove` - Remove properties from a webpack configuration file.
- `webpack-cli update` - Update properties in a webpack configuration file.
init Initialize a new webpack configuration
migrate Migrate a configuration to a new version
loader Scaffold a loader repository
plugin Scaffold a plugin repository
info Outputs information about your system and dependencies
serve Run the webpack Dev Server
### Utilities
Options
The project also has several utility packages which are used by other commands
- [`utils`](./packages/utils/README.md) - Several utilities used across webpack-cli.
- [`generators`](./packages/generators/README.md) - Contains all webpack-cli related yeoman generators.
- [`webpack-scaffold`](./packages/webpack-scaffold/README.md) - Utilities to create a webpack scaffold.
## Getting started
When you have followed the [Getting Started](https://webpack.js.org/guides/getting-started/) guide of webpack then webpack CLI is already installed! Otherwise, you would need to install webpack CLI and the packages you want to use. If we want to use the `create` command to create a new `webpack.config.js` configuration file:
```sh
npm i webpack-cli @webpack-cli/init
npx webpack-cli create
--entry string The entry point of your application.
-c, --config string Provide path to a webpack configuration file
-m, --merge string Merge a configuration file using webpack-merge
--progress Print compilation progress during build
--silent Disable any output that webpack makes
--help Outputs list of supported flags
--defaults Allow webpack to set defaults aggresively
-o, --output string Output location of the file generated by webpack
--plugin string Load a given plugin
-g, --global string[] Declares and exposes a global variable
-t, --target string Sets the build target
-w, --watch Watch for files changes
-h, --hot Enables Hot Module Replacement
-s, --sourcemap string Determine source maps to use
--prefetch string Prefetch this request
-j, --json Prints result as JSON
--standard Prints standard output
-d, --dev Run development build
-p, --prod Run production build
--mode string Defines the mode to pass to webpack
--version Get current version
--node-args string[] NodeJS flags
```
You will be prompted for some questions about what how you want to generate your config file when running the `create` command so webpack CLI can provide the best fitting configuration.
## Defaults
## webpack CLI Scaffolds
With v3 of webpack CLI, we introduced scaffolding as an integral part of the CLI. Our goal is to simplify the creation of webpack configurations for different purposes. Additionally, sharing such solutions with the community is beneficial and with webpack, we want to allow this. We provide `webpack-scaffold` as a utility suite for creating these scaffolds. It contains functions that could be of use for creating a scaffold yourself.
You can read more about [Scaffolding](https://webpack.js.org/guides/scaffolding), learn [How to compose a webpack-scaffold?](https://webpack.js.org/contribute/writing-a-scaffold) or generate one with [webpack-scaffold-starter](https://github.com/rishabh3112/webpack-scaffold-starter).
## Contributing and Internal Documentation
The webpack family welcomes any contributor, small or big. We are happy to elaborate, guide you through the source code and find issues you might want to work on! To get started have a look at our [documentation on contributing](./.github/CONTRIBUTING.md).
## Open Collective
If you like **webpack**, please consider donating to our [Open Collective](https://opencollective.com/webpack) to help us maintain it.
[build-status]: https://travis-ci.org/webpack/webpack-cli.svg
[build-status-url]: https://travis-ci.org/webpack/webpack-cli
[build-status-azure]: https://dev.azure.com/webpack/webpack/_apis/build/status/webpack.webpack-cli
[build-status-azure-url]: https://dev.azure.com/webpack/webpack/_build/latest?definitionId=4
[chat]: https://badges.gitter.im/webpack/webpack.svg
[chat-url]: https://gitter.im/webpack/webpack
[contributors]: https://img.shields.io/github/contributors/webpack/webpack-cli.svg
[contributors-url]: https://github.com/webpack/webpack-cli/graphs/contributors
[deps]: https://img.shields.io/david/webpack/webpack.svg
[deps-url]: https://david-dm.org/webpack/webpack-cli
[downloads]: https://img.shields.io/npm/dw/webpack-cli.svg
[downloads-url]: https://www.npmjs.com/package/webpack-cli
[issue-resolution]: https://isitmaintained.com/badge/resolution/webpack/webpack-cli.svg
[issue-resolution-url]: https://github.com/webpack/webpack-cli/issues
[lerna]: https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg
[lerna-url]: http://www.lernajs.io/
[maintainability]: https://codeclimate.com/github/webpack/webpack-cli/badges/gpa.svg
[maintainability-url]: https://codeclimate.com/github/webpack/webpack-cli
[npm]: https://img.shields.io/npm/v/webpack-cli.svg
[npm-url]: https://www.npmjs.com/package/webpack-cli
[pr-welcome]: https://img.shields.io/badge/PRs%20-welcome-brightgreen.svg
[pr-welcome-url]: https://github.com/webpack/webpack-cli/blob/next/.github/CONTRIBUTING.md
[size]: https://packagephobia.now.sh/badge?p=webpack-cli
[size-url]: https://packagephobia.now.sh/result?p=webpack-cli
TODO: explain defaults
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc