You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.3 KiB
35 lines
1.3 KiB
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.PluginGenerator = void 0;
|
|
const path_1 = __importDefault(require("path"));
|
|
const addon_generator_1 = __importDefault(require("./addon-generator"));
|
|
const helpers_1 = require("./utils/helpers");
|
|
/**
|
|
* A yeoman generator class for creating a webpack
|
|
* plugin project. It adds some starter plugin code
|
|
* and runs `webpack-defaults`.
|
|
*
|
|
* @class PluginGenerator
|
|
* @extends {Generator}
|
|
*/
|
|
exports.PluginGenerator = addon_generator_1.default([
|
|
{
|
|
default: 'my-webpack-plugin',
|
|
filter: helpers_1.toKebabCase,
|
|
message: 'Plugin name',
|
|
name: 'name',
|
|
type: 'input',
|
|
validate: (str) => str.length > 0,
|
|
},
|
|
], path_1.default.resolve(__dirname, '../plugin-template'), [
|
|
'src/cjs.js.tpl',
|
|
'test/test-utils.js.tpl',
|
|
'test/functional.test.js.tpl',
|
|
'examples/simple/src/index.js.tpl',
|
|
'examples/simple/src/lazy-module.js.tpl',
|
|
'examples/simple/src/static-esm-module.js.tpl',
|
|
], ['src/_index.js.tpl', 'examples/simple/_webpack.config.js.tpl'], (gen) => ({ name: helpers_1.toUpperCamelCase(gen.props.name) }));
|
|
exports.default = exports.PluginGenerator;
|
|
|