From 0b28fb337a1a9c491d2b5aacbc8ca9300f057906 Mon Sep 17 00:00:00 2001 From: Pranshu Chittora Date: Sat, 6 Apr 2019 19:48:12 +0530 Subject: [PATCH 1/7] misc(utils): refactors scaffold refactors the conditional statements in scaffold.ts --- packages/utils/scaffold.ts | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/packages/utils/scaffold.ts b/packages/utils/scaffold.ts index 7aa5ff7eb63..682f91ae989 100644 --- a/packages/utils/scaffold.ts +++ b/packages/utils/scaffold.ts @@ -90,22 +90,16 @@ export default function runTransform(transformConfig: ITransformConfig, action: console.error(err.message ? err.message : err); }); }); - + let successMessage : string = `Congratulations! Your new webpack configuration file has been created!\n` if (initActionNotDefined && transformConfig.config.item) { - process.stdout.write( - "\n" + - chalk.green( - `Congratulations! ${ - transformConfig.config.item - } has been ${action}ed!\n`, - ), - ); - } else { - process.stdout.write( - "\n" + - chalk.green( - "Congratulations! Your new webpack configuration file has been created!\n", - ), - ); + successMessage = `Congratulations! ${ + transformConfig.config.item + } has been ${action}ed!\n` } + process.stdout.write( + "\n" + + chalk.green( + successMessage + ) + ); } From 7fe35435a75b89fbce10c4a0281a75b3030a7edb Mon Sep 17 00:00:00 2001 From: Pranshu Chittora Date: Thu, 11 Apr 2019 14:52:25 +0530 Subject: [PATCH 2/7] fix(utils): refactors utils impoves the codebase by adding comments --- junit.xml | 632 +++++++++++++++++------------------ packages/utils/defineTest.ts | 1 + packages/utils/find-root.ts | 6 + packages/utils/scaffold.ts | 8 +- 4 files changed, 327 insertions(+), 320 deletions(-) diff --git a/junit.xml b/junit.xml index 304ccef7cc6..319cffbd123 100644 --- a/junit.xml +++ b/junit.xml @@ -1,149 +1,199 @@ - - - + + + - + - + - + - + - + - + - + + + - - - + + - - + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - - - + + - - - + + - - - + + - - - + + - - + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + - + + + - + + + - + + + - + + + - + + + - - - + + - - + + - + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -155,403 +205,353 @@ - + - + - - - - - - + + - - + + - + + + - + - + - + - + - - - + - + - + - + - + - + - + - - - + - + - + - + - + + + - + + + - + + + - + + + - + - + - + - - - + - + - + - + - - + + - - + + - - - + - - - + - - + + - - - - - - - - + + - - + + - - + + - - + + - - - + + - - - + - - - + - + - - - + - - - + - - - + - - - + - - - + - - + + - - - + - + - + - + - + - + - + - + - + - - - - + - - + + - - + + + + + + - - + + - + - + - + - + - - + + - - - + - - - + - + - - + + - - - + - - - + - - - + - - - + - - - + - - - + - + - - - + - - + + - - + + - - - + - - - + - - - + - - - + - - + + - + - + - - - + - - + + + + + + - - + + - + - + - + - - + + + - - + + + - - + + - + - + - - - - - - - - + + + - - + + + - - + + + - - - - - - + + + - - + + + - - + + + - - + + - - - + - + - + + + - - + + - + - + - - + + - + - + - - - + - - + + - - - + - - + + - - - + + + + + + + + + \ No newline at end of file diff --git a/packages/utils/defineTest.ts b/packages/utils/defineTest.ts index b5b076cfa4b..a5ee041d26f 100644 --- a/packages/utils/defineTest.ts +++ b/packages/utils/defineTest.ts @@ -1,5 +1,6 @@ import * as fs from "fs"; import * as path from "path"; + import { IJSCodeshift, INode } from "./types/NodePath"; interface IModule { diff --git a/packages/utils/find-root.ts b/packages/utils/find-root.ts index 9e1baf5b1a6..0345da2db62 100644 --- a/packages/utils/find-root.ts +++ b/packages/utils/find-root.ts @@ -1,6 +1,12 @@ import * as findup from "findup-sync"; import * as path from "path"; +/** + * Returns the absolute path of the project directory + * Finds the package.json, by using findup-sync + * @returns {String} path of project directory + */ + export function findProjectRoot(): string { const rootFilePath = findup(`package.json`); const projectRoot = path.dirname(rootFilePath); diff --git a/packages/utils/scaffold.ts b/packages/utils/scaffold.ts index 682f91ae989..a3add9ee769 100644 --- a/packages/utils/scaffold.ts +++ b/packages/utils/scaffold.ts @@ -90,16 +90,16 @@ export default function runTransform(transformConfig: ITransformConfig, action: console.error(err.message ? err.message : err); }); }); - let successMessage : string = `Congratulations! Your new webpack configuration file has been created!\n` + let successMessage: string = `Congratulations! Your new webpack configuration file has been created!\n`; if (initActionNotDefined && transformConfig.config.item) { successMessage = `Congratulations! ${ transformConfig.config.item - } has been ${action}ed!\n` + } has been ${action}ed!\n`; } process.stdout.write( "\n" + chalk.green( - successMessage - ) + successMessage, + ), ); } From 74179b5a94acc5b15e0b936a3321c4f03c01ef2b Mon Sep 17 00:00:00 2001 From: Rishabh Chawla Date: Sat, 13 Apr 2019 16:54:02 +0530 Subject: [PATCH 3/7] docs(README): update scaffolding links Links from webpack.js.org --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f25b9208ac..2c9befb35a3 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ You will answer many questions when running the `init` so webpack CLI can provid 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 webpack's 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 an scaffold yourself. -You can read more about [Scaffolding](./SCAFFOLDING.md) or check out the example project [How do I compose a webpack-scaffold?](https://github.com/evenstensberg/webpack-scaffold-demo). +You can read more about [Scaffolding](https://webpack.js.org/guides/scaffolding) or learn [How to compose a webpack-scaffold?](https://webpack.js.org/contribute/writing-a-scaffold). ## Contributing and Internal Documentation From e35a194bebee233a23076a8d591606ab21d7e594 Mon Sep 17 00:00:00 2001 From: Rishabh Chawla Date: Sat, 13 Apr 2019 16:59:38 +0530 Subject: [PATCH 4/7] docs(README): add link to webpack-scaffold-starter --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c9befb35a3..4a51ed0966a 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ You will answer many questions when running the `init` so webpack CLI can provid 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 webpack's 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 an scaffold yourself. -You can read more about [Scaffolding](https://webpack.js.org/guides/scaffolding) or learn [How to compose a webpack-scaffold?](https://webpack.js.org/contribute/writing-a-scaffold). +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 start writing scaffolds with [webpack-scaffold-starter](https://github.com/rishabh3112/webpack-scaffold-starter) on the go. ## Contributing and Internal Documentation From 3a11a16e83dce66604d5de2b3241b92350170b75 Mon Sep 17 00:00:00 2001 From: Rishabh Chawla Date: Sat, 13 Apr 2019 17:02:59 +0530 Subject: [PATCH 5/7] docs(README): phrase change --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a51ed0966a..f3aad250670 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ You will answer many questions when running the `init` so webpack CLI can provid 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 webpack's 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 an 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 start writing scaffolds with [webpack-scaffold-starter](https://github.com/rishabh3112/webpack-scaffold-starter) on the go. +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 From 80fd4facdd49a46c7deeaa9bcab5998c2ef93337 Mon Sep 17 00:00:00 2001 From: Pranshu Chittora Date: Sun, 14 Apr 2019 03:01:43 +0530 Subject: [PATCH 6/7] chore(junit): reverting the junit.xml --- junit.xml | 632 +++++++++++++++++++++++++++--------------------------- 1 file changed, 316 insertions(+), 316 deletions(-) diff --git a/junit.xml b/junit.xml index 319cffbd123..304ccef7cc6 100644 --- a/junit.xml +++ b/junit.xml @@ -1,199 +1,149 @@ - - - + + + - + - + - + - + - + - + - - - + - - + + + - - + + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - + + + - - + + + - - + + + - - + + + - - + + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - + - - - + - - - + - - - + - - - + - - - + - - - - - - - - - - - - - - + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -205,353 +155,403 @@ - + - + - - + + - - - + + + - - + + - + - + - + - + - + - + + + - + - + - + - + - + - + - + + + - + - + - - - + - - - + - - - + - - - + - + - + - + - + - + + + - + - + - - - + - - + + - + + + - + + + - - + + - - + + - - + + + + + + + + - - + + - - + + - - + + - + + + + - + + + - + + + - + - + + + - + + + - + + + - + + + - - + + - + + + - + + + - + - + - + - + - + - + - + - + - - + + + - - - - + + - + + + - - + + - + - + - + - + - - + + - + + + - + + + - + - - - - + + - + + + - + + + - + + + - + + + - + + + - + + + - + - - + + - - + + - + + + - + + + - + + + - + + + - - + + - + + + - + - + - - - + - + - + + + - - + + - + - + - + - - - + + - - - + + - - + + - + - + - - - + + - - - - + - - - - + - - - - + - - - + + - - - + + - - + + - + - + - - + + - - - - - - + + - - + + - + + + - + - + - - + + - + + + - - + + - + + + + + + + - + + + - + + + - + + + - + + + \ No newline at end of file From 6a0375a728888cf24736e631a3d52d2359d40085 Mon Sep 17 00:00:00 2001 From: Pranshu Chittora Date: Thu, 18 Apr 2019 00:00:28 +0530 Subject: [PATCH 7/7] docs(packages): adds downloads/month shield adds the image shield for downloads in readme file --- packages/add/README.md | 2 ++ packages/generate-loader/README.md | 4 +++- packages/generate-plugin/README.md | 4 +++- packages/generators/README.md | 2 ++ packages/info/README.md | 2 ++ packages/init/README.md | 2 ++ packages/migrate/README.md | 4 +++- packages/remove/README.md | 4 +++- packages/serve/README.md | 4 +++- packages/update/README.md | 4 +++- packages/utils/README.md | 4 +++- packages/webpack-scaffold/README.md | 25 ++++++++++++++++--------- 12 files changed, 45 insertions(+), 16 deletions(-) diff --git a/packages/add/README.md b/packages/add/README.md index 0cb1b45b86c..cc13015724b 100644 --- a/packages/add/README.md +++ b/packages/add/README.md @@ -1,5 +1,7 @@ # webpack-cli add +[![npm](https://img.shields.io/npm/dm/@webpack-cli/add.svg)](https://www.npmjs.com/package/@webpack-cli/add) + ## Description This package contains the logic to add new properties in a webpack configuration file. It will run a generator that prompts the user for questions of which property to add to their webpack configuration file. diff --git a/packages/generate-loader/README.md b/packages/generate-loader/README.md index 26a9100e432..ed7e47ae96a 100644 --- a/packages/generate-loader/README.md +++ b/packages/generate-loader/README.md @@ -1,5 +1,7 @@ # webpack-cli generate-loader +[![npm](https://img.shields.io/npm/dm/@webpack-cli/generate-loader.svg)](https://www.npmjs.com/package/@webpack-cli/generate-loader) + ## Description This package contains the logic to initiate new loader projects. @@ -24,4 +26,4 @@ generateLoader(); ### CLI (via `webpack-cli`) ```bash npx webpack-cli generate-loader -``` \ No newline at end of file +``` diff --git a/packages/generate-plugin/README.md b/packages/generate-plugin/README.md index df400763c1d..29662905a17 100644 --- a/packages/generate-plugin/README.md +++ b/packages/generate-plugin/README.md @@ -1,5 +1,7 @@ # webpack-cli generate-plugin +[![npm](https://img.shields.io/npm/dm/@webpack-cli/generate-plugin.svg)](https://www.npmjs.com/package/@webpack-cli/generate-plugin) + ## Description This package contains the logic to initiate new plugin projects. @@ -23,4 +25,4 @@ generatePlugin(); ### CLI (via `webpack-cli`) ```bash npx webpack-cli generate-plugin -``` \ No newline at end of file +``` diff --git a/packages/generators/README.md b/packages/generators/README.md index 921217257f9..5139dcf3c4b 100644 --- a/packages/generators/README.md +++ b/packages/generators/README.md @@ -1,5 +1,7 @@ # webpack-cli generators +[![npm](https://img.shields.io/npm/dm/@webpack-cli/generators.svg)](https://www.npmjs.com/package/@webpack-cli/generators) + ## Description This package contains all webpack-cli related yeoman generators. diff --git a/packages/info/README.md b/packages/info/README.md index a1944e21808..03dcd9bd8d1 100644 --- a/packages/info/README.md +++ b/packages/info/README.md @@ -1,5 +1,7 @@ # webpack-cli info +[![npm](https://img.shields.io/npm/dm/@webpack-cli/info.svg)](https://www.npmjs.com/package/@webpack-cli/info) + ## Description This pacakge returns a set of information related to the local enviroment. diff --git a/packages/init/README.md b/packages/init/README.md index d2eacb9caa1..465966be148 100644 --- a/packages/init/README.md +++ b/packages/init/README.md @@ -1,5 +1,7 @@ # webpack-cli init +[![npm](https://img.shields.io/npm/dm/@webpack-cli/init.svg)](https://www.npmjs.com/package/@webpack-cli/init) + ## Description This package contains the logic to create a new webpack configuration. diff --git a/packages/migrate/README.md b/packages/migrate/README.md index 38fad56a13d..68a8ae342a9 100644 --- a/packages/migrate/README.md +++ b/packages/migrate/README.md @@ -1,5 +1,7 @@ # webpack-cli migrate +[![npm](https://img.shields.io/npm/dm/@webpack-cli/migrate.svg)](https://www.npmjs.com/package/@webpack-cli/migrate) + ## Description This package contains the logic to migrate a project from one version to the other. @@ -25,4 +27,4 @@ migrate(null, null, inputPath, outputPath); ### CLI (via `webpack-cli`) ```bash npx webpack-cli migrate -``` \ No newline at end of file +``` diff --git a/packages/remove/README.md b/packages/remove/README.md index 6af72b205f4..9ec0202d772 100644 --- a/packages/remove/README.md +++ b/packages/remove/README.md @@ -1,5 +1,7 @@ # webpack-cli remove +[![npm](https://img.shields.io/npm/dm/@webpack-cli/remove.svg)](https://www.npmjs.com/package/@webpack-cli/remove) + ## Description This package contains the logic to remove properties of a webpack configuration file. It will run a generator that prompts the user for questions of which property to remove in their webpack configuration file. @@ -23,4 +25,4 @@ remove(); ### CLI (via `webpack-cli`) ```bash npx webpack-cli remove -``` \ No newline at end of file +``` diff --git a/packages/serve/README.md b/packages/serve/README.md index a6612b6f9be..aab9613599c 100644 --- a/packages/serve/README.md +++ b/packages/serve/README.md @@ -1,5 +1,7 @@ # webpack-cli serve +[![npm](https://img.shields.io/npm/dm/@webpack-cli/serve.svg)](https://www.npmjs.com/package/@webpack-cli/serve) + ## Description This package contains the logic to run webpack-serve without using webpack-serve directly. @@ -23,4 +25,4 @@ serve(); ### CLI (via `webpack-cli`) ```bash npx webpack-cli serve -``` \ No newline at end of file +``` diff --git a/packages/update/README.md b/packages/update/README.md index 16f38f42326..dd038a61038 100644 --- a/packages/update/README.md +++ b/packages/update/README.md @@ -1,5 +1,7 @@ # webpack-cli update +[![npm](https://img.shields.io/npm/dm/@webpack-cli/update.svg)](https://www.npmjs.com/package/@webpack-cli/update) + ## Description This package contains the logic to update properties in a webpack configuration file. It will run a generator that prompts the user for questions of which property to update in their webpack configuration file. @@ -23,4 +25,4 @@ update(); ### CLI (via `webpack-cli`) ```bash npx webpack-cli update -``` \ No newline at end of file +``` diff --git a/packages/utils/README.md b/packages/utils/README.md index 33bc3f771f6..2ea21274d09 100644 --- a/packages/utils/README.md +++ b/packages/utils/README.md @@ -1,5 +1,7 @@ # webpack-cli utils (WIP, not yet published) +[![npm](https://img.shields.io/npm/dm/@webpack-cli/utils.svg)](https://www.npmjs.com/package/@webpack-cli/utils) + ## Description This package contains the utilities used across the webpack-cli repositories. @@ -26,4 +28,4 @@ npm i -D webpack-cli @webpack-cli/utils ```js const utils = require("@webpack-cli/utils"); // API yet to be exposed -``` \ No newline at end of file +``` diff --git a/packages/webpack-scaffold/README.md b/packages/webpack-scaffold/README.md index 90453cc188b..fcd01de288f 100755 --- a/packages/webpack-scaffold/README.md +++ b/packages/webpack-scaffold/README.md @@ -1,5 +1,7 @@ # webpack-scaffold +[![npm](https://img.shields.io/npm/dm/@webpack-cli/webpack-scaffold.svg)](https://www.npmjs.com/package/@webpack-cli/webpack-scaffold) + This is the utility suite for creating a webpack `scaffold`, it contains utility functions to help you work with [Inquirer](https://github.com/SBoudrias/Inquirer.js/) prompting and scaffolding. # Installation @@ -9,15 +11,20 @@ npm i -D webpack-cli @webpack-cli/webpack-scaffold ``` # API - -1. [parseValue()](#parsevalue) -2. [createArrowFunction()](#createarrowfunction) -3. [createRegularFunction()](#createregularfunction) -4. [createDynamicPromise()](#createdynamicpromise) -5. [createAssetFilterFunction()](#createassetfilterfunction) -6. [createExternalFunction()](#createexternalfunction) -7. [createRequire()](#createrequire) -8. Inquirer: [List](#list), [RawList](#rawlist), [CheckList](#checklist), [Input](#input), [InputValidate](#inputvalidate), [Confirm](#confirm) +- [parseValue](#parsevalue) +- [createArrowFunction](#createarrowfunction) +- [createRegularFunction](#createregularfunction) +- [createDynamicPromise](#createdynamicpromise) +- [createAssetFilterFunction](#createassetfilterfunction) +- [createExternalFunction](#createexternalfunction) +- [createRequire](#createrequire) +- [Inquirer](#inquirer) + - [List](#list) + - [RawList](#rawlist) + - [CheckList](#checklist) + - [Input](#input) + - [InputValidate](#inputvalidate) + - [Confirm](#confirm) ## parseValue