@form8ion/javascript 5.9.0 → 6.0.0-alpha.2

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 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.rmdir(`${projectRoot}/.nyc_output`, {
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,18 +318,6 @@ var enginesEnhancer = /*#__PURE__*/Object.freeze({
318
318
  lift: lift$1
319
319
  });
320
320
 
321
- function write({
322
- projectRoot,
323
- config
324
- }) {
325
- return core.writeConfigFile({
326
- format: core.fileTypes.JSON,
327
- name: 'package',
328
- path: projectRoot,
329
- config
330
- });
331
- }
332
-
333
321
  function scaffoldScripts () {
334
322
  return {};
335
323
  }
@@ -375,15 +363,14 @@ function buildPackageDetails ({
375
363
  vcs,
376
364
  author,
377
365
  description,
378
- packageProperties,
379
366
  pathWithinParent
380
367
  }) {
381
- return _objectSpread2(_objectSpread2(_objectSpread2({
368
+ return _objectSpread2(_objectSpread2({
382
369
  name: packageName,
383
370
  description,
384
371
  license,
385
372
  type: javascriptCore.dialects.ESM === dialect ? 'module' : 'commonjs'
386
- }, packageProperties), defineVcsHostDetails(vcs, projectType, packageName, pathWithinParent)), {}, {
373
+ }, defineVcsHostDetails(vcs, projectType, packageName, pathWithinParent)), {}, {
387
374
  author: `${author.name}${author.email ? ` <${author.email}>` : ''}${author.url ? ` (${author.url})` : ''}`,
388
375
  scripts: scaffoldScripts()
389
376
  });
@@ -398,7 +385,6 @@ async function scaffoldPackage ({
398
385
  vcs,
399
386
  author,
400
387
  description,
401
- packageProperties,
402
388
  pathWithinParent
403
389
  }) {
404
390
  cliMessages.info('Configuring package.json');
@@ -410,10 +396,9 @@ async function scaffoldPackage ({
410
396
  vcs,
411
397
  author,
412
398
  description,
413
- packageProperties,
414
399
  pathWithinParent
415
400
  });
416
- await write({
401
+ await javascriptCore.writePackageJson({
417
402
  projectRoot,
418
403
  config: packageData
419
404
  });
@@ -436,7 +421,7 @@ async function liftPackage ({
436
421
  });
437
422
  const pathToPackageJson = `${projectRoot}/package.json`;
438
423
  const existingPackageJsonContents = JSON.parse(await fs.promises.readFile(pathToPackageJson, 'utf8'));
439
- await write({
424
+ await javascriptCore.writePackageJson({
440
425
  projectRoot,
441
426
  config: _objectSpread2(_objectSpread2({}, existingPackageJsonContents), {}, {
442
427
  scripts: liftScripts({
@@ -856,16 +841,6 @@ async function scaffoldTypescript ({
856
841
  };
857
842
  }
858
843
 
859
- function scaffoldEsm () {
860
- return {
861
- packageProperties: {
862
- engines: {
863
- node: '>=12.20'
864
- }
865
- }
866
- };
867
- }
868
-
869
844
  function scaffoldDialect ({
870
845
  dialect,
871
846
  projectType,
@@ -890,13 +865,8 @@ function scaffoldDialect ({
890
865
  testFilenamePattern
891
866
  });
892
867
 
893
- case javascriptCore.dialects.ESM:
894
- return scaffoldEsm();
895
-
896
868
  default:
897
- return {
898
- eslint: {}
899
- };
869
+ return {};
900
870
  }
901
871
  }
902
872
 
@@ -1163,7 +1133,7 @@ async function scaffoldPackageType ({
1163
1133
  publishRegistry
1164
1134
  }) {
1165
1135
  cliMessages.info('Scaffolding Package Details');
1166
- const detailsForBuild = await buildDetails({
1136
+ const [detailsForBuild] = await Promise.all([buildDetails({
1167
1137
  projectRoot,
1168
1138
  projectName,
1169
1139
  packageBundlers,
@@ -1171,28 +1141,29 @@ async function scaffoldPackageType ({
1171
1141
  packageName,
1172
1142
  dialect,
1173
1143
  decisions
1174
- });
1175
-
1176
- const details = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, javascriptCore.dialects.BABEL === dialect && _objectSpread2({
1177
- packageProperties: {
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 && {
1178
1157
  main: './lib/index.cjs.js',
1179
1158
  module: './lib/index.es.js',
1180
1159
  exports: {
1181
1160
  require: './lib/index.cjs.js',
1182
1161
  import: './lib/index.es.js'
1183
- },
1184
- sideEffects: false,
1185
- files: ['lib/']
1186
- }
1187
- }, detailsForBuild)), javascriptCore.dialects.ESM === dialect && _objectSpread2({
1188
- packageProperties: {
1162
+ }
1163
+ }), javascriptCore.dialects.ESM === dialect && {
1189
1164
  main: './lib/index.es.js',
1190
- exports: './lib/index.es.js',
1191
- sideEffects: false,
1192
- files: ['lib/']
1193
- }
1194
- }, detailsForBuild)), javascriptCore.dialects.TYPESCRIPT === dialect && _objectSpread2({
1195
- packageProperties: {
1165
+ exports: './lib/index.es.js'
1166
+ }), javascriptCore.dialects.TYPESCRIPT === dialect && {
1196
1167
  main: './lib/index.cjs.js',
1197
1168
  module: './lib/index.es.js',
1198
1169
  types: './lib/index.d.ts',
@@ -1200,16 +1171,9 @@ async function scaffoldPackageType ({
1200
1171
  types: './lib/index.d.ts',
1201
1172
  require: './lib/index.cjs.js',
1202
1173
  import: './lib/index.es.js'
1203
- },
1204
- sideEffects: false,
1205
- files: ['lib/']
1206
- }
1207
- }, detailsForBuild)), javascriptCore.dialects.COMMON_JS === dialect && _objectSpread2({
1208
- packageProperties: {
1209
- files: ['index.js']
1210
- }
1211
- }, detailsForBuild));
1212
-
1174
+ }
1175
+ })
1176
+ })]);
1213
1177
  const chosenType = await chooseApplicationType({
1214
1178
  types: packageTypes,
1215
1179
  projectType: 'package',
@@ -1222,17 +1186,7 @@ async function scaffoldPackageType ({
1222
1186
  tests,
1223
1187
  scope
1224
1188
  });
1225
- return deepmerge__default["default"].all([{
1226
- packageProperties: _objectSpread2({
1227
- files: ['example.js'],
1228
- publishConfig: _objectSpread2({
1229
- access: 'Public' === visibility ? 'public' : 'restricted'
1230
- }, publishRegistry && {
1231
- registry: publishRegistry
1232
- })
1233
- }, 'Public' === visibility && {
1234
- runkitExampleFilename: './example.js'
1235
- }),
1189
+ return deepmerge__default["default"].all([_objectSpread2(_objectSpread2({}, detailsForBuild), {}, {
1236
1190
  documentation: scaffoldPackageDocumentation({
1237
1191
  packageName,
1238
1192
  visibility,
@@ -1247,7 +1201,7 @@ async function scaffoldPackageType ({
1247
1201
  }],
1248
1202
  scripts: {},
1249
1203
  badges: defineBadges(packageName, visibility)
1250
- }, results, details]);
1204
+ }), results]);
1251
1205
  }
1252
1206
 
1253
1207
  const defaultBuildDirectory$1 = 'lib';
@@ -1261,11 +1215,16 @@ async function scaffoldApplicationType ({
1261
1215
  decisions
1262
1216
  }) {
1263
1217
  cliMessages.info('Scaffolding Application Details');
1264
- const chosenType = await chooseApplicationType({
1218
+ const [chosenType] = await Promise.all([chooseApplicationType({
1265
1219
  types: applicationTypes,
1266
1220
  projectType: 'application',
1267
1221
  decisions
1268
- });
1222
+ }), javascriptCore.mergeIntoExistingPackageJson({
1223
+ projectRoot,
1224
+ config: {
1225
+ private: true
1226
+ }
1227
+ })]);
1269
1228
  const results = await javascriptCore.scaffoldChoice(applicationTypes, chosenType, {
1270
1229
  projectRoot,
1271
1230
  projectName,
@@ -1287,9 +1246,6 @@ async function scaffoldApplicationType ({
1287
1246
  directories: [`/${buildDirectory}/`]
1288
1247
  },
1289
1248
  buildDirectory,
1290
- packageProperties: {
1291
- private: true
1292
- },
1293
1249
  eslintConfigs: [],
1294
1250
  nextSteps: []
1295
1251
  }, results);
@@ -1331,11 +1287,22 @@ async function scaffoldCliType ({
1331
1287
  dialect,
1332
1288
  publishRegistry
1333
1289
  }) {
1334
- const rollupResults = await rollup.scaffold({
1290
+ const [rollupResults] = await Promise.all([rollup.scaffold({
1335
1291
  projectRoot,
1336
1292
  dialect,
1337
1293
  projectType: javascriptCore.projectTypes.CLI
1338
- });
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
+ })]);
1339
1306
  return deepmerge__default["default"](rollupResults, {
1340
1307
  scripts: {
1341
1308
  clean: `rimraf ./${defaultBuildDirectory}`,
@@ -1351,16 +1318,6 @@ async function scaffoldCliType ({
1351
1318
  },
1352
1319
  buildDirectory: defaultBuildDirectory,
1353
1320
  badges: defineBadges(packageName, visibility),
1354
- packageProperties: {
1355
- version: '0.0.0-semantically-released',
1356
- bin: {},
1357
- files: [`${defaultBuildDirectory}/`],
1358
- publishConfig: _objectSpread2({
1359
- access: 'Public' === visibility ? 'public' : 'restricted'
1360
- }, publishRegistry && {
1361
- registry: publishRegistry
1362
- })
1363
- },
1364
1321
  eslintConfigs: [],
1365
1322
  nextSteps: []
1366
1323
  });
@@ -1717,6 +1674,19 @@ async function scaffolder (options) {
1717
1674
  level: 'secondary'
1718
1675
  });
1719
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
+ });
1720
1690
  const projectTypeResults = await scaffoldProjectType({
1721
1691
  projectType,
1722
1692
  projectRoot,
@@ -1786,20 +1756,6 @@ async function scaffolder (options) {
1786
1756
  configs,
1787
1757
  pathWithinParent
1788
1758
  })])), projectTypeResults, verificationResults, npmResults, dialectResults]);
1789
- const {
1790
- homepage: projectHomepage
1791
- } = await scaffoldPackage({
1792
- projectRoot,
1793
- projectType,
1794
- dialect,
1795
- packageName,
1796
- license,
1797
- vcs,
1798
- author,
1799
- description,
1800
- packageProperties: mergedContributions.packageProperties,
1801
- pathWithinParent
1802
- });
1803
1759
  const liftResults = await lift({
1804
1760
  results: deepmerge__default["default"]({
1805
1761
  devDependencies: ['npm-run-all'],