forked from auth0/cosmos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage-scripts.js
168 lines (167 loc) · 4.98 KB
/
package-scripts.js
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
const {
series: { nps: series },
concurrent: { nps: parallel }
} = require('nps-utils')
module.exports = {
scripts: {
default: 'nps help',
production: {
build: {
script: series(
'deploy.catchup',
'production.directory',
'icons.build',
'metadata.build',
'docs.build',
'production.copy.docs',
'manage.build',
'production.copy.manage',
'sandbox.build',
'production.copy.redirect'
),
description: 'Build for production'
},
directory: {
script: 'mkdir -p build',
description: 'Create build directory'
},
copy: {
docs: {
script: 'cp -r internal/docs/public build/docs',
description: 'Copy generated docs site to main production build'
},
manage: {
script: 'cp -r examples/manage/public build/manage',
description: 'Copy generated manage POC to main production build'
},
redirect: {
script: 'cp -r internal/redirect/* build/',
description: 'Copy redirection script'
}
},
start: {
script: 'serve -s build',
description: 'Start production server'
}
},
test: {
default: {
script: series('production.build', 'test.chromaticci', 'test.unit'),
description: 'Check if applications build + Run visual tests + Run unit tests'
},
chromaticci: {
script:
'if [ $TRAVIS_EVENT_TYPE != "pull_request" -o "$TRAVIS_PULL_REQUEST_SLUG" != "$TRAVIS_REPO_SLUG" ]; then chromatic test --storybook-addon --script-name=sandbox --exit-zero-on-changes; fi;',
description: 'Check if CI event is push and then run chromatic'
},
snapshot: {
script: 'cd internal/test && yarn test-snapshot',
description: 'Run snapshot tests'
},
unit: {
default: {
script: 'cd internal/test && yarn test-unit',
description: 'Run unit tests'
},
watch: {
script: 'cd internal/test && yarn test-unit-watch',
description: 'Run unit tests in watch mode'
}
},
watch: {
script: 'cd internal/test && yarn test-watch',
description: 'Run all tests in watch mode'
},
coverage: {
script: 'cd internal/test && yarn coverage',
description: 'Run a coverage report'
}
},
metadata: {
dev: {
script: 'node tooling/component-metadata -w',
description: 'Generate metadata from components with watch mode'
},
build: {
script: 'node tooling/component-metadata',
description: 'Generate metadata from components'
}
},
docs: {
dev: {
script: parallel('metadata.dev', 'icons.dev', 'docs.dev_site'),
description: 'Start metadata + documentation site in dev mode'
},
dev_site: {
script: 'cd internal/docs && yarn dev',
description: 'Start documentation site in dev mode'
},
build: {
script: 'cd internal/docs && yarn build',
description: 'Build documentation site'
}
},
manage: {
dev: {
script: 'cd examples/manage && yarn dev',
description: 'Start manage POC in dev mode'
},
build: {
script: 'cd examples/manage && yarn build',
description: 'Build manage POC'
}
},
icons: {
dev: {
script: 'node tooling/update-icons -w',
description: 'Build icons with watch mode'
},
build: {
script: 'node tooling/update-icons',
description: 'Build icons'
}
},
sandbox: {
dev: {
script: 'start-storybook -p 9001 -s build',
description: 'Start sandbox in dev mode'
},
build: {
script: 'build-storybook -c .storybook -o build/sandbox',
description: 'Build sandbox'
},
sketch: {
script: 'SKETCH=true build-storybook -c .storybook -o build/sandbox',
description: 'Build sandbox for sketch files'
}
},
sketch: {
default: {
script: series('sandbox.sketch', 'sketch.story2sketch', 'sketch.cleanup'),
description: 'Generate asketch file from sketch components'
},
story2sketch: {
script: 'story2sketch --input=build/sandbox/iframe.html --output=dist/asketch.json',
description: 'Pick components from sandbox to build asketch file'
},
cleanup: {
script: 'node tooling/cleanup-sketch.js',
description: 'Clean up generated asketch file'
}
},
codemods: {
script: 'jscodeshift -t core/codemods core/components/',
description: 'Run codemod on components'
},
deploy: {
default: {
script: 'node tooling/publish.js',
description: 'Publish new versions of core packages'
},
catchup: {
script: 'node tooling/catchup.js && yarn install',
description: 'Catch up with deployed version'
}
}
}
}