@form8ion/javascript 12.6.2 → 13.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/README.md CHANGED
@@ -74,9 +74,13 @@ const {
74
74
  babelPreset: {name: `@${accountName}`, packageName: `@${accountName}/babel-preset`},
75
75
  commitlint: {name: `@${accountName}`, packageName: `@${accountName}/commitlint-config`}
76
76
  },
77
- overrides: {npmAccount: accountName},
77
+ plugins: {
78
+ unitTestFrameworks: {},
79
+ applicationTypes: {},
80
+ packageTypes: {},
81
+ packageBundlers: {}
82
+ },
78
83
  ciServices: {},
79
- unitTestFrameworks: {},
80
84
  decisions: {
81
85
  [questionNames.DIALECT]: dialects.BABEL,
82
86
  [questionNames.NODE_VERSION_CATEGORY]: 'LTS',
@@ -103,6 +107,12 @@ const {
103
107
  scripts: {},
104
108
  eslint: {configs: [], ignore: {directories: []}},
105
109
  packageManager: 'npm'
110
+ },
111
+ enhancers: {
112
+ PluginName: {
113
+ test: () => true,
114
+ lift: () => ({})
115
+ }
106
116
  }
107
117
  });
108
118
  }
@@ -110,8 +120,8 @@ const {
110
120
  await scaffoldUnitTesting({
111
121
  projectRoot: process.cwd(),
112
122
  frameworks: {
113
- Mocha: {scaffolder: options => options},
114
- Jest: {scaffolder: options => options}
123
+ Mocha: {scaffold: options => options},
124
+ Jest: {scaffold: options => options}
115
125
  },
116
126
  visibility: 'Public',
117
127
  vcs: {host: 'GitHub', owner: 'foo', name: 'bar'},
package/example.js CHANGED
@@ -42,9 +42,13 @@ const {
42
42
  babelPreset: {name: `@${accountName}`, packageName: `@${accountName}/babel-preset`},
43
43
  commitlint: {name: `@${accountName}`, packageName: `@${accountName}/commitlint-config`}
44
44
  },
45
- overrides: {npmAccount: accountName},
45
+ plugins: {
46
+ unitTestFrameworks: {},
47
+ applicationTypes: {},
48
+ packageTypes: {},
49
+ packageBundlers: {}
50
+ },
46
51
  ciServices: {},
47
- unitTestFrameworks: {},
48
52
  decisions: {
49
53
  [questionNames.DIALECT]: dialects.BABEL,
50
54
  [questionNames.NODE_VERSION_CATEGORY]: 'LTS',
@@ -71,6 +75,12 @@ const {
71
75
  scripts: {},
72
76
  eslint: {configs: [], ignore: {directories: []}},
73
77
  packageManager: 'npm'
78
+ },
79
+ enhancers: {
80
+ PluginName: {
81
+ test: () => true,
82
+ lift: () => ({})
83
+ }
74
84
  }
75
85
  });
76
86
  }
@@ -78,8 +88,8 @@ const {
78
88
  await scaffoldUnitTesting({
79
89
  projectRoot: process.cwd(),
80
90
  frameworks: {
81
- Mocha: {scaffolder: options => options},
82
- Jest: {scaffolder: options => options}
91
+ Mocha: {scaffold: options => options},
92
+ Jest: {scaffold: options => options}
83
93
  },
84
94
  visibility: 'Public',
85
95
  vcs: {host: 'GitHub', owner: 'foo', name: 'bar'},
package/lib/index.js CHANGED
@@ -163,9 +163,7 @@ var coveragePlugin = /*#__PURE__*/Object.freeze({
163
163
  test: tester$4
164
164
  });
165
165
 
166
- const unitTestFrameworksSchema = joi__default["default"].object().required().pattern(/^/, joi__default["default"].object({
167
- scaffolder: joi__default["default"].func().arity(1).required()
168
- }));
166
+ const unitTestFrameworksSchema = joi__default["default"].object().pattern(/^/, core.optionsSchemas.form8ionPlugin).default({});
169
167
 
170
168
  async function chooseFramework ({frameworks, decisions}) {
171
169
  if (!Object.keys(frameworks).length) return 'Other';
@@ -597,8 +595,8 @@ async function scaffoldPackageType ({
597
595
  }
598
596
  },
599
597
  ...javascriptCore.dialects.ESM === dialect && {
600
- main: './lib/index.mjs',
601
- exports: './lib/index.mjs'
598
+ main: './lib/index.js',
599
+ exports: './lib/index.js'
602
600
  },
603
601
  ...javascriptCore.dialects.TYPESCRIPT === dialect && {
604
602
  main: './lib/index.js',
@@ -620,6 +618,7 @@ async function scaffoldPackageType ({
620
618
  documentation: scaffoldPackageDocumentation({packageName, visibility, scope, packageManager, provideExample}),
621
619
  nextSteps: [
622
620
  {summary: 'Add the appropriate `save` flag to the installation instructions in the README'},
621
+ {summary: 'Define supported node.js versions as `engines.node` in the `package.json` file'},
623
622
  {summary: 'Publish pre-release versions to npm until package is stable enough to publish v1.0.0'}
624
623
  ]
625
624
  },
@@ -718,7 +717,7 @@ async function scaffoldCliType ({
718
717
  devDependencies: ['rimraf'],
719
718
  vcsIgnore: {files: [], directories: [`/${defaultBuildDirectory}/`]},
720
719
  buildDirectory: defaultBuildDirectory,
721
- nextSteps: []
720
+ nextSteps: [{summary: 'Define supported node.js versions as `engines.node` in the `package.json` file'}]
722
721
  }
723
722
  ]);
724
723
  }
@@ -1156,7 +1155,7 @@ var packageManagers = /*#__PURE__*/Object.freeze({
1156
1155
  defineLockfilePath: determineLockfilePathFor
1157
1156
  });
1158
1157
 
1159
- async function lift ({projectRoot, vcs, results, pathWithinParent}) {
1158
+ async function lift ({projectRoot, vcs, results, pathWithinParent, enhancers = {}}) {
1160
1159
  cliMessages.info('Lifting JavaScript-specific details');
1161
1160
 
1162
1161
  const {
@@ -1174,17 +1173,18 @@ async function lift ({projectRoot, vcs, results, pathWithinParent}) {
1174
1173
 
1175
1174
  const enhancerResults = await core.applyEnhancers({
1176
1175
  results,
1177
- enhancers: [
1178
- huskyPlugin__namespace,
1176
+ enhancers: {
1177
+ ...enhancers,
1178
+ huskyPlugin: huskyPlugin__namespace,
1179
1179
  enginesEnhancer,
1180
1180
  coveragePlugin,
1181
- commitConventionPlugin__namespace,
1181
+ commitConventionPlugin: commitConventionPlugin__namespace,
1182
1182
  dialects,
1183
1183
  codeStylePlugin,
1184
1184
  npmConfigPlugin,
1185
1185
  projectTypes,
1186
1186
  packageManagers
1187
- ],
1187
+ },
1188
1188
  options: {packageManager, projectRoot, vcs, packageDetails: JSON.parse(packageContents)}
1189
1189
  });
1190
1190
 
@@ -1198,8 +1198,7 @@ async function lift ({projectRoot, vcs, results, pathWithinParent}) {
1198
1198
  return enhancerResults;
1199
1199
  }
1200
1200
 
1201
- const pluginSchema = joi__default["default"].object({scaffolder: joi__default["default"].func().arity(1).required()});
1202
- const pluginMapSchema = joi__default["default"].object().pattern(joi__default["default"].string(), pluginSchema);
1201
+ const pluginMapSchema = joi__default["default"].object().pattern(joi__default["default"].string(), core.optionsSchemas.form8ionPlugin);
1203
1202
 
1204
1203
  const packageBundlersSchema = pluginMapSchema.default({});
1205
1204
 
@@ -1242,16 +1241,6 @@ function validate(options) {
1242
1241
  remark: joi__default["default"].string()
1243
1242
  }).default({})
1244
1243
  })
1245
- .keys({
1246
- overrides: joi__default["default"].object({
1247
- npmAccount: joi__default["default"].string(),
1248
- author: joi__default["default"].object({
1249
- name: joi__default["default"].string().required(),
1250
- email: joi__default["default"].string().email(),
1251
- url: joi__default["default"].string().uri()
1252
- })
1253
- }).default({})
1254
- })
1255
1244
  .keys({
1256
1245
  ciServices: joi__default["default"].object().pattern(/^/, joi__default["default"].object({
1257
1246
  scaffolder: joi__default["default"].func().arity(1).required(),
@@ -1266,13 +1255,13 @@ function validate(options) {
1266
1255
  })).default({})
1267
1256
  })
1268
1257
  .keys({
1269
- applicationTypes: applicationTypesSchema,
1270
- packageTypes: packageTypesSchema,
1271
- monorepoTypes: monorepoTypesSchema
1272
- })
1273
- .keys({
1274
- unitTestFrameworks: unitTestFrameworksSchema,
1275
- packageBundlers: packageBundlersSchema
1258
+ plugins: {
1259
+ unitTestFrameworks: unitTestFrameworksSchema,
1260
+ packageBundlers: packageBundlersSchema,
1261
+ applicationTypes: applicationTypesSchema,
1262
+ packageTypes: packageTypesSchema,
1263
+ monorepoTypes: monorepoTypesSchema
1264
+ }
1276
1265
  })
1277
1266
  .keys({
1278
1267
  decisions: joi__default["default"].object()
@@ -1357,7 +1346,6 @@ function authorQuestions({name, email, url}) {
1357
1346
  }
1358
1347
 
1359
1348
  async function prompt(
1360
- {npmAccount, author},
1361
1349
  ciServices,
1362
1350
  hosts,
1363
1351
  visibility,
@@ -1434,9 +1422,9 @@ async function prompt(
1434
1422
  message: 'What is the scope?',
1435
1423
  when: scopePromptShouldBePresentedFactory(visibility),
1436
1424
  validate: scope(visibility),
1437
- default: npmAccount || maybeLoggedInNpmUsername
1425
+ default: maybeLoggedInNpmUsername
1438
1426
  },
1439
- ...authorQuestions(author || {
1427
+ ...authorQuestions({
1440
1428
  name: npmConf.get('init.author.name'),
1441
1429
  email: npmConf.get('init.author.email'),
1442
1430
  url: npmConf.get('init.author.url')
@@ -1707,17 +1695,18 @@ async function scaffolder (options) {
1707
1695
  vcs,
1708
1696
  description,
1709
1697
  configs,
1710
- overrides,
1711
1698
  ciServices,
1712
1699
  hosts,
1713
- applicationTypes,
1714
- packageTypes,
1715
- packageBundlers,
1716
- monorepoTypes,
1717
1700
  decisions,
1718
- unitTestFrameworks,
1719
1701
  pathWithinParent,
1720
- registries
1702
+ registries,
1703
+ plugins: {
1704
+ applicationTypes,
1705
+ packageTypes,
1706
+ monorepoTypes,
1707
+ packageBundlers,
1708
+ unitTestFrameworks
1709
+ }
1721
1710
  } = validate(options);
1722
1711
 
1723
1712
  const {
@@ -1732,7 +1721,7 @@ async function scaffolder (options) {
1732
1721
  provideExample,
1733
1722
  packageManager,
1734
1723
  dialect
1735
- } = await prompt(overrides, ciServices, hosts, visibility, vcs, decisions, configs, pathWithinParent);
1724
+ } = await prompt(ciServices, hosts, visibility, vcs, decisions, configs, pathWithinParent);
1736
1725
 
1737
1726
  cliMessages.info('Writing project files', {level: 'secondary'});
1738
1727