-
Notifications
You must be signed in to change notification settings - Fork 0
/
nr.config.ts
71 lines (62 loc) · 2.15 KB
/
nr.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
import path from 'node:path';
import defineConfig from '@darkobits/nr';
import fs from 'fs-extra';
import IS_CI from 'is-ci';
import { defaultPackageScripts } from './src';
import log from './src/lib/log';
export default defineConfig([
// Register the default scripts defined by this package.
defaultPackageScripts,
// Additionally, register our own custom scripts.
({ command, fn, script }) => {
const gitPushCommand = command('git', {
args: ['push', 'origin', 'HEAD', { setUpstream: true, followTags: true }]
});
script('test.smoke', [[
command.node('index.js', { cwd: './tests/fixtures/cjs' }),
command.node('index.js', { cwd: './tests/fixtures/esm' })
]], {
group: 'Test',
description: 'Run smoke tests against the compiled version of the project.',
timing: true
});
// When publishing this package, we use re-pack's 'publish' command to
// publish from the .re-pack folder rather than `npm publish`.
script('publish', [
// Re-pack the project.
command('re-pack'),
// Publish the project from the re-pack directory.
command('re-pack', { args: ['publish'] }),
// Push the release commit.
gitPushCommand,
// Remove the re-pack directory.
fn(() => fs.rm(path.resolve('.re-pack'), { recursive: true, force: true }))
], {
group: 'Release',
description: `Publish the package using ${log.chalk.white.bold('re-pack')}.`,
timing: true
});
script('postBump', [
'script:publish',
gitPushCommand
], {
group: 'Lifecycle',
description: '[hook] After the bump script, publish the project and push the release commit.'
});
if (!IS_CI) {
script('postBuild', [
command.node('./scripts/update-readme.mts', {
nodeOptions: ['--loader=ts-node/esm', '--no-warnings']
}),
'script:test.smoke'
], {
group: 'Lifecycle',
description: '[hook] Update dependency versions in README.'
});
script('postPrepare', 'script:test.smoke', {
group: 'Lifecycle',
description: '[hook] After the prepare script, run smoke tests.'
});
}
}
]);