@form8ion/javascript 5.8.0 → 6.0.0-alpha.1
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.cjs.js +75 -119
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.es.js +80 -124
- package/lib/index.es.js.map +1 -1
- package/package.json +5 -5
package/lib/index.cjs.js
CHANGED
|
@@ -171,7 +171,7 @@ async function removeNyc ({
|
|
|
171
171
|
projectRoot,
|
|
172
172
|
packageManager
|
|
173
173
|
}) {
|
|
174
|
-
await Promise.all([fs.promises.unlink(`${projectRoot}/.nycrc`), fs.promises.
|
|
174
|
+
await Promise.all([fs.promises.unlink(`${projectRoot}/.nycrc`), fs.promises.rm(`${projectRoot}/.nyc_output`, {
|
|
175
175
|
recursive: true,
|
|
176
176
|
force: true
|
|
177
177
|
}), removeDependencies({
|
|
@@ -318,16 +318,8 @@ var enginesEnhancer = /*#__PURE__*/Object.freeze({
|
|
|
318
318
|
lift: lift$1
|
|
319
319
|
});
|
|
320
320
|
|
|
321
|
-
function
|
|
322
|
-
|
|
323
|
-
config
|
|
324
|
-
}) {
|
|
325
|
-
return core.writeConfigFile({
|
|
326
|
-
format: core.fileTypes.JSON,
|
|
327
|
-
name: 'package',
|
|
328
|
-
path: projectRoot,
|
|
329
|
-
config
|
|
330
|
-
});
|
|
321
|
+
function scaffoldScripts () {
|
|
322
|
+
return {};
|
|
331
323
|
}
|
|
332
324
|
|
|
333
325
|
function projectWillBeTested(scripts) {
|
|
@@ -338,10 +330,17 @@ function projectShouldBeBuiltForVerification(scripts) {
|
|
|
338
330
|
return 'run-s build' === scripts['pregenerate:md'];
|
|
339
331
|
}
|
|
340
332
|
|
|
341
|
-
function
|
|
342
|
-
return {
|
|
333
|
+
function updateTestScript (scripts) {
|
|
334
|
+
return _objectSpread2(_objectSpread2({}, scripts), {}, {
|
|
343
335
|
test: `npm-run-all --print-label${projectShouldBeBuiltForVerification(scripts) ? ' build' : ''} --parallel lint:*${projectWillBeTested(scripts) ? ' --parallel test:*' : ''}`
|
|
344
|
-
};
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function liftScripts ({
|
|
340
|
+
existingScripts,
|
|
341
|
+
scripts
|
|
342
|
+
}) {
|
|
343
|
+
return updateTestScript(_objectSpread2(_objectSpread2({}, existingScripts), scripts));
|
|
345
344
|
}
|
|
346
345
|
|
|
347
346
|
function defineVcsHostDetails(vcs, packageType, packageName, pathWithinParent) {
|
|
@@ -364,18 +363,16 @@ function buildPackageDetails ({
|
|
|
364
363
|
vcs,
|
|
365
364
|
author,
|
|
366
365
|
description,
|
|
367
|
-
scripts,
|
|
368
|
-
packageProperties,
|
|
369
366
|
pathWithinParent
|
|
370
367
|
}) {
|
|
371
|
-
return _objectSpread2(_objectSpread2(
|
|
368
|
+
return _objectSpread2(_objectSpread2({
|
|
372
369
|
name: packageName,
|
|
373
370
|
description,
|
|
374
371
|
license,
|
|
375
372
|
type: javascriptCore.dialects.ESM === dialect ? 'module' : 'commonjs'
|
|
376
|
-
},
|
|
373
|
+
}, defineVcsHostDetails(vcs, projectType, packageName, pathWithinParent)), {}, {
|
|
377
374
|
author: `${author.name}${author.email ? ` <${author.email}>` : ''}${author.url ? ` (${author.url})` : ''}`,
|
|
378
|
-
scripts:
|
|
375
|
+
scripts: scaffoldScripts()
|
|
379
376
|
});
|
|
380
377
|
}
|
|
381
378
|
|
|
@@ -383,13 +380,11 @@ async function scaffoldPackage ({
|
|
|
383
380
|
projectRoot,
|
|
384
381
|
projectType,
|
|
385
382
|
dialect,
|
|
386
|
-
scripts,
|
|
387
383
|
packageName,
|
|
388
384
|
license,
|
|
389
385
|
vcs,
|
|
390
386
|
author,
|
|
391
387
|
description,
|
|
392
|
-
packageProperties,
|
|
393
388
|
pathWithinParent
|
|
394
389
|
}) {
|
|
395
390
|
cliMessages.info('Configuring package.json');
|
|
@@ -401,11 +396,9 @@ async function scaffoldPackage ({
|
|
|
401
396
|
vcs,
|
|
402
397
|
author,
|
|
403
398
|
description,
|
|
404
|
-
scripts,
|
|
405
|
-
packageProperties,
|
|
406
399
|
pathWithinParent
|
|
407
400
|
});
|
|
408
|
-
await
|
|
401
|
+
await javascriptCore.writePackageJson({
|
|
409
402
|
projectRoot,
|
|
410
403
|
config: packageData
|
|
411
404
|
});
|
|
@@ -414,13 +407,6 @@ async function scaffoldPackage ({
|
|
|
414
407
|
};
|
|
415
408
|
}
|
|
416
409
|
|
|
417
|
-
function liftScripts ({
|
|
418
|
-
existingScripts,
|
|
419
|
-
scripts
|
|
420
|
-
}) {
|
|
421
|
-
return _objectSpread2(_objectSpread2({}, existingScripts), scripts);
|
|
422
|
-
}
|
|
423
|
-
|
|
424
410
|
async function liftPackage ({
|
|
425
411
|
projectRoot,
|
|
426
412
|
scripts,
|
|
@@ -435,7 +421,7 @@ async function liftPackage ({
|
|
|
435
421
|
});
|
|
436
422
|
const pathToPackageJson = `${projectRoot}/package.json`;
|
|
437
423
|
const existingPackageJsonContents = JSON.parse(await fs.promises.readFile(pathToPackageJson, 'utf8'));
|
|
438
|
-
await
|
|
424
|
+
await javascriptCore.writePackageJson({
|
|
439
425
|
projectRoot,
|
|
440
426
|
config: _objectSpread2(_objectSpread2({}, existingPackageJsonContents), {}, {
|
|
441
427
|
scripts: liftScripts({
|
|
@@ -855,16 +841,6 @@ async function scaffoldTypescript ({
|
|
|
855
841
|
};
|
|
856
842
|
}
|
|
857
843
|
|
|
858
|
-
function scaffoldEsm () {
|
|
859
|
-
return {
|
|
860
|
-
packageProperties: {
|
|
861
|
-
engines: {
|
|
862
|
-
node: '>=12.20'
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
};
|
|
866
|
-
}
|
|
867
|
-
|
|
868
844
|
function scaffoldDialect ({
|
|
869
845
|
dialect,
|
|
870
846
|
projectType,
|
|
@@ -889,13 +865,8 @@ function scaffoldDialect ({
|
|
|
889
865
|
testFilenamePattern
|
|
890
866
|
});
|
|
891
867
|
|
|
892
|
-
case javascriptCore.dialects.ESM:
|
|
893
|
-
return scaffoldEsm();
|
|
894
|
-
|
|
895
868
|
default:
|
|
896
|
-
return {
|
|
897
|
-
eslint: {}
|
|
898
|
-
};
|
|
869
|
+
return {};
|
|
899
870
|
}
|
|
900
871
|
}
|
|
901
872
|
|
|
@@ -1162,7 +1133,7 @@ async function scaffoldPackageType ({
|
|
|
1162
1133
|
publishRegistry
|
|
1163
1134
|
}) {
|
|
1164
1135
|
cliMessages.info('Scaffolding Package Details');
|
|
1165
|
-
const detailsForBuild = await buildDetails({
|
|
1136
|
+
const [detailsForBuild] = await Promise.all([buildDetails({
|
|
1166
1137
|
projectRoot,
|
|
1167
1138
|
projectName,
|
|
1168
1139
|
packageBundlers,
|
|
@@ -1170,28 +1141,29 @@ async function scaffoldPackageType ({
|
|
|
1170
1141
|
packageName,
|
|
1171
1142
|
dialect,
|
|
1172
1143
|
decisions
|
|
1173
|
-
})
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1144
|
+
}), javascriptCore.mergeIntoExistingPackageJson({
|
|
1145
|
+
projectRoot,
|
|
1146
|
+
config: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
1147
|
+
files: ['example.js', ...(javascriptCore.dialects.COMMON_JS === dialect ? ['index.js'] : ['lib/'])],
|
|
1148
|
+
publishConfig: _objectSpread2({
|
|
1149
|
+
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1150
|
+
}, publishRegistry && {
|
|
1151
|
+
registry: publishRegistry
|
|
1152
|
+
}),
|
|
1153
|
+
sideEffects: false
|
|
1154
|
+
}, 'Public' === visibility && {
|
|
1155
|
+
runkitExampleFilename: './example.js'
|
|
1156
|
+
}), javascriptCore.dialects.BABEL === dialect && {
|
|
1177
1157
|
main: './lib/index.cjs.js',
|
|
1178
1158
|
module: './lib/index.es.js',
|
|
1179
1159
|
exports: {
|
|
1180
1160
|
require: './lib/index.cjs.js',
|
|
1181
1161
|
import: './lib/index.es.js'
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
files: ['lib/']
|
|
1185
|
-
}
|
|
1186
|
-
}, detailsForBuild)), javascriptCore.dialects.ESM === dialect && _objectSpread2({
|
|
1187
|
-
packageProperties: {
|
|
1162
|
+
}
|
|
1163
|
+
}), javascriptCore.dialects.ESM === dialect && {
|
|
1188
1164
|
main: './lib/index.es.js',
|
|
1189
|
-
exports: './lib/index.es.js'
|
|
1190
|
-
|
|
1191
|
-
files: ['lib/']
|
|
1192
|
-
}
|
|
1193
|
-
}, detailsForBuild)), javascriptCore.dialects.TYPESCRIPT === dialect && _objectSpread2({
|
|
1194
|
-
packageProperties: {
|
|
1165
|
+
exports: './lib/index.es.js'
|
|
1166
|
+
}), javascriptCore.dialects.TYPESCRIPT === dialect && {
|
|
1195
1167
|
main: './lib/index.cjs.js',
|
|
1196
1168
|
module: './lib/index.es.js',
|
|
1197
1169
|
types: './lib/index.d.ts',
|
|
@@ -1199,16 +1171,9 @@ async function scaffoldPackageType ({
|
|
|
1199
1171
|
types: './lib/index.d.ts',
|
|
1200
1172
|
require: './lib/index.cjs.js',
|
|
1201
1173
|
import: './lib/index.es.js'
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
}
|
|
1206
|
-
}, detailsForBuild)), javascriptCore.dialects.COMMON_JS === dialect && _objectSpread2({
|
|
1207
|
-
packageProperties: {
|
|
1208
|
-
files: ['index.js']
|
|
1209
|
-
}
|
|
1210
|
-
}, detailsForBuild));
|
|
1211
|
-
|
|
1174
|
+
}
|
|
1175
|
+
})
|
|
1176
|
+
})]);
|
|
1212
1177
|
const chosenType = await chooseApplicationType({
|
|
1213
1178
|
types: packageTypes,
|
|
1214
1179
|
projectType: 'package',
|
|
@@ -1221,17 +1186,7 @@ async function scaffoldPackageType ({
|
|
|
1221
1186
|
tests,
|
|
1222
1187
|
scope
|
|
1223
1188
|
});
|
|
1224
|
-
return deepmerge__default["default"].all([{
|
|
1225
|
-
packageProperties: _objectSpread2({
|
|
1226
|
-
files: ['example.js'],
|
|
1227
|
-
publishConfig: _objectSpread2({
|
|
1228
|
-
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1229
|
-
}, publishRegistry && {
|
|
1230
|
-
registry: publishRegistry
|
|
1231
|
-
})
|
|
1232
|
-
}, 'Public' === visibility && {
|
|
1233
|
-
runkitExampleFilename: './example.js'
|
|
1234
|
-
}),
|
|
1189
|
+
return deepmerge__default["default"].all([_objectSpread2(_objectSpread2({}, detailsForBuild), {}, {
|
|
1235
1190
|
documentation: scaffoldPackageDocumentation({
|
|
1236
1191
|
packageName,
|
|
1237
1192
|
visibility,
|
|
@@ -1246,7 +1201,7 @@ async function scaffoldPackageType ({
|
|
|
1246
1201
|
}],
|
|
1247
1202
|
scripts: {},
|
|
1248
1203
|
badges: defineBadges(packageName, visibility)
|
|
1249
|
-
}, results
|
|
1204
|
+
}), results]);
|
|
1250
1205
|
}
|
|
1251
1206
|
|
|
1252
1207
|
const defaultBuildDirectory$1 = 'lib';
|
|
@@ -1260,11 +1215,16 @@ async function scaffoldApplicationType ({
|
|
|
1260
1215
|
decisions
|
|
1261
1216
|
}) {
|
|
1262
1217
|
cliMessages.info('Scaffolding Application Details');
|
|
1263
|
-
const chosenType = await chooseApplicationType({
|
|
1218
|
+
const [chosenType] = await Promise.all([chooseApplicationType({
|
|
1264
1219
|
types: applicationTypes,
|
|
1265
1220
|
projectType: 'application',
|
|
1266
1221
|
decisions
|
|
1267
|
-
})
|
|
1222
|
+
}), javascriptCore.mergeIntoExistingPackageJson({
|
|
1223
|
+
projectRoot,
|
|
1224
|
+
config: {
|
|
1225
|
+
private: true
|
|
1226
|
+
}
|
|
1227
|
+
})]);
|
|
1268
1228
|
const results = await javascriptCore.scaffoldChoice(applicationTypes, chosenType, {
|
|
1269
1229
|
projectRoot,
|
|
1270
1230
|
projectName,
|
|
@@ -1286,9 +1246,6 @@ async function scaffoldApplicationType ({
|
|
|
1286
1246
|
directories: [`/${buildDirectory}/`]
|
|
1287
1247
|
},
|
|
1288
1248
|
buildDirectory,
|
|
1289
|
-
packageProperties: {
|
|
1290
|
-
private: true
|
|
1291
|
-
},
|
|
1292
1249
|
eslintConfigs: [],
|
|
1293
1250
|
nextSteps: []
|
|
1294
1251
|
}, results);
|
|
@@ -1330,11 +1287,22 @@ async function scaffoldCliType ({
|
|
|
1330
1287
|
dialect,
|
|
1331
1288
|
publishRegistry
|
|
1332
1289
|
}) {
|
|
1333
|
-
const rollupResults = await rollup.scaffold({
|
|
1290
|
+
const [rollupResults] = await Promise.all([rollup.scaffold({
|
|
1334
1291
|
projectRoot,
|
|
1335
1292
|
dialect,
|
|
1336
1293
|
projectType: javascriptCore.projectTypes.CLI
|
|
1337
|
-
})
|
|
1294
|
+
}), javascriptCore.mergeIntoExistingPackageJson({
|
|
1295
|
+
projectRoot,
|
|
1296
|
+
config: {
|
|
1297
|
+
bin: {},
|
|
1298
|
+
files: [`${defaultBuildDirectory}/`],
|
|
1299
|
+
publishConfig: _objectSpread2({
|
|
1300
|
+
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1301
|
+
}, publishRegistry && {
|
|
1302
|
+
registry: publishRegistry
|
|
1303
|
+
})
|
|
1304
|
+
}
|
|
1305
|
+
})]);
|
|
1338
1306
|
return deepmerge__default["default"](rollupResults, {
|
|
1339
1307
|
scripts: {
|
|
1340
1308
|
clean: `rimraf ./${defaultBuildDirectory}`,
|
|
@@ -1350,16 +1318,6 @@ async function scaffoldCliType ({
|
|
|
1350
1318
|
},
|
|
1351
1319
|
buildDirectory: defaultBuildDirectory,
|
|
1352
1320
|
badges: defineBadges(packageName, visibility),
|
|
1353
|
-
packageProperties: {
|
|
1354
|
-
version: '0.0.0-semantically-released',
|
|
1355
|
-
bin: {},
|
|
1356
|
-
files: [`${defaultBuildDirectory}/`],
|
|
1357
|
-
publishConfig: _objectSpread2({
|
|
1358
|
-
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1359
|
-
}, publishRegistry && {
|
|
1360
|
-
registry: publishRegistry
|
|
1361
|
-
})
|
|
1362
|
-
},
|
|
1363
1321
|
eslintConfigs: [],
|
|
1364
1322
|
nextSteps: []
|
|
1365
1323
|
});
|
|
@@ -1716,6 +1674,19 @@ async function scaffolder (options) {
|
|
|
1716
1674
|
level: 'secondary'
|
|
1717
1675
|
});
|
|
1718
1676
|
const packageName = buildPackageName(projectName, scope);
|
|
1677
|
+
const {
|
|
1678
|
+
homepage: projectHomepage
|
|
1679
|
+
} = await scaffoldPackage({
|
|
1680
|
+
projectRoot,
|
|
1681
|
+
projectType,
|
|
1682
|
+
dialect,
|
|
1683
|
+
packageName,
|
|
1684
|
+
license,
|
|
1685
|
+
vcs,
|
|
1686
|
+
author,
|
|
1687
|
+
description,
|
|
1688
|
+
pathWithinParent
|
|
1689
|
+
});
|
|
1719
1690
|
const projectTypeResults = await scaffoldProjectType({
|
|
1720
1691
|
projectType,
|
|
1721
1692
|
projectRoot,
|
|
@@ -1785,21 +1756,6 @@ async function scaffolder (options) {
|
|
|
1785
1756
|
configs,
|
|
1786
1757
|
pathWithinParent
|
|
1787
1758
|
})])), projectTypeResults, verificationResults, npmResults, dialectResults]);
|
|
1788
|
-
const {
|
|
1789
|
-
homepage: projectHomepage
|
|
1790
|
-
} = await scaffoldPackage({
|
|
1791
|
-
projectRoot,
|
|
1792
|
-
projectType,
|
|
1793
|
-
dialect,
|
|
1794
|
-
packageName,
|
|
1795
|
-
license,
|
|
1796
|
-
vcs,
|
|
1797
|
-
author,
|
|
1798
|
-
description,
|
|
1799
|
-
packageProperties: mergedContributions.packageProperties,
|
|
1800
|
-
scripts: mergedContributions.scripts,
|
|
1801
|
-
pathWithinParent
|
|
1802
|
-
});
|
|
1803
1759
|
const liftResults = await lift({
|
|
1804
1760
|
results: deepmerge__default["default"]({
|
|
1805
1761
|
devDependencies: ['npm-run-all'],
|