@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/README.md CHANGED
@@ -98,7 +98,7 @@ const {
98
98
  dependencies: [],
99
99
  devDependencies: [],
100
100
  scripts: {},
101
- eslintConfigs: [],
101
+ eslint: {configs: [], ignore: {directories: []}},
102
102
  packageManager: 'npm'
103
103
  }
104
104
  });
package/example.js CHANGED
@@ -68,7 +68,7 @@ const {
68
68
  dependencies: [],
69
69
  devDependencies: [],
70
70
  scripts: {},
71
- eslintConfigs: [],
71
+ eslint: {configs: [], ignore: {directories: []}},
72
72
  packageManager: 'npm'
73
73
  }
74
74
  });
package/lib/index.js CHANGED
@@ -29,6 +29,7 @@ var filedirname = require('filedirname');
29
29
  var huskyPlugin = require('@form8ion/husky');
30
30
  var prettier = require('@form8ion/prettier');
31
31
  var eslint = require('@form8ion/eslint');
32
+ var sortObjectKeys = require('sort-object-keys');
32
33
 
33
34
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
34
35
 
@@ -63,6 +64,7 @@ var makeDir__default = /*#__PURE__*/_interopDefaultLegacy(makeDir);
63
64
  var touch__default = /*#__PURE__*/_interopDefaultLegacy(touch);
64
65
  var filedirname__default = /*#__PURE__*/_interopDefaultLegacy(filedirname);
65
66
  var huskyPlugin__namespace = /*#__PURE__*/_interopNamespace(huskyPlugin);
67
+ var sortObjectKeys__default = /*#__PURE__*/_interopDefaultLegacy(sortObjectKeys);
66
68
 
