@form8ion/javascript 13.0.0-beta.1 → 13.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -5
- package/example.js +67 -59
- package/lib/index.js +543 -545
- package/lib/index.js.map +1 -1
- package/package.json +21 -29
- package/lib/index.mjs +0 -1824
- package/lib/index.mjs.map +0 -1
package/lib/index.js
CHANGED
|
@@ -1,69 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var sortProperties = require('sort-object-keys');
|
|
32
|
-
|
|
33
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
34
|
-
|
|
35
|
-
function _interopNamespace(e) {
|
|
36
|
-
if (e && e.__esModule) return e;
|
|
37
|
-
var n = Object.create(null);
|
|
38
|
-
if (e) {
|
|
39
|
-
Object.keys(e).forEach(function (k) {
|
|
40
|
-
if (k !== 'default') {
|
|
41
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
42
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () { return e[k]; }
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
n["default"] = e;
|
|
50
|
-
return Object.freeze(n);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
var deepmerge__default = /*#__PURE__*/_interopDefaultLegacy(deepmerge);
|
|
54
|
-
var joi__default = /*#__PURE__*/_interopDefaultLegacy(joi);
|
|
55
|
-
var commitConventionPlugin__namespace = /*#__PURE__*/_interopNamespace(commitConventionPlugin);
|
|
56
|
-
var execa__default = /*#__PURE__*/_interopDefaultLegacy(execa);
|
|
57
|
-
var npmConf__default = /*#__PURE__*/_interopDefaultLegacy(npmConf);
|
|
58
|
-
var validatePackageName__default = /*#__PURE__*/_interopDefaultLegacy(validatePackageName);
|
|
59
|
-
var mustache__default = /*#__PURE__*/_interopDefaultLegacy(mustache);
|
|
60
|
-
var mkdir__default = /*#__PURE__*/_interopDefaultLegacy(mkdir);
|
|
61
|
-
var touch__default = /*#__PURE__*/_interopDefaultLegacy(touch);
|
|
62
|
-
var camelcase__default = /*#__PURE__*/_interopDefaultLegacy(camelcase);
|
|
63
|
-
var filedirname__default = /*#__PURE__*/_interopDefaultLegacy(filedirname);
|
|
64
|
-
var huskyPlugin__namespace = /*#__PURE__*/_interopNamespace(huskyPlugin);
|
|
65
|
-
var eslintPlugin__namespace = /*#__PURE__*/_interopNamespace(eslintPlugin);
|
|
66
|
-
var sortProperties__default = /*#__PURE__*/_interopDefaultLegacy(sortProperties);
|
|
1
|
+
import { questionNames as questionNames$2, questions } from '@travi/language-scaffolder-prompts';
|
|
2
|
+
import deepmerge from 'deepmerge';
|
|
3
|
+
import { fileTypes, fileExists, optionsSchemas, validateOptions, applyEnhancers, writeConfigFile } from '@form8ion/core';
|
|
4
|
+
import { scaffoldChoice, packageManagers as packageManagers$1, projectTypes as projectTypes$1, mergeIntoExistingPackageJson, dialects as dialects$1, writePackageJson, DEV_DEPENDENCY_TYPE, PROD_DEPENDENCY_TYPE } from '@form8ion/javascript-core';
|
|
5
|
+
import { prompt as prompt$1 } from '@form8ion/overridable-prompts';
|
|
6
|
+
import joi from 'joi';
|
|
7
|
+
import { scaffold, lift as lift$3 } from '@form8ion/codecov';
|
|
8
|
+
import { write as write$2, load } from '@form8ion/config-file';
|
|
9
|
+
import { info, warn, error } from '@travi/cli-messages';
|
|
10
|
+
import * as commitConventionPlugin from '@form8ion/commit-convention';
|
|
11
|
+
import { scaffold as scaffold$4 } from '@form8ion/commit-convention';
|
|
12
|
+
import execa from '@form8ion/execa-wrapper';
|
|
13
|
+
import npmConf from 'npm-conf';
|
|
14
|
+
import { EOL } from 'os';
|
|
15
|
+
import validatePackageName from 'validate-npm-package-name';
|
|
16
|
+
import { promises } from 'fs';
|
|
17
|
+
import mustache from 'mustache';
|
|
18
|
+
import mkdir from 'make-dir';
|
|
19
|
+
import touch from 'touch';
|
|
20
|
+
import camelcase from 'camelcase';
|
|
21
|
+
import { resolve } from 'path';
|
|
22
|
+
import filedirname from 'filedirname';
|
|
23
|
+
import * as huskyPlugin from '@form8ion/husky';
|
|
24
|
+
import { scaffold as scaffold$3 } from '@form8ion/husky';
|
|
25
|
+
import { promises as promises$1 } from 'node:fs';
|
|
26
|
+
import { stringify, parse } from 'ini';
|
|
27
|
+
import { scaffold as scaffold$2 } from '@form8ion/prettier';
|
|
28
|
+
import * as eslintPlugin from '@form8ion/eslint';
|
|
29
|
+
import { scaffold as scaffold$1, test as test$1 } from '@form8ion/eslint';
|
|
30
|
+
import sortProperties from 'sort-object-keys';
|
|
67
31
|
|
|
68
32
|
const questionNames$1 = {
|
|
69
33
|
UNIT_TEST_FRAMEWORK: 'unitTestFramework',
|
|
@@ -84,9 +48,9 @@ const questionNames$1 = {
|
|
|
84
48
|
};
|
|
85
49
|
|
|
86
50
|
async function scaffoldC8 ({projectRoot}) {
|
|
87
|
-
await
|
|
51
|
+
await write$2({
|
|
88
52
|
name: 'c8',
|
|
89
|
-
format:
|
|
53
|
+
format: fileTypes.JSON,
|
|
90
54
|
path: projectRoot,
|
|
91
55
|
config: {
|
|
92
56
|
reporter: ['lcov', 'text-summary', 'html'],
|
|
@@ -102,27 +66,27 @@ async function scaffoldC8 ({projectRoot}) {
|
|
|
102
66
|
}
|
|
103
67
|
|
|
104
68
|
async function scaffoldCoverage ({projectRoot, vcs, visibility, pathWithinParent}) {
|
|
105
|
-
return
|
|
69
|
+
return deepmerge(await scaffoldC8({projectRoot}), await scaffold({vcs, visibility, pathWithinParent}));
|
|
106
70
|
}
|
|
107
71
|
|
|
108
72
|
function nycIsConfigured ({projectRoot}) {
|
|
109
|
-
return
|
|
73
|
+
return fileExists(`${projectRoot}/.nycrc`);
|
|
110
74
|
}
|
|
111
75
|
|
|
112
76
|
async function removeDependencies ({packageManager, dependencies}) {
|
|
113
|
-
await
|
|
77
|
+
await execa(packageManager, ['remove', ...dependencies]);
|
|
114
78
|
}
|
|
115
79
|
|
|
116
80
|
async function removeNyc ({projectRoot, packageManager}) {
|
|
117
81
|
await Promise.all([
|
|
118
|
-
|
|
119
|
-
|
|
82
|
+
promises.unlink(`${projectRoot}/.nycrc`),
|
|
83
|
+
promises.rm(`${projectRoot}/.nyc_output`, {recursive: true, force: true}),
|
|
120
84
|
removeDependencies({packageManager, dependencies: ['nyc', '@istanbuljs/nyc-config-babel', 'babel-plugin-istanbul']})
|
|
121
85
|
]);
|
|
122
86
|
}
|
|
123
87
|
|
|
124
88
|
async function lift$2({projectRoot, packageManager, vcs}) {
|
|
125
|
-
const codecovResults = await
|
|
89
|
+
const codecovResults = await lift$3({projectRoot, packageManager, vcs});
|
|
126
90
|
|
|
127
91
|
if (await nycIsConfigured({projectRoot})) {
|
|
128
92
|
const [c8Results] = await Promise.all([
|
|
@@ -130,7 +94,7 @@ async function lift$2({projectRoot, packageManager, vcs}) {
|
|
|
130
94
|
removeNyc({projectRoot, packageManager})
|
|
131
95
|
]);
|
|
132
96
|
|
|
133
|
-
return
|
|
97
|
+
return deepmerge.all([
|
|
134
98
|
c8Results,
|
|
135
99
|
codecovResults,
|
|
136
100
|
{
|
|
@@ -147,10 +111,10 @@ async function lift$2({projectRoot, packageManager, vcs}) {
|
|
|
147
111
|
}
|
|
148
112
|
|
|
149
113
|
function c8IsConfigured ({projectRoot}) {
|
|
150
|
-
return
|
|
114
|
+
return fileExists(`${projectRoot}/.c8rc.json`);
|
|
151
115
|
}
|
|
152
116
|
|
|
153
|
-
async function tester$
|
|
117
|
+
async function tester$5 ({projectRoot}) {
|
|
154
118
|
const [c8Exists, nycExists] = await Promise.all([c8IsConfigured({projectRoot}), nycIsConfigured({projectRoot})]);
|
|
155
119
|
|
|
156
120
|
return c8Exists || nycExists;
|
|
@@ -158,46 +122,259 @@ async function tester$4 ({projectRoot}) {
|
|
|
158
122
|
|
|
159
123
|
var coveragePlugin = /*#__PURE__*/Object.freeze({
|
|
160
124
|
__proto__: null,
|
|
161
|
-
scaffold: scaffoldCoverage,
|
|
162
125
|
lift: lift$2,
|
|
163
|
-
|
|
126
|
+
scaffold: scaffoldCoverage,
|
|
127
|
+
test: tester$5
|
|
164
128
|
});
|
|
165
129
|
|
|
166
|
-
const unitTestFrameworksSchema = joi__default["default"].object().required().pattern(/^/, joi__default["default"].object({
|
|
167
|
-
scaffolder: joi__default["default"].func().arity(1).required()
|
|
168
|
-
}));
|
|
169
|
-
|
|
170
130
|
async function chooseFramework ({frameworks, decisions}) {
|
|
171
131
|
if (!Object.keys(frameworks).length) return 'Other';
|
|
172
132
|
|
|
173
|
-
const answers = await
|
|
133
|
+
const answers = await prompt$1([{
|
|
174
134
|
name: questionNames$1.UNIT_TEST_FRAMEWORK,
|
|
175
135
|
type: 'list',
|
|
176
136
|
message: 'Which type of unit testing framework should be used?',
|
|
177
|
-
choices: [...Object.keys(frameworks),
|
|
137
|
+
choices: [...Object.keys(frameworks), 'Other']
|
|
178
138
|
}], decisions);
|
|
179
139
|
|
|
180
140
|
return answers[questionNames$1.UNIT_TEST_FRAMEWORK];
|
|
181
141
|
}
|
|
182
142
|
|
|
143
|
+
const pluginsSchema = joi.object().pattern(/^/, optionsSchemas.form8ionPlugin).default({});
|
|
144
|
+
|
|
183
145
|
async function scaffoldUnitTesting ({projectRoot, frameworks, decisions, visibility, vcs, pathWithinParent, dialect}) {
|
|
184
|
-
const validatedFrameworks =
|
|
146
|
+
const validatedFrameworks = validateOptions(pluginsSchema, frameworks);
|
|
185
147
|
const [framework, coverage] = await Promise.all([
|
|
186
148
|
chooseFramework({frameworks: validatedFrameworks, decisions})
|
|
187
|
-
.then(chosenFramework =>
|
|
149
|
+
.then(chosenFramework => scaffoldChoice(validatedFrameworks, chosenFramework, {projectRoot, dialect})),
|
|
188
150
|
scaffoldCoverage({projectRoot, vcs, visibility, pathWithinParent})
|
|
189
151
|
]);
|
|
190
152
|
|
|
191
|
-
return
|
|
153
|
+
return deepmerge.all([
|
|
192
154
|
{scripts: {'test:unit': 'cross-env NODE_ENV=test c8 run-s test:unit:base'}},
|
|
193
155
|
framework,
|
|
194
156
|
coverage
|
|
195
157
|
]);
|
|
196
158
|
}
|
|
197
159
|
|
|
160
|
+
function tester$4 () {
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function buildAllowedHostsList ({packageManager, registries = {}}) {
|
|
165
|
+
return [
|
|
166
|
+
...!registries.registry ? [packageManager] : [],
|
|
167
|
+
...Object.values(Object.fromEntries(Object.entries(registries).filter(([scope]) => 'publish' !== scope)))
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function determineLockfilePathFor (packageManager) {
|
|
172
|
+
const lockfilePaths = {
|
|
173
|
+
[packageManagers$1.NPM]: 'package-lock.json',
|
|
174
|
+
[packageManagers$1.YARN]: 'yarn.lock'
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
return lockfilePaths[packageManager];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function npmIsUsed ({projectRoot}) {
|
|
181
|
+
return fileExists(`${projectRoot}/${determineLockfilePathFor(packageManagers$1.NPM)}`);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function yarnIsUsed ({projectRoot}) {
|
|
185
|
+
return fileExists(`${projectRoot}/${determineLockfilePathFor(packageManagers$1.YARN)}`);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async function jsPackageManagerIsUsed ({projectRoot}) {
|
|
189
|
+
const [npmFound, yarnFound] = await Promise.all([
|
|
190
|
+
npmIsUsed({projectRoot}),
|
|
191
|
+
yarnIsUsed({projectRoot})
|
|
192
|
+
]);
|
|
193
|
+
|
|
194
|
+
return npmFound || yarnFound;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async function liftCorepack () {
|
|
198
|
+
await execa('corepack', ['use', 'npm@latest']);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
async function lifter$5 () {
|
|
202
|
+
await liftCorepack();
|
|
203
|
+
|
|
204
|
+
return {};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
async function resolvePackageManager ({projectRoot, packageManager}) {
|
|
208
|
+
if (packageManager) return packageManager;
|
|
209
|
+
|
|
210
|
+
if (await npmIsUsed({projectRoot})) {
|
|
211
|
+
return packageManagers$1.NPM;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (await yarnIsUsed({projectRoot})) {
|
|
215
|
+
return packageManagers$1.YARN;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
throw new Error('Package-manager could not be determined');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
var packageManagers = /*#__PURE__*/Object.freeze({
|
|
222
|
+
__proto__: null,
|
|
223
|
+
defineLockfilePath: determineLockfilePathFor,
|
|
224
|
+
determineCurrent: resolvePackageManager,
|
|
225
|
+
lift: lifter$5,
|
|
226
|
+
test: jsPackageManagerIsUsed
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
const lockfileLintSupportedPackageManagers = [packageManagers$1.NPM, packageManagers$1.YARN];
|
|
230
|
+
|
|
231
|
+
function lockfileLintSupports(packageManager) {
|
|
232
|
+
return lockfileLintSupportedPackageManagers.includes(packageManager);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
async function scaffoldLockfileLint ({projectRoot, packageManager, registries}) {
|
|
236
|
+
if (!lockfileLintSupports(packageManager)) {
|
|
237
|
+
throw new Error(
|
|
238
|
+
`The ${packageManager} package manager is currently not supported by lockfile-lint. `
|
|
239
|
+
+ `Only ${lockfileLintSupportedPackageManagers.join(' and ')} are currently supported.`
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
await write$2({
|
|
244
|
+
name: 'lockfile-lint',
|
|
245
|
+
format: fileTypes.JSON,
|
|
246
|
+
path: projectRoot,
|
|
247
|
+
config: {
|
|
248
|
+
path: determineLockfilePathFor(packageManager),
|
|
249
|
+
type: packageManager,
|
|
250
|
+
'validate-https': true,
|
|
251
|
+
'allowed-hosts': buildAllowedHostsList({packageManager, registries})
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
return {
|
|
256
|
+
devDependencies: ['lockfile-lint'],
|
|
257
|
+
scripts: {'lint:lockfile': 'lockfile-lint'}
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function lockfileLintIsAlreadyConfigured ({projectRoot}) {
|
|
262
|
+
return fileExists(`${projectRoot}/.lockfile-lintrc.json`);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const configName = 'lockfile-lint';
|
|
266
|
+
|
|
267
|
+
function read() {
|
|
268
|
+
return load({name: configName});
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function write$1({projectRoot, config}) {
|
|
272
|
+
return write$2({name: configName, format: fileTypes.JSON, path: projectRoot, config});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
async function writeNpmConfig ({projectRoot, config}) {
|
|
276
|
+
await promises$1.writeFile(`${projectRoot}/.npmrc`, stringify(config));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function projectWillNotBeConsumed(projectType) {
|
|
280
|
+
return projectTypes$1.APPLICATION === projectType || projectTypes$1.CLI === projectType;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
async function scaffoldNpmConfig ({projectRoot, projectType}) {
|
|
284
|
+
await writeNpmConfig({
|
|
285
|
+
projectRoot,
|
|
286
|
+
config: {'update-notifier': false, ...projectWillNotBeConsumed(projectType) && {'save-exact': true}}
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
return {scripts: {'lint:peer': 'npm ls >/dev/null'}};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function tester$3 ({projectRoot}) {
|
|
293
|
+
return fileExists(`${projectRoot}/.npmrc`);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
async function readNpmConfig ({projectRoot}) {
|
|
297
|
+
const pathToConfig = `${projectRoot}/.npmrc`;
|
|
298
|
+
|
|
299
|
+
if (!(await fileExists(pathToConfig))) return {};
|
|
300
|
+
|
|
301
|
+
return parse(await promises$1.readFile(pathToConfig, 'utf-8'));
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
async function lifter$4 ({projectRoot}) {
|
|
305
|
+
const {
|
|
306
|
+
provenance,
|
|
307
|
+
'engines-strict': enginesStrict,
|
|
308
|
+
...remainingProperties
|
|
309
|
+
} = await readNpmConfig({projectRoot});
|
|
310
|
+
|
|
311
|
+
await writeNpmConfig({projectRoot, config: remainingProperties});
|
|
312
|
+
|
|
313
|
+
return {};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
var npmConfigPlugin = /*#__PURE__*/Object.freeze({
|
|
317
|
+
__proto__: null,
|
|
318
|
+
lift: lifter$4,
|
|
319
|
+
read: readNpmConfig,
|
|
320
|
+
scaffold: scaffoldNpmConfig,
|
|
321
|
+
test: tester$3,
|
|
322
|
+
write: writeNpmConfig
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
function buildRegistriesConfig (registries = {}) {
|
|
326
|
+
return Object.entries(registries)
|
|
327
|
+
.filter(([scope]) => 'publish' !== scope)
|
|
328
|
+
.reduce((acc, [scope, url]) => {
|
|
329
|
+
if ('registry' === scope) return {...acc, registry: url};
|
|
330
|
+
|
|
331
|
+
return {...acc, [`@${scope}:registry`]: url};
|
|
332
|
+
}, {registry: 'https://registry.npmjs.org'});
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
async function updateRegistriesInNpmConfig(registries, projectRoot) {
|
|
336
|
+
const registriesForNpmConfig = buildRegistriesConfig(registries);
|
|
337
|
+
|
|
338
|
+
await writeNpmConfig({
|
|
339
|
+
projectRoot,
|
|
340
|
+
config: {
|
|
341
|
+
...(await readNpmConfig({projectRoot})),
|
|
342
|
+
...registriesForNpmConfig
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
async function updateRegistriesInLockfileLintConfig(projectRoot, packageManager, registries) {
|
|
348
|
+
await write$1({
|
|
349
|
+
projectRoot,
|
|
350
|
+
config: {
|
|
351
|
+
...await read(),
|
|
352
|
+
'allowed-hosts': buildAllowedHostsList({packageManager, registries})
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
async function lifter$3 ({projectRoot, packageManager, configs: {registries}}) {
|
|
358
|
+
await updateRegistriesInNpmConfig(registries, projectRoot);
|
|
359
|
+
|
|
360
|
+
if (!(await lockfileLintIsAlreadyConfigured({projectRoot}))) {
|
|
361
|
+
return scaffoldLockfileLint({projectRoot, packageManager, registries});
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
await updateRegistriesInLockfileLintConfig(projectRoot, packageManager, registries);
|
|
365
|
+
|
|
366
|
+
return {};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
var registriesPlugin = /*#__PURE__*/Object.freeze({
|
|
370
|
+
__proto__: null,
|
|
371
|
+
lift: lifter$3,
|
|
372
|
+
test: tester$4
|
|
373
|
+
});
|
|
374
|
+
|
|
198
375
|
async function scaffoldRemark ({config, projectRoot, projectType, vcs}) {
|
|
199
|
-
await
|
|
200
|
-
format:
|
|
376
|
+
await write$2({
|
|
377
|
+
format: fileTypes.JSON,
|
|
201
378
|
path: projectRoot,
|
|
202
379
|
name: 'remark',
|
|
203
380
|
config: {
|
|
@@ -211,13 +388,13 @@ async function scaffoldRemark ({config, projectRoot, projectType, vcs}) {
|
|
|
211
388
|
plugins: [
|
|
212
389
|
config,
|
|
213
390
|
['remark-toc', {tight: true}],
|
|
214
|
-
...
|
|
391
|
+
...projectTypes$1.PACKAGE === projectType ? [['remark-usage', {heading: 'example'}]] : [],
|
|
215
392
|
...!vcs ? [['validate-links', {repository: false}]] : []
|
|
216
393
|
]
|
|
217
394
|
}
|
|
218
395
|
});
|
|
219
396
|
|
|
220
|
-
return
|
|
397
|
+
return deepmerge(
|
|
221
398
|
{
|
|
222
399
|
devDependencies: [config, 'remark-cli', 'remark-toc'],
|
|
223
400
|
scripts: {
|
|
@@ -225,7 +402,7 @@ async function scaffoldRemark ({config, projectRoot, projectType, vcs}) {
|
|
|
225
402
|
'generate:md': 'remark . --output'
|
|
226
403
|
}
|
|
227
404
|
},
|
|
228
|
-
{...
|
|
405
|
+
{...projectTypes$1.PACKAGE === projectType && {devDependencies: ['remark-usage']}}
|
|
229
406
|
);
|
|
230
407
|
}
|
|
231
408
|
|
|
@@ -236,93 +413,37 @@ async function scaffoldCodeStyle ({
|
|
|
236
413
|
vcs,
|
|
237
414
|
configureLinting
|
|
238
415
|
}) {
|
|
239
|
-
return
|
|
416
|
+
return deepmerge.all(await Promise.all([
|
|
240
417
|
configs.eslint
|
|
241
418
|
&& configureLinting
|
|
242
|
-
&&
|
|
419
|
+
&& scaffold$1({projectRoot, config: configs.eslint}),
|
|
243
420
|
scaffoldRemark({
|
|
244
421
|
projectRoot,
|
|
245
422
|
projectType,
|
|
246
423
|
vcs,
|
|
247
424
|
config: configs.remark || '@form8ion/remark-lint-preset'
|
|
248
425
|
}),
|
|
249
|
-
|
|
426
|
+
scaffold$2({projectRoot, config: configs.prettier})
|
|
250
427
|
].filter(Boolean)));
|
|
251
428
|
}
|
|
252
429
|
|
|
253
|
-
function lifter$
|
|
254
|
-
return
|
|
430
|
+
function lifter$2 (options) {
|
|
431
|
+
return applyEnhancers({options, enhancers: [eslintPlugin]});
|
|
255
432
|
}
|
|
256
433
|
|
|
257
|
-
function tester$
|
|
258
|
-
return
|
|
434
|
+
function tester$2 (options) {
|
|
435
|
+
return test$1(options);
|
|
259
436
|
}
|
|
260
437
|
|
|
261
438
|
var codeStylePlugin = /*#__PURE__*/Object.freeze({
|
|
262
439
|
__proto__: null,
|
|
440
|
+
lift: lifter$2,
|
|
263
441
|
scaffold: scaffoldCodeStyle,
|
|
264
|
-
|
|
265
|
-
test: tester$3
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
async function write$1 ({projectRoot, config}) {
|
|
269
|
-
await node_fs.promises.writeFile(`${projectRoot}/.npmrc`, ini.stringify(config));
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
function projectWillNotBeConsumed(projectType) {
|
|
273
|
-
return javascriptCore.projectTypes.APPLICATION === projectType || javascriptCore.projectTypes.CLI === projectType;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
async function scaffoldNpmConfig ({
|
|
277
|
-
projectRoot,
|
|
278
|
-
projectType,
|
|
279
|
-
registries
|
|
280
|
-
}) {
|
|
281
|
-
await write$1({
|
|
282
|
-
projectRoot,
|
|
283
|
-
config: {
|
|
284
|
-
'update-notifier': false,
|
|
285
|
-
...projectWillNotBeConsumed(projectType) && {'save-exact': true},
|
|
286
|
-
...Object.fromEntries(Object.entries(registries)
|
|
287
|
-
.filter(([scope]) => 'publish' !== scope)
|
|
288
|
-
.map(([scope, url]) => {
|
|
289
|
-
if ('registry' === scope) return ['registry', url];
|
|
290
|
-
|
|
291
|
-
return [`@${scope}:registry`, url];
|
|
292
|
-
}))
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
return {scripts: {'lint:peer': 'npm ls >/dev/null'}};
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function tester$2 ({projectRoot}) {
|
|
300
|
-
return core.fileExists(`${projectRoot}/.npmrc`);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
async function lifter$3 ({projectRoot}) {
|
|
304
|
-
const pathToConfig = `${projectRoot}/.npmrc`;
|
|
305
|
-
|
|
306
|
-
const {
|
|
307
|
-
provenance,
|
|
308
|
-
'engines-strict': enginesStrict,
|
|
309
|
-
...remainingProperties
|
|
310
|
-
} = ini.parse(await node_fs.promises.readFile(pathToConfig, 'utf-8'));
|
|
311
|
-
|
|
312
|
-
await node_fs.promises.writeFile(pathToConfig, ini.stringify(remainingProperties));
|
|
313
|
-
|
|
314
|
-
return {};
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
var npmConfigPlugin = /*#__PURE__*/Object.freeze({
|
|
318
|
-
__proto__: null,
|
|
319
|
-
scaffold: scaffoldNpmConfig,
|
|
320
|
-
test: tester$2,
|
|
321
|
-
lift: lifter$3
|
|
442
|
+
test: tester$2
|
|
322
443
|
});
|
|
323
444
|
|
|
324
445
|
async function test({projectRoot}) {
|
|
325
|
-
const {engines} = JSON.parse(await
|
|
446
|
+
const {engines} = JSON.parse(await promises.readFile(`${projectRoot}/package.json`, 'utf8'));
|
|
326
447
|
|
|
327
448
|
return !!engines?.node;
|
|
328
449
|
}
|
|
@@ -337,27 +458,27 @@ async function lift$1({packageDetails: {name}}) {
|
|
|
337
458
|
|
|
338
459
|
var enginesEnhancer = /*#__PURE__*/Object.freeze({
|
|
339
460
|
__proto__: null,
|
|
340
|
-
|
|
341
|
-
|
|
461
|
+
lift: lift$1,
|
|
462
|
+
test: test
|
|
342
463
|
});
|
|
343
464
|
|
|
344
465
|
function buildDocumentationCommand (packageManager) {
|
|
345
|
-
if (
|
|
346
|
-
if (
|
|
466
|
+
if (packageManagers$1.NPM === packageManager) return 'npm run generate:md';
|
|
467
|
+
if (packageManagers$1.YARN === packageManager) return 'yarn generate:md';
|
|
347
468
|
|
|
348
469
|
throw new Error(
|
|
349
470
|
`The ${packageManager} package manager is currently not supported. `
|
|
350
|
-
+ `Only ${Object.values(
|
|
471
|
+
+ `Only ${Object.values(packageManagers$1).join(' and ')} are currently supported.`
|
|
351
472
|
);
|
|
352
473
|
}
|
|
353
474
|
|
|
354
475
|
function getInstallationCommand(packageManager) {
|
|
355
|
-
if (
|
|
356
|
-
if (
|
|
476
|
+
if (packageManagers$1.NPM === packageManager) return 'npm install';
|
|
477
|
+
if (packageManagers$1.YARN === packageManager) return 'yarn add';
|
|
357
478
|
|
|
358
479
|
throw new Error(
|
|
359
480
|
`The ${packageManager} package manager is currently not supported. `
|
|
360
|
-
+ `Only ${Object.values(
|
|
481
|
+
+ `Only ${Object.values(packageManagers$1).join(' and ')} are currently supported.`
|
|
361
482
|
);
|
|
362
483
|
}
|
|
363
484
|
|
|
@@ -423,7 +544,7 @@ async function liftProvenance ({projectRoot, packageDetails}) {
|
|
|
423
544
|
const {publishConfig: {access}} = packageDetails;
|
|
424
545
|
|
|
425
546
|
if ('public' === access) {
|
|
426
|
-
await
|
|
547
|
+
await mergeIntoExistingPackageJson({projectRoot, config: {publishConfig: {provenance: true}}});
|
|
427
548
|
|
|
428
549
|
return enhanceSlsa({provenance: true});
|
|
429
550
|
}
|
|
@@ -435,9 +556,9 @@ async function liftPublishable ({projectRoot, packageDetails}) {
|
|
|
435
556
|
const {name: packageName, publishConfig: {access: packageAccessLevel}} = packageDetails;
|
|
436
557
|
const homepage = `https://npm.im/${packageName}`;
|
|
437
558
|
|
|
438
|
-
await
|
|
559
|
+
await mergeIntoExistingPackageJson({projectRoot, config: {homepage}});
|
|
439
560
|
|
|
440
|
-
return
|
|
561
|
+
return deepmerge(
|
|
441
562
|
await liftProvenance({packageDetails, projectRoot}),
|
|
442
563
|
{
|
|
443
564
|
homepage,
|
|
@@ -457,7 +578,7 @@ async function scaffoldPublishable ({packageName, packageAccessLevel}) {
|
|
|
457
578
|
async function chooseBundler ({bundlers, decisions}) {
|
|
458
579
|
if (!Object.keys(bundlers).length) return 'Other';
|
|
459
580
|
|
|
460
|
-
const answers = await
|
|
581
|
+
const answers = await prompt$1([{
|
|
461
582
|
name: questionNames$1.PACKAGE_BUNDLER,
|
|
462
583
|
type: 'list',
|
|
463
584
|
message: 'Which bundler should be used?',
|
|
@@ -470,32 +591,32 @@ async function chooseBundler ({bundlers, decisions}) {
|
|
|
470
591
|
async function scaffoldBundler ({projectRoot, projectType, bundlers, dialect, decisions}) {
|
|
471
592
|
const chosenBundler = await chooseBundler({bundlers, decisions});
|
|
472
593
|
|
|
473
|
-
return
|
|
594
|
+
return scaffoldChoice(bundlers, chosenBundler, {projectRoot, projectType, dialect});
|
|
474
595
|
}
|
|
475
596
|
|
|
476
597
|
function determinePathToTemplateFile (fileName) {
|
|
477
|
-
const [, __dirname] =
|
|
598
|
+
const [, __dirname] = filedirname();
|
|
478
599
|
|
|
479
|
-
return
|
|
600
|
+
return resolve(__dirname, '..', 'templates', fileName);
|
|
480
601
|
}
|
|
481
602
|
|
|
482
603
|
const defaultBuildDirectory$2 = 'lib';
|
|
483
604
|
|
|
484
605
|
async function createExample(projectRoot, projectName, dialect) {
|
|
485
|
-
return
|
|
606
|
+
return promises.writeFile(
|
|
486
607
|
`${projectRoot}/example.js`,
|
|
487
|
-
|
|
488
|
-
await
|
|
489
|
-
{projectName:
|
|
608
|
+
mustache.render(
|
|
609
|
+
await promises.readFile(determinePathToTemplateFile('example.mustache'), 'utf8'),
|
|
610
|
+
{projectName: camelcase(projectName), esm: dialect === dialects$1.ESM}
|
|
490
611
|
)
|
|
491
612
|
);
|
|
492
613
|
}
|
|
493
614
|
|
|
494
615
|
async function buildDetailsForCommonJsProject({projectRoot, projectName, provideExample}) {
|
|
495
616
|
await Promise.all([
|
|
496
|
-
|
|
617
|
+
touch(`${projectRoot}/index.js`),
|
|
497
618
|
provideExample
|
|
498
|
-
?
|
|
619
|
+
? promises.writeFile(`${projectRoot}/example.js`, `const ${camelcase(projectName)} = require('.');\n`)
|
|
499
620
|
: Promise.resolve()
|
|
500
621
|
]);
|
|
501
622
|
|
|
@@ -512,16 +633,16 @@ async function buildDetails ({
|
|
|
512
633
|
provideExample,
|
|
513
634
|
decisions
|
|
514
635
|
}) {
|
|
515
|
-
if (
|
|
636
|
+
if (dialects$1.COMMON_JS === dialect) return buildDetailsForCommonJsProject({projectRoot, projectName, provideExample});
|
|
516
637
|
|
|
517
|
-
const pathToCreatedSrcDirectory = await
|
|
638
|
+
const pathToCreatedSrcDirectory = await mkdir(`${projectRoot}/src`);
|
|
518
639
|
const [bundlerResults] = await Promise.all([
|
|
519
|
-
scaffoldBundler({bundlers: packageBundlers, projectRoot, dialect, decisions, projectType:
|
|
640
|
+
scaffoldBundler({bundlers: packageBundlers, projectRoot, dialect, decisions, projectType: projectTypes$1.PACKAGE}),
|
|
520
641
|
provideExample ? await createExample(projectRoot, projectName, dialect) : Promise.resolve,
|
|
521
|
-
|
|
642
|
+
touch(`${pathToCreatedSrcDirectory}/index.js`)
|
|
522
643
|
]);
|
|
523
644
|
|
|
524
|
-
return
|
|
645
|
+
return deepmerge(
|
|
525
646
|
bundlerResults,
|
|
526
647
|
{
|
|
527
648
|
devDependencies: ['rimraf'],
|
|
@@ -562,7 +683,7 @@ async function scaffoldPackageType ({
|
|
|
562
683
|
provideExample,
|
|
563
684
|
publishRegistry
|
|
564
685
|
}) {
|
|
565
|
-
|
|
686
|
+
info('Scaffolding Package Details');
|
|
566
687
|
|
|
567
688
|
const packageAccessLevel = determinePackageAccessLevelFromProjectVisibility({projectVisibility: visibility});
|
|
568
689
|
const [detailsForBuild, publishableResults] = await Promise.all([
|
|
@@ -577,17 +698,17 @@ async function scaffoldPackageType ({
|
|
|
577
698
|
decisions
|
|
578
699
|
}),
|
|
579
700
|
scaffoldPublishable({packageName, packageAccessLevel}),
|
|
580
|
-
|
|
701
|
+
mergeIntoExistingPackageJson({
|
|
581
702
|
projectRoot,
|
|
582
703
|
config: {
|
|
583
|
-
files: ['example.js', ...
|
|
704
|
+
files: ['example.js', ...dialects$1.COMMON_JS === dialect ? ['index.js'] : ['lib/']],
|
|
584
705
|
publishConfig: {
|
|
585
706
|
access: packageAccessLevel,
|
|
586
707
|
...publishRegistry && {registry: publishRegistry}
|
|
587
708
|
},
|
|
588
709
|
sideEffects: false,
|
|
589
710
|
...'Public' === visibility && {runkitExampleFilename: './example.js'},
|
|
590
|
-
...
|
|
711
|
+
...dialects$1.BABEL === dialect && {
|
|
591
712
|
main: './lib/index.js',
|
|
592
713
|
module: './lib/index.mjs',
|
|
593
714
|
exports: {
|
|
@@ -596,11 +717,11 @@ async function scaffoldPackageType ({
|
|
|
596
717
|
import: './lib/index.mjs'
|
|
597
718
|
}
|
|
598
719
|
},
|
|
599
|
-
...
|
|
720
|
+
...dialects$1.ESM === dialect && {
|
|
600
721
|
main: './lib/index.js',
|
|
601
722
|
exports: './lib/index.js'
|
|
602
723
|
},
|
|
603
|
-
...
|
|
724
|
+
...dialects$1.TYPESCRIPT === dialect && {
|
|
604
725
|
main: './lib/index.js',
|
|
605
726
|
module: './lib/index.mjs',
|
|
606
727
|
types: './lib/index.d.ts',
|
|
@@ -614,12 +735,13 @@ async function scaffoldPackageType ({
|
|
|
614
735
|
})
|
|
615
736
|
]);
|
|
616
737
|
|
|
617
|
-
return
|
|
738
|
+
return deepmerge.all([
|
|
618
739
|
publishableResults,
|
|
619
740
|
{
|
|
620
741
|
documentation: scaffoldPackageDocumentation({packageName, visibility, scope, packageManager, provideExample}),
|
|
621
742
|
nextSteps: [
|
|
622
743
|
{summary: 'Add the appropriate `save` flag to the installation instructions in the README'},
|
|
744
|
+
{summary: 'Define supported node.js versions as `engines.node` in the `package.json` file'},
|
|
623
745
|
{summary: 'Publish pre-release versions to npm until package is stable enough to publish v1.0.0'}
|
|
624
746
|
]
|
|
625
747
|
},
|
|
@@ -638,9 +760,9 @@ async function isPackage ({packageDetails: {exports, publishConfig, bin}}) {
|
|
|
638
760
|
const defaultBuildDirectory$1 = 'public';
|
|
639
761
|
|
|
640
762
|
async function scaffoldApplicationType ({projectRoot}) {
|
|
641
|
-
|
|
763
|
+
info('Scaffolding Application Details');
|
|
642
764
|
|
|
643
|
-
await
|
|
765
|
+
await mergeIntoExistingPackageJson({projectRoot, config: {private: true}});
|
|
644
766
|
|
|
645
767
|
const buildDirectory = defaultBuildDirectory$1;
|
|
646
768
|
|
|
@@ -663,9 +785,9 @@ function isApplication ({packageDetails}) {
|
|
|
663
785
|
}
|
|
664
786
|
|
|
665
787
|
async function scaffoldMonorepoType ({projectRoot}) {
|
|
666
|
-
|
|
788
|
+
info('Scaffolding Monorepo Details');
|
|
667
789
|
|
|
668
|
-
await
|
|
790
|
+
await mergeIntoExistingPackageJson({projectRoot, config: {private: true}});
|
|
669
791
|
|
|
670
792
|
return {
|
|
671
793
|
nextSteps: [{
|
|
@@ -689,9 +811,9 @@ async function scaffoldCliType ({
|
|
|
689
811
|
}) {
|
|
690
812
|
const packageAccessLevel = determinePackageAccessLevelFromProjectVisibility({projectVisibility: visibility});
|
|
691
813
|
const [bundlerResults, publishableResults] = await Promise.all([
|
|
692
|
-
scaffoldBundler({bundlers: packageBundlers, projectRoot, dialect, decisions, projectType:
|
|
814
|
+
scaffoldBundler({bundlers: packageBundlers, projectRoot, dialect, decisions, projectType: projectTypes$1.CLI}),
|
|
693
815
|
scaffoldPublishable({packageName, packageAccessLevel}),
|
|
694
|
-
|
|
816
|
+
mergeIntoExistingPackageJson({
|
|
695
817
|
projectRoot,
|
|
696
818
|
config: {
|
|
697
819
|
bin: {},
|
|
@@ -704,7 +826,7 @@ async function scaffoldCliType ({
|
|
|
704
826
|
})
|
|
705
827
|
]);
|
|
706
828
|
|
|
707
|
-
return
|
|
829
|
+
return deepmerge.all([
|
|
708
830
|
publishableResults,
|
|
709
831
|
bundlerResults,
|
|
710
832
|
{
|
|
@@ -718,7 +840,7 @@ async function scaffoldCliType ({
|
|
|
718
840
|
devDependencies: ['rimraf'],
|
|
719
841
|
vcsIgnore: {files: [], directories: [`/${defaultBuildDirectory}/`]},
|
|
720
842
|
buildDirectory: defaultBuildDirectory,
|
|
721
|
-
nextSteps: []
|
|
843
|
+
nextSteps: [{summary: 'Define supported node.js versions as `engines.node` in the `package.json` file'}]
|
|
722
844
|
}
|
|
723
845
|
]);
|
|
724
846
|
}
|
|
@@ -746,7 +868,7 @@ async function scaffoldProjectType ({
|
|
|
746
868
|
publishRegistry
|
|
747
869
|
}) {
|
|
748
870
|
switch (projectType) {
|
|
749
|
-
case
|
|
871
|
+
case projectTypes$1.PACKAGE:
|
|
750
872
|
return scaffoldPackageType({
|
|
751
873
|
projectRoot,
|
|
752
874
|
projectName,
|
|
@@ -760,9 +882,9 @@ async function scaffoldProjectType ({
|
|
|
760
882
|
provideExample,
|
|
761
883
|
publishRegistry
|
|
762
884
|
});
|
|
763
|
-
case
|
|
885
|
+
case projectTypes$1.APPLICATION:
|
|
764
886
|
return scaffoldApplicationType({projectRoot});
|
|
765
|
-
case
|
|
887
|
+
case projectTypes$1.CLI:
|
|
766
888
|
return scaffoldCliType({
|
|
767
889
|
packageName,
|
|
768
890
|
visibility,
|
|
@@ -772,7 +894,7 @@ async function scaffoldProjectType ({
|
|
|
772
894
|
decisions,
|
|
773
895
|
packageBundlers
|
|
774
896
|
});
|
|
775
|
-
case
|
|
897
|
+
case projectTypes$1.MONOREPO:
|
|
776
898
|
return scaffoldMonorepoType({projectRoot});
|
|
777
899
|
case 'Other':
|
|
778
900
|
return {};
|
|
@@ -791,7 +913,7 @@ function vcsRepositoryHostedOnGithub(vcs) {
|
|
|
791
913
|
return vcs && 'github' === vcs.host;
|
|
792
914
|
}
|
|
793
915
|
|
|
794
|
-
async function lifter$
|
|
916
|
+
async function lifter$1 ({projectRoot, packageDetails, vcs}) {
|
|
795
917
|
if (await isPackage({projectRoot, packageDetails})) return liftPackage$1({projectRoot, packageDetails});
|
|
796
918
|
if (await isCli({projectRoot, packageDetails})) return liftCli({projectRoot, packageDetails});
|
|
797
919
|
|
|
@@ -800,7 +922,7 @@ async function lifter$2 ({projectRoot, packageDetails, vcs}) {
|
|
|
800
922
|
if (vcsRepositoryHostedOnGithub(vcs)) {
|
|
801
923
|
homepage = `https://github.com/${vcs.owner}/${vcs.name}#readme`;
|
|
802
924
|
|
|
803
|
-
await
|
|
925
|
+
await mergeIntoExistingPackageJson({projectRoot, config: {homepage}});
|
|
804
926
|
}
|
|
805
927
|
|
|
806
928
|
return {homepage};
|
|
@@ -808,18 +930,22 @@ async function lifter$2 ({projectRoot, packageDetails, vcs}) {
|
|
|
808
930
|
|
|
809
931
|
var projectTypes = /*#__PURE__*/Object.freeze({
|
|
810
932
|
__proto__: null,
|
|
933
|
+
lift: lifter$1,
|
|
811
934
|
scaffold: scaffoldProjectType,
|
|
812
|
-
test: tester$1
|
|
813
|
-
lift: lifter$2
|
|
935
|
+
test: tester$1
|
|
814
936
|
});
|
|
815
937
|
|
|
816
938
|
function write ({projectRoot, config}) {
|
|
817
|
-
return
|
|
939
|
+
return write$2({path: projectRoot, name: 'babel', format: fileTypes.JSON, config});
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
function loadConfig () {
|
|
943
|
+
return load({name: 'babel'});
|
|
818
944
|
}
|
|
819
945
|
|
|
820
946
|
async function addIgnore ({projectRoot, ignore}) {
|
|
821
947
|
if (ignore) {
|
|
822
|
-
const existingConfig =
|
|
948
|
+
const existingConfig = await loadConfig();
|
|
823
949
|
|
|
824
950
|
await write({projectRoot, config: {...existingConfig, ignore: [`./${ignore}/`]}});
|
|
825
951
|
}
|
|
@@ -838,29 +964,29 @@ async function scaffoldBabel ({projectRoot, preset}) {
|
|
|
838
964
|
};
|
|
839
965
|
}
|
|
840
966
|
|
|
841
|
-
async function lifter
|
|
967
|
+
async function lifter ({results, projectRoot}) {
|
|
842
968
|
await addIgnore({ignore: results.buildDirectory, projectRoot});
|
|
843
969
|
|
|
844
970
|
return {};
|
|
845
971
|
}
|
|
846
972
|
|
|
847
973
|
function predicate ({projectRoot}) {
|
|
848
|
-
return
|
|
974
|
+
return fileExists(`${projectRoot}/.babelrc.json`);
|
|
849
975
|
}
|
|
850
976
|
|
|
851
977
|
async function scaffoldTypescript ({config, projectType, projectRoot, testFilenamePattern}) {
|
|
852
978
|
const shareableTsConfigPackage = `${config.scope}/tsconfig`;
|
|
853
979
|
|
|
854
|
-
await
|
|
980
|
+
await writeConfigFile({
|
|
855
981
|
path: projectRoot,
|
|
856
982
|
name: 'tsconfig',
|
|
857
|
-
format:
|
|
983
|
+
format: fileTypes.JSON,
|
|
858
984
|
config: {
|
|
859
985
|
$schema: 'https://json.schemastore.org/tsconfig',
|
|
860
986
|
extends: shareableTsConfigPackage,
|
|
861
987
|
compilerOptions: {
|
|
862
988
|
rootDir: 'src',
|
|
863
|
-
...
|
|
989
|
+
...projectTypes$1.PACKAGE === projectType && {
|
|
864
990
|
outDir: 'lib',
|
|
865
991
|
declaration: true
|
|
866
992
|
}
|
|
@@ -879,9 +1005,9 @@ async function scaffoldTypescript ({config, projectType, projectRoot, testFilena
|
|
|
879
1005
|
|
|
880
1006
|
function scaffoldDialect ({dialect, projectType, projectRoot, configs, testFilenamePattern}) {
|
|
881
1007
|
switch (dialect) {
|
|
882
|
-
case
|
|
1008
|
+
case dialects$1.BABEL:
|
|
883
1009
|
return scaffoldBabel({preset: configs.babelPreset, projectRoot});
|
|
884
|
-
case
|
|
1010
|
+
case dialects$1.TYPESCRIPT:
|
|
885
1011
|
return scaffoldTypescript({config: configs.typescript, projectType, projectRoot, testFilenamePattern});
|
|
886
1012
|
default:
|
|
887
1013
|
return {};
|
|
@@ -890,11 +1016,22 @@ function scaffoldDialect ({dialect, projectType, projectRoot, configs, testFilen
|
|
|
890
1016
|
|
|
891
1017
|
var dialects = /*#__PURE__*/Object.freeze({
|
|
892
1018
|
__proto__: null,
|
|
1019
|
+
lift: lifter,
|
|
893
1020
|
scaffold: scaffoldDialect,
|
|
894
|
-
test: predicate
|
|
895
|
-
lift: lifter$1
|
|
1021
|
+
test: predicate
|
|
896
1022
|
});
|
|
897
1023
|
|
|
1024
|
+
function buildPackageName (projectName, scope) {
|
|
1025
|
+
const name = `${scope ? `@${scope}/` : ''}${projectName}`;
|
|
1026
|
+
|
|
1027
|
+
const {validForNewPackages, errors} = validatePackageName(name);
|
|
1028
|
+
|
|
1029
|
+
if (validForNewPackages) return name;
|
|
1030
|
+
if (1 === errors.length && errors.includes('name cannot start with a period')) return projectName.slice(1);
|
|
1031
|
+
|
|
1032
|
+
throw new Error(`The package name ${name} is invalid:${EOL}\t* ${errors.join(`${EOL}\t* `)}`);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
898
1035
|
function buildPackageDetails ({
|
|
899
1036
|
packageName,
|
|
900
1037
|
dialect,
|
|
@@ -906,7 +1043,7 @@ function buildPackageDetails ({
|
|
|
906
1043
|
name: packageName,
|
|
907
1044
|
description,
|
|
908
1045
|
license,
|
|
909
|
-
type:
|
|
1046
|
+
type: dialects$1.ESM === dialect ? 'module' : 'commonjs',
|
|
910
1047
|
author: `${author.name}${author.email ? ` <${author.email}>` : ''}${author.url ? ` (${author.url})` : ''}`,
|
|
911
1048
|
scripts: {}
|
|
912
1049
|
};
|
|
@@ -914,29 +1051,33 @@ function buildPackageDetails ({
|
|
|
914
1051
|
|
|
915
1052
|
async function scaffoldPackage ({
|
|
916
1053
|
projectRoot,
|
|
1054
|
+
projectName,
|
|
1055
|
+
scope,
|
|
917
1056
|
dialect,
|
|
918
|
-
packageName,
|
|
919
1057
|
license,
|
|
920
1058
|
author,
|
|
921
1059
|
description
|
|
922
1060
|
}) {
|
|
923
|
-
|
|
1061
|
+
info('Configuring package.json');
|
|
924
1062
|
|
|
925
|
-
const
|
|
926
|
-
packageName,
|
|
927
|
-
dialect,
|
|
928
|
-
license,
|
|
929
|
-
author,
|
|
930
|
-
description
|
|
931
|
-
});
|
|
1063
|
+
const packageName = buildPackageName(projectName, scope);
|
|
932
1064
|
|
|
933
|
-
await
|
|
1065
|
+
await writePackageJson({
|
|
1066
|
+
projectRoot,
|
|
1067
|
+
config: await buildPackageDetails({
|
|
1068
|
+
packageName,
|
|
1069
|
+
dialect,
|
|
1070
|
+
license,
|
|
1071
|
+
author,
|
|
1072
|
+
description
|
|
1073
|
+
})
|
|
1074
|
+
});
|
|
934
1075
|
|
|
935
|
-
return {};
|
|
1076
|
+
return {packageName};
|
|
936
1077
|
}
|
|
937
1078
|
|
|
938
1079
|
function sortPackageProperties (packageContents) {
|
|
939
|
-
return
|
|
1080
|
+
return sortProperties(
|
|
940
1081
|
packageContents,
|
|
941
1082
|
[
|
|
942
1083
|
'name',
|
|
@@ -986,19 +1127,19 @@ function defineVcsHostDetails (vcs, pathWithinParent) {
|
|
|
986
1127
|
}
|
|
987
1128
|
|
|
988
1129
|
const details = {
|
|
989
|
-
[
|
|
1130
|
+
[packageManagers$1.NPM]: {
|
|
990
1131
|
installationCommand: 'install',
|
|
991
1132
|
installationFlags: {
|
|
992
|
-
[
|
|
993
|
-
[
|
|
1133
|
+
[DEV_DEPENDENCY_TYPE]: `save-${DEV_DEPENDENCY_TYPE}`,
|
|
1134
|
+
[PROD_DEPENDENCY_TYPE]: `save-${PROD_DEPENDENCY_TYPE}`,
|
|
994
1135
|
exact: 'save-exact'
|
|
995
1136
|
}
|
|
996
1137
|
},
|
|
997
|
-
[
|
|
1138
|
+
[packageManagers$1.YARN]: {
|
|
998
1139
|
installationCommand: 'add',
|
|
999
1140
|
installationFlags: {
|
|
1000
|
-
[
|
|
1001
|
-
[
|
|
1141
|
+
[DEV_DEPENDENCY_TYPE]: DEV_DEPENDENCY_TYPE,
|
|
1142
|
+
[PROD_DEPENDENCY_TYPE]: PROD_DEPENDENCY_TYPE,
|
|
1002
1143
|
exact: 'exact'
|
|
1003
1144
|
}
|
|
1004
1145
|
}
|
|
@@ -1016,19 +1157,31 @@ function getExactFlag(manager) {
|
|
|
1016
1157
|
return details[manager].installationFlags.exact;
|
|
1017
1158
|
}
|
|
1018
1159
|
|
|
1019
|
-
async function install$1 (dependencies, dependenciesType, projectRoot, packageManager =
|
|
1160
|
+
async function install$1 (dependencies, dependenciesType, projectRoot, packageManager = packageManagers$1.NPM) {
|
|
1020
1161
|
if (dependencies.length) {
|
|
1021
|
-
|
|
1162
|
+
info(`Installing ${dependenciesType} dependencies`, {level: 'secondary'});
|
|
1022
1163
|
|
|
1023
|
-
await
|
|
1164
|
+
await execa(
|
|
1024
1165
|
`. ~/.nvm/nvm.sh && nvm use && ${packageManager} ${
|
|
1025
1166
|
getInstallationCommandFor(packageManager)
|
|
1026
1167
|
} ${[...new Set(dependencies)].join(' ')} --${getDependencyTypeFlag(packageManager, dependenciesType)}${
|
|
1027
|
-
|
|
1168
|
+
DEV_DEPENDENCY_TYPE === dependenciesType ? ` --${getExactFlag(packageManager)}` : ''
|
|
1028
1169
|
}`,
|
|
1029
1170
|
{shell: true, cwd: projectRoot}
|
|
1030
1171
|
);
|
|
1031
|
-
} else
|
|
1172
|
+
} else warn(`No ${dependenciesType} dependencies to install`);
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
async function processDependencies ({dependencies, devDependencies, projectRoot, packageManager}) {
|
|
1176
|
+
info('Processing dependencies');
|
|
1177
|
+
|
|
1178
|
+
try {
|
|
1179
|
+
await install$1(dependencies || [], PROD_DEPENDENCY_TYPE, projectRoot, packageManager);
|
|
1180
|
+
await install$1(devDependencies || [], DEV_DEPENDENCY_TYPE, projectRoot, packageManager);
|
|
1181
|
+
} catch (e) {
|
|
1182
|
+
error('Failed to update dependencies');
|
|
1183
|
+
error(e, {level: 'secondary'});
|
|
1184
|
+
}
|
|
1032
1185
|
}
|
|
1033
1186
|
|
|
1034
1187
|
function projectWillBeTested(scripts) {
|
|
@@ -1064,100 +1217,30 @@ async function liftPackage ({
|
|
|
1064
1217
|
vcs,
|
|
1065
1218
|
pathWithinParent
|
|
1066
1219
|
}) {
|
|
1067
|
-
|
|
1068
|
-
cliMessages.info('Updating `package.json`', {level: 'secondary'});
|
|
1069
|
-
|
|
1070
|
-
const pathToPackageJson = `${projectRoot}/package.json`;
|
|
1220
|
+
info('Updating `package.json`', {level: 'secondary'});
|
|
1071
1221
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
await javascriptCore.writePackageJson({
|
|
1075
|
-
projectRoot,
|
|
1076
|
-
config: sortPackageProperties({
|
|
1077
|
-
...existingPackageJsonContents,
|
|
1078
|
-
...defineVcsHostDetails(vcs, pathWithinParent),
|
|
1079
|
-
scripts: liftScripts({
|
|
1080
|
-
existingScripts: existingPackageJsonContents.scripts,
|
|
1081
|
-
scripts
|
|
1082
|
-
}),
|
|
1083
|
-
...tags && {
|
|
1084
|
-
keywords: existingPackageJsonContents.keywords ? [...existingPackageJsonContents.keywords, ...tags] : tags
|
|
1085
|
-
}
|
|
1086
|
-
})
|
|
1087
|
-
});
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
cliMessages.info('Installing dependencies');
|
|
1091
|
-
|
|
1092
|
-
try {
|
|
1093
|
-
await install$1(dependencies || [], javascriptCore.PROD_DEPENDENCY_TYPE, projectRoot, packageManager);
|
|
1094
|
-
await install$1([...devDependencies || []], javascriptCore.DEV_DEPENDENCY_TYPE, projectRoot, packageManager);
|
|
1095
|
-
} catch (e) {
|
|
1096
|
-
cliMessages.error('Failed to install dependencies');
|
|
1097
|
-
cliMessages.error(e, {level: 'secondary'});
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
function determineLockfilePathFor (packageManager) {
|
|
1102
|
-
const lockfilePaths = {
|
|
1103
|
-
[javascriptCore.packageManagers.NPM]: 'package-lock.json',
|
|
1104
|
-
[javascriptCore.packageManagers.YARN]: 'yarn.lock'
|
|
1105
|
-
};
|
|
1106
|
-
|
|
1107
|
-
return lockfilePaths[packageManager];
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
function npmIsUsed ({projectRoot}) {
|
|
1111
|
-
return core.fileExists(`${projectRoot}/${determineLockfilePathFor(javascriptCore.packageManagers.NPM)}`);
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
function yarnIsUsed ({projectRoot}) {
|
|
1115
|
-
return core.fileExists(`${projectRoot}/${determineLockfilePathFor(javascriptCore.packageManagers.YARN)}`);
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
async function jsPackageManagerIsUsed ({projectRoot}) {
|
|
1119
|
-
const [npmFound, yarnFound] = await Promise.all([
|
|
1120
|
-
npmIsUsed({projectRoot}),
|
|
1121
|
-
yarnIsUsed({projectRoot})
|
|
1122
|
-
]);
|
|
1123
|
-
|
|
1124
|
-
return npmFound || yarnFound;
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
async function liftCorepack () {
|
|
1128
|
-
await execa__default["default"]('corepack', ['use', 'npm@latest']);
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
async function lifter () {
|
|
1132
|
-
await liftCorepack();
|
|
1133
|
-
|
|
1134
|
-
return {};
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
async function resolvePackageManager ({projectRoot, packageManager}) {
|
|
1138
|
-
if (packageManager) return packageManager;
|
|
1139
|
-
|
|
1140
|
-
if (await npmIsUsed({projectRoot})) {
|
|
1141
|
-
return javascriptCore.packageManagers.NPM;
|
|
1142
|
-
}
|
|
1222
|
+
const existingPackageJsonContents = JSON.parse(await promises.readFile(`${projectRoot}/package.json`, 'utf-8'));
|
|
1143
1223
|
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1224
|
+
await writePackageJson({
|
|
1225
|
+
projectRoot,
|
|
1226
|
+
config: sortPackageProperties({
|
|
1227
|
+
...existingPackageJsonContents,
|
|
1228
|
+
...defineVcsHostDetails(vcs, pathWithinParent),
|
|
1229
|
+
scripts: liftScripts({
|
|
1230
|
+
existingScripts: existingPackageJsonContents.scripts,
|
|
1231
|
+
scripts
|
|
1232
|
+
}),
|
|
1233
|
+
...tags && {
|
|
1234
|
+
keywords: existingPackageJsonContents.keywords ? [...existingPackageJsonContents.keywords, ...tags] : tags
|
|
1235
|
+
}
|
|
1236
|
+
})
|
|
1237
|
+
});
|
|
1147
1238
|
|
|
1148
|
-
|
|
1239
|
+
await processDependencies({dependencies, devDependencies, projectRoot, packageManager});
|
|
1149
1240
|
}
|
|
1150
1241
|
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
test: jsPackageManagerIsUsed,
|
|
1154
|
-
lift: lifter,
|
|
1155
|
-
determineCurrent: resolvePackageManager,
|
|
1156
|
-
defineLockfilePath: determineLockfilePathFor
|
|
1157
|
-
});
|
|
1158
|
-
|
|
1159
|
-
async function lift ({projectRoot, vcs, results, pathWithinParent}) {
|
|
1160
|
-
cliMessages.info('Lifting JavaScript-specific details');
|
|
1242
|
+
async function lift ({projectRoot, vcs, results, pathWithinParent, enhancers = {}, configs = {}}) {
|
|
1243
|
+
info('Lifting JavaScript-specific details');
|
|
1161
1244
|
|
|
1162
1245
|
const {
|
|
1163
1246
|
scripts,
|
|
@@ -1169,27 +1252,29 @@ async function lift ({projectRoot, vcs, results, pathWithinParent}) {
|
|
|
1169
1252
|
|
|
1170
1253
|
const [packageManager, packageContents] = await Promise.all([
|
|
1171
1254
|
resolvePackageManager({projectRoot, packageManager: manager}),
|
|
1172
|
-
|
|
1255
|
+
promises$1.readFile(`${projectRoot}/package.json`, 'utf8')
|
|
1173
1256
|
]);
|
|
1174
1257
|
|
|
1175
|
-
const enhancerResults = await
|
|
1258
|
+
const enhancerResults = await applyEnhancers({
|
|
1176
1259
|
results,
|
|
1177
|
-
enhancers:
|
|
1178
|
-
|
|
1260
|
+
enhancers: {
|
|
1261
|
+
...enhancers,
|
|
1262
|
+
huskyPlugin,
|
|
1179
1263
|
enginesEnhancer,
|
|
1180
1264
|
coveragePlugin,
|
|
1181
|
-
|
|
1265
|
+
commitConventionPlugin,
|
|
1182
1266
|
dialects,
|
|
1183
1267
|
codeStylePlugin,
|
|
1184
1268
|
npmConfigPlugin,
|
|
1185
1269
|
projectTypes,
|
|
1186
|
-
packageManagers
|
|
1187
|
-
|
|
1188
|
-
|
|
1270
|
+
packageManagers,
|
|
1271
|
+
registriesPlugin
|
|
1272
|
+
},
|
|
1273
|
+
options: {packageManager, projectRoot, vcs, packageDetails: JSON.parse(packageContents), configs}
|
|
1189
1274
|
});
|
|
1190
1275
|
|
|
1191
1276
|
await liftPackage(
|
|
1192
|
-
|
|
1277
|
+
deepmerge.all([
|
|
1193
1278
|
{projectRoot, scripts, tags, dependencies, devDependencies, packageManager, vcs, pathWithinParent},
|
|
1194
1279
|
enhancerResults
|
|
1195
1280
|
])
|
|
@@ -1198,109 +1283,77 @@ async function lift ({projectRoot, vcs, results, pathWithinParent}) {
|
|
|
1198
1283
|
return enhancerResults;
|
|
1199
1284
|
}
|
|
1200
1285
|
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1286
|
+
const scopeBasedConfigSchema = joi.object({scope: joi.string().regex(/^@[a-z0-9-]+$/i, 'scope').required()});
|
|
1287
|
+
|
|
1288
|
+
const nameBasedConfigSchema = joi.object({
|
|
1289
|
+
packageName: joi.string().required(),
|
|
1290
|
+
name: joi.string().required()
|
|
1291
|
+
});
|
|
1203
1292
|
|
|
1204
|
-
const
|
|
1293
|
+
const registriesSchema = joi.object().pattern(joi.string(), joi.string().uri()).default({});
|
|
1205
1294
|
|
|
1206
|
-
const
|
|
1295
|
+
const visibilitySchema = joi.string().valid('Public', 'Private').required();
|
|
1207
1296
|
|
|
1208
|
-
const
|
|
1297
|
+
const projectNameSchema = joi.string().regex(/^@\w*\//, {invert: true}).required();
|
|
1209
1298
|
|
|
1210
|
-
const
|
|
1299
|
+
const vcsSchema = joi.object({
|
|
1300
|
+
host: joi.string().required(),
|
|
1301
|
+
owner: joi.string().required(),
|
|
1302
|
+
name: joi.string().required()
|
|
1303
|
+
});
|
|
1211
1304
|
|
|
1212
1305
|
function validate(options) {
|
|
1213
|
-
const schema =
|
|
1214
|
-
.
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
.
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
}),
|
|
1242
|
-
remark: joi__default["default"].string()
|
|
1243
|
-
}).default({})
|
|
1244
|
-
})
|
|
1245
|
-
.keys({
|
|
1246
|
-
overrides: joi__default["default"].object({
|
|
1247
|
-
npmAccount: joi__default["default"].string(),
|
|
1248
|
-
author: joi__default["default"].object({
|
|
1249
|
-
name: joi__default["default"].string().required(),
|
|
1250
|
-
email: joi__default["default"].string().email(),
|
|
1251
|
-
url: joi__default["default"].string().uri()
|
|
1252
|
-
})
|
|
1253
|
-
}).default({})
|
|
1254
|
-
})
|
|
1255
|
-
.keys({
|
|
1256
|
-
ciServices: joi__default["default"].object().pattern(/^/, joi__default["default"].object({
|
|
1257
|
-
scaffolder: joi__default["default"].func().arity(1).required(),
|
|
1258
|
-
public: joi__default["default"].boolean(),
|
|
1259
|
-
private: joi__default["default"].boolean()
|
|
1260
|
-
})).default({})
|
|
1261
|
-
})
|
|
1262
|
-
.keys({
|
|
1263
|
-
hosts: joi__default["default"].object().pattern(/^/, joi__default["default"].object({
|
|
1264
|
-
scaffolder: joi__default["default"].func().arity(1).required(),
|
|
1265
|
-
projectTypes: joi__default["default"].array().items(joi__default["default"].string().valid('static', 'node')).default([])
|
|
1266
|
-
})).default({})
|
|
1267
|
-
})
|
|
1268
|
-
.keys({
|
|
1269
|
-
applicationTypes: applicationTypesSchema,
|
|
1270
|
-
packageTypes: packageTypesSchema,
|
|
1271
|
-
monorepoTypes: monorepoTypesSchema
|
|
1272
|
-
})
|
|
1273
|
-
.keys({
|
|
1274
|
-
unitTestFrameworks: unitTestFrameworksSchema,
|
|
1275
|
-
packageBundlers: packageBundlersSchema
|
|
1276
|
-
})
|
|
1277
|
-
.keys({
|
|
1278
|
-
decisions: joi__default["default"].object()
|
|
1279
|
-
})
|
|
1280
|
-
.keys({registries: joi__default["default"].object().pattern(joi__default["default"].string(), joi__default["default"].string().uri()).default({})});
|
|
1306
|
+
const schema = joi.object({
|
|
1307
|
+
projectRoot: joi.string().required(),
|
|
1308
|
+
projectName: projectNameSchema,
|
|
1309
|
+
visibility: visibilitySchema,
|
|
1310
|
+
license: joi.string().required(),
|
|
1311
|
+
description: joi.string(),
|
|
1312
|
+
pathWithinParent: joi.string(),
|
|
1313
|
+
decisions: joi.object(),
|
|
1314
|
+
vcs: vcsSchema,
|
|
1315
|
+
configs: joi.object({
|
|
1316
|
+
eslint: scopeBasedConfigSchema,
|
|
1317
|
+
typescript: scopeBasedConfigSchema,
|
|
1318
|
+
prettier: scopeBasedConfigSchema,
|
|
1319
|
+
commitlint: nameBasedConfigSchema,
|
|
1320
|
+
babelPreset: nameBasedConfigSchema,
|
|
1321
|
+
remark: joi.string(),
|
|
1322
|
+
registries: registriesSchema
|
|
1323
|
+
}).default({}),
|
|
1324
|
+
plugins: {
|
|
1325
|
+
unitTestFrameworks: pluginsSchema,
|
|
1326
|
+
packageBundlers: pluginsSchema,
|
|
1327
|
+
applicationTypes: pluginsSchema,
|
|
1328
|
+
packageTypes: pluginsSchema,
|
|
1329
|
+
monorepoTypes: pluginsSchema,
|
|
1330
|
+
hosts: pluginsSchema,
|
|
1331
|
+
ciServices: pluginsSchema
|
|
1332
|
+
}
|
|
1333
|
+
}).required();
|
|
1281
1334
|
|
|
1282
|
-
return
|
|
1335
|
+
return validateOptions(schema, options);
|
|
1283
1336
|
}
|
|
1284
1337
|
|
|
1285
1338
|
function buildDialectChoices ({babelPreset, typescript}) {
|
|
1286
1339
|
return [
|
|
1287
|
-
{name: 'Common JS (no transpilation)', value:
|
|
1288
|
-
...babelPreset ? [{name: 'Modern JavaScript (transpiled)', value:
|
|
1289
|
-
{name: 'ESM-only (no transpilation)', value:
|
|
1290
|
-
...typescript ? [{name: 'TypeScript', value:
|
|
1340
|
+
{name: 'Common JS (no transpilation)', value: dialects$1.COMMON_JS, short: 'cjs'},
|
|
1341
|
+
...babelPreset ? [{name: 'Modern JavaScript (transpiled)', value: dialects$1.BABEL, short: 'modern'}] : [],
|
|
1342
|
+
{name: 'ESM-only (no transpilation)', value: dialects$1.ESM, short: 'esm'},
|
|
1343
|
+
...typescript ? [{name: 'TypeScript', value: dialects$1.TYPESCRIPT, short: 'ts'}] : []
|
|
1291
1344
|
];
|
|
1292
1345
|
}
|
|
1293
1346
|
|
|
1294
1347
|
function projectIsCLI(answers) {
|
|
1295
|
-
return
|
|
1348
|
+
return projectTypes$1.CLI === answers[questionNames$1.PROJECT_TYPE];
|
|
1296
1349
|
}
|
|
1297
1350
|
|
|
1298
1351
|
function projectIsPackage(answers) {
|
|
1299
|
-
return
|
|
1352
|
+
return projectTypes$1.PACKAGE === answers[questionNames$1.PROJECT_TYPE];
|
|
1300
1353
|
}
|
|
1301
1354
|
|
|
1302
1355
|
function projectIsApplication(answers) {
|
|
1303
|
-
return
|
|
1356
|
+
return projectTypes$1.APPLICATION === answers[questionNames$1.PROJECT_TYPE];
|
|
1304
1357
|
}
|
|
1305
1358
|
|
|
1306
1359
|
function packageShouldBeScoped(visibility, answers) {
|
|
@@ -1320,8 +1373,8 @@ function scopePromptShouldBePresentedFactory(visibility) {
|
|
|
1320
1373
|
}
|
|
1321
1374
|
|
|
1322
1375
|
function lintingPromptShouldBePresented({
|
|
1323
|
-
[
|
|
1324
|
-
[
|
|
1376
|
+
[questionNames$2.UNIT_TESTS]: unitTested,
|
|
1377
|
+
[questionNames$2.INTEGRATION_TESTS]: integrationTested
|
|
1325
1378
|
}) {
|
|
1326
1379
|
return !unitTested && !integrationTested;
|
|
1327
1380
|
}
|
|
@@ -1357,7 +1410,6 @@ function authorQuestions({name, email, url}) {
|
|
|
1357
1410
|
}
|
|
1358
1411
|
|
|
1359
1412
|
async function prompt(
|
|
1360
|
-
{npmAccount, author},
|
|
1361
1413
|
ciServices,
|
|
1362
1414
|
hosts,
|
|
1363
1415
|
visibility,
|
|
@@ -1366,23 +1418,23 @@ async function prompt(
|
|
|
1366
1418
|
configs,
|
|
1367
1419
|
pathWithinParent
|
|
1368
1420
|
) {
|
|
1369
|
-
const npmConf =
|
|
1421
|
+
const npmConf$1 = npmConf();
|
|
1370
1422
|
|
|
1371
1423
|
let maybeLoggedInNpmUsername;
|
|
1372
1424
|
try {
|
|
1373
|
-
maybeLoggedInNpmUsername = (await
|
|
1425
|
+
maybeLoggedInNpmUsername = (await execa('npm', ['whoami'])).stdout;
|
|
1374
1426
|
} catch (failedExecutionResult) {
|
|
1375
1427
|
if (!decisions[questionNames$1.SCOPE]) {
|
|
1376
|
-
|
|
1428
|
+
warn('No logged in user found with `npm whoami`. Login with `npm login` '
|
|
1377
1429
|
+ 'to use your npm account name as the package scope default.');
|
|
1378
1430
|
}
|
|
1379
1431
|
}
|
|
1380
1432
|
|
|
1381
1433
|
const {
|
|
1382
|
-
[
|
|
1383
|
-
[
|
|
1434
|
+
[questionNames$2.UNIT_TESTS]: unitTested,
|
|
1435
|
+
[questionNames$2.INTEGRATION_TESTS]: integrationTested,
|
|
1384
1436
|
[questionNames$1.PROJECT_TYPE]: projectType,
|
|
1385
|
-
[
|
|
1437
|
+
[questionNames$2.CI_SERVICE]: ci,
|
|
1386
1438
|
[questionNames$1.HOST]: chosenHost,
|
|
1387
1439
|
[questionNames$1.SCOPE]: scope$1,
|
|
1388
1440
|
[questionNames$1.NODE_VERSION_CATEGORY]: nodeVersionCategory,
|
|
@@ -1393,7 +1445,7 @@ async function prompt(
|
|
|
1393
1445
|
[questionNames$1.PROVIDE_EXAMPLE]: provideExample,
|
|
1394
1446
|
[questionNames$1.PACKAGE_MANAGER]: packageManager,
|
|
1395
1447
|
[questionNames$1.DIALECT]: dialect
|
|
1396
|
-
} = await
|
|
1448
|
+
} = await prompt$1([
|
|
1397
1449
|
{
|
|
1398
1450
|
name: questionNames$1.DIALECT,
|
|
1399
1451
|
message: 'Which JavaScript dialect should this project follow?',
|
|
@@ -1412,15 +1464,15 @@ async function prompt(
|
|
|
1412
1464
|
name: questionNames$1.PACKAGE_MANAGER,
|
|
1413
1465
|
message: 'Which package manager will be used with this project?',
|
|
1414
1466
|
type: 'list',
|
|
1415
|
-
choices: Object.values(
|
|
1416
|
-
default:
|
|
1467
|
+
choices: Object.values(packageManagers$1),
|
|
1468
|
+
default: packageManagers$1.NPM
|
|
1417
1469
|
},
|
|
1418
1470
|
{
|
|
1419
1471
|
name: questionNames$1.PROJECT_TYPE,
|
|
1420
1472
|
message: 'What type of JavaScript project is this?',
|
|
1421
1473
|
type: 'list',
|
|
1422
|
-
choices: [...Object.values(
|
|
1423
|
-
default:
|
|
1474
|
+
choices: [...Object.values(projectTypes$1), 'Other'],
|
|
1475
|
+
default: projectTypes$1.PACKAGE
|
|
1424
1476
|
},
|
|
1425
1477
|
...'Private' === visibility ? [] : [{
|
|
1426
1478
|
name: questionNames$1.SHOULD_BE_SCOPED,
|
|
@@ -1434,14 +1486,14 @@ async function prompt(
|
|
|
1434
1486
|
message: 'What is the scope?',
|
|
1435
1487
|
when: scopePromptShouldBePresentedFactory(visibility),
|
|
1436
1488
|
validate: scope(visibility),
|
|
1437
|
-
default:
|
|
1489
|
+
default: maybeLoggedInNpmUsername
|
|
1438
1490
|
},
|
|
1439
|
-
...authorQuestions(
|
|
1440
|
-
name: npmConf.get('init.author.name'),
|
|
1441
|
-
email: npmConf.get('init.author.email'),
|
|
1442
|
-
url: npmConf.get('init.author.url')
|
|
1491
|
+
...authorQuestions({
|
|
1492
|
+
name: npmConf$1.get('init.author.name'),
|
|
1493
|
+
email: npmConf$1.get('init.author.email'),
|
|
1494
|
+
url: npmConf$1.get('init.author.url')
|
|
1443
1495
|
}),
|
|
1444
|
-
...
|
|
1496
|
+
...questions(({vcs, ciServices, pathWithinParent})),
|
|
1445
1497
|
{
|
|
1446
1498
|
name: questionNames$1.CONFIGURE_LINTING,
|
|
1447
1499
|
message: 'Will there be source code that should be linted?',
|
|
@@ -1459,7 +1511,7 @@ async function prompt(
|
|
|
1459
1511
|
type: 'list',
|
|
1460
1512
|
message: 'Where will the application be hosted?',
|
|
1461
1513
|
when: projectIsApplication,
|
|
1462
|
-
choices: [...Object.keys(hosts),
|
|
1514
|
+
choices: [...Object.keys(hosts), 'Other']
|
|
1463
1515
|
}
|
|
1464
1516
|
], decisions);
|
|
1465
1517
|
|
|
@@ -1497,10 +1549,14 @@ $ ${packageManager} test
|
|
|
1497
1549
|
};
|
|
1498
1550
|
}
|
|
1499
1551
|
|
|
1552
|
+
function buildBadgesDetails (contributors) {
|
|
1553
|
+
return deepmerge.all(contributors).badges;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1500
1556
|
async function determineLatestVersionOf(nodeVersionCategory) {
|
|
1501
|
-
|
|
1557
|
+
info('Determining version of node', {level: 'secondary'});
|
|
1502
1558
|
|
|
1503
|
-
const {stdout: nvmLsOutput} = await
|
|
1559
|
+
const {stdout: nvmLsOutput} = await execa(
|
|
1504
1560
|
`. ~/.nvm/nvm.sh && nvm ls-remote${('LTS' === nodeVersionCategory) ? ' --lts' : ''}`,
|
|
1505
1561
|
{shell: true}
|
|
1506
1562
|
);
|
|
@@ -1512,9 +1568,9 @@ async function determineLatestVersionOf(nodeVersionCategory) {
|
|
|
1512
1568
|
}
|
|
1513
1569
|
|
|
1514
1570
|
function install(nodeVersionCategory) {
|
|
1515
|
-
|
|
1571
|
+
info(`Installing ${nodeVersionCategory} version of node using nvm`, {level: 'secondary'});
|
|
1516
1572
|
|
|
1517
|
-
const subprocess =
|
|
1573
|
+
const subprocess = execa('. ~/.nvm/nvm.sh && nvm install', {shell: true});
|
|
1518
1574
|
subprocess.stdout.pipe(process.stdout);
|
|
1519
1575
|
return subprocess;
|
|
1520
1576
|
}
|
|
@@ -1523,11 +1579,11 @@ async function scaffoldNodeVersion ({projectRoot, nodeVersionCategory}) {
|
|
|
1523
1579
|
if (!nodeVersionCategory) return undefined;
|
|
1524
1580
|
|
|
1525
1581
|
const lowerCaseCategory = nodeVersionCategory.toLowerCase();
|
|
1526
|
-
|
|
1582
|
+
info(`Configuring ${lowerCaseCategory} version of node`);
|
|
1527
1583
|
|
|
1528
1584
|
const version = await determineLatestVersionOf(nodeVersionCategory);
|
|
1529
1585
|
|
|
1530
|
-
await
|
|
1586
|
+
await promises$1.writeFile(`${projectRoot}/.nvmrc`, version);
|
|
1531
1587
|
|
|
1532
1588
|
await install(nodeVersionCategory);
|
|
1533
1589
|
|
|
@@ -1535,11 +1591,7 @@ async function scaffoldNodeVersion ({projectRoot, nodeVersionCategory}) {
|
|
|
1535
1591
|
}
|
|
1536
1592
|
|
|
1537
1593
|
function nvmIsUsed ({projectRoot}) {
|
|
1538
|
-
return
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
function buildBadgesDetails (contributors) {
|
|
1542
|
-
return deepmerge__default["default"].all(contributors).badges;
|
|
1594
|
+
return fileExists(`${projectRoot}/.nvmrc`);
|
|
1543
1595
|
}
|
|
1544
1596
|
|
|
1545
1597
|
function buildVcsIgnoreLists (vcsIgnoreLists = {}) {
|
|
@@ -1549,25 +1601,14 @@ function buildVcsIgnoreLists (vcsIgnoreLists = {}) {
|
|
|
1549
1601
|
};
|
|
1550
1602
|
}
|
|
1551
1603
|
|
|
1552
|
-
function buildPackageName (projectName, scope) {
|
|
1553
|
-
const name = `${scope ? `@${scope}/` : ''}${projectName}`;
|
|
1554
|
-
|
|
1555
|
-
const {validForNewPackages, errors} = validatePackageName__default["default"](name);
|
|
1556
|
-
|
|
1557
|
-
if (validForNewPackages) return name;
|
|
1558
|
-
if (1 === errors.length && errors.includes('name cannot start with a period')) return projectName.slice(1);
|
|
1559
|
-
|
|
1560
|
-
throw new Error(`The package name ${name} is invalid:${os.EOL}\t* ${errors.join(`${os.EOL}\t* `)}`);
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
1604
|
async function chooseProjectTypePlugin ({types, projectType, decisions}) {
|
|
1564
1605
|
if (!Object.keys(types).length) return 'Other';
|
|
1565
1606
|
|
|
1566
|
-
const answers = await
|
|
1607
|
+
const answers = await prompt$1([{
|
|
1567
1608
|
name: questionNames$1.PROJECT_TYPE_CHOICE,
|
|
1568
1609
|
type: 'list',
|
|
1569
1610
|
message: `What type of ${projectType} is this?`,
|
|
1570
|
-
choices: [...Object.keys(types),
|
|
1611
|
+
choices: [...Object.keys(types), 'Other']
|
|
1571
1612
|
}], decisions);
|
|
1572
1613
|
|
|
1573
1614
|
return answers[questionNames$1.PROJECT_TYPE_CHOICE];
|
|
@@ -1591,7 +1632,7 @@ async function scaffoldProjectTypePlugin ({
|
|
|
1591
1632
|
|
|
1592
1633
|
const chosenType = await chooseProjectTypePlugin({types: pluginsForProjectType, decisions, projectType});
|
|
1593
1634
|
|
|
1594
|
-
return
|
|
1635
|
+
return scaffoldChoice(
|
|
1595
1636
|
pluginsForProjectType,
|
|
1596
1637
|
chosenType,
|
|
1597
1638
|
{projectRoot, projectName, packageName, packageManager, scope, tests, dialect}
|
|
@@ -1620,46 +1661,7 @@ async function scaffoldTesting ({
|
|
|
1620
1661
|
})
|
|
1621
1662
|
: {};
|
|
1622
1663
|
|
|
1623
|
-
return
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
function buildAllowedHostsList ({packageManager, registries}) {
|
|
1627
|
-
return [
|
|
1628
|
-
...(!registries || (registries && !registries.registry)) ? [packageManager] : [],
|
|
1629
|
-
...Object.values(Object.fromEntries(Object.entries(registries).filter(([scope]) => 'publish' !== scope)))
|
|
1630
|
-
];
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
const lockfileLintSupportedPackageManagers = [javascriptCore.packageManagers.NPM, javascriptCore.packageManagers.YARN];
|
|
1634
|
-
|
|
1635
|
-
function lockfileLintSupports(packageManager) {
|
|
1636
|
-
return lockfileLintSupportedPackageManagers.includes(packageManager);
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
async function scaffoldLockfileLint ({projectRoot, packageManager, registries}) {
|
|
1640
|
-
if (!lockfileLintSupports(packageManager)) {
|
|
1641
|
-
throw new Error(
|
|
1642
|
-
`The ${packageManager} package manager is currently not supported by lockfile-lint. `
|
|
1643
|
-
+ `Only ${lockfileLintSupportedPackageManagers.join(' and ')} are currently supported.`
|
|
1644
|
-
);
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
await configFile.write({
|
|
1648
|
-
name: 'lockfile-lint',
|
|
1649
|
-
format: core.fileTypes.JSON,
|
|
1650
|
-
path: projectRoot,
|
|
1651
|
-
config: {
|
|
1652
|
-
path: determineLockfilePathFor(packageManager),
|
|
1653
|
-
type: packageManager,
|
|
1654
|
-
'validate-https': true,
|
|
1655
|
-
'allowed-hosts': buildAllowedHostsList({packageManager, registries})
|
|
1656
|
-
}
|
|
1657
|
-
});
|
|
1658
|
-
|
|
1659
|
-
return {
|
|
1660
|
-
devDependencies: ['lockfile-lint'],
|
|
1661
|
-
scripts: {'lint:lockfile': 'lockfile-lint'}
|
|
1662
|
-
};
|
|
1664
|
+
return deepmerge({devDependencies: [...(unit || integration) ? ['@travi/any'] : []], eslint: {}}, unitResults);
|
|
1663
1665
|
}
|
|
1664
1666
|
|
|
1665
1667
|
async function scaffoldLinting ({projectRoot, packageManager, registries}) {
|
|
@@ -1690,14 +1692,14 @@ async function scaffoldVerification({
|
|
|
1690
1692
|
pathWithinParent
|
|
1691
1693
|
}),
|
|
1692
1694
|
scaffoldLinting({projectRoot, packageManager, registries, vcs, pathWithinParent}),
|
|
1693
|
-
|
|
1695
|
+
scaffold$3({projectRoot, packageManager, pathWithinParent})
|
|
1694
1696
|
]);
|
|
1695
1697
|
|
|
1696
|
-
return
|
|
1698
|
+
return deepmerge.all([testingResults, lintingResults, huskyResults]);
|
|
1697
1699
|
}
|
|
1698
1700
|
|
|
1699
1701
|
async function scaffolder (options) {
|
|
1700
|
-
|
|
1702
|
+
info('Initializing JavaScript project');
|
|
1701
1703
|
|
|
1702
1704
|
const {
|
|
1703
1705
|
projectRoot,
|
|
@@ -1707,17 +1709,17 @@ async function scaffolder (options) {
|
|
|
1707
1709
|
vcs,
|
|
1708
1710
|
description,
|
|
1709
1711
|
configs,
|
|
1710
|
-
overrides,
|
|
1711
|
-
ciServices,
|
|
1712
|
-
hosts,
|
|
1713
|
-
applicationTypes,
|
|
1714
|
-
packageTypes,
|
|
1715
|
-
packageBundlers,
|
|
1716
|
-
monorepoTypes,
|
|
1717
1712
|
decisions,
|
|
1718
|
-
unitTestFrameworks,
|
|
1719
1713
|
pathWithinParent,
|
|
1720
|
-
|
|
1714
|
+
plugins: {
|
|
1715
|
+
applicationTypes,
|
|
1716
|
+
packageTypes,
|
|
1717
|
+
monorepoTypes,
|
|
1718
|
+
packageBundlers,
|
|
1719
|
+
unitTestFrameworks,
|
|
1720
|
+
hosts,
|
|
1721
|
+
ciServices
|
|
1722
|
+
}
|
|
1721
1723
|
} = validate(options);
|
|
1722
1724
|
|
|
1723
1725
|
const {
|
|
@@ -1732,15 +1734,15 @@ async function scaffolder (options) {
|
|
|
1732
1734
|
provideExample,
|
|
1733
1735
|
packageManager,
|
|
1734
1736
|
dialect
|
|
1735
|
-
} = await prompt(
|
|
1737
|
+
} = await prompt(ciServices, hosts, visibility, vcs, decisions, configs, pathWithinParent);
|
|
1736
1738
|
|
|
1737
|
-
|
|
1739
|
+
info('Writing project files', {level: 'secondary'});
|
|
1738
1740
|
|
|
1739
|
-
const packageName =
|
|
1740
|
-
await scaffoldPackage({
|
|
1741
|
+
const {packageName} = await scaffoldPackage({
|
|
1741
1742
|
projectRoot,
|
|
1743
|
+
projectName,
|
|
1744
|
+
scope,
|
|
1742
1745
|
dialect,
|
|
1743
|
-
packageName,
|
|
1744
1746
|
license,
|
|
1745
1747
|
author,
|
|
1746
1748
|
description
|
|
@@ -1754,15 +1756,15 @@ async function scaffolder (options) {
|
|
|
1754
1756
|
visibility,
|
|
1755
1757
|
applicationTypes,
|
|
1756
1758
|
packageTypes,
|
|
1757
|
-
packageBundlers,
|
|
1758
1759
|
monorepoTypes,
|
|
1760
|
+
packageBundlers,
|
|
1759
1761
|
scope,
|
|
1760
1762
|
tests,
|
|
1761
1763
|
vcs,
|
|
1762
1764
|
decisions,
|
|
1763
1765
|
dialect,
|
|
1764
1766
|
provideExample,
|
|
1765
|
-
publishRegistry: registries.publish
|
|
1767
|
+
publishRegistry: configs.registries.publish
|
|
1766
1768
|
});
|
|
1767
1769
|
const verificationResults = await scaffoldVerification({
|
|
1768
1770
|
projectRoot,
|
|
@@ -1770,7 +1772,7 @@ async function scaffolder (options) {
|
|
|
1770
1772
|
visibility,
|
|
1771
1773
|
packageManager,
|
|
1772
1774
|
vcs,
|
|
1773
|
-
registries,
|
|
1775
|
+
registries: configs.registries,
|
|
1774
1776
|
tests,
|
|
1775
1777
|
unitTestFrameworks,
|
|
1776
1778
|
decisions,
|
|
@@ -1778,7 +1780,7 @@ async function scaffolder (options) {
|
|
|
1778
1780
|
});
|
|
1779
1781
|
const [nodeVersion, npmResults, dialectResults, codeStyleResults] = await Promise.all([
|
|
1780
1782
|
scaffoldNodeVersion({projectRoot, nodeVersionCategory}),
|
|
1781
|
-
scaffoldNpmConfig({projectType, projectRoot
|
|
1783
|
+
scaffoldNpmConfig({projectType, projectRoot}),
|
|
1782
1784
|
scaffoldDialect({
|
|
1783
1785
|
dialect,
|
|
1784
1786
|
configs,
|
|
@@ -1799,20 +1801,20 @@ async function scaffolder (options) {
|
|
|
1799
1801
|
tests,
|
|
1800
1802
|
decisions,
|
|
1801
1803
|
plugins: {
|
|
1802
|
-
[
|
|
1803
|
-
[
|
|
1804
|
-
[
|
|
1804
|
+
[projectTypes$1.PACKAGE]: packageTypes,
|
|
1805
|
+
[projectTypes$1.APPLICATION]: applicationTypes,
|
|
1806
|
+
[projectTypes$1.MONOREPO]: monorepoTypes
|
|
1805
1807
|
}
|
|
1806
1808
|
});
|
|
1807
|
-
const mergedContributions =
|
|
1809
|
+
const mergedContributions = deepmerge.all([
|
|
1808
1810
|
...(await Promise.all([
|
|
1809
|
-
|
|
1811
|
+
scaffoldChoice(
|
|
1810
1812
|
hosts,
|
|
1811
1813
|
chosenHost,
|
|
1812
1814
|
{buildDirectory: `./${projectTypeResults.buildDirectory}`, projectRoot, projectName, nodeVersion}
|
|
1813
1815
|
),
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
+
scaffoldChoice(ciServices, ci, {projectRoot, vcs, visibility, projectType, projectName, nodeVersion, tests}),
|
|
1817
|
+
scaffold$4({projectRoot, projectType, configs, pathWithinParent})
|
|
1816
1818
|
])),
|
|
1817
1819
|
projectTypeResults,
|
|
1818
1820
|
verificationResults,
|
|
@@ -1823,7 +1825,7 @@ async function scaffolder (options) {
|
|
|
1823
1825
|
]);
|
|
1824
1826
|
|
|
1825
1827
|
const liftResults = await lift({
|
|
1826
|
-
results:
|
|
1828
|
+
results: deepmerge({devDependencies: ['npm-run-all2'], packageManager}, mergedContributions),
|
|
1827
1829
|
projectRoot,
|
|
1828
1830
|
configs,
|
|
1829
1831
|
vcs,
|
|
@@ -1849,16 +1851,12 @@ async function tester ({projectRoot}) {
|
|
|
1849
1851
|
|
|
1850
1852
|
const jsProjectFound = nvmFound || jsPackageManagerFound;
|
|
1851
1853
|
|
|
1852
|
-
if (jsProjectFound)
|
|
1854
|
+
if (jsProjectFound) info('JavaScript Project Detected');
|
|
1853
1855
|
|
|
1854
1856
|
return jsProjectFound;
|
|
1855
1857
|
}
|
|
1856
1858
|
|
|
1857
|
-
const questionNames = {...
|
|
1859
|
+
const questionNames = {...questionNames$2, ...questionNames$1};
|
|
1858
1860
|
|
|
1859
|
-
|
|
1860
|
-
exports.questionNames = questionNames;
|
|
1861
|
-
exports.scaffold = scaffolder;
|
|
1862
|
-
exports.scaffoldUnitTesting = scaffoldUnitTesting;
|
|
1863
|
-
exports.test = tester;
|
|
1861
|
+
export { lift, questionNames, scaffolder as scaffold, scaffoldUnitTesting, tester as test };
|
|
1864
1862
|
//# sourceMappingURL=index.js.map
|