Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/webpack/webpack-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
anshumanv committed Apr 19, 2019
2 parents 0bf458f + b8d5511 commit 964bff5
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 33 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -69,7 +69,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), 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

Expand Down
2 changes: 2 additions & 0 deletions 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.
Expand Down
4 changes: 3 additions & 1 deletion 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.
Expand All @@ -24,4 +26,4 @@ generateLoader();
### CLI (via `webpack-cli`)
```bash
npx webpack-cli generate-loader
```
```
4 changes: 3 additions & 1 deletion 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.
Expand All @@ -23,4 +25,4 @@ generatePlugin();
### CLI (via `webpack-cli`)
```bash
npx webpack-cli generate-plugin
```
```
2 changes: 2 additions & 0 deletions 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.
Expand Down
2 changes: 2 additions & 0 deletions 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.
Expand Down
2 changes: 2 additions & 0 deletions 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.
Expand Down
4 changes: 3 additions & 1 deletion 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.
Expand All @@ -25,4 +27,4 @@ migrate(null, null, inputPath, outputPath);
### CLI (via `webpack-cli`)
```bash
npx webpack-cli migrate
```
```
4 changes: 3 additions & 1 deletion 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.
Expand All @@ -23,4 +25,4 @@ remove();
### CLI (via `webpack-cli`)
```bash
npx webpack-cli remove
```
```
4 changes: 3 additions & 1 deletion 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.
Expand All @@ -23,4 +25,4 @@ serve();
### CLI (via `webpack-cli`)
```bash
npx webpack-cli serve
```
```
4 changes: 3 additions & 1 deletion 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.
Expand All @@ -23,4 +25,4 @@ update();
### CLI (via `webpack-cli`)
```bash
npx webpack-cli update
```
```
4 changes: 3 additions & 1 deletion 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.
Expand All @@ -26,4 +28,4 @@ npm i -D webpack-cli @webpack-cli/utils
```js
const utils = require("@webpack-cli/utils");
// API yet to be exposed
```
```
1 change: 1 addition & 0 deletions 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 {
Expand Down
6 changes: 6 additions & 0 deletions 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);
Expand Down
26 changes: 10 additions & 16 deletions packages/utils/scaffold.ts
Expand Up @@ -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,
),
);
}
25 changes: 16 additions & 9 deletions 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
Expand All @@ -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

Expand Down

0 comments on commit 964bff5

Please sign in to comment.