@@ -46,88 +46,85 @@ $ npm install @form8ion/javascript --save
4646#### Import
4747
4848``` javascript
49- const {dialects , projectTypes } = require (' @form8ion/javascript-core' );
49+ const {dialects , projectTypes } = await import (' @form8ion/javascript-core' );
5050const {
5151 scaffold: scaffoldJavaScript ,
5252 lift: liftJavascript ,
5353 test: thisIsAJavaScriptProject ,
5454 scaffoldUnitTesting ,
5555 questionNames
56- } = require ( ' @form8ion/javascript ' );
56+ } = await import ( ' ./lib/index.js ' );
5757```
5858
5959#### Execute
6060
6161``` javascript
62- (async () => {
63- const accountName = ' form8ion' ;
64- const projectRoot = process .cwd ();
62+ const accountName = ' form8ion' ;
63+ const projectRoot = process .cwd ();
64+
65+ await scaffoldJavaScript ({
66+ projectRoot,
67+ projectName: ' project-name' ,
68+ visibility: ' Public' ,
69+ license: ' MIT' ,
70+ configs: {
71+ eslint: {scope: ` @${ accountName} ` },
72+ remark: ` @${ accountName} /remark-lint-preset` ,
73+ babelPreset: {name: ` @${ accountName} ` , packageName: ` @${ accountName} /babel-preset` },
74+ commitlint: {name: ` @${ accountName} ` , packageName: ` @${ accountName} /commitlint-config` }
75+ },
76+ plugins: {
77+ unitTestFrameworks: {},
78+ applicationTypes: {},
79+ packageTypes: {},
80+ packageBundlers: {},
81+ ciServices: {}
82+ },
83+ decisions: {
84+ [questionNames .DIALECT ]: dialects .BABEL ,
85+ [questionNames .NODE_VERSION_CATEGORY ]: ' LTS' ,
86+ [questionNames .PACKAGE_MANAGER ]: ' npm' ,
87+ [questionNames .PROJECT_TYPE ]: projectTypes .PACKAGE ,
88+ [questionNames .SHOULD_BE_SCOPED ]: true ,
89+ [questionNames .SCOPE ]: accountName,
90+ [questionNames .AUTHOR_NAME ]: ' Your Name' ,
91+ [questionNames .AUTHOR_EMAIL ]: ' you@domain.tld' ,
92+ [questionNames .AUTHOR_URL ]: ' https://your.website.tld' ,
93+ [questionNames .UNIT_TESTS ]: true ,
94+ [questionNames .INTEGRATION_TESTS ]: true ,
95+ [questionNames .PROVIDE_EXAMPLE ]: true
96+ }
97+ });
6598
66- await scaffoldJavaScript ({
99+ if (await thisIsAJavaScriptProject ({projectRoot})) {
100+ await liftJavascript ({
67101 projectRoot,
68- projectName: ' project-name' ,
69- visibility: ' Public' ,
70- license: ' MIT' ,
71- configs: {
72- eslint: {scope: ` @${ accountName} ` },
73- remark: ` @${ accountName} /remark-lint-preset` ,
74- babelPreset: {name: ` @${ accountName} ` , packageName: ` @${ accountName} /babel-preset` },
75- commitlint: {name: ` @${ accountName} ` , packageName: ` @${ accountName} /commitlint-config` }
76- },
77- plugins: {
78- unitTestFrameworks: {},
79- applicationTypes: {},
80- packageTypes: {},
81- packageBundlers: {},
82- ciServices: {}
102+ configs: {eslint: {scope: ' @foo' }},
103+ results: {
104+ dependencies: {javascript: {production: [], development: []}},
105+ scripts: {},
106+ eslint: {configs: [], ignore: {directories: []}},
107+ packageManager: ' npm'
83108 },
84- decisions: {
85- [questionNames .DIALECT ]: dialects .BABEL ,
86- [questionNames .NODE_VERSION_CATEGORY ]: ' LTS' ,
87- [questionNames .PACKAGE_MANAGER ]: ' npm' ,
88- [questionNames .PROJECT_TYPE ]: projectTypes .PACKAGE ,
89- [questionNames .SHOULD_BE_SCOPED ]: true ,
90- [questionNames .SCOPE ]: accountName,
91- [questionNames .AUTHOR_NAME ]: ' Your Name' ,
92- [questionNames .AUTHOR_EMAIL ]: ' you@domain.tld' ,
93- [questionNames .AUTHOR_URL ]: ' https://your.website.tld' ,
94- [questionNames .UNIT_TESTS ]: true ,
95- [questionNames .INTEGRATION_TESTS ]: true ,
96- [questionNames .PROVIDE_EXAMPLE ]: true
97- }
98- });
99-
100- if (await thisIsAJavaScriptProject ({projectRoot})) {
101- await liftJavascript ({
102- projectRoot,
103- configs: {eslint: {scope: ' @foo' }},
104- results: {
105- dependencies: [],
106- devDependencies: [],
107- scripts: {},
108- eslint: {configs: [], ignore: {directories: []}},
109- packageManager: ' npm'
110- },
111- enhancers: {
112- PluginName: {
113- test : () => true ,
114- lift : () => ({})
115- }
109+ enhancers: {
110+ PluginName: {
111+ test : () => true ,
112+ lift : () => ({})
116113 }
117- });
118- }
119-
120- await scaffoldUnitTesting ({
121- projectRoot: process .cwd (),
122- frameworks: {
123- Mocha: {scaffold : options => options},
124- Jest: {scaffold : options => options}
125- },
126- visibility: ' Public' ,
127- vcs: {host: ' GitHub' , owner: ' foo' , name: ' bar' },
128- decisions: {[questionNames .UNIT_TEST_FRAMEWORK ]: ' Mocha' }
114+ }
129115 });
130- })();
116+ }
117+
118+ await scaffoldUnitTesting ({
119+ projectRoot: process .cwd (),
120+ frameworks: {
121+ Mocha: {scaffold : options => options},
122+ Jest: {scaffold : options => options}
123+ },
124+ visibility: ' Public' ,
125+ vcs: {host: ' GitHub' , owner: ' foo' , name: ' bar' },
126+ decisions: {[questionNames .UNIT_TEST_FRAMEWORK ]: ' Mocha' }
127+ });
131128```
132129
133130### Documentation
0 commit comments