@form8ion/javascript 13.0.0-beta.7 → 13.0.0-beta.9

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/example.js CHANGED
@@ -2,97 +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(...[__dirname, 'node_modules'])),
10
+ node_modules: stubbedFs.load(resolve('node_modules')),
11
11
  '.nvmrc': 'v1.2.3',
12
- lib: stubbedFs.load(resolve(...[__dirname, 'lib'])),
13
- templates: stubbedFs.load(resolve(...[__dirname, 'templates']))
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} = require('@form8ion/javascript-core');
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
- } = require('./lib/index.js');
27
+ } = await import('./lib/index.js');
28
28
 
29
29
  // #### Execute
30
- (async () => {
31
- const accountName = 'form8ion';
32
- const projectRoot = process.cwd();
30
+ const accountName = 'form8ion';
31
+ const projectRoot = process.cwd();
33
32
 
34
- await scaffoldJavaScript({
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: {
45
+ unitTestFrameworks: {},
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
64
+ }
65
+ });
66
+
67
+ if (await thisIsAJavaScriptProject({projectRoot})) {
68
+ await liftJavascript({
35
69
  projectRoot,
36
- projectName: 'project-name',
37
- visibility: 'Public',
38
- license: 'MIT',
39
- configs: {
40
- eslint: {scope: `@${accountName}`},
41
- remark: `@${accountName}/remark-lint-preset`,
42
- babelPreset: {name: `@${accountName}`, packageName: `@${accountName}/babel-preset`},
43
- commitlint: {name: `@${accountName}`, packageName: `@${accountName}/commitlint-config`}
70
+ configs: {eslint: {scope: '@foo'}},
71
+ results: {
72
+ dependencies: [],
73
+ devDependencies: [],
74
+ scripts: {},
75
+ eslint: {configs: [], ignore: {directories: []}},
76
+ packageManager: 'npm'
44
77
  },
45
- plugins: {
46
- unitTestFrameworks: {},
47
- applicationTypes: {},
48
- packageTypes: {},
49
- packageBundlers: {},
50
- ciServices: {}
51
- },
52
- decisions: {
53
- [questionNames.DIALECT]: dialects.BABEL,
54
- [questionNames.NODE_VERSION_CATEGORY]: 'LTS',
55
- [questionNames.PACKAGE_MANAGER]: 'npm',
56
- [questionNames.PROJECT_TYPE]: projectTypes.PACKAGE,
57
- [questionNames.SHOULD_BE_SCOPED]: true,
58
- [questionNames.SCOPE]: accountName,
59
- [questionNames.AUTHOR_NAME]: 'Your Name',
60
- [questionNames.AUTHOR_EMAIL]: 'you@domain.tld',
61
- [questionNames.AUTHOR_URL]: 'https://your.website.tld',
62
- [questionNames.UNIT_TESTS]: true,
63
- [questionNames.INTEGRATION_TESTS]: true,
64
- [questionNames.PROVIDE_EXAMPLE]: true
78
+ enhancers: {
79
+ PluginName: {
80
+ test: () => true,
81
+ lift: () => ({})
82
+ }
65
83
  }
66
84
  });
85
+ }
67
86
 
68
- if (await thisIsAJavaScriptProject({projectRoot})) {
69
- await liftJavascript({
70
- projectRoot,
71
- configs: {eslint: {scope: '@foo'}},
72
- results: {
73
- dependencies: [],
74
- devDependencies: [],
75
- scripts: {},
76
- eslint: {configs: [], ignore: {directories: []}},
77
- packageManager: 'npm'
78
- },
79
- enhancers: {
80
- PluginName: {
81
- test: () => true,
82
- lift: () => ({})
83
- }
84
- }
85
- });
86
- }
87
-
88
- await scaffoldUnitTesting({
89
- projectRoot: process.cwd(),
90
- frameworks: {
91
- Mocha: {scaffold: options => options},
92
- Jest: {scaffold: options => options}
93
- },
94
- visibility: 'Public',
95
- vcs: {host: 'GitHub', owner: 'foo', name: 'bar'},
96
- decisions: {[questionNames.UNIT_TEST_FRAMEWORK]: 'Mocha'}
97
- });
98
- })();
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
+ });