-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathpinefile.ts
More file actions
36 lines (30 loc) · 881 Bytes
/
pinefile.ts
File metadata and controls
36 lines (30 loc) · 881 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
import { run, log, series } from '@pinefile/pine';
import isCI from 'is-ci';
import { build } from '@frozzare/pkg';
const buildOptions = (format: 'cjs' | 'esm') => ({
entry: './src/index.ts',
format,
outfile: `./dist/${format}/index.js`,
});
export default {
build: async () => {
await run('rimraf dist');
log.info('Building types');
await run('tsc --emitDeclarationOnly');
log.info('Building cjs');
await build(buildOptions('cjs'));
log.info('Building esm');
await build(buildOptions('esm'));
},
test: async (args: { _: string[] }) => {
const files = isCI
? [__dirname + '/dist/cjs', __dirname + '/dist/esm']
: [__dirname + '/src'];
await series(
files.map((file) => async () => {
log.info(`Running tests with ${file}\n`);
await run(`FILE=${file} vitest ${args._}`);
}),
);
},
};