-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.sh
More file actions
94 lines (81 loc) · 2.16 KB
/
config.sh
File metadata and controls
94 lines (81 loc) · 2.16 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
#!/bin/bash
if [[ ! -d .git ]]; then
# Init git repository if doesn't exists
git init
fi
# Init Node.js project
npm init -y
# Install dependencies
npm i -D commitizen standard husky ava sinon c8 typescript --silent
# Initialize Commitizen with cz-conventional-changelog adapter
npx commitizen init cz-conventional-changelog --save-dev --save-exact
# Create .czrc configuration file
echo '{ "path": "cz-conventional-changelog" }' > .czrc
# Create ava.config.js file
echo "export default {
files: [
'test/**/*.spec.js'
]
}" > ava.config.js
# Set npm package scripts
npm pkg set type='module'
npm pkg set license='MIT'
npm pkg set scripts.build:types="tsc -p tsconfig-build-types.json"
npm pkg set scripts.check:types="tsc"
npm pkg set scripts.check:types:watch="tsc --watch"
npm pkg set scripts.coverage="c8 --reporter=lcov ava"
npm pkg set scripts.coverage:view="c8 --reporter=html --reporter=text ava"
npm pkg set scripts.lint="standard"
npm pkg set scripts.lint:fix="standard --fix"
npm pkg set scripts.release:first="npm run release -- --first-release"
npm pkg set scripts.test="ava"
npm pkg set scripts.test:watch="ava --watch"
npm pkg set standard.includes='["test"]' --json
# Run prepare script
npx husky init
# Add husky hooks
echo "npm run lint" > .husky/pre-commit
echo "npm test" >> .husky/pre-commit
echo "exec < /dev/tty && node_modules/.bin/cz --hook || true" >> .husky/prepare-commit-msg
mkdir test
echo "import test from 'ava'
test('initial setup', async t => {
t.pass()
})" > test/initial-setup.spec.js
echo '{
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"alwaysStrict": true,
"checkJs": true,
"esModuleInterop": true,
"lib": [
"ESNext"
],
"module": "NodeNext",
"noEmit": true,
"noImplicitThis": true,
"strict": true,
"strictNullChecks": true,
"target": "ESNext"
},
"exclude": [
"node_modules"
],
"include": [
"test",
"src"
]
}' > tsconfig.json
echo '{
"extends": "./tsconfig",
"compilerOptions": {
"declaration": true,
"declarationDir": "./types",
"emitDeclarationOnly": true,
"noEmit": false
},
"include": [
"src"
]
}' > tsconfig-build-types.json