@form8ion/javascript 7.2.4 → 7.2.5
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 +94 -90
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +100 -96
- package/lib/index.mjs.map +1 -1
- package/package.json +2 -2
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,32 +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({
|
|
507
|
-
projectRoot,
|
|
508
|
-
configs: [...eslintConfigs || [], ...eslint$1?.configs || []],
|
|
509
|
-
buildDirectory
|
|
510
|
-
});
|
|
511
584
|
const enhancerResults = await core.applyEnhancers({
|
|
512
585
|
results,
|
|
513
|
-
enhancers: [huskyPlugin__namespace, enginesEnhancer, coveragePlugin, commitConventionPlugin__namespace, dialects],
|
|
514
|
-
options: {packageManager, projectRoot, vcs
|
|
586
|
+
enhancers: [huskyPlugin__namespace, enginesEnhancer, coveragePlugin, commitConventionPlugin__namespace, dialects, codeStylePlugin],
|
|
587
|
+
options: {packageManager, projectRoot, vcs}
|
|
515
588
|
});
|
|
516
589
|
|
|
517
590
|
await liftPackage(
|
|
518
591
|
deepmerge__default["default"].all([
|
|
519
592
|
{projectRoot, scripts, tags, dependencies, devDependencies, packageManager},
|
|
520
|
-
enhancerResults
|
|
521
|
-
eslintResults
|
|
593
|
+
enhancerResults
|
|
522
594
|
])
|
|
523
595
|
);
|
|
524
596
|
|
|
@@ -1331,15 +1403,17 @@ async function scaffoldLockfileLint ({projectRoot, packageManager, registries})
|
|
|
1331
1403
|
);
|
|
1332
1404
|
}
|
|
1333
1405
|
|
|
1334
|
-
await
|
|
1335
|
-
|
|
1336
|
-
JSON
|
|
1406
|
+
await configFile.write({
|
|
1407
|
+
name: 'lockfile-lint',
|
|
1408
|
+
format: core.fileTypes.JSON,
|
|
1409
|
+
path: projectRoot,
|
|
1410
|
+
config: {
|
|
1337
1411
|
path: determineLockfilePathFor(packageManager),
|
|
1338
1412
|
type: packageManager,
|
|
1339
1413
|
'validate-https': true,
|
|
1340
1414
|
'allowed-hosts': buildAllowedHostsList({packageManager, registries})
|
|
1341
|
-
}
|
|
1342
|
-
);
|
|
1415
|
+
}
|
|
1416
|
+
});
|
|
1343
1417
|
|
|
1344
1418
|
return {
|
|
1345
1419
|
devDependencies: ['lockfile-lint'],
|
|
@@ -1384,76 +1458,6 @@ async function scaffoldVerification({
|
|
|
1384
1458
|
return deepmerge__default["default"].all([testingResults, lintingResults, huskyResults]);
|
|
1385
1459
|
}
|
|
1386
1460
|
|
|
1387
|
-
async function scaffoldEslint ({config, projectRoot, additionalConfiguration}) {
|
|
1388
|
-
const {scope} = config;
|
|
1389
|
-
const {ignore} = additionalConfiguration;
|
|
1390
|
-
|
|
1391
|
-
return eslint.scaffold({scope, projectRoot, ignore});
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
async function scaffoldRemark ({config, projectRoot, projectType, vcs, dialect}) {
|
|
1395
|
-
await configFile.write({
|
|
1396
|
-
format: core.fileTypes.JSON,
|
|
1397
|
-
path: projectRoot,
|
|
1398
|
-
name: 'remark',
|
|
1399
|
-
config: {
|
|
1400
|
-
settings: {
|
|
1401
|
-
listItemIndent: 1,
|
|
1402
|
-
emphasis: '_',
|
|
1403
|
-
strong: '_',
|
|
1404
|
-
bullet: '*',
|
|
1405
|
-
incrementListMarker: false
|
|
1406
|
-
},
|
|
1407
|
-
plugins: [
|
|
1408
|
-
config,
|
|
1409
|
-
['remark-toc', {tight: true}],
|
|
1410
|
-
...javascriptCore.projectTypes.PACKAGE === projectType ? [['remark-usage', {heading: 'example'}]] : [],
|
|
1411
|
-
...!vcs ? [['validate-links', {repository: false}]] : []
|
|
1412
|
-
]
|
|
1413
|
-
}
|
|
1414
|
-
});
|
|
1415
|
-
|
|
1416
|
-
return deepmerge__default["default"](
|
|
1417
|
-
{
|
|
1418
|
-
devDependencies: [config, 'remark-cli', 'remark-toc'],
|
|
1419
|
-
scripts: {
|
|
1420
|
-
'lint:md': 'remark . --frail',
|
|
1421
|
-
'generate:md': 'remark . --output'
|
|
1422
|
-
}
|
|
1423
|
-
},
|
|
1424
|
-
{
|
|
1425
|
-
...javascriptCore.projectTypes.PACKAGE === projectType && {
|
|
1426
|
-
devDependencies: ['remark-usage'],
|
|
1427
|
-
...javascriptCore.dialects.COMMON_JS !== dialect && {scripts: {'pregenerate:md': 'run-s build'}}
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
|
-
);
|
|
1431
|
-
}
|
|
1432
|
-
|
|
1433
|
-
async function scaffoldCodeStyle ({
|
|
1434
|
-
projectRoot,
|
|
1435
|
-
projectType,
|
|
1436
|
-
dialect,
|
|
1437
|
-
configs,
|
|
1438
|
-
vcs,
|
|
1439
|
-
configureLinting,
|
|
1440
|
-
eslint
|
|
1441
|
-
}) {
|
|
1442
|
-
return deepmerge__default["default"].all(await Promise.all([
|
|
1443
|
-
configs.eslint
|
|
1444
|
-
&& configureLinting
|
|
1445
|
-
&& scaffoldEslint({projectRoot, config: configs.eslint, additionalConfiguration: eslint}),
|
|
1446
|
-
scaffoldRemark({
|
|
1447
|
-
projectRoot,
|
|
1448
|
-
projectType,
|
|
1449
|
-
dialect,
|
|
1450
|
-
vcs,
|
|
1451
|
-
config: configs.remark || '@form8ion/remark-lint-preset'
|
|
1452
|
-
}),
|
|
1453
|
-
prettier.scaffold({projectRoot, config: configs.prettier})
|
|
1454
|
-
].filter(Boolean)));
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
1461
|
async function scaffolder (options) {
|
|
1458
1462
|
cliMessages.info('Initializing JavaScript project');
|
|
1459
1463
|
|