@form8ion/javascript 8.0.0 → 8.1.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,13 @@ 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
+ ['name', 'keywords', 'engines', 'scripts', 'dependencies', 'devDependencies', 'peerDependencies']
468
+ );
469
+ }
470
+
464
471
  const details = {
465
472
  [javascriptCore.packageManagers.NPM]: {
466
473
  installationCommand: 'install',
@@ -524,13 +531,13 @@ async function liftPackage ({
524
531
 
525
532
  await javascriptCore.writePackageJson({
526
533
  projectRoot,
527
- config: {
534
+ config: sortPackageProperties({
528
535
  ...existingPackageJsonContents,
529
536
  scripts: liftScripts({existingScripts: existingPackageJsonContents.scripts, scripts}),
530
537
  ...tags && {
531
538
  keywords: existingPackageJsonContents.keywords ? [...existingPackageJsonContents.keywords, ...tags] : tags
532
539
  }
533
- }
540
+ })
534
541
  });
535
542
  }
536
543
 
@@ -1161,7 +1168,6 @@ async function scaffoldPackageType ({
1161
1168
  return deepmerge__default["default"].all([
1162
1169
  {
1163
1170
  documentation: scaffoldPackageDocumentation({packageName, visibility, scope, packageManager}),
1164
- eslintConfigs: [],
1165
1171
  nextSteps: [
1166
1172
  {summary: 'Add the appropriate `save` flag to the installation instructions in the README'},
1167
1173
  {summary: 'Publish pre-release versions to npm until package is stable enough to publish v1.0.0'}
@@ -1192,7 +1198,6 @@ async function scaffoldApplicationType ({projectRoot}) {
1192
1198
  devDependencies: ['rimraf'],
1193
1199
  vcsIgnore: {files: ['.env'], directories: [`/${buildDirectory}/`]},
1194
1200
  buildDirectory,
1195
- eslintConfigs: [],
1196
1201
  nextSteps: []
1197
1202
  };
1198
1203
  }
@@ -1203,7 +1208,6 @@ async function scaffoldMonorepoType ({projectRoot}) {
1203
1208
  await javascriptCore.mergeIntoExistingPackageJson({projectRoot, config: {private: true}});
1204
1209
 
1205
1210
  return {
1206
- eslintConfigs: [],
1207
1211
  nextSteps: [{
1208
1212
  summary: 'Add packages to your new monorepo',
1209
1213
  description: 'Leverage [@form8ion/add-package-to-monorepo](https://npm.im/@form8ion/add-package-to-monorepo)'
@@ -1244,7 +1248,6 @@ async function scaffoldCliType ({packageName, visibility, projectRoot, dialect,
1244
1248
  vcsIgnore: {files: [], directories: [`/${defaultBuildDirectory}/`]},
1245
1249
  buildDirectory: defaultBuildDirectory,
1246
1250
  badges: defineBadges(packageName, visibility),
1247
- eslintConfigs: [],
1248
1251
  nextSteps: []
1249
1252
  }
1250
1253
  );
@@ -1286,9 +1289,7 @@ async function scaffoldProjectType ({
1286
1289
  case javascriptCore.projectTypes.MONOREPO:
1287
1290
  return scaffoldMonorepoType({projectRoot});
1288
1291
  case 'Other':
1289
- return {
1290
- eslintConfigs: []
1291
- };
1292
+ return {};
1292
1293
  default:
1293
1294
  throw new Error(`The project-type of ${projectType} is invalid`);
1294
1295
  }
@@ -1529,7 +1530,7 @@ async function scaffolder (options) {
1529
1530
  decisions,
1530
1531
  pathWithinParent
1531
1532
  });
1532
- const [nodeVersion, npmResults, dialectResults, codeStyleResults, projectTypePluginResults] = await Promise.all([
1533
+ const [nodeVersion, npmResults, dialectResults, codeStyleResults] = await Promise.all([
1533
1534
  scaffoldNodeVersion({projectRoot, nodeVersionCategory}),
1534
1535
  scaffoldNpmConfig({projectType, projectRoot, registries}),
1535
1536
  scaffoldDialect({
@@ -1539,24 +1540,24 @@ async function scaffolder (options) {
1539
1540
  projectType,
1540
1541
  testFilenamePattern: verificationResults.testFilenamePattern
1541
1542
  }),
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
- })
1543
+ scaffoldCodeStyle({projectRoot, projectType, dialect, configs, vcs, configureLinting})
1559
1544
  ]);
1545
+ const projectTypePluginResults = await scaffoldProjectTypePlugin({
1546
+ projectRoot,
1547
+ projectType,
1548
+ projectName,
1549
+ packageName,
1550
+ packageManager,
1551
+ scope,
1552
+ dialect,
1553
+ tests,
1554
+ decisions,
1555
+ plugins: {
1556
+ [javascriptCore.projectTypes.PACKAGE]: packageTypes,
1557
+ [javascriptCore.projectTypes.APPLICATION]: applicationTypes,
1558
+ [javascriptCore.projectTypes.MONOREPO]: monorepoTypes
1559
+ }
1560
+ });
1560
1561
  const mergedContributions = deepmerge__default["default"].all([
1561
1562
  ...(await Promise.all([
1562
1563
  javascriptCore.scaffoldChoice(