67
69
  const questionNames$1 = {
68
70
  UNIT_TEST_FRAMEWORK: 'unitTestFramework',
@@ -320,7 +322,6 @@ function predicate ({projectRoot}) {
320
322
  }
321
323
 
322
324
  async function scaffoldTypescript ({config, projectType, projectRoot, testFilenamePattern}) {
323
- const eslintConfigs = ['typescript'];
324
325
  const shareableTsConfigPackage = `${config.scope}/tsconfig`;
325
326
 
326
327
  await core.writeConfigFile({
@@ -343,8 +344,7 @@ async function scaffoldTypescript ({config, projectType, projectRoot, testFilena
343
344
  });
344
345
 
345
346
  return {
346
- eslint: {configs: eslintConfigs},
347
- eslintConfigs,
347
+ eslint: {configs: ['typescript']},
348
348
  devDependencies: ['typescript', shareableTsConfigPackage],
349
349
  vcsIgnore: {files: ['tsconfig.tsbuildinfo']}
350
350
  };
@@ -461,6 +461,35 @@ async function scaffoldPackage ({
461
461
  return {homepage: packageData.homepage};
462
462
  }
463
463
 
464
+ function sortPackageProperties (packageContents) {
465
+ return sortObjectKeys__default["default"](
466
+ packageContents,
467
+ [
468
+ 'name',
469
+ 'description',
470
+ 'license',
471
+ 'version',
472
+ 'engines',
473
+ 'author',
474
+ 'repository',
475
+ 'bugs',
476
+ 'homepage',
477
+ 'keywords',
478
+ 'runkitExampleFilename',
479
+ 'exports',
480
+ 'main',
481
+ 'module',
482
+ 'files',
483
+ 'publishConfig',
484
+ 'sideEffects',
485
+ 'scripts',
486
+ 'dependencies',
487
+ 'devDependencies',
488
+ 'peerDependencies'
489
+ ]
490
+ );
491
+ }
492
+
464
493
  const details = {
465
494
  [javascriptCore.packageManagers.NPM]: {
466
495
  installationCommand: 'install',
@@ -524,13 +553,13 @@ async function liftPackage ({
524
553
 
525
554
  await javascriptCore.writePackageJson({
526
555
  projectRoot,
527
- config: {
556
+ config: sortPackageProperties({
528
557
  ...existingPackageJsonContents,
529
558
  scripts: liftScripts({existingScripts: existingPackageJsonContents.scripts, scripts}),
530
559
  ...tags && {
531
560
  keywords: existingPackageJsonContents.keywords ? [...existingPackageJsonContents.keywords, ...tags] : tags
532
561
  }
533
- }
562
+ })
534
563
  });
535
564
  }
536
565
 
@@ -1161,7 +1190,6 @@ async function scaffoldPackageType ({
1161
1190
  return deepmerge__default["default"].all([
1162
1191
  {
1163
1192
  documentation: scaffoldPackageDocumentation({packageName, visibility, scope, packageManager}),
1164
- eslintConfigs: [],
1165
1193
  nextSteps: [
1166
1194
  {summary: 'Add the appropriate `save` flag to the installation instructions in the README'},
1167
1195
  {summary: 'Publish pre-release versions to npm until package is stable enough to publish v1.0.0'}
@@ -1192,7 +1220,6 @@ async function scaffoldApplicationType ({projectRoot}) {
1192
1220
  devDependencies: ['rimraf'],
1193
1221
  vcsIgnore: {files: ['.env'], directories: [`/${buildDirectory}/`]},
1194
1222
  buildDirectory,
1195
- eslintConfigs: [],
1196
1223
  nextSteps: []
1197
1224
  };
1198
1225
  }
@@ -1203,7 +1230,6 @@ async function scaffoldMonorepoType ({projectRoot}) {
1203
1230
  await javascriptCore.mergeIntoExistingPackageJson({projectRoot, config: {private: true}});
1204
1231
 
1205
1232
  return {
1206
- eslintConfigs: [],
1207
1233
  nextSteps: [{
1208
1234
  summary: 'Add packages to your new monorepo',
1209
1235
  description: 'Leverage [@form8ion/add-package-to-monorepo](https://npm.im/@form8ion/add-package-to-monorepo)'
@@ -1244,7 +1270,6 @@ async function scaffoldCliType ({packageName, visibility, projectRoot, dialect,
1244
1270
  vcsIgnore: {files: [], directories: [`/${defaultBuildDirectory}/`]},
1245
1271
  buildDirectory: defaultBuildDirectory,
1246
1272
  badges: defineBadges(packageName, visibility),
1247
- eslintConfigs: [],
1248
1273
  nextSteps: []
1249
1274
  }
1250
1275
  );
@@ -1286,9 +1311,7 @@ async function scaffoldProjectType ({
1286
1311
  case javascriptCore.projectTypes.MONOREPO:
1287
1312
  return scaffoldMonorepoType({projectRoot});
1288
1313
  case 'Other':
1289
- return {
1290
- eslintConfigs: []
1291
- };
1314
+ return {};
1292
1315
  default:
1293
1316
  throw new Error(`The project-type of ${projectType} is invalid`);
1294
1317
  }
@@ -1529,7 +1552,7 @@ async function scaffolder (options) {
1529
1552
  decisions,
1530
1553
  pathWithinParent
1531
1554
  });
1532
- const [nodeVersion, npmResults, dialectResults, codeStyleResults, projectTypePluginResults] = await Promise.all([
1555
+ const [nodeVersion, npmResults, dialectResults, codeStyleResults] = await Promise.all([
1533
1556
  scaffoldNodeVersion({projectRoot, nodeVersionCategory}),
1534
1557
  scaffoldNpmConfig({projectType, projectRoot, registries}),
1535
1558
  scaffoldDialect({
@@ -1539,24 +1562,24 @@ async function scaffolder (options) {
1539
1562
  projectType,
1540
1563
  testFilenamePattern: verificationResults.testFilenamePattern
1541
1564
  }),
1542
- scaffoldCodeStyle({projectRoot, projectType, dialect, configs, vcs, configureLinting}),
1543
- scaffoldProjectTypePlugin({
1544
- projectRoot,
1545
- projectType,
1546
- projectName,
1547
- packageName,
1548
- packageManager,
1549
- scope,
1550
- dialect,
1551
- tests,
1552
- decisions,
1553
- plugins: {
1554
- [javascriptCore.projectTypes.PACKAGE]: packageTypes,
1555
- [javascriptCore.projectTypes.APPLICATION]: applicationTypes,
1556
- [javascriptCore.projectTypes.MONOREPO]: monorepoTypes
1557
- }
1558
- })
1565
+ scaffoldCodeStyle({projectRoot, projectType, dialect, configs, vcs, configureLinting})
1559
1566
  ]);
1567
+ const projectTypePluginResults = await scaffoldProjectTypePlugin({
1568
+ projectRoot,
1569
+ projectType,
1570
+ projectName,
1571
+ packageName,
1572
+ packageManager,
1573
+ scope,
1574
+ dialect,
1575
+ tests,
1576
+ decisions,
1577
+ plugins: {
1578
+ [javascriptCore.projectTypes.PACKAGE]: packageTypes,
1579
+ [javascriptCore.projectTypes.APPLICATION]: applicationTypes,
1580
+ [javascriptCore.projectTypes.MONOREPO]: monorepoTypes
1581
+ }
1582
+ });
1560
1583
  const mergedContributions = deepmerge__default["default"].all([
1561
1584
  ...(await Promise.all([
1562
1585
  javascriptCore.scaffoldChoice(