@omni-door/tpl-component-library-react
Version:
The React component-library-react project template
50 lines (49 loc) • 3.65 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (config) {
var name = config.name, ts = config.ts, devServer = config.devServer, test = config.test, eslint = config.eslint, commitlint = config.commitlint, stylelint = config.stylelint, strategy = config.strategy, type_react = config.type_react;
var devScript = '';
var demoScript = '';
switch (devServer) {
case 'docz':
devScript = 'docz dev';
demoScript = "docz build --base /." + name;
break;
case 'storybook':
devScript = 'start-storybook -p 6200';
demoScript = "build-storybook -c .storybook -o ." + name;
break;
case 'bisheng':
devScript = 'bisheng start';
demoScript = 'bisheng build';
break;
}
var lowerName = name.toLowerCase();
return "{\n \"name\": \"" + lowerName + "\",\n \"version\": \"0.0.1\",\n \"description\": \"\",\n \"main\": \"lib/index.js\",\n \"module\": \"es/index.js\",\n \"typings\": \"lib/index.d.ts\",\n \"scripts\": {\n " + (devScript ? "\"start\": \"" + devScript + "\",\n \"dev\": \"" + devScript + "\"," : '') + "\n " + (test
? "\"test\": \"jest --passWithNoTests\",\n \"test:snapshot\": \"jest --updateSnapshot\","
: '') + "\n " + (eslint || stylelint
? "\"lint\": \"" + (eslint && stylelint
? 'npm run lint:es && npm run lint:style'
: eslint
? 'npm run lint:es'
: 'npm run lint:style') + "\",\n \"lint:fix\": \"" + (eslint && stylelint
? 'npm run lint:es_fix && npm run lint:style_fix'
: eslint
? 'npm run lint:es_fix'
: 'npm run lint:style_fix') + "\",\n " + (eslint ? "\"lint:es\": \"eslint src/ --ext ." + (ts ? 'ts' : 'js') + " --ext ." + (ts ? 'tsx' : 'jsx') + "\",\n \"lint:es_fix\": \"eslint src/ --ext ." + (ts ? 'ts' : 'js') + " --ext ." + (ts ? 'tsx' : 'jsx') + " --fix\"," : '') + "\n " + (stylelint ? "\"lint:style\": \"stylelint src/**/*.{css,less,scss,sass} --allow-empty-input\",\n \"lint:style_fix\": \"stylelint src/**/*.{css,less,scss,sass} --fix\"," : '')
: '') + "\n " + (commitlint
? '"lint:commit": "commitlint -e $HUSKY_GIT_PARAMS",'
: '') + "\n \"new\": \"omni new\",\n \"build\": \"omni build\",\n " + (demoScript
? "\"build:demo\": \"" + demoScript + "\","
: '') + "\n \"release\": \"omni release\"\n },\n " + (commitlint
? "\"husky\": {\n \"hooks\": {\n \"pre-commit\": \"lint-staged\",\n \"pre-push\": " + ((eslint || stylelint) && test
? '"npm run lint && npm run test"'
: (eslint || stylelint)
? '"npm run lint"'
: test
? '"npm run test"'
: '') + ",\n \"commit-msg\": \"npm run lint:commit\"\n }\n },\n \"lint-staged\": {\n " + (eslint ? "\"src/**/*.{js,jsx,ts,tsx,css}\": [\n \"npm run lint:es_fix\",\n \"git add\"\n ]" + (eslint && stylelint ? ',' : '') : '') + "\n " + (stylelint ? "\"src/**/*.{scss,sass,less}\": [\n \"npm run lint:style_fix\",\n \"git add\"\n ]" : '') + "\n },"
: '') + "\n \"keywords\": [],\n \"author\": \"\",\n " + (type_react && ts && strategy === 'stable'
? "\"resolutions\": {\n \"@types/react\": '" + type_react + "'\n },"
: '') + "\n \"license\": \"ISC\"\n}";
});