@form8ion/javascript 13.0.0-alpha.1 → 13.0.0-alpha.3
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 +8 -4
- package/example.js +8 -4
- package/lib/index.js +15 -42
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +15 -42
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
-
|
|
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',
|
|
@@ -116,8 +120,8 @@ const {
|
|
|
116
120
|
await scaffoldUnitTesting({
|
|
117
121
|
projectRoot: process.cwd(),
|
|
118
122
|
frameworks: {
|
|
119
|
-
Mocha: {
|
|
120
|
-
Jest: {
|
|
123
|
+
Mocha: {scaffold: options => options},
|
|
124
|
+
Jest: {scaffold: options => options}
|
|
121
125
|
},
|
|
122
126
|
visibility: 'Public',
|
|
123
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
|
-
|
|
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',
|
|
@@ -84,8 +88,8 @@ const {
|
|
|
84
88
|
await scaffoldUnitTesting({
|
|
85
89
|
projectRoot: process.cwd(),
|
|
86
90
|
frameworks: {
|
|
87
|
-
Mocha: {
|
|
88
|
-
Jest: {
|
|
91
|
+
Mocha: {scaffold: options => options},
|
|
92
|
+
Jest: {scaffold: options => options}
|
|
89
93
|
},
|
|
90
94
|
visibility: 'Public',
|
|
91
95
|
vcs: {host: 'GitHub', owner: 'foo', name: 'bar'},
|
package/lib/index.js
CHANGED
|
@@ -6,8 +6,8 @@ var languageScaffolderPrompts = require('@travi/language-scaffolder-prompts');
|
|
|
6
6
|
var deepmerge = require('deepmerge');
|
|
7
7
|
var core = require('@form8ion/core');
|
|
8
8
|
var javascriptCore = require('@form8ion/javascript-core');
|
|
9
|
-
var joi = require('joi');
|
|
10
9
|
var overridablePrompts = require('@form8ion/overridable-prompts');
|
|
10
|
+
var joi = require('joi');
|
|
11
11
|
var codecov = require('@form8ion/codecov');
|
|
12
12
|
var configFile = require('@form8ion/config-file');
|
|
13
13
|
var cliMessages = require('@travi/cli-messages');
|
|
@@ -163,8 +163,6 @@ var coveragePlugin = /*#__PURE__*/Object.freeze({
|
|
|
163
163
|
test: tester$4
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
-
const unitTestFrameworksSchema = joi__default["default"].object().required().pattern(/^/, core.optionsSchemas.form8ionPlugin);
|
|
167
|
-
|
|
168
166
|
async function chooseFramework ({frameworks, decisions}) {
|
|
169
167
|
if (!Object.keys(frameworks).length) return 'Other';
|
|
170
168
|
|
|
@@ -178,8 +176,10 @@ async function chooseFramework ({frameworks, decisions}) {
|
|
|
178
176
|
return answers[questionNames$1.UNIT_TEST_FRAMEWORK];
|
|
179
177
|
}
|
|
180
178
|
|
|
179
|
+
const pluginsSchema = joi__default["default"].object().pattern(/^/, core.optionsSchemas.form8ionPlugin).default({});
|
|
180
|
+
|
|
181
181
|
async function scaffoldUnitTesting ({projectRoot, frameworks, decisions, visibility, vcs, pathWithinParent, dialect}) {
|
|
182
|
-
const validatedFrameworks = core.validateOptions(
|
|
182
|
+
const validatedFrameworks = core.validateOptions(pluginsSchema, frameworks);
|
|
183
183
|
const [framework, coverage] = await Promise.all([
|
|
184
184
|
chooseFramework({frameworks: validatedFrameworks, decisions})
|
|
185
185
|
.then(chosenFramework => javascriptCore.scaffoldChoice(validatedFrameworks, chosenFramework, {projectRoot, dialect})),
|
|
@@ -1198,16 +1198,6 @@ async function lift ({projectRoot, vcs, results, pathWithinParent, enhancers = {
|
|
|
1198
1198
|
return enhancerResults;
|
|
1199
1199
|
}
|
|
1200
1200
|
|
|
1201
|
-
const pluginMapSchema = joi__default["default"].object().pattern(joi__default["default"].string(), core.optionsSchemas.form8ionPlugin);
|
|
1202
|
-
|
|
1203
|
-
const packageBundlersSchema = pluginMapSchema.default({});
|
|
1204
|
-
|
|
1205
|
-
const applicationTypesSchema = pluginMapSchema.default({});
|
|
1206
|
-
|
|
1207
|
-
const packageTypesSchema = pluginMapSchema.default({});
|
|
1208
|
-
|
|
1209
|
-
const monorepoTypesSchema = pluginMapSchema.default({});
|
|
1210
|
-
|
|
1211
1201
|
function validate(options) {
|
|
1212
1202
|
const schema = joi__default["default"].object().required()
|
|
1213
1203
|
.keys({
|
|
@@ -1241,16 +1231,6 @@ function validate(options) {
|
|
|
1241
1231
|
remark: joi__default["default"].string()
|
|
1242
1232
|
}).default({})
|
|
1243
1233
|
})
|
|
1244
|
-
.keys({
|
|
1245
|
-
overrides: joi__default["default"].object({
|
|
1246
|
-
npmAccount: joi__default["default"].string(),
|
|
1247
|
-
author: joi__default["default"].object({
|
|
1248
|
-
name: joi__default["default"].string().required(),
|
|
1249
|
-
email: joi__default["default"].string().email(),
|
|
1250
|
-
url: joi__default["default"].string().uri()
|
|
1251
|
-
})
|
|
1252
|
-
}).default({})
|
|
1253
|
-
})
|
|
1254
1234
|
.keys({
|
|
1255
1235
|
ciServices: joi__default["default"].object().pattern(/^/, joi__default["default"].object({
|
|
1256
1236
|
scaffolder: joi__default["default"].func().arity(1).required(),
|
|
@@ -1258,19 +1238,14 @@ function validate(options) {
|
|
|
1258
1238
|
private: joi__default["default"].boolean()
|
|
1259
1239
|
})).default({})
|
|
1260
1240
|
})
|
|
1261
|
-
.keys({
|
|
1262
|
-
hosts: joi__default["default"].object().pattern(/^/, joi__default["default"].object({
|
|
1263
|
-
scaffolder: joi__default["default"].func().arity(1).required(),
|
|
1264
|
-
projectTypes: joi__default["default"].array().items(joi__default["default"].string().valid('static', 'node')).default([])
|
|
1265
|
-
})).default({})
|
|
1266
|
-
})
|
|
1267
1241
|
.keys({
|
|
1268
1242
|
plugins: {
|
|
1269
|
-
unitTestFrameworks:
|
|
1270
|
-
packageBundlers:
|
|
1271
|
-
applicationTypes:
|
|
1272
|
-
packageTypes:
|
|
1273
|
-
monorepoTypes:
|
|
1243
|
+
unitTestFrameworks: pluginsSchema,
|
|
1244
|
+
packageBundlers: pluginsSchema,
|
|
1245
|
+
applicationTypes: pluginsSchema,
|
|
1246
|
+
packageTypes: pluginsSchema,
|
|
1247
|
+
monorepoTypes: pluginsSchema,
|
|
1248
|
+
hosts: pluginsSchema
|
|
1274
1249
|
}
|
|
1275
1250
|
})
|
|
1276
1251
|
.keys({
|
|
@@ -1356,7 +1331,6 @@ function authorQuestions({name, email, url}) {
|
|
|
1356
1331
|
}
|
|
1357
1332
|
|
|
1358
1333
|
async function prompt(
|
|
1359
|
-
{npmAccount, author},
|
|
1360
1334
|
ciServices,
|
|
1361
1335
|
hosts,
|
|
1362
1336
|
visibility,
|
|
@@ -1433,9 +1407,9 @@ async function prompt(
|
|
|
1433
1407
|
message: 'What is the scope?',
|
|
1434
1408
|
when: scopePromptShouldBePresentedFactory(visibility),
|
|
1435
1409
|
validate: scope(visibility),
|
|
1436
|
-
default:
|
|
1410
|
+
default: maybeLoggedInNpmUsername
|
|
1437
1411
|
},
|
|
1438
|
-
...authorQuestions(
|
|
1412
|
+
...authorQuestions({
|
|
1439
1413
|
name: npmConf.get('init.author.name'),
|
|
1440
1414
|
email: npmConf.get('init.author.email'),
|
|
1441
1415
|
url: npmConf.get('init.author.url')
|
|
@@ -1706,9 +1680,7 @@ async function scaffolder (options) {
|
|
|
1706
1680
|
vcs,
|
|
1707
1681
|
description,
|
|
1708
1682
|
configs,
|
|
1709
|
-
overrides,
|
|
1710
1683
|
ciServices,
|
|
1711
|
-
hosts,
|
|
1712
1684
|
decisions,
|
|
1713
1685
|
pathWithinParent,
|
|
1714
1686
|
registries,
|
|
@@ -1717,7 +1689,8 @@ async function scaffolder (options) {
|
|
|
1717
1689
|
packageTypes,
|
|
1718
1690
|
monorepoTypes,
|
|
1719
1691
|
packageBundlers,
|
|
1720
|
-
unitTestFrameworks
|
|
1692
|
+
unitTestFrameworks,
|
|
1693
|
+
hosts
|
|
1721
1694
|
}
|
|
1722
1695
|
} = validate(options);
|
|
1723
1696
|
|
|
@@ -1733,7 +1706,7 @@ async function scaffolder (options) {
|
|
|
1733
1706
|
provideExample,
|
|
1734
1707
|
packageManager,
|
|
1735
1708
|
dialect
|
|
1736
|
-
} = await prompt(
|
|
1709
|
+
} = await prompt(ciServices, hosts, visibility, vcs, decisions, configs, pathWithinParent);
|
|
1737
1710
|
|
|
1738
1711
|
cliMessages.info('Writing project files', {level: 'secondary'});
|
|
1739
1712
|
|