UNPKG

@omni-door/tpl-component-library-react

Version:
61 lines (60 loc) 3.64 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var utils_1 = require("@omni-door/utils"); var script_test_1 = __importDefault(require("./script_test")); var script_commitlint_1 = __importDefault(require("./script_commitlint")); var script_lint_1 = __importDefault(require("./script_lint")); var script_lint_es_1 = __importDefault(require("./script_lint_es")); var script_lint_prettier_1 = __importDefault(require("./script_lint_prettier")); var script_lint_style_1 = __importDefault(require("./script_lint_style")); var commitlint_1 = __importDefault(require("./commitlint")); var resolutions_1 = __importDefault(require("./resolutions")); var tpl = "`{\n \"name\": \"${project_name.toLowerCase()}\",\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 \"start\": \"omni dev\",\n \"dev\": \"omni dev\",\n ${alter('test', 'script_test')}\n ${include('script_lint')}\n ${alter('eslint', 'script_lint_es')}\n ${alter('prettier', 'script_lint_prettier')}\n ${alter('stylelint', 'script_lint_style')}\n ${alter('commitlint', 'script_commitlint')}\n \"new\": \"omni new\",\n \"build\": \"omni build\",\n ${\n demoScript\n ? `\"build:demo\": \"${demoScript}\",`\n : ''\n }\n \"release\": \"omni release\"\n },\n ${alter('commitlint', 'commitlint')}\n \"keywords\": [],\n \"author\": \"\",\n \"peerDependencies\": {\n \"react\": \">=16.8.0\",\n \"react-dom\": \">=16.8.0\",\n \"prop-types\": \">=15.7.0\"\n },\n ${!install ? dependencies : ''}\n ${!install ? devDependencies : ''}\n ${\n (type_react && ts && `${alter_strategy({\n stable: 'resolutions'\n })}`) || ''\n }\n \"license\": \"ISC\"\n}\n`"; exports.tpl_package = { tpl: tpl, script_test: script_test_1.default, script_commitlint: script_commitlint_1.default, script_lint: script_lint_1.default, script_lint_es: script_lint_es_1.default, script_lint_prettier: script_lint_prettier_1.default, script_lint_style: script_lint_style_1.default, commitlint: commitlint_1.default, resolutions: resolutions_1.default }; exports.default = (function (_a) { var type_react = _a.type_react, project_name = _a.project_name, devServer = _a.devServer; var devScript = ''; var demoScript = ''; switch (devServer) { case 'docz': devScript = 'docz dev'; demoScript = "docz build --base /dist-docz"; break; case 'storybook': devScript = 'start-storybook -p 6200'; demoScript = "build-storybook -c .storybook -o dist-story"; break; case 'bisheng': devScript = 'bisheng start'; demoScript = 'bisheng build'; break; case 'styleguidist': devScript = 'styleguidist server --port 6200'; demoScript = 'styleguidist build'; break; } return utils_1.tpl_engine_init(exports.tpl_package, 'tpl', { type_react: type_react, devScript: devScript, demoScript: demoScript, script_eslint: 'npm run lint:es', script_stylelint: 'npm run lint:style', script_prettier: 'npm run lint:prettier', script_eslint_fix: 'npm run lint:es_fix', script_stylelint_fix: 'npm run lint:style_fix', script_prettier_fix: 'npm run lint:prettier_fix' }); });