@form8ion/javascript 7.2.3 → 7.2.6
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/lib/index.js +124 -125
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +130 -131
- package/lib/index.mjs.map +1 -1
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -191,6 +191,87 @@ async function scaffoldUnitTesting ({projectRoot, frameworks, decisions, visibil
|
|
|
191
191
|
]);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
async function scaffoldEslint ({config, projectRoot, additionalConfiguration}) {
|
|
195
|
+
const {scope} = config;
|
|
196
|
+
const {ignore} = additionalConfiguration;
|
|
197
|
+
|
|
198
|
+
return eslint.scaffold({scope, projectRoot, ignore});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function lifter$1 ({results: {buildDirectory, eslintConfigs, eslint: eslint$1}, projectRoot}) {
|
|
202
|
+
return eslint.lift({projectRoot, configs: [...eslintConfigs || [], ...eslint$1?.configs || []], buildDirectory});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
async function scaffoldRemark ({config, projectRoot, projectType, vcs, dialect}) {
|
|
206
|
+
await configFile.write({
|
|
207
|
+
format: core.fileTypes.JSON,
|
|
208
|
+
path: projectRoot,
|
|
209
|
+
name: 'remark',
|
|
210
|
+
config: {
|
|
211
|
+
settings: {
|
|
212
|
+
listItemIndent: 1,
|
|
213
|
+
emphasis: '_',
|
|
214
|
+
strong: '_',
|
|
215
|
+
bullet: '*',
|
|
216
|
+
incrementListMarker: false
|
|
217
|
+
},
|
|
218
|
+
plugins: [
|
|
219
|
+
config,
|
|
220
|
+
['remark-toc', {tight: true}],
|
|
221
|
+
...javascriptCore.projectTypes.PACKAGE === projectType ? [['remark-usage', {heading: 'example'}]] : [],
|
|
222
|
+
...!vcs ? [['validate-links', {repository: false}]] : []
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
return deepmerge__default["default"](
|
|
228
|
+
{
|
|
229
|
+
devDependencies: [config, 'remark-cli', 'remark-toc'],
|
|
230
|
+
scripts: {
|
|
231
|
+
'lint:md': 'remark . --frail',
|
|
232
|
+
'generate:md': 'remark . --output'
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
...javascriptCore.projectTypes.PACKAGE === projectType && {
|
|
237
|
+
devDependencies: ['remark-usage'],
|
|
238
|
+
...javascriptCore.dialects.COMMON_JS !== dialect && {scripts: {'pregenerate:md': 'run-s build'}}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
async function scaffoldCodeStyle ({
|
|
245
|
+
projectRoot,
|
|
246
|
+
projectType,
|
|
247
|
+
dialect,
|
|
248
|
+
configs,
|
|
249
|
+
vcs,
|
|
250
|
+
configureLinting,
|
|
251
|
+
eslint
|
|
252
|
+
}) {
|
|
253
|
+
return deepmerge__default["default"].all(await Promise.all([
|
|
254
|
+
configs.eslint
|
|
255
|
+
&& configureLinting
|
|
256
|
+
&& scaffoldEslint({projectRoot, config: configs.eslint, additionalConfiguration: eslint}),
|
|
257
|
+
scaffoldRemark({
|
|
258
|
+
projectRoot,
|
|
259
|
+
projectType,
|
|
260
|
+
dialect,
|
|
261
|
+
vcs,
|
|
262
|
+
config: configs.remark || '@form8ion/remark-lint-preset'
|
|
263
|
+
}),
|
|
264
|
+
prettier.scaffold({projectRoot, config: configs.prettier})
|
|
265
|
+
].filter(Boolean)));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
var codeStylePlugin = /*#__PURE__*/Object.freeze({
|
|
269
|
+
__proto__: null,
|
|
270
|
+
scaffold: scaffoldCodeStyle,
|
|
271
|
+
lift: lifter$1,
|
|
272
|
+
test: eslint.test
|
|
273
|
+
});
|
|
274
|
+
|
|
194
275
|
async function test$1({projectRoot}) {
|
|
195
276
|
const {engines} = JSON.parse(await fs.promises.readFile(`${projectRoot}/package.json`, 'utf8'));
|
|
196
277
|
|
|
@@ -238,8 +319,8 @@ async function scaffoldBabel ({projectRoot, preset}) {
|
|
|
238
319
|
};
|
|
239
320
|
}
|
|
240
321
|
|
|
241
|
-
async function lifter ({
|
|
242
|
-
await addIgnore({ignore: buildDirectory, projectRoot});
|
|
322
|
+
async function lifter ({results, projectRoot}) {
|
|
323
|
+
await addIgnore({ignore: results.buildDirectory, projectRoot});
|
|
243
324
|
|
|
244
325
|
return {};
|
|
245
326
|
}
|
|
@@ -493,28 +574,23 @@ async function lift ({projectRoot, vcs, results}) {
|
|
|
493
574
|
const {
|
|
494
575
|
scripts,
|
|
495
576
|
tags,
|
|
496
|
-
eslintConfigs,
|
|
497
|
-
eslint: eslint$1,
|
|
498
577
|
dependencies,
|
|
499
578
|
devDependencies,
|
|
500
|
-
packageManager: manager
|
|
501
|
-
buildDirectory
|
|
579
|
+
packageManager: manager
|
|
502
580
|
} = results;
|
|
503
581
|
|
|
504
582
|
const packageManager = await resolvePackageManager({projectRoot, packageManager: manager});
|
|
505
583
|
|
|
506
|
-
const eslintResults = await eslint.lift({projectRoot, configs: [...eslintConfigs || [], ...eslint$1?.configs || []]});
|
|
507
584
|
const enhancerResults = await core.applyEnhancers({
|
|
508
585
|
results,
|
|
509
|
-
enhancers: [huskyPlugin__namespace, enginesEnhancer, coveragePlugin, commitConventionPlugin__namespace, dialects],
|
|
510
|
-
options: {packageManager, projectRoot, vcs
|
|
586
|
+
enhancers: [huskyPlugin__namespace, enginesEnhancer, coveragePlugin, commitConventionPlugin__namespace, dialects, codeStylePlugin],
|
|
587
|
+
options: {packageManager, projectRoot, vcs}
|
|
511
588
|
});
|
|
512
589
|
|
|
513
590
|
await liftPackage(
|
|
514
591
|
deepmerge__default["default"].all([
|
|
515
592
|
{projectRoot, scripts, tags, dependencies, devDependencies, packageManager},
|
|
516
|
-
enhancerResults
|
|
517
|
-
eslintResults
|
|
593
|
+
enhancerResults
|
|
518
594
|
])
|
|
519
595
|
);
|
|
520
596
|
|
|
@@ -1327,15 +1403,17 @@ async function scaffoldLockfileLint ({projectRoot, packageManager, registries})
|
|
|
1327
1403
|
);
|
|
1328
1404
|
}
|
|
1329
1405
|
|
|
1330
|
-
await
|
|
1331
|
-
|
|
1332
|
-
JSON
|
|
1406
|
+
await configFile.write({
|
|
1407
|
+
name: 'lockfile-lint',
|
|
1408
|
+
format: core.fileTypes.JSON,
|
|
1409
|
+
path: projectRoot,
|
|
1410
|
+
config: {
|
|
1333
1411
|
path: determineLockfilePathFor(packageManager),
|
|
1334
1412
|
type: packageManager,
|
|
1335
1413
|
'validate-https': true,
|
|
1336
1414
|
'allowed-hosts': buildAllowedHostsList({packageManager, registries})
|
|
1337
|
-
}
|
|
1338
|
-
);
|
|
1415
|
+
}
|
|
1416
|
+
});
|
|
1339
1417
|
|
|
1340
1418
|
return {
|
|
1341
1419
|
devDependencies: ['lockfile-lint'],
|
|
@@ -1380,82 +1458,6 @@ async function scaffoldVerification({
|
|
|
1380
1458
|
return deepmerge__default["default"].all([testingResults, lintingResults, huskyResults]);
|
|
1381
1459
|
}
|
|
1382
1460
|
|
|
1383
|
-
async function scaffoldEslint ({config, projectRoot, buildDirectory, additionalConfiguration}) {
|
|
1384
|
-
const {scope} = config;
|
|
1385
|
-
const {ignore} = additionalConfiguration;
|
|
1386
|
-
const ignores = deepmerge__default["default"](ignore, {directories: [`/${buildDirectory}/`]});
|
|
1387
|
-
|
|
1388
|
-
return eslint.scaffold({scope, projectRoot, ignore: {directories: ignores.directories}});
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
async function scaffoldRemark ({config, projectRoot, projectType, vcs, dialect}) {
|
|
1392
|
-
await configFile.write({
|
|
1393
|
-
format: core.fileTypes.JSON,
|
|
1394
|
-
path: projectRoot,
|
|
1395
|
-
name: 'remark',
|
|
1396
|
-
config: {
|
|
1397
|
-
settings: {
|
|
1398
|
-
listItemIndent: 1,
|
|
1399
|
-
emphasis: '_',
|
|
1400
|
-
strong: '_',
|
|
1401
|
-
bullet: '*',
|
|
1402
|
-
incrementListMarker: false
|
|
1403
|
-
},
|
|
1404
|
-
plugins: [
|
|
1405
|
-
config,
|
|
1406
|
-
['remark-toc', {tight: true}],
|
|
1407
|
-
...javascriptCore.projectTypes.PACKAGE === projectType ? [['remark-usage', {heading: 'example'}]] : [],
|
|
1408
|
-
...!vcs ? [['validate-links', {repository: false}]] : []
|
|
1409
|
-
]
|
|
1410
|
-
}
|
|
1411
|
-
});
|
|
1412
|
-
|
|
1413
|
-
return deepmerge__default["default"](
|
|
1414
|
-
{
|
|
1415
|
-
devDependencies: [config, 'remark-cli', 'remark-toc'],
|
|
1416
|
-
scripts: {
|
|
1417
|
-
'lint:md': 'remark . --frail',
|
|
1418
|
-
'generate:md': 'remark . --output'
|
|
1419
|
-
}
|
|
1420
|
-
},
|
|
1421
|
-
{
|
|
1422
|
-
...javascriptCore.projectTypes.PACKAGE === projectType && {
|
|
1423
|
-
devDependencies: ['remark-usage'],
|
|
1424
|
-
...javascriptCore.dialects.COMMON_JS !== dialect && {scripts: {'pregenerate:md': 'run-s build'}}
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
);
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
async function scaffoldCodeStyle ({
|
|
1431
|
-
projectRoot,
|
|
1432
|
-
projectType,
|
|
1433
|
-
dialect,
|
|
1434
|
-
configs,
|
|
1435
|
-
vcs,
|
|
1436
|
-
configureLinting,
|
|
1437
|
-
buildDirectory,
|
|
1438
|
-
eslint
|
|
1439
|
-
}) {
|
|
1440
|
-
return deepmerge__default["default"].all(await Promise.all([
|
|
1441
|
-
configs.eslint && configureLinting
|
|
1442
|
-
&& scaffoldEslint({
|
|
1443
|
-
projectRoot,
|
|
1444
|
-
config: configs.eslint,
|
|
1445
|
-
buildDirectory,
|
|
1446
|
-
additionalConfiguration: eslint
|
|
1447
|
-
}),
|
|
1448
|
-
scaffoldRemark({
|
|
1449
|
-
projectRoot,
|
|
1450
|
-
projectType,
|
|
1451
|
-
dialect,
|
|
1452
|
-
vcs,
|
|
1453
|
-
config: configs.remark || '@form8ion/remark-lint-preset'
|
|
1454
|
-
}),
|
|
1455
|
-
prettier.scaffold({projectRoot, config: configs.prettier})
|
|
1456
|
-
].filter(Boolean)));
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
1461
|
async function scaffolder (options) {
|
|
1460
1462
|
cliMessages.info('Initializing JavaScript project');
|
|
1461
1463
|
|
|
@@ -1507,38 +1509,36 @@ async function scaffolder (options) {
|
|
|
1507
1509
|
description,
|
|
1508
1510
|
pathWithinParent
|
|
1509
1511
|
});
|
|
1510
|
-
const
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
})
|
|
1541
|
-
]);
|
|
1512
|
+
const projectTypeResults = await scaffoldProjectType({
|
|
1513
|
+
projectType,
|
|
1514
|
+
projectRoot,
|
|
1515
|
+
projectName,
|
|
1516
|
+
packageName,
|
|
1517
|
+
packageManager,
|
|
1518
|
+
visibility,
|
|
1519
|
+
applicationTypes,
|
|
1520
|
+
packageTypes,
|
|
1521
|
+
packageBundlers,
|
|
1522
|
+
monorepoTypes,
|
|
1523
|
+
scope,
|
|
1524
|
+
tests,
|
|
1525
|
+
vcs,
|
|
1526
|
+
decisions,
|
|
1527
|
+
dialect,
|
|
1528
|
+
publishRegistry: registries.publish
|
|
1529
|
+
});
|
|
1530
|
+
const verificationResults = await scaffoldVerification({
|
|
1531
|
+
projectRoot,
|
|
1532
|
+
dialect,
|
|
1533
|
+
visibility,
|
|
1534
|
+
packageManager,
|
|
1535
|
+
vcs,
|
|
1536
|
+
registries,
|
|
1537
|
+
tests,
|
|
1538
|
+
unitTestFrameworks,
|
|
1539
|
+
decisions,
|
|
1540
|
+
pathWithinParent
|
|
1541
|
+
});
|
|
1542
1542
|
const [nodeVersion, npmResults, dialectResults, codeStyleResults, projectTypePluginResults] = await Promise.all([
|
|
1543
1543
|
scaffoldNodeVersion({projectRoot, nodeVersionCategory}),
|
|
1544
1544
|
scaffoldNpmConfig({projectType, projectRoot, registries}),
|
|
@@ -1556,7 +1556,6 @@ async function scaffolder (options) {
|
|
|
1556
1556
|
configs,
|
|
1557
1557
|
vcs,
|
|
1558
1558
|
configureLinting,
|
|
1559
|
-
buildDirectory: projectTypeResults.buildDirectory,
|
|
1560
1559
|
eslint: verificationResults.eslint
|
|
1561
1560
|
}),
|
|
1562
1561
|
scaffoldProjectTypePlugin({
|