@webpack-cli/webpack-scaffold
Utility files for webpack-scaffold
Last updated 7 years ago by ev1stensberg .
MIT · Original npm · Tarball · package.json
$ npm install @webpack-cli/webpack-scaffold 
SYNC missed versions from official npm registry.

webpack-scaffold

NPM Downloads

This is the utility suite for creating a webpack scaffold, it contains utility functions to help you work with Inquirer prompting and scaffolding.

Installation

npm i -D webpack-cli @webpack-cli/webpack-scaffold

API

parseValue

Param: String

Used when you cannot use regular conventions. Handy for examples like RegExp or output.sourcePrefix

const parseValue = require('@webpack-cli/webpack-scaffold').parseValue;

this.configuration.myScaffold.webpackOptions.output.sourcePrefix = parseValue('\t');
// sourcePrefix: '\t'

createArrowFunction

Param: String

Generally used when dealing with an entry point as an arrow function

const createArrowFunction = require('@webpack-cli/webpack-scaffold').createArrowFunction;

this.configuration.myScaffold.webpackOptions.entry = createArrowFunction('app.js');
// entry: () => 'app.js'

createRegularFunction

Param: String

Used when creating a function that returns a single value

const createRegularFunction = require('@webpack-cli/webpack-scaffold').createRegularFunction;

this.configuration.myScaffold.webpackOptions.entry = createRegularFunction('app.js');
// entry: function() { return 'app.js' }

createDynamicPromise

Param: Array | String

Used to create a dynamic entry point

const createDynamicPromise = require('@webpack-cli/webpack-scaffold').createDynamicPromise;

this.confguration.myScaffold.webpackOptions.entry = createDynamicPromise('app.js');
// entry: () => new Promise((resolve) => resolve('app.js'))

this.configuration.myScaffold.webpackOptions.entry = createDynamicPromise(['app.js', 'index.js']);
// entry: () => new Promise((resolve) => resolve(['app.js','index.js']))

createAssetFilterFunction

Param: String

Used to create an assetFilterFunction

const createAssetFilterFunction = require('@webpack-cli/webpack-scaffold').createAssetFilterFunction;

this.configuration.myScaffold.webpackOptions.performance.assetFilter = createAssetFilterFunction('js');
// assetFilter: function (assetFilename) { return assetFilename.endsWith('.js'); }

createExternalFunction

Param: String

Used to create a general function from Externals

const createExternalFunction = require('@webpack-cli/webpack-scaffold').createExternalFunction;

this.configuration.myScaffold.webpackOptions.externals = [createExternalFunction('^yourregex$')];
/*
externals: [
  function(context, request, callback) {
    if (/^yourregex$/.test(request)){
      return callback(null, 'commonjs ' + request);
    }
    callback();
  }
*/

createRequire

Param: String

Used to create a module in topScope

const createRequire = require('@webpack-cli/webpack-scaffold').createRequire;

this.configuration.myScaffold.topScope = [createRequire('webpack')];
// const webpack = require('webpack')

Inquirer

List

Param: name<String>, message<String>, choices<Array>

Creates a List from Inquirer

const List = require('@webpack-cli/webpack-scaffold').List;

List('entry', 'what kind of entry do you want?', ['Array', 'Function']);

RawList

Param: name<String>, message<String>, choices<Array>

Creates a RawList from Inquirer

const RawList = require('@webpack-cli/webpack-scaffold').RawList;

RawList('entry', 'what kind of entry do you want?', ['Array', 'Function']);

CheckList

Param: name<String>, message<String>, choices<Array>

Creates a CheckList(checkbox) from Inquirer

const CheckList = require('@webpack-cli/webpack-scaffold').CheckList;

CheckList('entry', 'what kind of entry do you want?', ['Array', 'Function']);

Input

Param: name<String>, message<String>, [default<String>]

Creates an Input from Inquirer

const Input = require('@webpack-cli/webpack-scaffold').Input;

Input('entry', 'what is your entry point?', 'src/index');

InputValidate

Param: name<String>, message<String>, [validate<Function>, default<String>]

Creates an Input from Inquirer

const InputValidate = require('@webpack-cli/webpack-scaffold').InputValidate;

const validation = (value) => {
    if (value.length > 4) {
        return true;
    } else {
        return 'Your answer must be longer than 4 characters, try again';
    }
};

InputValidate('entry', 'what is your entry point?', validation, 'src/index');

Confirm

Param: name<String>, message<String>, [default<Boolean>]

Creates an Input from Inquirer

const Confirm = require('@webpack-cli/webpack-scaffold').Confirm;

Confirm('contextConfirm', 'Is this your context?');

Current Tags

  • 1.0.1-alpha.4                                ...           beta (5 years ago)
  • 1.0.3                                ...           latest (4 years ago)
  • 1.0.1-rc.1                                ...           next (4 years ago)

22 Versions

  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.1-rc.1                                ...           4 years ago
  • 1.0.1-rc.0                                ...           4 years ago
  • 1.0.1-alpha.4                                ...           5 years ago
  • 1.0.1-alpha.3                                ...           5 years ago
  • 1.0.1-alpha.2                                ...           5 years ago
  • 1.0.1-alpha.1                                ...           5 years ago
  • 0.1.9                                ...           5 years ago
  • 0.1.8                                ...           6 years ago
  • 0.1.7                                ...           6 years ago
  • 0.1.6                                ...           6 years ago
  • 0.1.5                                ...           6 years ago
  • 0.1.4                                ...           6 years ago
  • 0.1.3                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
  • 0.0.8                                ...           7 years ago
  • 0.0.7                                ...           7 years ago
  • 0.0.4                                ...           7 years ago
Maintainers (1)
Downloads
Total 1
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE