Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.js
More file actions
Latest commit
96 lines (90 loc) · 2.88 KB
/
Copy pathexample.js
File metadata and controls
96 lines (90 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// #### Import
// remark-usage-ignore-next 4
import{resolve}from'path';
importstubbedFsfrom'mock-fs';
import*astdfrom'testdouble';
import'validate-npm-package-name';
// remark-usage-ignore-next 11
stubbedFs({
node_modules: stubbedFs.load(resolve('node_modules')),
'.nvmrc': 'v1.2.3',
lib: stubbedFs.load(resolve('lib')),
templates: stubbedFs.load(resolve('templates'))
});
const{execa}=awaittd.replaceEsm('execa');
td.when(execa('. ~/.nvm/nvm.sh && nvm ls-remote --lts',{shell: true}))
.thenResolve({stdout: ['v16.5.4',''].join('\n')});
td.when(execa('. ~/.nvm/nvm.sh && nvm install',{shell: true})).thenReturn({stdout: {pipe: ()=>undefined}});
td.when(execa('npm',['--version'])).thenResolve({stdout: '10.6.18'});
const{dialects, projectTypes}=awaitimport('@form8ion/javascript-core');
const{
scaffold: scaffoldJavaScript,
lift: liftJavascript,
test: thisIsAJavaScriptProject,
scaffoldUnitTesting,
questionNames
}=awaitimport('./lib/index.js');
// #### Execute
constaccountName='form8ion';
constprojectRoot=process.cwd();
awaitscaffoldJavaScript({
projectRoot,
projectName: 'project-name',
visibility: 'Public',
license: 'MIT',
configs: {
eslint: {scope: `@${accountName}`},
remark: `@${accountName}/remark-lint-preset`,
babelPreset: {name: `@${accountName}`,packageName: `@${accountName}/babel-preset`},
commitlint: {name: `@${accountName}`,packageName: `@${accountName}/commitlint-config`}
},
plugins: {
unitTestFrameworks: {},
applicationTypes: {},
packageTypes: {},
packageBundlers: {},
ciServices: {}
},
decisions: {
[questionNames.DIALECT]: dialects.BABEL,
[questionNames.NODE_VERSION_CATEGORY]: 'LTS',
[questionNames.PACKAGE_MANAGER]: 'npm',
[questionNames.PROJECT_TYPE]: projectTypes.PACKAGE,
[questionNames.SHOULD_BE_SCOPED]: true,
[questionNames.SCOPE]: accountName,
[questionNames.AUTHOR_NAME]: 'Your Name',
[questionNames.AUTHOR_EMAIL]: 'you@domain.tld',
[questionNames.AUTHOR_URL]: 'https://your.website.tld',
[questionNames.UNIT_TESTS]: true,
[questionNames.INTEGRATION_TESTS]: true,
[questionNames.PROVIDE_EXAMPLE]: true
}
});
if(awaitthisIsAJavaScriptProject({projectRoot})){
awaitliftJavascript({
projectRoot,
configs: {eslint: {scope: '@foo'}},
results: {
dependencies: {javascript: {production: [],development: []}},
scripts: {},
eslint: {configs: [],ignore: {directories: []}},
packageManager: 'npm'
},
enhancers: {
PluginName: {
test: ()=>true,
lift: ()=>({})
}
}
});
}
awaitscaffoldUnitTesting({
projectRoot: process.cwd(),
frameworks: {
Mocha: {scaffold: options=>options},
Jest: {scaffold: options=>options}
},
visibility: 'Public',
vcs: {host: 'GitHub',owner: 'foo',name: 'bar'},
decisions: {[questionNames.UNIT_TEST_FRAMEWORK]: 'Mocha'}
});