@form8ion/javascript 1.0.2 → 1.1.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 +5 -0
- package/lib/index.cjs.js +10 -89
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.es.js +10 -89
- package/lib/index.es.js.map +1 -1
- package/package.json +13 -14
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ toolset
|
|
|
6
6
|
<!--status-badges start -->
|
|
7
7
|
|
|
8
8
|
[![Node CI Workflow Status][github-actions-ci-badge]][github-actions-ci-link]
|
|
9
|
+
[![Codecov][coverage-badge]][coverage-link]
|
|
9
10
|
|
|
10
11
|
<!--status-badges end -->
|
|
11
12
|
|
|
@@ -181,3 +182,7 @@ $ npm test
|
|
|
181
182
|
[runkit-link]: https://npm.runkit.com/@form8ion/javascript
|
|
182
183
|
|
|
183
184
|
[runkit-badge]: https://badge.runkitcdn.com/@form8ion/javascript.svg
|
|
185
|
+
|
|
186
|
+
[coverage-link]: https://codecov.io/github/form8ion/javascript
|
|
187
|
+
|
|
188
|
+
[coverage-badge]: https://img.shields.io/codecov/c/github/form8ion/javascript.svg
|
package/lib/index.cjs.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var deepmerge = require('deepmerge');
|
|
6
6
|
var javascriptCore = require('@form8ion/javascript-core');
|
|
7
|
+
var codecov = require('@form8ion/codecov');
|
|
7
8
|
var fs = require('fs');
|
|
8
9
|
var joi = require('@hapi/joi');
|
|
9
10
|
var inquirer = require('inquirer');
|
|
@@ -32,102 +33,22 @@ function _interopNamespace(e) {
|
|
|
32
33
|
var deepmerge__default = /*#__PURE__*/_interopDefaultLegacy(deepmerge);
|
|
33
34
|
var joi__namespace = /*#__PURE__*/_interopNamespace(joi);
|
|
34
35
|
|
|
35
|
-
function scaffold
|
|
36
|
+
function scaffold () {
|
|
36
37
|
return undefined;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
function
|
|
40
|
-
var keys = Object.keys(object);
|
|
41
|
-
|
|
42
|
-
if (Object.getOwnPropertySymbols) {
|
|
43
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
44
|
-
|
|
45
|
-
if (enumerableOnly) {
|
|
46
|
-
symbols = symbols.filter(function (sym) {
|
|
47
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
keys.push.apply(keys, symbols);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return keys;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function _objectSpread2(target) {
|
|
58
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
59
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
60
|
-
|
|
61
|
-
if (i % 2) {
|
|
62
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
|
63
|
-
_defineProperty(target, key, source[key]);
|
|
64
|
-
});
|
|
65
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
66
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
67
|
-
} else {
|
|
68
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
69
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return target;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function _defineProperty(obj, key, value) {
|
|
78
|
-
if (key in obj) {
|
|
79
|
-
Object.defineProperty(obj, key, {
|
|
80
|
-
value: value,
|
|
81
|
-
enumerable: true,
|
|
82
|
-
configurable: true,
|
|
83
|
-
writable: true
|
|
84
|
-
});
|
|
85
|
-
} else {
|
|
86
|
-
obj[key] = value;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return obj;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function scaffold({
|
|
93
|
-
vcs,
|
|
94
|
-
visibility
|
|
95
|
-
}) {
|
|
96
|
-
if ('Public' !== visibility) {
|
|
97
|
-
return {};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return _objectSpread2({
|
|
101
|
-
devDependencies: ['codecov'],
|
|
102
|
-
scripts: {
|
|
103
|
-
'coverage:report': 'nyc report --reporter=text-lcov > coverage.lcov && codecov'
|
|
104
|
-
}
|
|
105
|
-
}, ['github', 'gitlab', 'bitbucket'].includes(vcs === null || vcs === void 0 ? void 0 : vcs.host) && {
|
|
106
|
-
badges: {
|
|
107
|
-
status: {
|
|
108
|
-
coverage: {
|
|
109
|
-
img: `https://img.shields.io/codecov/c/${vcs.host}/${vcs.owner}/${vcs.name}.svg`,
|
|
110
|
-
link: `https://codecov.io/${vcs.host}/${vcs.owner}/${vcs.name}`,
|
|
111
|
-
text: 'Codecov'
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
async function scaffoldNyc ({
|
|
40
|
+
async function scaffoldC8 ({
|
|
119
41
|
projectRoot
|
|
120
42
|
}) {
|
|
121
|
-
await fs.promises.writeFile(`${projectRoot}/.
|
|
122
|
-
extends: '@istanbuljs/nyc-config-babel',
|
|
43
|
+
await fs.promises.writeFile(`${projectRoot}/.c8rc.json`, JSON.stringify({
|
|
123
44
|
reporter: ['lcov', 'text-summary', 'html'],
|
|
124
45
|
exclude: ['src/**/*-test.js', 'test/', 'thirdparty-wrappers/', 'vendor/']
|
|
125
46
|
}));
|
|
126
47
|
return {
|
|
127
|
-
devDependencies: ['cross-env', '
|
|
48
|
+
devDependencies: ['cross-env', 'c8'],
|
|
128
49
|
vcsIgnore: {
|
|
129
50
|
files: [],
|
|
130
|
-
directories: ['/coverage/'
|
|
51
|
+
directories: ['/coverage/']
|
|
131
52
|
},
|
|
132
53
|
eslint: {
|
|
133
54
|
ignore: {
|
|
@@ -142,9 +63,9 @@ async function scaffoldCoverage ({
|
|
|
142
63
|
vcs,
|
|
143
64
|
visibility
|
|
144
65
|
}) {
|
|
145
|
-
return deepmerge__default["default"](await
|
|
66
|
+
return deepmerge__default["default"](await scaffoldC8({
|
|
146
67
|
projectRoot
|
|
147
|
-
}), scaffold({
|
|
68
|
+
}), await codecov.scaffold({
|
|
148
69
|
vcs,
|
|
149
70
|
visibility
|
|
150
71
|
}));
|
|
@@ -192,13 +113,13 @@ async function unit ({
|
|
|
192
113
|
})]);
|
|
193
114
|
return deepmerge__default["default"].all([{
|
|
194
115
|
scripts: {
|
|
195
|
-
'test:unit': 'cross-env NODE_ENV=test
|
|
116
|
+
'test:unit': 'cross-env NODE_ENV=test c8 run-s test:unit:base'
|
|
196
117
|
}
|
|
197
118
|
}, framework, coverage]);
|
|
198
119
|
}
|
|
199
120
|
|
|
200
121
|
exports.questionNames = questionNames;
|
|
201
|
-
exports.scaffold = scaffold
|
|
122
|
+
exports.scaffold = scaffold;
|
|
202
123
|
exports.scaffoldUnitTesting = unit;
|
|
203
124
|
exports.unitTestFrameworksSchema = unitTestFrameworksSchema;
|
|
204
125
|
//# sourceMappingURL=index.cjs.js.map
|
package/lib/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/scaffold.js","../src/coverage/
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/scaffold.js","../src/coverage/c8.js","../src/coverage/scaffolder.js","../src/testing/options-schemas.js","../src/prompts/question-names.js","../src/testing/prompt.js","../src/testing/unit.js"],"sourcesContent":["export default function () {\n return undefined;\n}\n","import {promises} from 'fs';\n\nexport default async function ({projectRoot}) {\n await promises.writeFile(\n `${projectRoot}/.c8rc.json`,\n JSON.stringify({\n reporter: ['lcov', 'text-summary', 'html'],\n exclude: ['src/**/*-test.js', 'test/', 'thirdparty-wrappers/', 'vendor/']\n })\n );\n\n return {\n devDependencies: ['cross-env', 'c8'],\n vcsIgnore: {files: [], directories: ['/coverage/']},\n eslint: {ignore: {directories: ['/coverage/']}}\n };\n}\n","import deepmerge from 'deepmerge';\nimport {scaffold as scaffoldCodecov} from '@form8ion/codecov';\nimport scaffoldC8 from './c8';\n\nexport default async function ({projectRoot, vcs, visibility}) {\n return deepmerge(await scaffoldC8({projectRoot}), await scaffoldCodecov({vcs, visibility}));\n}\n","import * as joi from '@hapi/joi';\n\nexport const unitTestFrameworksSchema = joi.object().required().pattern(/^/, joi.object({\n scaffolder: joi.func().arity(1).required()\n}));\n","export const questionNames = {\n UNIT_TEST_FRAMEWORK: 'unitTestFramework'\n};\n","import {Separator} from 'inquirer';\nimport {prompt} from '@form8ion/overridable-prompts';\nimport {questionNames} from '../prompts/question-names';\n\nexport default async function ({frameworks, decisions}) {\n if (!Object.keys(frameworks).length) return 'Other';\n\n const answers = await prompt([{\n name: questionNames.UNIT_TEST_FRAMEWORK,\n type: 'list',\n message: 'Which type of unit testing framework should be used?',\n choices: [...Object.keys(frameworks), new Separator(), 'Other']\n }], decisions);\n\n return answers[questionNames.UNIT_TEST_FRAMEWORK];\n}\n","import deepmerge from 'deepmerge';\nimport {scaffoldChoice as scaffoldFrameworkChoice, validateOptions} from '@form8ion/javascript-core';\nimport scaffoldCoverage from '../coverage/scaffolder';\nimport {unitTestFrameworksSchema} from './options-schemas';\nimport chooseFramework from './prompt';\n\nexport default async function ({projectRoot, frameworks, decisions, visibility, vcs}) {\n const validatedFrameworks = validateOptions(unitTestFrameworksSchema, frameworks);\n const [framework, coverage] = await Promise.all([\n chooseFramework({frameworks: validatedFrameworks, decisions})\n .then(chosenFramework => scaffoldFrameworkChoice(validatedFrameworks, chosenFramework, {projectRoot})),\n scaffoldCoverage({projectRoot, vcs, visibility})\n ]);\n\n return deepmerge.all([\n {scripts: {'test:unit': 'cross-env NODE_ENV=test c8 run-s test:unit:base'}},\n framework,\n coverage\n ]);\n}\n"],"names":["undefined","projectRoot","promises","writeFile","JSON","stringify","reporter","exclude","devDependencies","vcsIgnore","files","directories","eslint","ignore","vcs","visibility","deepmerge","scaffoldC8","scaffoldCodecov","unitTestFrameworksSchema","joi","object","required","pattern","scaffolder","func","arity","questionNames","UNIT_TEST_FRAMEWORK","frameworks","decisions","Object","keys","length","answers","prompt","name","type","message","choices","Separator","validatedFrameworks","validateOptions","framework","coverage","Promise","all","chooseFramework","then","chosenFramework","scaffoldFrameworkChoice","scaffoldCoverage","scripts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAe,qBAAY;AACzB,SAAOA,SAAP;AACD;;ACAc,2BAAgB;AAACC,EAAAA;AAAD,CAAhB,EAA+B;AAC5C,QAAMC,WAAQ,CAACC,SAAT,CACH,GAAEF,WAAY,aADX,EAEJG,IAAI,CAACC,SAAL,CAAe;AACbC,IAAAA,QAAQ,EAAE,CAAC,MAAD,EAAS,cAAT,EAAyB,MAAzB,CADG;AAEbC,IAAAA,OAAO,EAAE,CAAC,kBAAD,EAAqB,OAArB,EAA8B,sBAA9B,EAAsD,SAAtD;AAFI,GAAf,CAFI,CAAN;AAQA,SAAO;AACLC,IAAAA,eAAe,EAAE,CAAC,WAAD,EAAc,IAAd,CADZ;AAELC,IAAAA,SAAS,EAAE;AAACC,MAAAA,KAAK,EAAE,EAAR;AAAYC,MAAAA,WAAW,EAAE,CAAC,YAAD;AAAzB,KAFN;AAGLC,IAAAA,MAAM,EAAE;AAACC,MAAAA,MAAM,EAAE;AAACF,QAAAA,WAAW,EAAE,CAAC,YAAD;AAAd;AAAT;AAHH,GAAP;AAKD;;ACZc,iCAAgB;AAACV,EAAAA,WAAD;AAAca,EAAAA,GAAd;AAAmBC,EAAAA;AAAnB,CAAhB,EAAgD;AAC7D,SAAOC,6BAAS,CAAC,MAAMC,UAAU,CAAC;AAAChB,IAAAA;AAAD,GAAD,CAAjB,EAAkC,MAAMiB,gBAAe,CAAC;AAACJ,IAAAA,GAAD;AAAMC,IAAAA;AAAN,GAAD,CAAvD,CAA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H,CACQC,eAAe,IAAIC,6BAAuB,CAACT,mBAAD,EAAsBQ,eAAtB,EAAuC;AAAChD,IAAAA;AAAD,GAAvC,CADlD,CAD8C,EAG9CkD,gBAAgB,CAAC;AAAClD,IAAAA,WAAD;AAAca,IAAAA,GAAd;AAAmBC,IAAAA;AAAnB,GAAD,CAH8B,CAAZ,CAApC;AAMA,SAAOC,6BAAS,CAAC8B,GAAV,CAAc,CACnB;AAACM,IAAAA,OAAO,EAAE;AAAC,mBAAa;AAAd;AAAV,GADmB,EAEnBT,SAFmB,EAGnBC,QAHmB,CAAd,CAAP;AAKD;;;;;;;"}
|
package/lib/index.es.js
CHANGED
|
@@ -1,106 +1,27 @@
|
|
|
1
1
|
import deepmerge from 'deepmerge';
|
|
2
2
|
import { validateOptions, scaffoldChoice } from '@form8ion/javascript-core';
|
|
3
|
+
import { scaffold as scaffold$1 } from '@form8ion/codecov';
|
|
3
4
|
import { promises } from 'fs';
|
|
4
5
|
import * as joi from '@hapi/joi';
|
|
5
6
|
import { Separator } from 'inquirer';
|
|
6
7
|
import { prompt } from '@form8ion/overridable-prompts';
|
|
7
8
|
|
|
8
|
-
function scaffold
|
|
9
|
+
function scaffold () {
|
|
9
10
|
return undefined;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
function
|
|
13
|
-
var keys = Object.keys(object);
|
|
14
|
-
|
|
15
|
-
if (Object.getOwnPropertySymbols) {
|
|
16
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
17
|
-
|
|
18
|
-
if (enumerableOnly) {
|
|
19
|
-
symbols = symbols.filter(function (sym) {
|
|
20
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
keys.push.apply(keys, symbols);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return keys;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function _objectSpread2(target) {
|
|
31
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
32
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
33
|
-
|
|
34
|
-
if (i % 2) {
|
|
35
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
|
36
|
-
_defineProperty(target, key, source[key]);
|
|
37
|
-
});
|
|
38
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
39
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
40
|
-
} else {
|
|
41
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
42
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return target;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function _defineProperty(obj, key, value) {
|
|
51
|
-
if (key in obj) {
|
|
52
|
-
Object.defineProperty(obj, key, {
|
|
53
|
-
value: value,
|
|
54
|
-
enumerable: true,
|
|
55
|
-
configurable: true,
|
|
56
|
-
writable: true
|
|
57
|
-
});
|
|
58
|
-
} else {
|
|
59
|
-
obj[key] = value;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return obj;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function scaffold({
|
|
66
|
-
vcs,
|
|
67
|
-
visibility
|
|
68
|
-
}) {
|
|
69
|
-
if ('Public' !== visibility) {
|
|
70
|
-
return {};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return _objectSpread2({
|
|
74
|
-
devDependencies: ['codecov'],
|
|
75
|
-
scripts: {
|
|
76
|
-
'coverage:report': 'nyc report --reporter=text-lcov > coverage.lcov && codecov'
|
|
77
|
-
}
|
|
78
|
-
}, ['github', 'gitlab', 'bitbucket'].includes(vcs === null || vcs === void 0 ? void 0 : vcs.host) && {
|
|
79
|
-
badges: {
|
|
80
|
-
status: {
|
|
81
|
-
coverage: {
|
|
82
|
-
img: `https://img.shields.io/codecov/c/${vcs.host}/${vcs.owner}/${vcs.name}.svg`,
|
|
83
|
-
link: `https://codecov.io/${vcs.host}/${vcs.owner}/${vcs.name}`,
|
|
84
|
-
text: 'Codecov'
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async function scaffoldNyc ({
|
|
13
|
+
async function scaffoldC8 ({
|
|
92
14
|
projectRoot
|
|
93
15
|
}) {
|
|
94
|
-
await promises.writeFile(`${projectRoot}/.
|
|
95
|
-
extends: '@istanbuljs/nyc-config-babel',
|
|
16
|
+
await promises.writeFile(`${projectRoot}/.c8rc.json`, JSON.stringify({
|
|
96
17
|
reporter: ['lcov', 'text-summary', 'html'],
|
|
97
18
|
exclude: ['src/**/*-test.js', 'test/', 'thirdparty-wrappers/', 'vendor/']
|
|
98
19
|
}));
|
|
99
20
|
return {
|
|
100
|
-
devDependencies: ['cross-env', '
|
|
21
|
+
devDependencies: ['cross-env', 'c8'],
|
|
101
22
|
vcsIgnore: {
|
|
102
23
|
files: [],
|
|
103
|
-
directories: ['/coverage/'
|
|
24
|
+
directories: ['/coverage/']
|
|
104
25
|
},
|
|
105
26
|
eslint: {
|
|
106
27
|
ignore: {
|
|
@@ -115,9 +36,9 @@ async function scaffoldCoverage ({
|
|
|
115
36
|
vcs,
|
|
116
37
|
visibility
|
|
117
38
|
}) {
|
|
118
|
-
return deepmerge(await
|
|
39
|
+
return deepmerge(await scaffoldC8({
|
|
119
40
|
projectRoot
|
|
120
|
-
}), scaffold({
|
|
41
|
+
}), await scaffold$1({
|
|
121
42
|
vcs,
|
|
122
43
|
visibility
|
|
123
44
|
}));
|
|
@@ -165,10 +86,10 @@ async function unit ({
|
|
|
165
86
|
})]);
|
|
166
87
|
return deepmerge.all([{
|
|
167
88
|
scripts: {
|
|
168
|
-
'test:unit': 'cross-env NODE_ENV=test
|
|
89
|
+
'test:unit': 'cross-env NODE_ENV=test c8 run-s test:unit:base'
|
|
169
90
|
}
|
|
170
91
|
}, framework, coverage]);
|
|
171
92
|
}
|
|
172
93
|
|
|
173
|
-
export { questionNames, scaffold
|
|
94
|
+
export { questionNames, scaffold, unit as scaffoldUnitTesting, unitTestFrameworksSchema };
|
|
174
95
|
//# sourceMappingURL=index.es.js.map
|
package/lib/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/scaffold.js","../src/coverage/
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/scaffold.js","../src/coverage/c8.js","../src/coverage/scaffolder.js","../src/testing/options-schemas.js","../src/prompts/question-names.js","../src/testing/prompt.js","../src/testing/unit.js"],"sourcesContent":["export default function () {\n return undefined;\n}\n","import {promises} from 'fs';\n\nexport default async function ({projectRoot}) {\n await promises.writeFile(\n `${projectRoot}/.c8rc.json`,\n JSON.stringify({\n reporter: ['lcov', 'text-summary', 'html'],\n exclude: ['src/**/*-test.js', 'test/', 'thirdparty-wrappers/', 'vendor/']\n })\n );\n\n return {\n devDependencies: ['cross-env', 'c8'],\n vcsIgnore: {files: [], directories: ['/coverage/']},\n eslint: {ignore: {directories: ['/coverage/']}}\n };\n}\n","import deepmerge from 'deepmerge';\nimport {scaffold as scaffoldCodecov} from '@form8ion/codecov';\nimport scaffoldC8 from './c8';\n\nexport default async function ({projectRoot, vcs, visibility}) {\n return deepmerge(await scaffoldC8({projectRoot}), await scaffoldCodecov({vcs, visibility}));\n}\n","import * as joi from '@hapi/joi';\n\nexport const unitTestFrameworksSchema = joi.object().required().pattern(/^/, joi.object({\n scaffolder: joi.func().arity(1).required()\n}));\n","export const questionNames = {\n UNIT_TEST_FRAMEWORK: 'unitTestFramework'\n};\n","import {Separator} from 'inquirer';\nimport {prompt} from '@form8ion/overridable-prompts';\nimport {questionNames} from '../prompts/question-names';\n\nexport default async function ({frameworks, decisions}) {\n if (!Object.keys(frameworks).length) return 'Other';\n\n const answers = await prompt([{\n name: questionNames.UNIT_TEST_FRAMEWORK,\n type: 'list',\n message: 'Which type of unit testing framework should be used?',\n choices: [...Object.keys(frameworks), new Separator(), 'Other']\n }], decisions);\n\n return answers[questionNames.UNIT_TEST_FRAMEWORK];\n}\n","import deepmerge from 'deepmerge';\nimport {scaffoldChoice as scaffoldFrameworkChoice, validateOptions} from '@form8ion/javascript-core';\nimport scaffoldCoverage from '../coverage/scaffolder';\nimport {unitTestFrameworksSchema} from './options-schemas';\nimport chooseFramework from './prompt';\n\nexport default async function ({projectRoot, frameworks, decisions, visibility, vcs}) {\n const validatedFrameworks = validateOptions(unitTestFrameworksSchema, frameworks);\n const [framework, coverage] = await Promise.all([\n chooseFramework({frameworks: validatedFrameworks, decisions})\n .then(chosenFramework => scaffoldFrameworkChoice(validatedFrameworks, chosenFramework, {projectRoot})),\n scaffoldCoverage({projectRoot, vcs, visibility})\n ]);\n\n return deepmerge.all([\n {scripts: {'test:unit': 'cross-env NODE_ENV=test c8 run-s test:unit:base'}},\n framework,\n coverage\n ]);\n}\n"],"names":["undefined","projectRoot","promises","writeFile","JSON","stringify","reporter","exclude","devDependencies","vcsIgnore","files","directories","eslint","ignore","vcs","visibility","deepmerge","scaffoldC8","scaffoldCodecov","unitTestFrameworksSchema","joi","object","required","pattern","scaffolder","func","arity","questionNames","UNIT_TEST_FRAMEWORK","frameworks","decisions","Object","keys","length","answers","prompt","name","type","message","choices","Separator","validatedFrameworks","validateOptions","framework","coverage","Promise","all","chooseFramework","then","chosenFramework","scaffoldFrameworkChoice","scaffoldCoverage","scripts"],"mappings":";;;;;;;;AAAe,qBAAY;AACzB,SAAOA,SAAP;AACD;;ACAc,2BAAgB;AAACC,EAAAA;AAAD,CAAhB,EAA+B;AAC5C,QAAMC,QAAQ,CAACC,SAAT,CACH,GAAEF,WAAY,aADX,EAEJG,IAAI,CAACC,SAAL,CAAe;AACbC,IAAAA,QAAQ,EAAE,CAAC,MAAD,EAAS,cAAT,EAAyB,MAAzB,CADG;AAEbC,IAAAA,OAAO,EAAE,CAAC,kBAAD,EAAqB,O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5BC,IAAAA,OAAO,EAAE,CAAC,GAAGR,MAAM,CAACC,IAAP,CAAYH,UAAZ,CAAJ,EAA6B,IAAIW,SAAJ,EAA7B,EAA8C,OAA9C;AAJmB,GAAD,CAAD,EAKxBV,SALwB,CAA5B;AAOA,SAAOI,OAAO,CAACP,aAAa,CAACC,mBAAf,CAAd;AACD;;ACTc,qBAAgB;AAAC3B,EAAAA,WAAD;AAAc4B,EAAAA,UAAd;AAA0BC,EAAAA,SAA1B;AAAqCf,EAAAA,UAArC;AAAiDD,EAAAA;AAAjD,CAAhB,EAAuE;AACpF,QAAM2B,mBAAmB,GAAGC,eAAe,CAACvB,wBAAD,EAA2BU,UAA3B,CAA3C;AACA,QAAM,CAACc,SAAD,EAAYC,QAAZ,IAAwB,MAAMC,OAAO,CAACC,GAAR,CAAY,CAC9CC,eAAe,CAAC;AAAClB,IAAAA,UAAU,EAAEY,mBAAb;AAAkCX,IAAAA;AAAlC,GAAD,CAAf,CACGkB,IADH,CACQC,eAAe,IAAIC,cAAuB,CAACT,mBAAD,EAAsBQ,eAAtB,EAAuC;AAAChD,IAAAA;AAAD,GAAvC,CADlD,CAD8C,EAG9CkD,gBAAgB,CAAC;AAAClD,IAAAA,WAAD;AAAca,IAAAA,GAAd;AAAmBC,IAAAA;AAAnB,GAAD,CAH8B,CAAZ,CAApC;AAMA,SAAOC,SAAS,CAAC8B,GAAV,CAAc,CACnB;AAACM,IAAAA,OAAO,EAAE;AAAC,mBAAa;AAAd;AAAV,GADmB,EAEnBT,SAFmB,EAGnBC,QAHmB,CAAd,CAAP;AAKD;;;;"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@form8ion/javascript",
|
|
3
3
|
"description": "JavaScript language plugin for the @form8ion toolset",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.1.3",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=12.20"
|
|
8
8
|
},
|
|
@@ -47,24 +47,23 @@
|
|
|
47
47
|
"build:js": "rollup --config",
|
|
48
48
|
"watch": "run-s 'build:js -- --watch'",
|
|
49
49
|
"prepack": "run-s build",
|
|
50
|
-
"test:unit": "cross-env NODE_ENV=test
|
|
51
|
-
"coverage:report": "
|
|
50
|
+
"test:unit": "cross-env NODE_ENV=test c8 run-s test:unit:base",
|
|
51
|
+
"coverage:report": "c8 report --reporter=text-lcov > coverage.lcov && codecov",
|
|
52
52
|
"test:unit:base": "DEBUG=any mocha 'src/**/*-test.js'"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@babel/register": "7.16.0",
|
|
56
56
|
"@cucumber/cucumber": "7.3.1",
|
|
57
|
-
"@form8ion/babel-preset": "1.6.
|
|
58
|
-
"@form8ion/commitlint-config": "1.0.
|
|
59
|
-
"@form8ion/eslint-config": "1.
|
|
57
|
+
"@form8ion/babel-preset": "1.6.72",
|
|
58
|
+
"@form8ion/commitlint-config": "1.0.23",
|
|
59
|
+
"@form8ion/eslint-config": "1.9.0",
|
|
60
60
|
"@form8ion/eslint-config-cucumber": "1.4.0",
|
|
61
61
|
"@form8ion/eslint-config-mocha": "1.2.12",
|
|
62
|
-
"@form8ion/remark-lint-preset": "2.1.
|
|
63
|
-
"@istanbuljs/nyc-config-babel": "3.0.0",
|
|
62
|
+
"@form8ion/remark-lint-preset": "2.1.7",
|
|
64
63
|
"@rollup/plugin-babel": "5.3.0",
|
|
65
|
-
"@travi/any": "2.0.
|
|
66
|
-
"babel-plugin-istanbul": "6.1.1",
|
|
64
|
+
"@travi/any": "2.0.19",
|
|
67
65
|
"ban-sensitive-files": "1.9.16",
|
|
66
|
+
"c8": "7.10.0",
|
|
68
67
|
"chai": "4.3.4",
|
|
69
68
|
"codecov": "3.8.2",
|
|
70
69
|
"cross-env": "7.0.3",
|
|
@@ -74,19 +73,19 @@
|
|
|
74
73
|
"lockfile-lint": "4.6.2",
|
|
75
74
|
"ls-engines": "0.6.1",
|
|
76
75
|
"mocha": "9.1.3",
|
|
77
|
-
"mock-fs": "5.1.
|
|
76
|
+
"mock-fs": "5.1.2",
|
|
78
77
|
"npm-run-all": "4.1.5",
|
|
79
|
-
"nyc": "15.1.0",
|
|
80
78
|
"package-preview": "4.0.0",
|
|
81
|
-
"remark-cli": "10.0.
|
|
79
|
+
"remark-cli": "10.0.1",
|
|
82
80
|
"remark-toc": "8.0.1",
|
|
83
81
|
"remark-usage": "10.0.1",
|
|
84
82
|
"rimraf": "3.0.2",
|
|
85
|
-
"rollup": "2.
|
|
83
|
+
"rollup": "2.60.2",
|
|
86
84
|
"rollup-plugin-auto-external": "2.0.0",
|
|
87
85
|
"sinon": "12.0.1"
|
|
88
86
|
},
|
|
89
87
|
"dependencies": {
|
|
88
|
+
"@form8ion/codecov": "^1.0.0-alpha.2",
|
|
90
89
|
"@form8ion/javascript-core": "^4.0.0",
|
|
91
90
|
"@form8ion/overridable-prompts": "^1.1.1",
|
|
92
91
|
"@hapi/joi": "^17.1.1",
|