@form8ion/javascript 11.5.4 → 11.5.6

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,15 +1,14 @@
1
1
  import { questionNames as questionNames$2, questions } from '@travi/language-scaffolder-prompts';
2
2
  import deepmerge from 'deepmerge';
3
- import { validateOptions, scaffoldChoice, projectTypes as projectTypes$1, packageManagers, dialects as dialects$1, mergeIntoExistingPackageJson, writePackageJson, DEV_DEPENDENCY_TYPE, PROD_DEPENDENCY_TYPE } from '@form8ion/javascript-core';
3
+ import { fileTypes, fileExists, validateOptions, writeConfigFile, applyEnhancers } from '@form8ion/core';
4
+ import { scaffoldChoice, projectTypes as projectTypes$1, packageManagers, dialects as dialects$1, mergeIntoExistingPackageJson, writePackageJson, DEV_DEPENDENCY_TYPE, PROD_DEPENDENCY_TYPE } from '@form8ion/javascript-core';
4
5
  import joi from 'joi';
5
6
  import { prompt as prompt$1, Separator } from '@form8ion/overridable-prompts';
6
7
  import { scaffold, lift as lift$3 } from '@form8ion/codecov';
7
8
  import { write as write$1 } from '@form8ion/config-file';
8
- import { fileTypes, fileExists, writeConfigFile, applyEnhancers } from '@form8ion/core';
9
9
  import { info, warn, error } from '@travi/cli-messages';
10
10
  import * as commitConventionPlugin from '@form8ion/commit-convention';
11
11
  import { scaffold as scaffold$5 } from '@form8ion/commit-convention';
12
- import * as hoek from '@hapi/hoek';
13
12
  import execa from '@form8ion/execa-wrapper';
14
13
  import npmConf from 'npm-conf';
15
14
  import { promises } from 'fs';
@@ -981,9 +980,16 @@ async function lift ({projectRoot, vcs, results}) {
981
980
  return enhancerResults;
982
981
  }
983
982
 
984
- const packageBundlersSchema = joi.object().pattern(/^/, joi.object({
985
- scaffolder: joi.func().arity(1).required()
986
- })).default({});
983
+ const pluginSchema = joi.object({scaffolder: joi.func().arity(1).required()});
984
+ const pluginMapSchema = joi.object().pattern(/^/, pluginSchema);
985
+
986
+ const packageBundlersSchema = pluginMapSchema.default({});
987
+
988
+ const applicationTypesSchema = pluginMapSchema.default({});
989
+
990
+ const packageTypesSchema = pluginMapSchema.default({});
991
+
992
+ const monorepoTypesSchema = pluginMapSchema.default({});
987
993
 
988
994
  function validate(options) {
989
995
  const schema = joi.object().required()
@@ -1042,15 +1048,9 @@ function validate(options) {
1042
1048
  })).default({})
1043
1049
  })
1044
1050
  .keys({
1045
- applicationTypes: joi.object().pattern(/^/, joi.object({
1046
- scaffolder: joi.func().arity(1).required()
1047
- })).default({}),
1048
- packageTypes: joi.object().pattern(/^/, joi.object({
1049
- scaffolder: joi.func().arity(1).required()
1050
- })).default({}),
1051
- monorepoTypes: joi.object().pattern(/^/, joi.object({
1052
- scaffolder: joi.func().arity(1).required()
1053
- }))
1051
+ applicationTypes: applicationTypesSchema,
1052
+ packageTypes: packageTypesSchema,
1053
+ monorepoTypes: monorepoTypesSchema
1054
1054
  })
1055
1055
  .keys({
1056
1056
  unitTestFrameworks: unitTestFrameworksSchema,
@@ -1060,11 +1060,8 @@ function validate(options) {
1060
1060
  decisions: joi.object()
1061
1061
  })
1062
1062
  .keys({registries: joi.object().pattern(joi.string(), joi.string().uri()).default({})});
1063
- const {error, value} = schema.validate(options);
1064
-
1065
- hoek.assert(!error, error);
1066
1063
 
1067
- return value;
1064
+ return validateOptions(schema, options);
1068
1065
  }
1069
1066
 
1070
1067
  function buildDialectChoices ({babelPreset, typescript}) {