1 | "use strict";
|
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4 | return new (P || (P = Promise))(function (resolve, reject) {
|
5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9 | });
|
10 | };
|
11 | var __generator = (this && this.__generator) || function (thisArg, body) {
|
12 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14 | function verb(n) { return function (v) { return step([n, v]); }; }
|
15 | function step(op) {
|
16 | if (f) throw new TypeError("Generator is already executing.");
|
17 | while (_) try {
|
18 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19 | if (y = 0, t) op = [op[0] & 2, t.value];
|
20 | switch (op[0]) {
|
21 | case 0: case 1: t = op; break;
|
22 | case 4: _.label++; return { value: op[1], done: false };
|
23 | case 5: _.label++; y = op[1]; op = [0]; continue;
|
24 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25 | default:
|
26 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30 | if (t[2]) _.ops.pop();
|
31 | _.trys.pop(); continue;
|
32 | }
|
33 | op = body.call(thisArg, _);
|
34 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36 | }
|
37 | };
|
38 | var __spreadArrays = (this && this.__spreadArrays) || function () {
|
39 | for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
40 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
41 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
42 | r[k] = a[j];
|
43 | return r;
|
44 | };
|
45 | Object.defineProperty(exports, "__esModule", { value: true });
|
46 | exports.devDependencies = exports.dependencies = void 0;
|
47 | var utils_1 = require("@omni-door/utils");
|
48 | var dependencies_stable_map_1 = require("./dependencies_stable_map");
|
49 | function dependencies(strategy, config) {
|
50 | return __awaiter(this, void 0, void 0, function () {
|
51 | var dependency, deps;
|
52 | return __generator(this, function (_a) {
|
53 | switch (_a.label) {
|
54 | case 0: return [4 , utils_1.getDependency(strategy, dependencies_stable_map_1.dependencies)];
|
55 | case 1:
|
56 | dependency = _a.sent();
|
57 | deps = [
|
58 | dependency('vue'),
|
59 | dependency('vue-router'),
|
60 | dependency('core-js'),
|
61 | dependency('regenerator-runtime'),
|
62 | config.layout === 'rem' ? dependency('amfe-flexible') : ''
|
63 | ];
|
64 | return [2 , {
|
65 | depArr: __spreadArrays(deps),
|
66 | depStr: utils_1.arr2str(deps)
|
67 | }];
|
68 | }
|
69 | });
|
70 | });
|
71 | }
|
72 | exports.dependencies = dependencies;
|
73 | function devDependencies(strategy, config) {
|
74 | return __awaiter(this, void 0, void 0, function () {
|
75 | var dependency, ts, test, eslint, prettier, commitlint, style, stylelint, layout, tag, loaderDependencies, babelDependencies, pluginDependencies, buildDependencies, testDependencies, testTypesDependencies, tsDependencies, eslintDependencies, prettierDependencies, commitlintDependencies, stylelintDependencies, devServerDependencies, defaultDep;
|
76 | return __generator(this, function (_a) {
|
77 | switch (_a.label) {
|
78 | case 0: return [4 , utils_1.getDependency(strategy, dependencies_stable_map_1.devDependencies)];
|
79 | case 1:
|
80 | dependency = _a.sent();
|
81 | ts = config.ts, test = config.test, eslint = config.eslint, prettier = config.prettier, commitlint = config.commitlint, style = config.style, stylelint = config.stylelint, layout = config.layout, tag = config.tag;
|
82 | loaderDependencies = [
|
83 | dependency('vue-loader'),
|
84 | dependency('@vue/compiler-sfc'),
|
85 | dependency('babel-loader'),
|
86 | style ? dependency('style-loader') : '',
|
87 | style ? dependency('css-loader') : '',
|
88 | style ? dependency('postcss') : '',
|
89 | style ? dependency('postcss-loader') : '',
|
90 | style ? dependency('autoprefixer') : '',
|
91 | style && layout === 'rem' ? dependency('postcss-plugin-px2rem') : '',
|
92 | style && layout === 'viewport' ? dependency('postcss-px-to-viewport') : '',
|
93 | (style === 'all' || style === 'less') ? dependency('less') : '',
|
94 | (style === 'all' || style === 'less') ? dependency('less-loader') : '',
|
95 | (style === 'all' || style === 'scss') ? dependency('sass') : '',
|
96 | (style === 'all' || style === 'scss') ? dependency('sass-loader') : '',
|
97 | dependency('url-loader'),
|
98 | dependency('file-loader')
|
99 | ];
|
100 | babelDependencies = [
|
101 | dependency('@babel/core'),
|
102 | dependency('@babel/preset-env'),
|
103 | ts ? dependency('@babel/preset-typescript') : ''
|
104 | ];
|
105 | pluginDependencies = [
|
106 | dependency('html-webpack-plugin'),
|
107 | dependency('terser-webpack-plugin'),
|
108 | style ? dependency('css-minimizer-webpack-plugin') : '',
|
109 | style ? dependency('mini-css-extract-plugin') : '',
|
110 | style ? dependency('cssnano') : '',
|
111 | dependency('webpackbar'),
|
112 | dependency('webpack-bundle-analyzer'),
|
113 | style ? dependency('html-inline-css-webpack-plugin') : '',
|
114 | dependency('html-webpack-externals-plugin'),
|
115 | ts ? dependency('fork-ts-checker-webpack-plugin') : ''
|
116 | ];
|
117 | buildDependencies = __spreadArrays([
|
118 | dependency('webpack'),
|
119 | dependency('webpack-cli'),
|
120 | dependency('webpack-merge')
|
121 | ], pluginDependencies, loaderDependencies, babelDependencies);
|
122 | testDependencies = test ? [
|
123 | dependency('vue-jest'),
|
124 | dependency('@vue/test-utils'),
|
125 | dependency('jest'),
|
126 | dependency('jest-transform-stub'),
|
127 | ts ? dependency('ts-jest') : dependency('babel-jest')
|
128 | ] : [];
|
129 | testTypesDependencies = test ? [
|
130 | dependency('@types/jest')
|
131 | ] : [];
|
132 | tsDependencies = ts ? __spreadArrays([
|
133 | dependency('typescript'),
|
134 | dependency('ts-loader'),
|
135 | dependency('ts-node'),
|
136 | dependency('@types/webpack-env')
|
137 | ], testTypesDependencies) : [];
|
138 | eslintDependencies = eslint ? [
|
139 | dependency('eslint'),
|
140 | dependency('eslint-plugin-vue'),
|
141 | dependency('vue-eslint-parser'),
|
142 | ts ? dependency('@vue/eslint-config-typescript') : '',
|
143 | ts ? dependency('@typescript-eslint/eslint-plugin') : '',
|
144 | ts ? dependency('@typescript-eslint/parser') : ''
|
145 | ] : [];
|
146 | prettierDependencies = prettier ? [
|
147 | dependency('prettier'),
|
148 | eslint ? dependency('eslint-config-prettier') : '',
|
149 | eslint ? dependency('eslint-plugin-prettier') : '',
|
150 | eslint ? dependency('@vue/eslint-config-prettier') : '',
|
151 | stylelint ? dependency('stylelint-config-prettier') : ''
|
152 | ] : [];
|
153 | commitlintDependencies = commitlint ? [
|
154 | dependency('@commitlint/cli'),
|
155 | dependency('husky'),
|
156 | dependency('lint-staged')
|
157 | ] : [];
|
158 | stylelintDependencies = stylelint ? [
|
159 | dependency('stylelint'),
|
160 | dependency('stylelint-config-standard'),
|
161 | dependency('stylelint-config-css-modules'),
|
162 | dependency('stylelint-config-rational-order'),
|
163 | dependency('stylelint-order'),
|
164 | dependency('stylelint-declaration-block-no-ignored-properties'),
|
165 | ts ? dependency('@types/vfile-message') : '',
|
166 | style === 'all' || style === 'scss' ? dependency('stylelint-scss') : ''
|
167 | ] : [];
|
168 | devServerDependencies = [
|
169 | dependency('open'),
|
170 | dependency('ip'),
|
171 | dependency('detect-port'),
|
172 | dependency('express'),
|
173 | dependency('serve-favicon'),
|
174 | dependency('webpack-dev-middleware'),
|
175 | dependency('webpack-hot-middleware'),
|
176 | dependency('http-proxy-middleware')
|
177 | ];
|
178 | defaultDep = [
|
179 | !tag ? dependency('@omni-door/cli') : "@omni-door/cli@" + tag,
|
180 | dependency('del')
|
181 | ];
|
182 | return [2 , {
|
183 | devDepArr: __spreadArrays(defaultDep, buildDependencies, tsDependencies, testDependencies, eslintDependencies, prettierDependencies, commitlintDependencies, stylelintDependencies, devServerDependencies),
|
184 | defaultDepArr: defaultDep,
|
185 | defaultDepStr: utils_1.arr2str(defaultDep),
|
186 | buildDepArr: buildDependencies,
|
187 | buildDepStr: utils_1.arr2str(buildDependencies),
|
188 | tsDepArr: tsDependencies,
|
189 | tsDepStr: utils_1.arr2str(tsDependencies),
|
190 | testDepArr: testDependencies,
|
191 | testDepStr: utils_1.arr2str(testDependencies),
|
192 | eslintDepArr: eslintDependencies,
|
193 | eslintDepStr: utils_1.arr2str(eslintDependencies),
|
194 | prettierDepArr: prettierDependencies,
|
195 | prettierDepStr: utils_1.arr2str(prettierDependencies),
|
196 | commitlintDepArr: commitlintDependencies,
|
197 | commitlintDepStr: utils_1.arr2str(commitlintDependencies),
|
198 | stylelintDepArr: stylelintDependencies,
|
199 | stylelintDepStr: utils_1.arr2str(stylelintDependencies),
|
200 | devServerDepArr: devServerDependencies,
|
201 | devServerDepStr: utils_1.arr2str(devServerDependencies)
|
202 | }];
|
203 | }
|
204 | });
|
205 | });
|
206 | }
|
207 | exports.devDependencies = devDependencies;
|