@form8ion/javascript 13.0.0-beta.7 → 13.0.0-beta.9
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/example.js +67 -69
- package/lib/index.js +295 -330
- package/lib/index.js.map +1 -1
- package/package.json +9 -17
- package/lib/index.mjs +0 -1795
- 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, projectTypes as projectTypes$1, packageManagers as packageManagers$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,7 +111,7 @@ 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
117
|
async function tester$4 ({projectRoot}) {
|
|
@@ -158,35 +122,35 @@ 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,
|
|
126
|
+
scaffold: scaffoldCoverage,
|
|
163
127
|
test: tester$4
|
|
164
128
|
});
|
|
165
129
|
|
|
166
130
|
async function chooseFramework ({frameworks, decisions}) {
|
|
167
131
|
if (!Object.keys(frameworks).length) return 'Other';
|
|
168
132
|
|
|
169
|
-
const answers = await
|
|
133
|
+
const answers = await prompt$1([{
|
|
170
134
|
name: questionNames$1.UNIT_TEST_FRAMEWORK,
|
|
171
135
|
type: 'list',
|
|
172
136
|
message: 'Which type of unit testing framework should be used?',
|
|
173
|
-
choices: [...Object.keys(frameworks),
|
|
137
|
+
choices: [...Object.keys(frameworks), 'Other']
|
|
174
138
|
}], decisions);
|
|
175
139
|
|
|
176
140
|
return answers[questionNames$1.UNIT_TEST_FRAMEWORK];
|
|
177
141
|
}
|
|
178
142
|
|
|
179
|
-
const pluginsSchema =
|
|
143
|
+
const pluginsSchema = joi.object().pattern(/^/, optionsSchemas.form8ionPlugin).default({});
|
|
180
144
|
|
|
181
145
|
async function scaffoldUnitTesting ({projectRoot, frameworks, decisions, visibility, vcs, pathWithinParent, dialect}) {
|
|
182
|
-
const validatedFrameworks =
|
|
146
|
+
const validatedFrameworks = validateOptions(pluginsSchema, frameworks);
|
|
183
147
|
const [framework, coverage] = await Promise.all([
|
|
184
148
|
chooseFramework({frameworks: validatedFrameworks, decisions})
|
|
185
|
-
.then(chosenFramework =>
|
|
149
|
+
.then(chosenFramework => scaffoldChoice(validatedFrameworks, chosenFramework, {projectRoot, dialect})),
|
|
186
150
|
scaffoldCoverage({projectRoot, vcs, visibility, pathWithinParent})
|
|
187
151
|
]);
|
|
188
152
|
|
|
189
|
-
return
|
|
153
|
+
return deepmerge.all([
|
|
190
154
|
{scripts: {'test:unit': 'cross-env NODE_ENV=test c8 run-s test:unit:base'}},
|
|
191
155
|
framework,
|
|
192
156
|
coverage
|
|
@@ -194,8 +158,8 @@ async function scaffoldUnitTesting ({projectRoot, frameworks, decisions, visibil
|
|
|
194
158
|
}
|
|
195
159
|
|
|
196
160
|
async function scaffoldRemark ({config, projectRoot, projectType, vcs}) {
|
|
197
|
-
await
|
|
198
|
-
format:
|
|
161
|
+
await write$2({
|
|
162
|
+
format: fileTypes.JSON,
|
|
199
163
|
path: projectRoot,
|
|
200
164
|
name: 'remark',
|
|
201
165
|
config: {
|
|
@@ -209,13 +173,13 @@ async function scaffoldRemark ({config, projectRoot, projectType, vcs}) {
|
|
|
209
173
|
plugins: [
|
|
210
174
|
config,
|
|
211
175
|
['remark-toc', {tight: true}],
|
|
212
|
-
...
|
|
176
|
+
...projectTypes$1.PACKAGE === projectType ? [['remark-usage', {heading: 'example'}]] : [],
|
|
213
177
|
...!vcs ? [['validate-links', {repository: false}]] : []
|
|
214
178
|
]
|
|
215
179
|
}
|
|
216
180
|
});
|
|
217
181
|
|
|
218
|
-
return
|
|
182
|
+
return deepmerge(
|
|
219
183
|
{
|
|
220
184
|
devDependencies: [config, 'remark-cli', 'remark-toc'],
|
|
221
185
|
scripts: {
|
|
@@ -223,7 +187,7 @@ async function scaffoldRemark ({config, projectRoot, projectType, vcs}) {
|
|
|
223
187
|
'generate:md': 'remark . --output'
|
|
224
188
|
}
|
|
225
189
|
},
|
|
226
|
-
{...
|
|
190
|
+
{...projectTypes$1.PACKAGE === projectType && {devDependencies: ['remark-usage']}}
|
|
227
191
|
);
|
|
228
192
|
}
|
|
229
193
|
|
|
@@ -234,41 +198,41 @@ async function scaffoldCodeStyle ({
|
|
|
234
198
|
vcs,
|
|
235
199
|
configureLinting
|
|
236
200
|
}) {
|
|
237
|
-
return
|
|
201
|
+
return deepmerge.all(await Promise.all([
|
|
238
202
|
configs.eslint
|
|
239
203
|
&& configureLinting
|
|
240
|
-
&&
|
|
204
|
+
&& scaffold$1({projectRoot, config: configs.eslint}),
|
|
241
205
|
scaffoldRemark({
|
|
242
206
|
projectRoot,
|
|
243
207
|
projectType,
|
|
244
208
|
vcs,
|
|
245
209
|
config: configs.remark || '@form8ion/remark-lint-preset'
|
|
246
210
|
}),
|
|
247
|
-
|
|
211
|
+
scaffold$2({projectRoot, config: configs.prettier})
|
|
248
212
|
].filter(Boolean)));
|
|
249
213
|
}
|
|
250
214
|
|
|
251
215
|
function lifter$4 (options) {
|
|
252
|
-
return
|
|
216
|
+
return applyEnhancers({options, enhancers: [eslintPlugin]});
|
|
253
217
|
}
|
|
254
218
|
|
|
255
219
|
function tester$3 (options) {
|
|
256
|
-
return
|
|
220
|
+
return test$1(options);
|
|
257
221
|
}
|
|
258
222
|
|
|
259
223
|
var codeStylePlugin = /*#__PURE__*/Object.freeze({
|
|
260
224
|
__proto__: null,
|
|
261
|
-
scaffold: scaffoldCodeStyle,
|
|
262
225
|
lift: lifter$4,
|
|
226
|
+
scaffold: scaffoldCodeStyle,
|
|
263
227
|
test: tester$3
|
|
264
228
|
});
|
|
265
229
|
|
|
266
230
|
async function write$1 ({projectRoot, config}) {
|
|
267
|
-
await
|
|
231
|
+
await promises$1.writeFile(`${projectRoot}/.npmrc`, stringify(config));
|
|
268
232
|
}
|
|
269
233
|
|
|
270
234
|
function projectWillNotBeConsumed(projectType) {
|
|
271
|
-
return
|
|
235
|
+
return projectTypes$1.APPLICATION === projectType || projectTypes$1.CLI === projectType;
|
|
272
236
|
}
|
|
273
237
|
|
|
274
238
|
async function scaffoldNpmConfig ({
|
|
@@ -295,7 +259,7 @@ async function scaffoldNpmConfig ({
|
|
|
295
259
|
}
|
|
296
260
|
|
|
297
261
|
function tester$2 ({projectRoot}) {
|
|
298
|
-
return
|
|
262
|
+
return fileExists(`${projectRoot}/.npmrc`);
|
|
299
263
|
}
|
|
300
264
|
|
|
301
265
|
async function lifter$3 ({projectRoot}) {
|
|
@@ -305,22 +269,22 @@ async function lifter$3 ({projectRoot}) {
|
|
|
305
269
|
provenance,
|
|
306
270
|
'engines-strict': enginesStrict,
|
|
307
271
|
...remainingProperties
|
|
308
|
-
} =
|
|
272
|
+
} = parse(await promises$1.readFile(pathToConfig, 'utf-8'));
|
|
309
273
|
|
|
310
|
-
await
|
|
274
|
+
await promises$1.writeFile(pathToConfig, stringify(remainingProperties));
|
|
311
275
|
|
|
312
276
|
return {};
|
|
313
277
|
}
|
|
314
278
|
|
|
315
279
|
var npmConfigPlugin = /*#__PURE__*/Object.freeze({
|
|
316
280
|
__proto__: null,
|
|
281
|
+
lift: lifter$3,
|
|
317
282
|
scaffold: scaffoldNpmConfig,
|
|
318
|
-
test: tester$2
|
|
319
|
-
lift: lifter$3
|
|
283
|
+
test: tester$2
|
|
320
284
|
});
|
|
321
285
|
|
|
322
286
|
async function test({projectRoot}) {
|
|
323
|
-
const {engines} = JSON.parse(await
|
|
287
|
+
const {engines} = JSON.parse(await promises.readFile(`${projectRoot}/package.json`, 'utf8'));
|
|
324
288
|
|
|
325
289
|
return !!engines?.node;
|
|
326
290
|
}
|
|
@@ -335,27 +299,27 @@ async function lift$1({packageDetails: {name}}) {
|
|
|
335
299
|
|
|
336
300
|
var enginesEnhancer = /*#__PURE__*/Object.freeze({
|
|
337
301
|
__proto__: null,
|
|
338
|
-
|
|
339
|
-
|
|
302
|
+
lift: lift$1,
|
|
303
|
+
test: test
|
|
340
304
|
});
|
|
341
305
|
|
|
342
306
|
function buildDocumentationCommand (packageManager) {
|
|
343
|
-
if (
|
|
344
|
-
if (
|
|
307
|
+
if (packageManagers$1.NPM === packageManager) return 'npm run generate:md';
|
|
308
|
+
if (packageManagers$1.YARN === packageManager) return 'yarn generate:md';
|
|
345
309
|
|
|
346
310
|
throw new Error(
|
|
347
311
|
`The ${packageManager} package manager is currently not supported. `
|
|
348
|
-
+ `Only ${Object.values(
|
|
312
|
+
+ `Only ${Object.values(packageManagers$1).join(' and ')} are currently supported.`
|
|
349
313
|
);
|
|
350
314
|
}
|
|
351
315
|
|
|
352
316
|
function getInstallationCommand(packageManager) {
|
|
353
|
-
if (
|
|
354
|
-
if (
|
|
317
|
+
if (packageManagers$1.NPM === packageManager) return 'npm install';
|
|
318
|
+
if (packageManagers$1.YARN === packageManager) return 'yarn add';
|
|
355
319
|
|
|
356
320
|
throw new Error(
|
|
357
321
|
`The ${packageManager} package manager is currently not supported. `
|
|
358
|
-
+ `Only ${Object.values(
|
|
322
|
+
+ `Only ${Object.values(packageManagers$1).join(' and ')} are currently supported.`
|
|
359
323
|
);
|
|
360
324
|
}
|
|
361
325
|
|
|
@@ -421,7 +385,7 @@ async function liftProvenance ({projectRoot, packageDetails}) {
|
|
|
421
385
|
const {publishConfig: {access}} = packageDetails;
|
|
422
386
|
|
|
423
387
|
if ('public' === access) {
|
|
424
|
-
await
|
|
388
|
+
await mergeIntoExistingPackageJson({projectRoot, config: {publishConfig: {provenance: true}}});
|
|
425
389
|
|
|
426
390
|
return enhanceSlsa({provenance: true});
|
|
427
391
|
}
|
|
@@ -433,9 +397,9 @@ async function liftPublishable ({projectRoot, packageDetails}) {
|
|
|
433
397
|
const {name: packageName, publishConfig: {access: packageAccessLevel}} = packageDetails;
|
|
434
398
|
const homepage = `https://npm.im/${packageName}`;
|
|
435
399
|
|
|
436
|
-
await
|
|
400
|
+
await mergeIntoExistingPackageJson({projectRoot, config: {homepage}});
|
|
437
401
|
|
|
438
|
-
return
|
|
402
|
+
return deepmerge(
|
|
439
403
|
await liftProvenance({packageDetails, projectRoot}),
|
|
440
404
|
{
|
|
441
405
|
homepage,
|
|
@@ -455,7 +419,7 @@ async function scaffoldPublishable ({packageName, packageAccessLevel}) {
|
|
|
455
419
|
async function chooseBundler ({bundlers, decisions}) {
|
|
456
420
|
if (!Object.keys(bundlers).length) return 'Other';
|
|
457
421
|
|
|
458
|
-
const answers = await
|
|
422
|
+
const answers = await prompt$1([{
|
|
459
423
|
name: questionNames$1.PACKAGE_BUNDLER,
|
|
460
424
|
type: 'list',
|
|
461
425
|
message: 'Which bundler should be used?',
|
|
@@ -468,32 +432,32 @@ async function chooseBundler ({bundlers, decisions}) {
|
|
|
468
432
|
async function scaffoldBundler ({projectRoot, projectType, bundlers, dialect, decisions}) {
|
|
469
433
|
const chosenBundler = await chooseBundler({bundlers, decisions});
|
|
470
434
|
|
|
471
|
-
return
|
|
435
|
+
return scaffoldChoice(bundlers, chosenBundler, {projectRoot, projectType, dialect});
|
|
472
436
|
}
|
|
473
437
|
|
|
474
438
|
function determinePathToTemplateFile (fileName) {
|
|
475
|
-
const [, __dirname] =
|
|
439
|
+
const [, __dirname] = filedirname();
|
|
476
440
|
|
|
477
|
-
return
|
|
441
|
+
return resolve(__dirname, '..', 'templates', fileName);
|
|
478
442
|
}
|
|
479
443
|
|
|
480
444
|
const defaultBuildDirectory$2 = 'lib';
|
|
481
445
|
|
|
482
446
|
async function createExample(projectRoot, projectName, dialect) {
|
|
483
|
-
return
|
|
447
|
+
return promises.writeFile(
|
|
484
448
|
`${projectRoot}/example.js`,
|
|
485
|
-
|
|
486
|
-
await
|
|
487
|
-
{projectName:
|
|
449
|
+
mustache.render(
|
|
450
|
+
await promises.readFile(determinePathToTemplateFile('example.mustache'), 'utf8'),
|
|
451
|
+
{projectName: camelcase(projectName), esm: dialect === dialects$1.ESM}
|
|
488
452
|
)
|
|
489
453
|
);
|
|
490
454
|
}
|
|
491
455
|
|
|
492
456
|
async function buildDetailsForCommonJsProject({projectRoot, projectName, provideExample}) {
|
|
493
457
|
await Promise.all([
|
|
494
|
-
|
|
458
|
+
touch(`${projectRoot}/index.js`),
|
|
495
459
|
provideExample
|
|
496
|
-
?
|
|
460
|
+
? promises.writeFile(`${projectRoot}/example.js`, `const ${camelcase(projectName)} = require('.');\n`)
|
|
497
461
|
: Promise.resolve()
|
|
498
462
|
]);
|
|
499
463
|
|
|
@@ -510,16 +474,16 @@ async function buildDetails ({
|
|
|
510
474
|
provideExample,
|
|
511
475
|
decisions
|
|
512
476
|
}) {
|
|
513
|
-
if (
|
|
477
|
+
if (dialects$1.COMMON_JS === dialect) return buildDetailsForCommonJsProject({projectRoot, projectName, provideExample});
|
|
514
478
|
|
|
515
|
-
const pathToCreatedSrcDirectory = await
|
|
479
|
+
const pathToCreatedSrcDirectory = await mkdir(`${projectRoot}/src`);
|
|
516
480
|
const [bundlerResults] = await Promise.all([
|
|
517
|
-
scaffoldBundler({bundlers: packageBundlers, projectRoot, dialect, decisions, projectType:
|
|
481
|
+
scaffoldBundler({bundlers: packageBundlers, projectRoot, dialect, decisions, projectType: projectTypes$1.PACKAGE}),
|
|
518
482
|
provideExample ? await createExample(projectRoot, projectName, dialect) : Promise.resolve,
|
|
519
|
-
|
|
483
|
+
touch(`${pathToCreatedSrcDirectory}/index.js`)
|
|
520
484
|
]);
|
|
521
485
|
|
|
522
|
-
return
|
|
486
|
+
return deepmerge(
|
|
523
487
|
bundlerResults,
|
|
524
488
|
{
|
|
525
489
|
devDependencies: ['rimraf'],
|
|
@@ -560,7 +524,7 @@ async function scaffoldPackageType ({
|
|
|
560
524
|
provideExample,
|
|
561
525
|
publishRegistry
|
|
562
526
|
}) {
|
|
563
|
-
|
|
527
|
+
info('Scaffolding Package Details');
|
|
564
528
|
|
|
565
529
|
const packageAccessLevel = determinePackageAccessLevelFromProjectVisibility({projectVisibility: visibility});
|
|
566
530
|
const [detailsForBuild, publishableResults] = await Promise.all([
|
|
@@ -575,17 +539,17 @@ async function scaffoldPackageType ({
|
|
|
575
539
|
decisions
|
|
576
540
|
}),
|
|
577
541
|
scaffoldPublishable({packageName, packageAccessLevel}),
|
|
578
|
-
|
|
542
|
+
mergeIntoExistingPackageJson({
|
|
579
543
|
projectRoot,
|
|
580
544
|
config: {
|
|
581
|
-
files: ['example.js', ...
|
|
545
|
+
files: ['example.js', ...dialects$1.COMMON_JS === dialect ? ['index.js'] : ['lib/']],
|
|
582
546
|
publishConfig: {
|
|
583
547
|
access: packageAccessLevel,
|
|
584
548
|
...publishRegistry && {registry: publishRegistry}
|
|
585
549
|
},
|
|
586
550
|
sideEffects: false,
|
|
587
551
|
...'Public' === visibility && {runkitExampleFilename: './example.js'},
|
|
588
|
-
...
|
|
552
|
+
...dialects$1.BABEL === dialect && {
|
|
589
553
|
main: './lib/index.js',
|
|
590
554
|
module: './lib/index.mjs',
|
|
591
555
|
exports: {
|
|
@@ -594,11 +558,11 @@ async function scaffoldPackageType ({
|
|
|
594
558
|
import: './lib/index.mjs'
|
|
595
559
|
}
|
|
596
560
|
},
|
|
597
|
-
...
|
|
561
|
+
...dialects$1.ESM === dialect && {
|
|
598
562
|
main: './lib/index.js',
|
|
599
563
|
exports: './lib/index.js'
|
|
600
564
|
},
|
|
601
|
-
...
|
|
565
|
+
...dialects$1.TYPESCRIPT === dialect && {
|
|
602
566
|
main: './lib/index.js',
|
|
603
567
|
module: './lib/index.mjs',
|
|
604
568
|
types: './lib/index.d.ts',
|
|
@@ -612,7 +576,7 @@ async function scaffoldPackageType ({
|
|
|
612
576
|
})
|
|
613
577
|
]);
|
|
614
578
|
|
|
615
|
-
return
|
|
579
|
+
return deepmerge.all([
|
|
616
580
|
publishableResults,
|
|
617
581
|
{
|
|
618
582
|
documentation: scaffoldPackageDocumentation({packageName, visibility, scope, packageManager, provideExample}),
|
|
@@ -637,9 +601,9 @@ async function isPackage ({packageDetails: {exports, publishConfig, bin}}) {
|
|
|
637
601
|
const defaultBuildDirectory$1 = 'public';
|
|
638
602
|
|
|
639
603
|
async function scaffoldApplicationType ({projectRoot}) {
|
|
640
|
-
|
|
604
|
+
info('Scaffolding Application Details');
|
|
641
605
|
|
|
642
|
-
await
|
|
606
|
+
await mergeIntoExistingPackageJson({projectRoot, config: {private: true}});
|
|
643
607
|
|
|
644
608
|
const buildDirectory = defaultBuildDirectory$1;
|
|
645
609
|
|
|
@@ -662,9 +626,9 @@ function isApplication ({packageDetails}) {
|
|
|
662
626
|
}
|
|
663
627
|
|
|
664
628
|
async function scaffoldMonorepoType ({projectRoot}) {
|
|
665
|
-
|
|
629
|
+
info('Scaffolding Monorepo Details');
|
|
666
630
|
|
|
667
|
-
await
|
|
631
|
+
await mergeIntoExistingPackageJson({projectRoot, config: {private: true}});
|
|
668
632
|
|
|
669
633
|
return {
|
|
670
634
|
nextSteps: [{
|
|
@@ -688,9 +652,9 @@ async function scaffoldCliType ({
|
|
|
688
652
|
}) {
|
|
689
653
|
const packageAccessLevel = determinePackageAccessLevelFromProjectVisibility({projectVisibility: visibility});
|
|
690
654
|
const [bundlerResults, publishableResults] = await Promise.all([
|
|
691
|
-
scaffoldBundler({bundlers: packageBundlers, projectRoot, dialect, decisions, projectType:
|
|
655
|
+
scaffoldBundler({bundlers: packageBundlers, projectRoot, dialect, decisions, projectType: projectTypes$1.CLI}),
|
|
692
656
|
scaffoldPublishable({packageName, packageAccessLevel}),
|
|
693
|
-
|
|
657
|
+
mergeIntoExistingPackageJson({
|
|
694
658
|
projectRoot,
|
|
695
659
|
config: {
|
|
696
660
|
bin: {},
|
|
@@ -703,7 +667,7 @@ async function scaffoldCliType ({
|
|
|
703
667
|
})
|
|
704
668
|
]);
|
|
705
669
|
|
|
706
|
-
return
|
|
670
|
+
return deepmerge.all([
|
|
707
671
|
publishableResults,
|
|
708
672
|
bundlerResults,
|
|
709
673
|
{
|
|
@@ -745,7 +709,7 @@ async function scaffoldProjectType ({
|
|
|
745
709
|
publishRegistry
|
|
746
710
|
}) {
|
|
747
711
|
switch (projectType) {
|
|
748
|
-
case
|
|
712
|
+
case projectTypes$1.PACKAGE:
|
|
749
713
|
return scaffoldPackageType({
|
|
750
714
|
projectRoot,
|
|
751
715
|
projectName,
|
|
@@ -759,9 +723,9 @@ async function scaffoldProjectType ({
|
|
|
759
723
|
provideExample,
|
|
760
724
|
publishRegistry
|
|
761
725
|
});
|
|
762
|
-
case
|
|
726
|
+
case projectTypes$1.APPLICATION:
|
|
763
727
|
return scaffoldApplicationType({projectRoot});
|
|
764
|
-
case
|
|
728
|
+
case projectTypes$1.CLI:
|
|
765
729
|
return scaffoldCliType({
|
|
766
730
|
packageName,
|
|
767
731
|
visibility,
|
|
@@ -771,7 +735,7 @@ async function scaffoldProjectType ({
|
|
|
771
735
|
decisions,
|
|
772
736
|
packageBundlers
|
|
773
737
|
});
|
|
774
|
-
case
|
|
738
|
+
case projectTypes$1.MONOREPO:
|
|
775
739
|
return scaffoldMonorepoType({projectRoot});
|
|
776
740
|
case 'Other':
|
|
777
741
|
return {};
|
|
@@ -799,7 +763,7 @@ async function lifter$2 ({projectRoot, packageDetails, vcs}) {
|
|
|
799
763
|
if (vcsRepositoryHostedOnGithub(vcs)) {
|
|
800
764
|
homepage = `https://github.com/${vcs.owner}/${vcs.name}#readme`;
|
|
801
765
|
|
|
802
|
-
await
|
|
766
|
+
await mergeIntoExistingPackageJson({projectRoot, config: {homepage}});
|
|
803
767
|
}
|
|
804
768
|
|
|
805
769
|
return {homepage};
|
|
@@ -807,18 +771,22 @@ async function lifter$2 ({projectRoot, packageDetails, vcs}) {
|
|
|
807
771
|
|
|
808
772
|
var projectTypes = /*#__PURE__*/Object.freeze({
|
|
809
773
|
__proto__: null,
|
|
774
|
+
lift: lifter$2,
|
|
810
775
|
scaffold: scaffoldProjectType,
|
|
811
|
-
test: tester$1
|
|
812
|
-
lift: lifter$2
|
|
776
|
+
test: tester$1
|
|
813
777
|
});
|
|
814
778
|
|
|
815
779
|
function write ({projectRoot, config}) {
|
|
816
|
-
return
|
|
780
|
+
return write$2({path: projectRoot, name: 'babel', format: fileTypes.JSON, config});
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
function loadConfig () {
|
|
784
|
+
return load({name: 'babel'});
|
|
817
785
|
}
|
|
818
786
|
|
|
819
787
|
async function addIgnore ({projectRoot, ignore}) {
|
|
820
788
|
if (ignore) {
|
|
821
|
-
const existingConfig =
|
|
789
|
+
const existingConfig = await loadConfig();
|
|
822
790
|
|
|
823
791
|
await write({projectRoot, config: {...existingConfig, ignore: [`./${ignore}/`]}});
|
|
824
792
|
}
|
|
@@ -844,22 +812,22 @@ async function lifter$1 ({results, projectRoot}) {
|
|
|
844
812
|
}
|
|
845
813
|
|
|
846
814
|
function predicate ({projectRoot}) {
|
|
847
|
-
return
|
|
815
|
+
return fileExists(`${projectRoot}/.babelrc.json`);
|
|
848
816
|
}
|
|
849
817
|
|
|
850
818
|
async function scaffoldTypescript ({config, projectType, projectRoot, testFilenamePattern}) {
|
|
851
819
|
const shareableTsConfigPackage = `${config.scope}/tsconfig`;
|
|
852
820
|
|
|
853
|
-
await
|
|
821
|
+
await writeConfigFile({
|
|
854
822
|
path: projectRoot,
|
|
855
823
|
name: 'tsconfig',
|
|
856
|
-
format:
|
|
824
|
+
format: fileTypes.JSON,
|
|
857
825
|
config: {
|
|
858
826
|
$schema: 'https://json.schemastore.org/tsconfig',
|
|
859
827
|
extends: shareableTsConfigPackage,
|
|
860
828
|
compilerOptions: {
|
|
861
829
|
rootDir: 'src',
|
|
862
|
-
...
|
|
830
|
+
...projectTypes$1.PACKAGE === projectType && {
|
|
863
831
|
outDir: 'lib',
|
|
864
832
|
declaration: true
|
|
865
833
|
}
|
|
@@ -878,9 +846,9 @@ async function scaffoldTypescript ({config, projectType, projectRoot, testFilena
|
|
|
878
846
|
|
|
879
847
|
function scaffoldDialect ({dialect, projectType, projectRoot, configs, testFilenamePattern}) {
|
|
880
848
|
switch (dialect) {
|
|
881
|
-
case
|
|
849
|
+
case dialects$1.BABEL:
|
|
882
850
|
return scaffoldBabel({preset: configs.babelPreset, projectRoot});
|
|
883
|
-
case
|
|
851
|
+
case dialects$1.TYPESCRIPT:
|
|
884
852
|
return scaffoldTypescript({config: configs.typescript, projectType, projectRoot, testFilenamePattern});
|
|
885
853
|
default:
|
|
886
854
|
return {};
|
|
@@ -889,11 +857,22 @@ function scaffoldDialect ({dialect, projectType, projectRoot, configs, testFilen
|
|
|
889
857
|
|
|
890
858
|
var dialects = /*#__PURE__*/Object.freeze({
|
|
891
859
|
__proto__: null,
|
|
860
|
+
lift: lifter$1,
|
|
892
861
|
scaffold: scaffoldDialect,
|
|
893
|
-
test: predicate
|
|
894
|
-
lift: lifter$1
|
|
862
|
+
test: predicate
|
|
895
863
|
});
|
|
896
864
|
|
|
865
|
+
function buildPackageName (projectName, scope) {
|
|
866
|
+
const name = `${scope ? `@${scope}/` : ''}${projectName}`;
|
|
867
|
+
|
|
868
|
+
const {validForNewPackages, errors} = validatePackageName(name);
|
|
869
|
+
|
|
870
|
+
if (validForNewPackages) return name;
|
|
871
|
+
if (1 === errors.length && errors.includes('name cannot start with a period')) return projectName.slice(1);
|
|
872
|
+
|
|
873
|
+
throw new Error(`The package name ${name} is invalid:${EOL}\t* ${errors.join(`${EOL}\t* `)}`);
|
|
874
|
+
}
|
|
875
|
+
|
|
897
876
|
function buildPackageDetails ({
|
|
898
877
|
packageName,
|
|
899
878
|
dialect,
|
|
@@ -905,7 +884,7 @@ function buildPackageDetails ({
|
|
|
905
884
|
name: packageName,
|
|
906
885
|
description,
|
|
907
886
|
license,
|
|
908
|
-
type:
|
|
887
|
+
type: dialects$1.ESM === dialect ? 'module' : 'commonjs',
|
|
909
888
|
author: `${author.name}${author.email ? ` <${author.email}>` : ''}${author.url ? ` (${author.url})` : ''}`,
|
|
910
889
|
scripts: {}
|
|
911
890
|
};
|
|
@@ -913,29 +892,33 @@ function buildPackageDetails ({
|
|
|
913
892
|
|
|
914
893
|
async function scaffoldPackage ({
|
|
915
894
|
projectRoot,
|
|
895
|
+
projectName,
|
|
896
|
+
scope,
|
|
916
897
|
dialect,
|
|
917
|
-
packageName,
|
|
918
898
|
license,
|
|
919
899
|
author,
|
|
920
900
|
description
|
|
921
901
|
}) {
|
|
922
|
-
|
|
902
|
+
info('Configuring package.json');
|
|
923
903
|
|
|
924
|
-
const
|
|
925
|
-
packageName,
|
|
926
|
-
dialect,
|
|
927
|
-
license,
|
|
928
|
-
author,
|
|
929
|
-
description
|
|
930
|
-
});
|
|
904
|
+
const packageName = buildPackageName(projectName, scope);
|
|
931
905
|
|
|
932
|
-
await
|
|
906
|
+
await writePackageJson({
|
|
907
|
+
projectRoot,
|
|
908
|
+
config: await buildPackageDetails({
|
|
909
|
+
packageName,
|
|
910
|
+
dialect,
|
|
911
|
+
license,
|
|
912
|
+
author,
|
|
913
|
+
description
|
|
914
|
+
})
|
|
915
|
+
});
|
|
933
916
|
|
|
934
|
-
return {};
|
|
917
|
+
return {packageName};
|
|
935
918
|
}
|
|
936
919
|
|
|
937
920
|
function sortPackageProperties (packageContents) {
|
|
938
|
-
return
|
|
921
|
+
return sortProperties(
|
|
939
922
|
packageContents,
|
|
940
923
|
[
|
|
941
924
|
'name',
|
|
@@ -985,19 +968,19 @@ function defineVcsHostDetails (vcs, pathWithinParent) {
|
|
|
985
968
|
}
|
|
986
969
|
|
|
987
970
|
const details = {
|
|
988
|
-
[
|
|
971
|
+
[packageManagers$1.NPM]: {
|
|
989
972
|
installationCommand: 'install',
|
|
990
973
|
installationFlags: {
|
|
991
|
-
[
|
|
992
|
-
[
|
|
974
|
+
[DEV_DEPENDENCY_TYPE]: `save-${DEV_DEPENDENCY_TYPE}`,
|
|
975
|
+
[PROD_DEPENDENCY_TYPE]: `save-${PROD_DEPENDENCY_TYPE}`,
|
|
993
976
|
exact: 'save-exact'
|
|
994
977
|
}
|
|
995
978
|
},
|
|
996
|
-
[
|
|
979
|
+
[packageManagers$1.YARN]: {
|
|
997
980
|
installationCommand: 'add',
|
|
998
981
|
installationFlags: {
|
|
999
|
-
[
|
|
1000
|
-
[
|
|
982
|
+
[DEV_DEPENDENCY_TYPE]: DEV_DEPENDENCY_TYPE,
|
|
983
|
+
[PROD_DEPENDENCY_TYPE]: PROD_DEPENDENCY_TYPE,
|
|
1001
984
|
exact: 'exact'
|
|
1002
985
|
}
|
|
1003
986
|
}
|
|
@@ -1015,19 +998,31 @@ function getExactFlag(manager) {
|
|
|
1015
998
|
return details[manager].installationFlags.exact;
|
|
1016
999
|
}
|
|
1017
1000
|
|
|
1018
|
-
async function install$1 (dependencies, dependenciesType, projectRoot, packageManager =
|
|
1001
|
+
async function install$1 (dependencies, dependenciesType, projectRoot, packageManager = packageManagers$1.NPM) {
|
|
1019
1002
|
if (dependencies.length) {
|
|
1020
|
-
|
|
1003
|
+
info(`Installing ${dependenciesType} dependencies`, {level: 'secondary'});
|
|
1021
1004
|
|
|
1022
|
-
await
|
|
1005
|
+
await execa(
|
|
1023
1006
|
`. ~/.nvm/nvm.sh && nvm use && ${packageManager} ${
|
|
1024
1007
|
getInstallationCommandFor(packageManager)
|
|
1025
1008
|
} ${[...new Set(dependencies)].join(' ')} --${getDependencyTypeFlag(packageManager, dependenciesType)}${
|
|
1026
|
-
|
|
1009
|
+
DEV_DEPENDENCY_TYPE === dependenciesType ? ` --${getExactFlag(packageManager)}` : ''
|
|
1027
1010
|
}`,
|
|
1028
1011
|
{shell: true, cwd: projectRoot}
|
|
1029
1012
|
);
|
|
1030
|
-
} else
|
|
1013
|
+
} else warn(`No ${dependenciesType} dependencies to install`);
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
async function processDependencies ({dependencies, devDependencies, projectRoot, packageManager}) {
|
|
1017
|
+
info('Processing dependencies');
|
|
1018
|
+
|
|
1019
|
+
try {
|
|
1020
|
+
await install$1(dependencies || [], PROD_DEPENDENCY_TYPE, projectRoot, packageManager);
|
|
1021
|
+
await install$1(devDependencies || [], DEV_DEPENDENCY_TYPE, projectRoot, packageManager);
|
|
1022
|
+
} catch (e) {
|
|
1023
|
+
error('Failed to update dependencies');
|
|
1024
|
+
error(e, {level: 'secondary'});
|
|
1025
|
+
}
|
|
1031
1026
|
}
|
|
1032
1027
|
|
|
1033
1028
|
function projectWillBeTested(scripts) {
|
|
@@ -1063,55 +1058,43 @@ async function liftPackage ({
|
|
|
1063
1058
|
vcs,
|
|
1064
1059
|
pathWithinParent
|
|
1065
1060
|
}) {
|
|
1066
|
-
|
|
1067
|
-
cliMessages.info('Updating `package.json`', {level: 'secondary'});
|
|
1061
|
+
info('Updating `package.json`', {level: 'secondary'});
|
|
1068
1062
|
|
|
1069
|
-
|
|
1063
|
+
const existingPackageJsonContents = JSON.parse(await promises.readFile(`${projectRoot}/package.json`, 'utf-8'));
|
|
1070
1064
|
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
scripts
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
})
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
cliMessages.info('Installing dependencies');
|
|
1065
|
+
await writePackageJson({
|
|
1066
|
+
projectRoot,
|
|
1067
|
+
config: sortPackageProperties({
|
|
1068
|
+
...existingPackageJsonContents,
|
|
1069
|
+
...defineVcsHostDetails(vcs, pathWithinParent),
|
|
1070
|
+
scripts: liftScripts({
|
|
1071
|
+
existingScripts: existingPackageJsonContents.scripts,
|
|
1072
|
+
scripts
|
|
1073
|
+
}),
|
|
1074
|
+
...tags && {
|
|
1075
|
+
keywords: existingPackageJsonContents.keywords ? [...existingPackageJsonContents.keywords, ...tags] : tags
|
|
1076
|
+
}
|
|
1077
|
+
})
|
|
1078
|
+
});
|
|
1090
1079
|
|
|
1091
|
-
|
|
1092
|
-
await install$1(dependencies || [], javascriptCore.PROD_DEPENDENCY_TYPE, projectRoot, packageManager);
|
|
1093
|
-
await install$1([...devDependencies || []], javascriptCore.DEV_DEPENDENCY_TYPE, projectRoot, packageManager);
|
|
1094
|
-
} catch (e) {
|
|
1095
|
-
cliMessages.error('Failed to install dependencies');
|
|
1096
|
-
cliMessages.error(e, {level: 'secondary'});
|
|
1097
|
-
}
|
|
1080
|
+
await processDependencies({dependencies, devDependencies, projectRoot, packageManager});
|
|
1098
1081
|
}
|
|
1099
1082
|
|
|
1100
1083
|
function determineLockfilePathFor (packageManager) {
|
|
1101
1084
|
const lockfilePaths = {
|
|
1102
|
-
[
|
|
1103
|
-
[
|
|
1085
|
+
[packageManagers$1.NPM]: 'package-lock.json',
|
|
1086
|
+
[packageManagers$1.YARN]: 'yarn.lock'
|
|
1104
1087
|
};
|
|
1105
1088
|
|
|
1106
1089
|
return lockfilePaths[packageManager];
|
|
1107
1090
|
}
|
|
1108
1091
|
|
|
1109
1092
|
function npmIsUsed ({projectRoot}) {
|
|
1110
|
-
return
|
|
1093
|
+
return fileExists(`${projectRoot}/${determineLockfilePathFor(packageManagers$1.NPM)}`);
|
|
1111
1094
|
}
|
|
1112
1095
|
|
|
1113
1096
|
function yarnIsUsed ({projectRoot}) {
|
|
1114
|
-
return
|
|
1097
|
+
return fileExists(`${projectRoot}/${determineLockfilePathFor(packageManagers$1.YARN)}`);
|
|
1115
1098
|
}
|
|
1116
1099
|
|
|
1117
1100
|
async function jsPackageManagerIsUsed ({projectRoot}) {
|
|
@@ -1124,7 +1107,7 @@ async function jsPackageManagerIsUsed ({projectRoot}) {
|
|
|
1124
1107
|
}
|
|
1125
1108
|
|
|
1126
1109
|
async function liftCorepack () {
|
|
1127
|
-
await
|
|
1110
|
+
await execa('corepack', ['use', 'npm@latest']);
|
|
1128
1111
|
}
|
|
1129
1112
|
|
|
1130
1113
|
async function lifter () {
|
|
@@ -1137,11 +1120,11 @@ async function resolvePackageManager ({projectRoot, packageManager}) {
|
|
|
1137
1120
|
if (packageManager) return packageManager;
|
|
1138
1121
|
|
|
1139
1122
|
if (await npmIsUsed({projectRoot})) {
|
|
1140
|
-
return
|
|
1123
|
+
return packageManagers$1.NPM;
|
|
1141
1124
|
}
|
|
1142
1125
|
|
|
1143
1126
|
if (await yarnIsUsed({projectRoot})) {
|
|
1144
|
-
return
|
|
1127
|
+
return packageManagers$1.YARN;
|
|
1145
1128
|
}
|
|
1146
1129
|
|
|
1147
1130
|
throw new Error('Package-manager could not be determined');
|
|
@@ -1149,14 +1132,14 @@ async function resolvePackageManager ({projectRoot, packageManager}) {
|
|
|
1149
1132
|
|
|
1150
1133
|
var packageManagers = /*#__PURE__*/Object.freeze({
|
|
1151
1134
|
__proto__: null,
|
|
1152
|
-
|
|
1153
|
-
lift: lifter,
|
|
1135
|
+
defineLockfilePath: determineLockfilePathFor,
|
|
1154
1136
|
determineCurrent: resolvePackageManager,
|
|
1155
|
-
|
|
1137
|
+
lift: lifter,
|
|
1138
|
+
test: jsPackageManagerIsUsed
|
|
1156
1139
|
});
|
|
1157
1140
|
|
|
1158
1141
|
async function lift ({projectRoot, vcs, results, pathWithinParent, enhancers = {}}) {
|
|
1159
|
-
|
|
1142
|
+
info('Lifting JavaScript-specific details');
|
|
1160
1143
|
|
|
1161
1144
|
const {
|
|
1162
1145
|
scripts,
|
|
@@ -1168,17 +1151,17 @@ async function lift ({projectRoot, vcs, results, pathWithinParent, enhancers = {
|
|
|
1168
1151
|
|
|
1169
1152
|
const [packageManager, packageContents] = await Promise.all([
|
|
1170
1153
|
resolvePackageManager({projectRoot, packageManager: manager}),
|
|
1171
|
-
|
|
1154
|
+
promises$1.readFile(`${projectRoot}/package.json`, 'utf8')
|
|
1172
1155
|
]);
|
|
1173
1156
|
|
|
1174
|
-
const enhancerResults = await
|
|
1157
|
+
const enhancerResults = await applyEnhancers({
|
|
1175
1158
|
results,
|
|
1176
1159
|
enhancers: {
|
|
1177
1160
|
...enhancers,
|
|
1178
|
-
huskyPlugin
|
|
1161
|
+
huskyPlugin,
|
|
1179
1162
|
enginesEnhancer,
|
|
1180
1163
|
coveragePlugin,
|
|
1181
|
-
commitConventionPlugin
|
|
1164
|
+
commitConventionPlugin,
|
|
1182
1165
|
dialects,
|
|
1183
1166
|
codeStylePlugin,
|
|
1184
1167
|
npmConfigPlugin,
|
|
@@ -1189,7 +1172,7 @@ async function lift ({projectRoot, vcs, results, pathWithinParent, enhancers = {
|
|
|
1189
1172
|
});
|
|
1190
1173
|
|
|
1191
1174
|
await liftPackage(
|
|
1192
|
-
|
|
1175
|
+
deepmerge.all([
|
|
1193
1176
|
{projectRoot, scripts, tags, dependencies, devDependencies, packageManager, vcs, pathWithinParent},
|
|
1194
1177
|
enhancerResults
|
|
1195
1178
|
])
|
|
@@ -1198,43 +1181,43 @@ async function lift ({projectRoot, vcs, results, pathWithinParent, enhancers = {
|
|
|
1198
1181
|
return enhancerResults;
|
|
1199
1182
|
}
|
|
1200
1183
|
|
|
1201
|
-
const
|
|
1202
|
-
host: joi__default["default"].string().required(),
|
|
1203
|
-
owner: joi__default["default"].string().required(),
|
|
1204
|
-
name: joi__default["default"].string().required()
|
|
1205
|
-
});
|
|
1206
|
-
|
|
1207
|
-
const scopeBasedConfigSchema = joi__default["default"].object({scope: joi__default["default"].string().regex(/^@[a-z0-9-]+$/i, 'scope').required()});
|
|
1184
|
+
const scopeBasedConfigSchema = joi.object({scope: joi.string().regex(/^@[a-z0-9-]+$/i, 'scope').required()});
|
|
1208
1185
|
|
|
1209
|
-
const nameBasedConfigSchema =
|
|
1210
|
-
packageName:
|
|
1211
|
-
name:
|
|
1186
|
+
const nameBasedConfigSchema = joi.object({
|
|
1187
|
+
packageName: joi.string().required(),
|
|
1188
|
+
name: joi.string().required()
|
|
1212
1189
|
});
|
|
1213
1190
|
|
|
1214
|
-
const registriesSchema =
|
|
1191
|
+
const registriesSchema = joi.object().pattern(joi.string(), joi.string().uri()).default({});
|
|
1192
|
+
|
|
1193
|
+
const visibilitySchema = joi.string().valid('Public', 'Private').required();
|
|
1215
1194
|
|
|
1216
|
-
const
|
|
1195
|
+
const projectNameSchema = joi.string().regex(/^@\w*\//, {invert: true}).required();
|
|
1217
1196
|
|
|
1218
|
-
const
|
|
1197
|
+
const vcsSchema = joi.object({
|
|
1198
|
+
host: joi.string().required(),
|
|
1199
|
+
owner: joi.string().required(),
|
|
1200
|
+
name: joi.string().required()
|
|
1201
|
+
});
|
|
1219
1202
|
|
|
1220
1203
|
function validate(options) {
|
|
1221
|
-
const schema =
|
|
1222
|
-
projectRoot:
|
|
1204
|
+
const schema = joi.object({
|
|
1205
|
+
projectRoot: joi.string().required(),
|
|
1223
1206
|
projectName: projectNameSchema,
|
|
1224
1207
|
visibility: visibilitySchema,
|
|
1225
|
-
license:
|
|
1226
|
-
description:
|
|
1227
|
-
pathWithinParent:
|
|
1228
|
-
decisions:
|
|
1208
|
+
license: joi.string().required(),
|
|
1209
|
+
description: joi.string(),
|
|
1210
|
+
pathWithinParent: joi.string(),
|
|
1211
|
+
decisions: joi.object(),
|
|
1229
1212
|
vcs: vcsSchema,
|
|
1230
1213
|
registries: registriesSchema,
|
|
1231
|
-
configs:
|
|
1214
|
+
configs: joi.object({
|
|
1232
1215
|
eslint: scopeBasedConfigSchema,
|
|
1233
1216
|
typescript: scopeBasedConfigSchema,
|
|
1234
1217
|
prettier: scopeBasedConfigSchema,
|
|
1235
1218
|
commitlint: nameBasedConfigSchema,
|
|
1236
1219
|
babelPreset: nameBasedConfigSchema,
|
|
1237
|
-
remark:
|
|
1220
|
+
remark: joi.string()
|
|
1238
1221
|
}).default({}),
|
|
1239
1222
|
plugins: {
|
|
1240
1223
|
unitTestFrameworks: pluginsSchema,
|
|
@@ -1246,32 +1229,29 @@ function validate(options) {
|
|
|
1246
1229
|
ciServices: pluginsSchema
|
|
1247
1230
|
}
|
|
1248
1231
|
}).required();
|
|
1249
|
-
// .keys({
|
|
1250
|
-
// projectName: joi.string().regex(/^@\w*\//, {invert: true}).required(),
|
|
1251
|
-
// })
|
|
1252
1232
|
|
|
1253
|
-
return
|
|
1233
|
+
return validateOptions(schema, options);
|
|
1254
1234
|
}
|
|
1255
1235
|
|
|
1256
1236
|
function buildDialectChoices ({babelPreset, typescript}) {
|
|
1257
1237
|
return [
|
|
1258
|
-
{name: 'Common JS (no transpilation)', value:
|
|
1259
|
-
...babelPreset ? [{name: 'Modern JavaScript (transpiled)', value:
|
|
1260
|
-
{name: 'ESM-only (no transpilation)', value:
|
|
1261
|
-
...typescript ? [{name: 'TypeScript', value:
|
|
1238
|
+
{name: 'Common JS (no transpilation)', value: dialects$1.COMMON_JS, short: 'cjs'},
|
|
1239
|
+
...babelPreset ? [{name: 'Modern JavaScript (transpiled)', value: dialects$1.BABEL, short: 'modern'}] : [],
|
|
1240
|
+
{name: 'ESM-only (no transpilation)', value: dialects$1.ESM, short: 'esm'},
|
|
1241
|
+
...typescript ? [{name: 'TypeScript', value: dialects$1.TYPESCRIPT, short: 'ts'}] : []
|
|
1262
1242
|
];
|
|
1263
1243
|
}
|
|
1264
1244
|
|
|
1265
1245
|
function projectIsCLI(answers) {
|
|
1266
|
-
return
|
|
1246
|
+
return projectTypes$1.CLI === answers[questionNames$1.PROJECT_TYPE];
|
|
1267
1247
|
}
|
|
1268
1248
|
|
|
1269
1249
|
function projectIsPackage(answers) {
|
|
1270
|
-
return
|
|
1250
|
+
return projectTypes$1.PACKAGE === answers[questionNames$1.PROJECT_TYPE];
|
|
1271
1251
|
}
|
|
1272
1252
|
|
|
1273
1253
|
function projectIsApplication(answers) {
|
|
1274
|
-
return
|
|
1254
|
+
return projectTypes$1.APPLICATION === answers[questionNames$1.PROJECT_TYPE];
|
|
1275
1255
|
}
|
|
1276
1256
|
|
|
1277
1257
|
function packageShouldBeScoped(visibility, answers) {
|
|
@@ -1291,8 +1271,8 @@ function scopePromptShouldBePresentedFactory(visibility) {
|
|
|
1291
1271
|
}
|
|
1292
1272
|
|
|
1293
1273
|
function lintingPromptShouldBePresented({
|
|
1294
|
-
[
|
|
1295
|
-
[
|
|
1274
|
+
[questionNames$2.UNIT_TESTS]: unitTested,
|
|
1275
|
+
[questionNames$2.INTEGRATION_TESTS]: integrationTested
|
|
1296
1276
|
}) {
|
|
1297
1277
|
return !unitTested && !integrationTested;
|
|
1298
1278
|
}
|
|
@@ -1336,23 +1316,23 @@ async function prompt(
|
|
|
1336
1316
|
configs,
|
|
1337
1317
|
pathWithinParent
|
|
1338
1318
|
) {
|
|
1339
|
-
const npmConf =
|
|
1319
|
+
const npmConf$1 = npmConf();
|
|
1340
1320
|
|
|
1341
1321
|
let maybeLoggedInNpmUsername;
|
|
1342
1322
|
try {
|
|
1343
|
-
maybeLoggedInNpmUsername = (await
|
|
1323
|
+
maybeLoggedInNpmUsername = (await execa('npm', ['whoami'])).stdout;
|
|
1344
1324
|
} catch (failedExecutionResult) {
|
|
1345
1325
|
if (!decisions[questionNames$1.SCOPE]) {
|
|
1346
|
-
|
|
1326
|
+
warn('No logged in user found with `npm whoami`. Login with `npm login` '
|
|
1347
1327
|
+ 'to use your npm account name as the package scope default.');
|
|
1348
1328
|
}
|
|
1349
1329
|
}
|
|
1350
1330
|
|
|
1351
1331
|
const {
|
|
1352
|
-
[
|
|
1353
|
-
[
|
|
1332
|
+
[questionNames$2.UNIT_TESTS]: unitTested,
|
|
1333
|
+
[questionNames$2.INTEGRATION_TESTS]: integrationTested,
|
|
1354
1334
|
[questionNames$1.PROJECT_TYPE]: projectType,
|
|
1355
|
-
[
|
|
1335
|
+
[questionNames$2.CI_SERVICE]: ci,
|
|
1356
1336
|
[questionNames$1.HOST]: chosenHost,
|
|
1357
1337
|
[questionNames$1.SCOPE]: scope$1,
|
|
1358
1338
|
[questionNames$1.NODE_VERSION_CATEGORY]: nodeVersionCategory,
|
|
@@ -1363,7 +1343,7 @@ async function prompt(
|
|
|
1363
1343
|
[questionNames$1.PROVIDE_EXAMPLE]: provideExample,
|
|
1364
1344
|
[questionNames$1.PACKAGE_MANAGER]: packageManager,
|
|
1365
1345
|
[questionNames$1.DIALECT]: dialect
|
|
1366
|
-
} = await
|
|
1346
|
+
} = await prompt$1([
|
|
1367
1347
|
{
|
|
1368
1348
|
name: questionNames$1.DIALECT,
|
|
1369
1349
|
message: 'Which JavaScript dialect should this project follow?',
|
|
@@ -1382,15 +1362,15 @@ async function prompt(
|
|
|
1382
1362
|
name: questionNames$1.PACKAGE_MANAGER,
|
|
1383
1363
|
message: 'Which package manager will be used with this project?',
|
|
1384
1364
|
type: 'list',
|
|
1385
|
-
choices: Object.values(
|
|
1386
|
-
default:
|
|
1365
|
+
choices: Object.values(packageManagers$1),
|
|
1366
|
+
default: packageManagers$1.NPM
|
|
1387
1367
|
},
|
|
1388
1368
|
{
|
|
1389
1369
|
name: questionNames$1.PROJECT_TYPE,
|
|
1390
1370
|
message: 'What type of JavaScript project is this?',
|
|
1391
1371
|
type: 'list',
|
|
1392
|
-
choices: [...Object.values(
|
|
1393
|
-
default:
|
|
1372
|
+
choices: [...Object.values(projectTypes$1), 'Other'],
|
|
1373
|
+
default: projectTypes$1.PACKAGE
|
|
1394
1374
|
},
|
|
1395
1375
|
...'Private' === visibility ? [] : [{
|
|
1396
1376
|
name: questionNames$1.SHOULD_BE_SCOPED,
|
|
@@ -1407,11 +1387,11 @@ async function prompt(
|
|
|
1407
1387
|
default: maybeLoggedInNpmUsername
|
|
1408
1388
|
},
|
|
1409
1389
|
...authorQuestions({
|
|
1410
|
-
name: npmConf.get('init.author.name'),
|
|
1411
|
-
email: npmConf.get('init.author.email'),
|
|
1412
|
-
url: npmConf.get('init.author.url')
|
|
1390
|
+
name: npmConf$1.get('init.author.name'),
|
|
1391
|
+
email: npmConf$1.get('init.author.email'),
|
|
1392
|
+
url: npmConf$1.get('init.author.url')
|
|
1413
1393
|
}),
|
|
1414
|
-
...
|
|
1394
|
+
...questions(({vcs, ciServices, pathWithinParent})),
|
|
1415
1395
|
{
|
|
1416
1396
|
name: questionNames$1.CONFIGURE_LINTING,
|
|
1417
1397
|
message: 'Will there be source code that should be linted?',
|
|
@@ -1429,7 +1409,7 @@ async function prompt(
|
|
|
1429
1409
|
type: 'list',
|
|
1430
1410
|
message: 'Where will the application be hosted?',
|
|
1431
1411
|
when: projectIsApplication,
|
|
1432
|
-
choices: [...Object.keys(hosts),
|
|
1412
|
+
choices: [...Object.keys(hosts), 'Other']
|
|
1433
1413
|
}
|
|
1434
1414
|
], decisions);
|
|
1435
1415
|
|
|
@@ -1467,10 +1447,14 @@ $ ${packageManager} test
|
|
|
1467
1447
|
};
|
|
1468
1448
|
}
|
|
1469
1449
|
|
|
1450
|
+
function buildBadgesDetails (contributors) {
|
|
1451
|
+
return deepmerge.all(contributors).badges;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1470
1454
|
async function determineLatestVersionOf(nodeVersionCategory) {
|
|
1471
|
-
|
|
1455
|
+
info('Determining version of node', {level: 'secondary'});
|
|
1472
1456
|
|
|
1473
|
-
const {stdout: nvmLsOutput} = await
|
|
1457
|
+
const {stdout: nvmLsOutput} = await execa(
|
|
1474
1458
|
`. ~/.nvm/nvm.sh && nvm ls-remote${('LTS' === nodeVersionCategory) ? ' --lts' : ''}`,
|
|
1475
1459
|
{shell: true}
|
|
1476
1460
|
);
|
|
@@ -1482,9 +1466,9 @@ async function determineLatestVersionOf(nodeVersionCategory) {
|
|
|
1482
1466
|
}
|
|
1483
1467
|
|
|
1484
1468
|
function install(nodeVersionCategory) {
|
|
1485
|
-
|
|
1469
|
+
info(`Installing ${nodeVersionCategory} version of node using nvm`, {level: 'secondary'});
|
|
1486
1470
|
|
|
1487
|
-
const subprocess =
|
|
1471
|
+
const subprocess = execa('. ~/.nvm/nvm.sh && nvm install', {shell: true});
|
|
1488
1472
|
subprocess.stdout.pipe(process.stdout);
|
|
1489
1473
|
return subprocess;
|
|
1490
1474
|
}
|
|
@@ -1493,11 +1477,11 @@ async function scaffoldNodeVersion ({projectRoot, nodeVersionCategory}) {
|
|
|
1493
1477
|
if (!nodeVersionCategory) return undefined;
|
|
1494
1478
|
|
|
1495
1479
|
const lowerCaseCategory = nodeVersionCategory.toLowerCase();
|
|
1496
|
-
|
|
1480
|
+
info(`Configuring ${lowerCaseCategory} version of node`);
|
|
1497
1481
|
|
|
1498
1482
|
const version = await determineLatestVersionOf(nodeVersionCategory);
|
|
1499
1483
|
|
|
1500
|
-
await
|
|
1484
|
+
await promises$1.writeFile(`${projectRoot}/.nvmrc`, version);
|
|
1501
1485
|
|
|
1502
1486
|
await install(nodeVersionCategory);
|
|
1503
1487
|
|
|
@@ -1505,11 +1489,7 @@ async function scaffoldNodeVersion ({projectRoot, nodeVersionCategory}) {
|
|
|
1505
1489
|
}
|
|
1506
1490
|
|
|
1507
1491
|
function nvmIsUsed ({projectRoot}) {
|
|
1508
|
-
return
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
function buildBadgesDetails (contributors) {
|
|
1512
|
-
return deepmerge__default["default"].all(contributors).badges;
|
|
1492
|
+
return fileExists(`${projectRoot}/.nvmrc`);
|
|
1513
1493
|
}
|
|
1514
1494
|
|
|
1515
1495
|
function buildVcsIgnoreLists (vcsIgnoreLists = {}) {
|
|
@@ -1519,25 +1499,14 @@ function buildVcsIgnoreLists (vcsIgnoreLists = {}) {
|
|
|
1519
1499
|
};
|
|
1520
1500
|
}
|
|
1521
1501
|
|
|
1522
|
-
function buildPackageName (projectName, scope) {
|
|
1523
|
-
const name = `${scope ? `@${scope}/` : ''}${projectName}`;
|
|
1524
|
-
|
|
1525
|
-
const {validForNewPackages, errors} = validatePackageName__default["default"](name);
|
|
1526
|
-
|
|
1527
|
-
if (validForNewPackages) return name;
|
|
1528
|
-
if (1 === errors.length && errors.includes('name cannot start with a period')) return projectName.slice(1);
|
|
1529
|
-
|
|
1530
|
-
throw new Error(`The package name ${name} is invalid:${os.EOL}\t* ${errors.join(`${os.EOL}\t* `)}`);
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
1502
|
async function chooseProjectTypePlugin ({types, projectType, decisions}) {
|
|
1534
1503
|
if (!Object.keys(types).length) return 'Other';
|
|
1535
1504
|
|
|
1536
|
-
const answers = await
|
|
1505
|
+
const answers = await prompt$1([{
|
|
1537
1506
|
name: questionNames$1.PROJECT_TYPE_CHOICE,
|
|
1538
1507
|
type: 'list',
|
|
1539
1508
|
message: `What type of ${projectType} is this?`,
|
|
1540
|
-
choices: [...Object.keys(types),
|
|
1509
|
+
choices: [...Object.keys(types), 'Other']
|
|
1541
1510
|
}], decisions);
|
|
1542
1511
|
|
|
1543
1512
|
return answers[questionNames$1.PROJECT_TYPE_CHOICE];
|
|
@@ -1561,7 +1530,7 @@ async function scaffoldProjectTypePlugin ({
|
|
|
1561
1530
|
|
|
1562
1531
|
const chosenType = await chooseProjectTypePlugin({types: pluginsForProjectType, decisions, projectType});
|
|
1563
1532
|
|
|
1564
|
-
return
|
|
1533
|
+
return scaffoldChoice(
|
|
1565
1534
|
pluginsForProjectType,
|
|
1566
1535
|
chosenType,
|
|
1567
1536
|
{projectRoot, projectName, packageName, packageManager, scope, tests, dialect}
|
|
@@ -1590,7 +1559,7 @@ async function scaffoldTesting ({
|
|
|
1590
1559
|
})
|
|
1591
1560
|
: {};
|
|
1592
1561
|
|
|
1593
|
-
return
|
|
1562
|
+
return deepmerge({devDependencies: [...(unit || integration) ? ['@travi/any'] : []], eslint: {}}, unitResults);
|
|
1594
1563
|
}
|
|
1595
1564
|
|
|
1596
1565
|
function buildAllowedHostsList ({packageManager, registries}) {
|
|
@@ -1600,7 +1569,7 @@ function buildAllowedHostsList ({packageManager, registries}) {
|
|
|
1600
1569
|
];
|
|
1601
1570
|
}
|
|
1602
1571
|
|
|
1603
|
-
const lockfileLintSupportedPackageManagers = [
|
|
1572
|
+
const lockfileLintSupportedPackageManagers = [packageManagers$1.NPM, packageManagers$1.YARN];
|
|
1604
1573
|
|
|
1605
1574
|
function lockfileLintSupports(packageManager) {
|
|
1606
1575
|
return lockfileLintSupportedPackageManagers.includes(packageManager);
|
|
@@ -1614,9 +1583,9 @@ async function scaffoldLockfileLint ({projectRoot, packageManager, registries})
|
|
|
1614
1583
|
);
|
|
1615
1584
|
}
|
|
1616
1585
|
|
|
1617
|
-
await
|
|
1586
|
+
await write$2({
|
|
1618
1587
|
name: 'lockfile-lint',
|
|
1619
|
-
format:
|
|
1588
|
+
format: fileTypes.JSON,
|
|
1620
1589
|
path: projectRoot,
|
|
1621
1590
|
config: {
|
|
1622
1591
|
path: determineLockfilePathFor(packageManager),
|
|
@@ -1660,14 +1629,14 @@ async function scaffoldVerification({
|
|
|
1660
1629
|
pathWithinParent
|
|
1661
1630
|
}),
|
|
1662
1631
|
scaffoldLinting({projectRoot, packageManager, registries, vcs, pathWithinParent}),
|
|
1663
|
-
|
|
1632
|
+
scaffold$3({projectRoot, packageManager, pathWithinParent})
|
|
1664
1633
|
]);
|
|
1665
1634
|
|
|
1666
|
-
return
|
|
1635
|
+
return deepmerge.all([testingResults, lintingResults, huskyResults]);
|
|
1667
1636
|
}
|
|
1668
1637
|
|
|
1669
1638
|
async function scaffolder (options) {
|
|
1670
|
-
|
|
1639
|
+
info('Initializing JavaScript project');
|
|
1671
1640
|
|
|
1672
1641
|
const {
|
|
1673
1642
|
projectRoot,
|
|
@@ -1705,13 +1674,13 @@ async function scaffolder (options) {
|
|
|
1705
1674
|
dialect
|
|
1706
1675
|
} = await prompt(ciServices, hosts, visibility, vcs, decisions, configs, pathWithinParent);
|
|
1707
1676
|
|
|
1708
|
-
|
|
1677
|
+
info('Writing project files', {level: 'secondary'});
|
|
1709
1678
|
|
|
1710
|
-
const packageName =
|
|
1711
|
-
await scaffoldPackage({
|
|
1679
|
+
const {packageName} = await scaffoldPackage({
|
|
1712
1680
|
projectRoot,
|
|
1681
|
+
projectName,
|
|
1682
|
+
scope,
|
|
1713
1683
|
dialect,
|
|
1714
|
-
packageName,
|
|
1715
1684
|
license,
|
|
1716
1685
|
author,
|
|
1717
1686
|
description
|
|
@@ -1725,8 +1694,8 @@ async function scaffolder (options) {
|
|
|
1725
1694
|
visibility,
|
|
1726
1695
|
applicationTypes,
|
|
1727
1696
|
packageTypes,
|
|
1728
|
-
packageBundlers,
|
|
1729
1697
|
monorepoTypes,
|
|
1698
|
+
packageBundlers,
|
|
1730
1699
|
scope,
|
|
1731
1700
|
tests,
|
|
1732
1701
|
vcs,
|
|
@@ -1770,20 +1739,20 @@ async function scaffolder (options) {
|
|
|
1770
1739
|
tests,
|
|
1771
1740
|
decisions,
|
|
1772
1741
|
plugins: {
|
|
1773
|
-
[
|
|
1774
|
-
[
|
|
1775
|
-
[
|
|
1742
|
+
[projectTypes$1.PACKAGE]: packageTypes,
|
|
1743
|
+
[projectTypes$1.APPLICATION]: applicationTypes,
|
|
1744
|
+
[projectTypes$1.MONOREPO]: monorepoTypes
|
|
1776
1745
|
}
|
|
1777
1746
|
});
|
|
1778
|
-
const mergedContributions =
|
|
1747
|
+
const mergedContributions = deepmerge.all([
|
|
1779
1748
|
...(await Promise.all([
|
|
1780
|
-
|
|
1749
|
+
scaffoldChoice(
|
|
1781
1750
|
hosts,
|
|
1782
1751
|
chosenHost,
|
|
1783
1752
|
{buildDirectory: `./${projectTypeResults.buildDirectory}`, projectRoot, projectName, nodeVersion}
|
|
1784
1753
|
),
|
|
1785
|
-
|
|
1786
|
-
|
|
1754
|
+
scaffoldChoice(ciServices, ci, {projectRoot, vcs, visibility, projectType, projectName, nodeVersion, tests}),
|
|
1755
|
+
scaffold$4({projectRoot, projectType, configs, pathWithinParent})
|
|
1787
1756
|
])),
|
|
1788
1757
|
projectTypeResults,
|
|
1789
1758
|
verificationResults,
|
|
@@ -1794,7 +1763,7 @@ async function scaffolder (options) {
|
|
|
1794
1763
|
]);
|
|
1795
1764
|
|
|
1796
1765
|
const liftResults = await lift({
|
|
1797
|
-
results:
|
|
1766
|
+
results: deepmerge({devDependencies: ['npm-run-all2'], packageManager}, mergedContributions),
|
|
1798
1767
|
projectRoot,
|
|
1799
1768
|
configs,
|
|
1800
1769
|
vcs,
|
|
@@ -1820,16 +1789,12 @@ async function tester ({projectRoot}) {
|
|
|
1820
1789
|
|
|
1821
1790
|
const jsProjectFound = nvmFound || jsPackageManagerFound;
|
|
1822
1791
|
|
|
1823
|
-
if (jsProjectFound)
|
|
1792
|
+
if (jsProjectFound) info('JavaScript Project Detected');
|
|
1824
1793
|
|
|
1825
1794
|
return jsProjectFound;
|
|
1826
1795
|
}
|
|
1827
1796
|
|
|
1828
|
-
const questionNames = {...
|
|
1797
|
+
const questionNames = {...questionNames$2, ...questionNames$1};
|
|
1829
1798
|
|
|
1830
|
-
|
|
1831
|
-
exports.questionNames = questionNames;
|
|
1832
|
-
exports.scaffold = scaffolder;
|
|
1833
|
-
exports.scaffoldUnitTesting = scaffoldUnitTesting;
|
|
1834
|
-
exports.test = tester;
|
|
1799
|
+
export { lift, questionNames, scaffolder as scaffold, scaffoldUnitTesting, tester as test };
|
|
1835
1800
|
//# sourceMappingURL=index.js.map
|