-
Notifications
You must be signed in to change notification settings - Fork 1
/
just.config.ts
207 lines (163 loc) · 4.93 KB
/
just.config.ts
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/* eslint-disable import/no-extraneous-dependencies */
import execa from 'execa';
import { logger, parallel, series, task } from 'just-task';
import readPkg from 'read-pkg';
function splitArgs(args: string): string[] {
return args
.split(' ')
.map((line) => line.trim())
.filter((line) => line != null && line !== '');
}
task('clean', async () => {
const cmd = 'rimraf';
const option = 'dist/ artifact/';
logger.info('clean: ', cmd, option);
await execa(cmd, splitArgs(option), {
stderr: process.stderr,
stdout: process.stdout,
});
});
task('lint', async () => {
const cmd = 'eslint';
const option = '--cache --ext ts,tsx .';
logger.info('lint: ', cmd, option);
await execa(cmd, splitArgs(option), {
stderr: process.stderr,
stdout: process.stdout,
});
});
task('+rollup:dev', async () => {
const cmd = 'rollup';
const option = '--config ./.configs/rollup.config.dev.ts --configPlugin ts';
logger.info('Rollup: ', cmd, option);
await execa(cmd, splitArgs(option), {
env: {
NODE_ENV: 'production',
},
stderr: process.stderr,
stdout: process.stdout,
});
});
task('+rollup:prod', async () => {
const cmd = 'rollup';
const option = '--config ./.configs/rollup.config.prod.ts --configPlugin ts --bundleConfigAsCjs';
logger.info('Rollup: ', cmd, option);
await execa(cmd, splitArgs(option), {
env: {
NODE_ENV: 'production',
},
stderr: process.stderr,
stdout: process.stdout,
});
});
task('+build', async () => {
const cmd = 'tsc';
const option = '--incremental --project tsconfig.json';
logger.info('Build: ', cmd, option);
await execa(cmd, splitArgs(option), {
stderr: process.stderr,
stdout: process.stdout,
});
});
task('+pub', async () => {
const cmd = 'npm';
const option = 'publish --registry http://localhost:8901 --force';
logger.info('Publish package to verdaccio: ', cmd, option);
await execa(cmd, splitArgs(option), {
env: {
NODE_ENV: 'production',
RELEASE_MODE: 'true',
},
stderr: process.stderr,
stdout: process.stdout,
});
});
task('unpub', async () => {
const packageJson = readPkg.sync();
const cmd = 'npm';
const option = `unpublish jin-frame@${packageJson.version} --registry http://localhost:8901 --force`;
logger.info('Publish package to verdaccio: ', cmd, option);
await execa(cmd, splitArgs(option), {
env: {
NODE_ENV: 'production',
RELEASE_MODE: 'true',
},
stderr: process.stderr,
stdout: process.stdout,
});
});
task('+pub:prod', async () => {
const cmd = 'npm';
const option = 'publish';
logger.info('Publish package to npm registry: ', cmd, option);
await execa(cmd, splitArgs(option), {
env: {
NODE_ENV: 'production',
RELEASE_MODE: 'true',
},
stderr: process.stderr,
stdout: process.stdout,
});
});
task('clean:file', async () => {
const cmd = 'rimraf';
const option = 'dist';
logger.info('Clean builded directory: ', cmd, option);
await execa(cmd, splitArgs(option), {
stderr: process.stderr,
stdout: process.stdout,
});
});
task('ctix:single', async () => {
const cmd = 'ctix';
const option = 'single -p ./tsconfig.prod.json --config ./.configs/.ctirc';
logger.info('Create index file : ', cmd, option);
await execa(cmd, splitArgs(option), {
stderr: process.stderr,
stdout: process.stdout,
});
});
task('ctix:create', async () => {
const cmd = 'ctix';
const option = 'create -p ./tsconfig.prod.json --config ./.configs/.ctirc --startAt src';
logger.info('Create index file : ', cmd, option);
await execa(cmd, splitArgs(option), {
stderr: process.stderr,
stdout: process.stdout,
});
});
task('ctix:remove', async () => {
const cmd = 'ctix';
const option = 'remove -p ./tsconfig.json --config ./.configs/.ctirc';
logger.info('Remove index file : ', cmd, option);
await execa(cmd, splitArgs(option), {
stderr: process.stderr,
stdout: process.stdout,
});
});
task('+docs', async () => {
const cmd = 'typedoc';
const option = '--out docs src/index.ts';
logger.info('Create document file : ', cmd, option);
await execa(cmd, splitArgs(option), {
stderr: process.stderr,
stdout: process.stdout,
});
});
task('+docs-watch', async () => {
const cmd = 'typedoc';
const option = '--watch --out docs src/index.ts';
logger.info('Create document file : ', cmd, option);
await execa(cmd, splitArgs(option), {
stderr: process.stderr,
stdout: process.stdout,
});
});
task('docs', series('clean', 'ctix:single', '+docs', 'ctix:remove'));
task('docs-watch', series('clean', 'ctix:single', '+docs-watch'));
task('build', '+build');
task('rollup:dev', series('clean', 'ctix:single', '+rollup:dev', 'ctix:remove'));
task('rollup:prod', series('clean', 'ctix:single', '+rollup:prod', 'ctix:remove'));
task('pub', series('rollup:prod', '+pub'));
task('clean', parallel('clean:file', 'ctix:remove'));
task('pub:prod', series('rollup:prod', '+pub:prod'));