-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (35 loc) · 870 Bytes
/
index.js
File metadata and controls
38 lines (35 loc) · 870 Bytes
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
const fs = require('fs')
const path = require('path')
module.exports = async function(prompts) {
const lib = await prompts({
name: 'value',
initial: true,
type: 'confirm',
message: 'Create a library project?',
})
if (lib.value) {
return {
ts: true,
lib: true,
test: true,
dirs: ['src'],
files: [
['src/index.ts', fs.readFileSync(resolve('files/src/index.ts'))],
['test/hello.test.ts', fs.readFileSync(resolve('files/test/hello.test.ts'))]
],
lint: ['stylelint', 'eslint', 'commitlint']
}
} else {
return {
ts: true,
dirs: ['src'],
files: [
['src/index.ts', fs.readFileSync(resolve('files/src/index.ts'))]
],
lint: ['stylelint', 'eslint', 'commitlint']
}
}
}
function resolve(filePath) {
return path.join(__dirname, filePath)
}