-
Notifications
You must be signed in to change notification settings - Fork 0
/
.scripts.ts
143 lines (127 loc) · 3.9 KB
/
.scripts.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
/// <reference path="./scripts/nps-utils.d.ts" />
import { concurrent, series } from 'nps-utils';
import { DEFAULT_OPTIONS } from './scripts';
const PKG_FILTER = '--ignore=@knot/*-example';
const EXAMPLE_FILTER = '--scope=@knot/*-example';
const run = (args: string, filter?: string) =>
`lerna run ${filter ? `--scope=${filter} ` : ''}${args}`;
const pkgRun = (task: string) => run(`${PKG_FILTER} ${task}`);
const exampleRun = (task: string) => run(`${EXAMPLE_FILTER} ${task}`);
const webpackExample = (framework: string) => ({
description: `run the "webpack + ${framework}" example`,
script: run(
"start -- --env.knotc='esy x -P ../../compiler knotc.exe'",
`@knot/webpack-${framework}-example`
)
});
const browserifyExample = (framework: string) => ({
default: {
description: `run the "browserify + ${framework}" example`,
script: series.nps(
`start.example.browserify_${framework}.build`,
`start.example.browserify_${framework}.serve`
)
},
build: {
description: `build the "browserify + ${framework}" example`,
script: run(
"build -- --knotc='esy x -P ../../compiler knotc.exe'",
`@knot/browserify-${framework}-example`
)
},
serve: {
description: `serve the "browserify + ${framework}" example`,
script: run('start', `@knot/browserify-${framework}-example`)
}
});
const rollupExample = (framework: string) => ({
default: {
description: `run the "rollup + ${framework}" example`,
script: series.nps(
`start.example.rollup_${framework}.build`,
`start.example.rollup_${framework}.serve`
)
},
build: {
description: `build the "rollup + ${framework}" example`,
script: run(
"build -- --configKnotc='esy x -P ../../compiler knotc.exe'",
`@knot/rollup-${framework}-example`
)
},
serve: {
description: `serve the "rollup + ${framework}" example`,
script: run('start', `@knot/rollup-${framework}-example`)
}
});
export default {
options: DEFAULT_OPTIONS,
scripts: {
setup: {
description: 'bootstrap lerna project',
script: 'lerna bootstrap'
},
build: {
default: {
description: 'build all projects in repo',
script: concurrent.nps('build.packages', 'build.compiler')
},
packages: {
description: 'build all packages in repo',
script: pkgRun('build')
},
compiler: {
description: 'build compiler',
script: '(cd compiler && esy release)'
},
utils: {
description: 'build plugin utils',
script: run('build', '@knot/plugin-utils')
},
react: {
description: 'build react plugin',
script: run('build', '@knot/react-plugin')
},
vue: {
description: 'build vue plugin',
script: run('build', '@knot/vue-plugin')
}
},
start: {
example: {
webpack_react: webpackExample('react'),
webpack_vue: webpackExample('vue'),
browserify_react: browserifyExample('react'),
browserify_vue: browserifyExample('vue'),
rollup_react: rollupExample('react'),
rollup_vue: rollupExample('vue'),
todo: {
description: 'run the "todo" example',
script: run(
"start -- --env.knotc='esy x -P ../../compiler knotc.exe'",
'@knot/todomvc-example'
)
}
}
},
test: {
default: {
description: 'test all projects in repo',
script: series.nps('test.packages', 'test.examples')
},
packages: {
description: 'test all packages in repo',
script: pkgRun('test')
},
examples: {
description: 'test all examples in repo',
script: exampleRun('test')
}
},
release: {
description:
'release all packages in repo, auto version and update interdependencies',
script: 'iolaus --repository="https://github.com/effervescentia/knot"'
}
}
};