@form8ion/javascript 12.6.2 → 13.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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { questionNames as questionNames$2, questions } from '@travi/language-scaffolder-prompts';
2
2
  import deepmerge from 'deepmerge';
3
- import { fileTypes, fileExists, validateOptions, applyEnhancers, writeConfigFile } from '@form8ion/core';
3
+ import { fileTypes, fileExists, optionsSchemas, validateOptions, applyEnhancers, writeConfigFile } from '@form8ion/core';
4
4
  import { scaffoldChoice, projectTypes as projectTypes$1, packageManagers as packageManagers$1, mergeIntoExistingPackageJson, dialects as dialects$1, writePackageJson, DEV_DEPENDENCY_TYPE, PROD_DEPENDENCY_TYPE } from '@form8ion/javascript-core';
5
5
  import joi from 'joi';
6
6
  import { prompt as prompt$1, Separator } from '@form8ion/overridable-prompts';
@@ -127,9 +127,7 @@ var coveragePlugin = /*#__PURE__*/Object.freeze({
127
127
  test: tester$4
128
128
  });
129
129
 
130
- const unitTestFrameworksSchema = joi.object().required().pattern(/^/, joi.object({
131
- scaffolder: joi.func().arity(1).required()
132
- }));
130
+ const unitTestFrameworksSchema = joi.object().required().pattern(/^/, optionsSchemas.form8ionPlugin);
133
131
 
134
132
  async function chooseFramework ({frameworks, decisions}) {
135
133
  if (!Object.keys(frameworks).length) return 'Other';
@@ -561,8 +559,8 @@ async function scaffoldPackageType ({
561
559
  }
562
560
  },
563
561
  ...dialects$1.ESM === dialect && {
564
- main: './lib/index.mjs',
565
- exports: './lib/index.mjs'
562
+ main: './lib/index.js',
563
+ exports: './lib/index.js'
566
564
  },
567
565
  ...dialects$1.TYPESCRIPT === dialect && {
568
566
  main: './lib/index.js',
@@ -584,6 +582,7 @@ async function scaffoldPackageType ({
584
582
  documentation: scaffoldPackageDocumentation({packageName, visibility, scope, packageManager, provideExample}),
585
583
  nextSteps: [
586
584
  {summary: 'Add the appropriate `save` flag to the installation instructions in the README'},
585
+ {summary: 'Define supported node.js versions as `engines.node` in the `package.json` file'},
587
586
  {summary: 'Publish pre-release versions to npm until package is stable enough to publish v1.0.0'}
588
587
  ]
589
588
  },
@@ -682,7 +681,7 @@ async function scaffoldCliType ({
682
681
  devDependencies: ['rimraf'],
683
682
  vcsIgnore: {files: [], directories: [`/${defaultBuildDirectory}/`]},
684
683
  buildDirectory: defaultBuildDirectory,
685
- nextSteps: []
684
+ nextSteps: [{summary: 'Define supported node.js versions as `engines.node` in the `package.json` file'}]
686
685
  }
687
686
  ]);
688
687
  }
@@ -1120,7 +1119,7 @@ var packageManagers = /*#__PURE__*/Object.freeze({
1120
1119
  defineLockfilePath: determineLockfilePathFor
1121
1120
  });
1122
1121
 
1123
- async function lift ({projectRoot, vcs, results, pathWithinParent}) {
1122
+ async function lift ({projectRoot, vcs, results, pathWithinParent, enhancers = {}}) {
1124
1123
  info('Lifting JavaScript-specific details');
1125
1124
 
1126
1125
  const {
@@ -1138,7 +1137,8 @@ async function lift ({projectRoot, vcs, results, pathWithinParent}) {
1138
1137
 
1139
1138
  const enhancerResults = await applyEnhancers({
1140
1139
  results,
1141
- enhancers: [
1140
+ enhancers: {
1141
+ ...enhancers,
1142
1142
  huskyPlugin,
1143
1143
  enginesEnhancer,
1144
1144
  coveragePlugin,
@@ -1148,7 +1148,7 @@ async function lift ({projectRoot, vcs, results, pathWithinParent}) {
1148
1148
  npmConfigPlugin,
1149
1149
  projectTypes,
1150
1150
  packageManagers
1151
- ],
1151
+ },
1152
1152
  options: {packageManager, projectRoot, vcs, packageDetails: JSON.parse(packageContents)}
1153
1153
  });
1154
1154
 
@@ -1162,8 +1162,7 @@ async function lift ({projectRoot, vcs, results, pathWithinParent}) {
1162
1162
  return enhancerResults;
1163
1163
  }
1164
1164
 
1165
- const pluginSchema = joi.object({scaffolder: joi.func().arity(1).required()});
1166
- const pluginMapSchema = joi.object().pattern(joi.string(), pluginSchema);
1165
+ const pluginMapSchema = joi.object().pattern(joi.string(), optionsSchemas.form8ionPlugin);
1167
1166
 
1168
1167
  const packageBundlersSchema = pluginMapSchema.default({});
1169
1168
 
@@ -1230,13 +1229,13 @@ function validate(options) {
1230
1229
  })).default({})
1231
1230
  })
1232
1231
  .keys({
1233
- applicationTypes: applicationTypesSchema,
1234
- packageTypes: packageTypesSchema,
1235
- monorepoTypes: monorepoTypesSchema
1236
- })
1237
- .keys({
1238
- unitTestFrameworks: unitTestFrameworksSchema,
1239
- packageBundlers: packageBundlersSchema
1232
+ plugins: {
1233
+ unitTestFrameworks: unitTestFrameworksSchema,
1234
+ packageBundlers: packageBundlersSchema,
1235
+ applicationTypes: applicationTypesSchema,
1236
+ packageTypes: packageTypesSchema,
1237
+ monorepoTypes: monorepoTypesSchema
1238
+ }
1240
1239
  })
1241
1240
  .keys({
1242
1241
  decisions: joi.object()
@@ -1674,14 +1673,16 @@ async function scaffolder (options) {
1674
1673
  overrides,
1675
1674
  ciServices,
1676
1675
  hosts,
1677
- applicationTypes,
1678
- packageTypes,
1679
- packageBundlers,
1680
- monorepoTypes,
1681
1676
  decisions,
1682
- unitTestFrameworks,
1683
1677
  pathWithinParent,
1684
- registries
1678
+ registries,
1679
+ plugins: {
1680
+ applicationTypes,
1681
+ packageTypes,
1682
+ monorepoTypes,
1683
+ packageBundlers,
1684
+ unitTestFrameworks
1685
+ }
1685
1686
  } = validate(options);
1686
1687
 
1687
1688
  const {