@form8ion/javascript 13.0.0-alpha.2 → 13.0.0-alpha.4

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
@@ -2,8 +2,8 @@ import { questionNames as questionNames$2, questions } from '@travi/language-sca
2
2
  import deepmerge from 'deepmerge';
3
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
- import joi from 'joi';
6
5
  import { prompt as prompt$1, Separator } from '@form8ion/overridable-prompts';
6
+ import joi from 'joi';
7
7
  import { scaffold, lift as lift$3 } from '@form8ion/codecov';
8
8
  import { write as write$2 } from '@form8ion/config-file';
9
9
  import { info, warn, error } from '@travi/cli-messages';
@@ -127,8 +127,6 @@ var coveragePlugin = /*#__PURE__*/Object.freeze({
127
127
  test: tester$4
128
128
  });
129
129
 
130
- const unitTestFrameworksSchema = joi.object().pattern(/^/, optionsSchemas.form8ionPlugin).default({});
131
-
132
130
  async function chooseFramework ({frameworks, decisions}) {
133
131
  if (!Object.keys(frameworks).length) return 'Other';
134
132
 
@@ -142,8 +140,10 @@ async function chooseFramework ({frameworks, decisions}) {
142
140
  return answers[questionNames$1.UNIT_TEST_FRAMEWORK];
143
141
  }
144
142
 
143
+ const pluginsSchema = joi.object().pattern(/^/, optionsSchemas.form8ionPlugin).default({});
144
+
145
145
  async function scaffoldUnitTesting ({projectRoot, frameworks, decisions, visibility, vcs, pathWithinParent, dialect}) {
146
- const validatedFrameworks = validateOptions(unitTestFrameworksSchema, frameworks);
146
+ const validatedFrameworks = validateOptions(pluginsSchema, frameworks);
147
147
  const [framework, coverage] = await Promise.all([
148
148
  chooseFramework({frameworks: validatedFrameworks, decisions})
149
149
  .then(chosenFramework => scaffoldChoice(validatedFrameworks, chosenFramework, {projectRoot, dialect})),
@@ -1162,16 +1162,6 @@ async function lift ({projectRoot, vcs, results, pathWithinParent, enhancers = {
1162
1162
  return enhancerResults;
1163
1163
  }
1164
1164
 
1165
- const pluginMapSchema = joi.object().pattern(joi.string(), optionsSchemas.form8ionPlugin);
1166
-
1167
- const packageBundlersSchema = pluginMapSchema.default({});
1168
-
1169
- const applicationTypesSchema = pluginMapSchema.default({});
1170
-
1171
- const packageTypesSchema = pluginMapSchema.default({});
1172
-
1173
- const monorepoTypesSchema = pluginMapSchema.default({});
1174
-
1175
1165
  function validate(options) {
1176
1166
  const schema = joi.object().required()
1177
1167
  .keys({
@@ -1205,26 +1195,15 @@ function validate(options) {
1205
1195
  remark: joi.string()
1206
1196
  }).default({})
1207
1197
  })
1208
- .keys({
1209
- ciServices: joi.object().pattern(/^/, joi.object({
1210
- scaffolder: joi.func().arity(1).required(),
1211
- public: joi.boolean(),
1212
- private: joi.boolean()
1213
- })).default({})
1214
- })
1215
- .keys({
1216
- hosts: joi.object().pattern(/^/, joi.object({
1217
- scaffolder: joi.func().arity(1).required(),
1218
- projectTypes: joi.array().items(joi.string().valid('static', 'node')).default([])
1219
- })).default({})
1220
- })
1221
1198
  .keys({
1222
1199
  plugins: {
1223
- unitTestFrameworks: unitTestFrameworksSchema,
1224
- packageBundlers: packageBundlersSchema,
1225
- applicationTypes: applicationTypesSchema,
1226
- packageTypes: packageTypesSchema,
1227
- monorepoTypes: monorepoTypesSchema
1200
+ unitTestFrameworks: pluginsSchema,
1201
+ packageBundlers: pluginsSchema,
1202
+ applicationTypes: pluginsSchema,
1203
+ packageTypes: pluginsSchema,
1204
+ monorepoTypes: pluginsSchema,
1205
+ hosts: pluginsSchema,
1206
+ ciServices: pluginsSchema
1228
1207
  }
1229
1208
  })
1230
1209
  .keys({
@@ -1659,8 +1638,6 @@ async function scaffolder (options) {
1659
1638
  vcs,
1660
1639
  description,
1661
1640
  configs,
1662
- ciServices,
1663
- hosts,
1664
1641
  decisions,
1665
1642
  pathWithinParent,
1666
1643
  registries,
@@ -1669,7 +1646,9 @@ async function scaffolder (options) {
1669
1646
  packageTypes,
1670
1647
  monorepoTypes,
1671
1648
  packageBundlers,
1672
- unitTestFrameworks
1649
+ unitTestFrameworks,
1650
+ hosts,
1651
+ ciServices
1673
1652
  }
1674
1653
  } = validate(options);
1675
1654