@form8ion/javascript 8.0.1 → 8.2.0

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.mjs CHANGED
@@ -27,6 +27,7 @@ import * as huskyPlugin from '@form8ion/husky';
27
27
  import { scaffold as scaffold$4 } from '@form8ion/husky';
28
28
  import { scaffold as scaffold$2 } from '@form8ion/prettier';
29
29
  import { scaffold as scaffold$1, lift as lift$4, test as test$2 } from '@form8ion/eslint';
30
+ import sortObjectKeys from 'sort-object-keys';
30
31
 
31
32
  const questionNames$1 = {
32
33
  UNIT_TEST_FRAMEWORK: 'unitTestFramework',
@@ -284,7 +285,6 @@ function predicate ({projectRoot}) {
284
285
  }
285
286
 
286
287
  async function scaffoldTypescript ({config, projectType, projectRoot, testFilenamePattern}) {
287
- const eslintConfigs = ['typescript'];
288
288
  const shareableTsConfigPackage = `${config.scope}/tsconfig`;
289
289
 
290
290
  await writeConfigFile({
@@ -307,8 +307,7 @@ async function scaffoldTypescript ({config, projectType, projectRoot, testFilena
307
307
  });
308
308
 
309
309
  return {
310
- eslint: {configs: eslintConfigs},
311
- eslintConfigs,
310
+ eslint: {configs: ['typescript']},
312
311
  devDependencies: ['typescript', shareableTsConfigPackage],
313
312
  vcsIgnore: {files: ['tsconfig.tsbuildinfo']}
314
313
  };
@@ -425,6 +424,35 @@ async function scaffoldPackage ({
425
424
  return {homepage: packageData.homepage};
426
425
  }
427
426
 
427
+ function sortPackageProperties (packageContents) {
428
+ return sortObjectKeys(
429
+ packageContents,
430
+ [
431
+ 'name',
432
+ 'description',
433
+ 'license',
434
+ 'version',
435
+ 'engines',
436
+ 'author',
437
+ 'repository',
438
+ 'bugs',
439
+ 'homepage',
440
+ 'keywords',
441
+ 'runkitExampleFilename',
442
+ 'exports',
443
+ 'main',
444
+ 'module',
445
+ 'files',
446
+ 'publishConfig',
447
+ 'sideEffects',
448
+ 'scripts',
449
+ 'dependencies',
450
+ 'devDependencies',
451
+ 'peerDependencies'
452
+ ]
453
+ );
454
+ }
455
+
428
456
  const details = {
429
457
  [packageManagers.NPM]: {
430
458
  installationCommand: 'install',
@@ -488,13 +516,13 @@ async function liftPackage ({
488
516
 
489
517
  await writePackageJson({
490
518
  projectRoot,
491
- config: {
519
+ config: sortPackageProperties({
492
520
  ...existingPackageJsonContents,
493
521
  scripts: liftScripts({existingScripts: existingPackageJsonContents.scripts, scripts}),
494
522
  ...tags && {
495
523
  keywords: existingPackageJsonContents.keywords ? [...existingPackageJsonContents.keywords, ...tags] : tags
496
524
  }
497
- }
525
+ })
498
526
  });
499
527
  }
500
528
 
@@ -1125,7 +1153,6 @@ async function scaffoldPackageType ({
1125
1153
  return deepmerge.all([
1126
1154
  {
1127
1155
  documentation: scaffoldPackageDocumentation({packageName, visibility, scope, packageManager}),
1128
- eslintConfigs: [],
1129
1156
  nextSteps: [
1130
1157
  {summary: 'Add the appropriate `save` flag to the installation instructions in the README'},
1131
1158
  {summary: 'Publish pre-release versions to npm until package is stable enough to publish v1.0.0'}
@@ -1156,7 +1183,6 @@ async function scaffoldApplicationType ({projectRoot}) {
1156
1183
  devDependencies: ['rimraf'],
1157
1184
  vcsIgnore: {files: ['.env'], directories: [`/${buildDirectory}/`]},
1158
1185
  buildDirectory,
1159
- eslintConfigs: [],
1160
1186
  nextSteps: []
1161
1187
  };
1162
1188
  }
@@ -1167,7 +1193,6 @@ async function scaffoldMonorepoType ({projectRoot}) {
1167
1193
  await mergeIntoExistingPackageJson({projectRoot, config: {private: true}});
1168
1194
 
1169
1195
  return {
1170
- eslintConfigs: [],
1171
1196
  nextSteps: [{
1172
1197
  summary: 'Add packages to your new monorepo',
1173
1198
  description: 'Leverage [@form8ion/add-package-to-monorepo](https://npm.im/@form8ion/add-package-to-monorepo)'
@@ -1208,7 +1233,6 @@ async function scaffoldCliType ({packageName, visibility, projectRoot, dialect,
1208
1233
  vcsIgnore: {files: [], directories: [`/${defaultBuildDirectory}/`]},
1209
1234
  buildDirectory: defaultBuildDirectory,
1210
1235
  badges: defineBadges(packageName, visibility),
1211
- eslintConfigs: [],
1212
1236
  nextSteps: []
1213
1237
  }
1214
1238
  );
@@ -1250,9 +1274,7 @@ async function scaffoldProjectType ({
1250
1274
  case projectTypes.MONOREPO:
1251
1275
  return scaffoldMonorepoType({projectRoot});
1252
1276
  case 'Other':
1253
- return {
1254
- eslintConfigs: []
1255
- };
1277
+ return {};
1256
1278
  default:
1257
1279
  throw new Error(`The project-type of ${projectType} is invalid`);
1258
1280
  }
@@ -1493,7 +1515,7 @@ async function scaffolder (options) {
1493
1515
  decisions,
1494
1516
  pathWithinParent
1495
1517
  });
1496
- const [nodeVersion, npmResults, dialectResults, codeStyleResults, projectTypePluginResults] = await Promise.all([
1518
+ const [nodeVersion, npmResults, dialectResults, codeStyleResults] = await Promise.all([
1497
1519
  scaffoldNodeVersion({projectRoot, nodeVersionCategory}),
1498
1520
  scaffoldNpmConfig({projectType, projectRoot, registries}),
1499
1521
  scaffoldDialect({
@@ -1503,24 +1525,24 @@ async function scaffolder (options) {
1503
1525
  projectType,
1504
1526
  testFilenamePattern: verificationResults.testFilenamePattern
1505
1527
  }),
1506
- scaffoldCodeStyle({projectRoot, projectType, dialect, configs, vcs, configureLinting}),
1507
- scaffoldProjectTypePlugin({
1508
- projectRoot,
1509
- projectType,
1510
- projectName,
1511
- packageName,
1512
- packageManager,
1513
- scope,
1514
- dialect,
1515
- tests,
1516
- decisions,
1517
- plugins: {
1518
- [projectTypes.PACKAGE]: packageTypes,
1519
- [projectTypes.APPLICATION]: applicationTypes,
1520
- [projectTypes.MONOREPO]: monorepoTypes
1521
- }
1522
- })
1528
+ scaffoldCodeStyle({projectRoot, projectType, dialect, configs, vcs, configureLinting})
1523
1529
  ]);
1530
+ const projectTypePluginResults = await scaffoldProjectTypePlugin({
1531
+ projectRoot,
1532
+ projectType,
1533
+ projectName,
1534
+ packageName,
1535
+ packageManager,
1536
+ scope,
1537
+ dialect,
1538
+ tests,
1539
+ decisions,
1540
+ plugins: {
1541
+ [projectTypes.PACKAGE]: packageTypes,
1542
+ [projectTypes.APPLICATION]: applicationTypes,
1543
+ [projectTypes.MONOREPO]: monorepoTypes
1544
+ }
1545
+ });
1524
1546
  const mergedContributions = deepmerge.all([
1525
1547
  ...(await Promise.all([
1526
1548
  scaffoldChoice(