@form8ion/javascript 13.0.0-beta.1 → 13.0.0-beta.11
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 +15 -5
- package/example.js +67 -59
- package/lib/index.js +543 -545
- package/lib/index.js.map +1 -1
- package/package.json +21 -29
- package/lib/index.mjs +0 -1824
- package/lib/index.mjs.map +0 -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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
plugins: {
|
|
78
|
+
unitTestFrameworks: {},
|
|
79
|
+
applicationTypes: {},
|
|
80
|
+
packageTypes: {},
|
|
81
|
+
packageBundlers: {},
|
|
82
|
+
ciServices: {}
|
|
83
|
+
},
|
|
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: {
|
|
114
|
-
Jest: {
|
|
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
|
@@ -2,87 +2,95 @@
|
|
|
2
2
|
// remark-usage-ignore-next 4
|
|
3
3
|
import {resolve} from 'path';
|
|
4
4
|
import stubbedFs from 'mock-fs';
|
|
5
|
-
import td from 'testdouble';
|
|
5
|
+
import * as td from 'testdouble';
|
|
6
6
|
import 'validate-npm-package-name';
|
|
7
7
|
|
|
8
8
|
// remark-usage-ignore-next 10
|
|
9
9
|
stubbedFs({
|
|
10
|
-
node_modules: stubbedFs.load(resolve(
|
|
10
|
+
node_modules: stubbedFs.load(resolve('node_modules')),
|
|
11
11
|
'.nvmrc': 'v1.2.3',
|
|
12
|
-
lib: stubbedFs.load(resolve(
|
|
13
|
-
templates: stubbedFs.load(resolve(
|
|
12
|
+
lib: stubbedFs.load(resolve('lib')),
|
|
13
|
+
templates: stubbedFs.load(resolve('templates'))
|
|
14
14
|
});
|
|
15
15
|
const execa = td.replace('execa');
|
|
16
16
|
td.when(execa('. ~/.nvm/nvm.sh && nvm ls-remote --lts', {shell: true}))
|
|
17
17
|
.thenResolve({stdout: ['v16.5.4', ''].join('\n')});
|
|
18
18
|
td.when(execa('. ~/.nvm/nvm.sh && nvm install', {shell: true})).thenReturn({stdout: {pipe: () => undefined}});
|
|
19
19
|
|
|
20
|
-
const {dialects, projectTypes} =
|
|
20
|
+
const {dialects, projectTypes} = await import('@form8ion/javascript-core');
|
|
21
21
|
const {
|
|
22
22
|
scaffold: scaffoldJavaScript,
|
|
23
23
|
lift: liftJavascript,
|
|
24
24
|
test: thisIsAJavaScriptProject,
|
|
25
25
|
scaffoldUnitTesting,
|
|
26
26
|
questionNames
|
|
27
|
-
} =
|
|
27
|
+
} = await import('./lib/index.js');
|
|
28
28
|
|
|
29
29
|
// #### Execute
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const projectRoot = process.cwd();
|
|
30
|
+
const accountName = 'form8ion';
|
|
31
|
+
const projectRoot = process.cwd();
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
ciServices: {},
|
|
33
|
+
await scaffoldJavaScript({
|
|
34
|
+
projectRoot,
|
|
35
|
+
projectName: 'project-name',
|
|
36
|
+
visibility: 'Public',
|
|
37
|
+
license: 'MIT',
|
|
38
|
+
configs: {
|
|
39
|
+
eslint: {scope: `@${accountName}`},
|
|
40
|
+
remark: `@${accountName}/remark-lint-preset`,
|
|
41
|
+
babelPreset: {name: `@${accountName}`, packageName: `@${accountName}/babel-preset`},
|
|
42
|
+
commitlint: {name: `@${accountName}`, packageName: `@${accountName}/commitlint-config`}
|
|
43
|
+
},
|
|
44
|
+
plugins: {
|
|
47
45
|
unitTestFrameworks: {},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
projectRoot,
|
|
67
|
-
configs: {eslint: {scope: '@foo'}},
|
|
68
|
-
results: {
|
|
69
|
-
dependencies: [],
|
|
70
|
-
devDependencies: [],
|
|
71
|
-
scripts: {},
|
|
72
|
-
eslint: {configs: [], ignore: {directories: []}},
|
|
73
|
-
packageManager: 'npm'
|
|
74
|
-
}
|
|
75
|
-
});
|
|
46
|
+
applicationTypes: {},
|
|
47
|
+
packageTypes: {},
|
|
48
|
+
packageBundlers: {},
|
|
49
|
+
ciServices: {}
|
|
50
|
+
},
|
|
51
|
+
decisions: {
|
|
52
|
+
[questionNames.DIALECT]: dialects.BABEL,
|
|
53
|
+
[questionNames.NODE_VERSION_CATEGORY]: 'LTS',
|
|
54
|
+
[questionNames.PACKAGE_MANAGER]: 'npm',
|
|
55
|
+
[questionNames.PROJECT_TYPE]: projectTypes.PACKAGE,
|
|
56
|
+
[questionNames.SHOULD_BE_SCOPED]: true,
|
|
57
|
+
[questionNames.SCOPE]: accountName,
|
|
58
|
+
[questionNames.AUTHOR_NAME]: 'Your Name',
|
|
59
|
+
[questionNames.AUTHOR_EMAIL]: 'you@domain.tld',
|
|
60
|
+
[questionNames.AUTHOR_URL]: 'https://your.website.tld',
|
|
61
|
+
[questionNames.UNIT_TESTS]: true,
|
|
62
|
+
[questionNames.INTEGRATION_TESTS]: true,
|
|
63
|
+
[questionNames.PROVIDE_EXAMPLE]: true
|
|
76
64
|
}
|
|
65
|
+
});
|
|
77
66
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
67
|
+
if (await thisIsAJavaScriptProject({projectRoot})) {
|
|
68
|
+
await liftJavascript({
|
|
69
|
+
projectRoot,
|
|
70
|
+
configs: {eslint: {scope: '@foo'}},
|
|
71
|
+
results: {
|
|
72
|
+
dependencies: [],
|
|
73
|
+
devDependencies: [],
|
|
74
|
+
scripts: {},
|
|
75
|
+
eslint: {configs: [], ignore: {directories: []}},
|
|
76
|
+
packageManager: 'npm'
|
|
83
77
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
enhancers: {
|
|
79
|
+
PluginName: {
|
|
80
|
+
test: () => true,
|
|
81
|
+
lift: () => ({})
|
|
82
|
+
}
|
|
83
|
+
}
|
|
87
84
|
});
|
|
88
|
-
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
await scaffoldUnitTesting({
|
|
88
|
+
projectRoot: process.cwd(),
|
|
89
|
+
frameworks: {
|
|
90
|
+
Mocha: {scaffold: options => options},
|
|
91
|
+
Jest: {scaffold: options => options}
|
|
92
|
+
},
|
|
93
|
+
visibility: 'Public',
|
|
94
|
+
vcs: {host: 'GitHub', owner: 'foo', name: 'bar'},
|
|
95
|
+
decisions: {[questionNames.UNIT_TEST_FRAMEWORK]: 'Mocha'}
|
|
96
|
+
});
|