-
Notifications
You must be signed in to change notification settings - Fork 0
/
.projenrc.ts
119 lines (101 loc) · 2.86 KB
/
.projenrc.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
import { IgnoreFile, Version } from 'projen';
import { BunTypescript } from './src';
import { GitHubCICDComponent } from 'projen-cicd-component';
const project = new BunTypescript({
authorName: 'Liam Johnston',
repository: 'https://github.com/Liam-Johnston/projen-bun-ts',
name: 'bun-ts-projen',
tsconfigFilename: 'tsconfig.dev.json',
keywords: ['bun', 'projen', 'jsii', 'project-template'],
bunContainerVersion: '1.0.25-alpine',
devDeps: [
'projen-cicd-component',
'jsii',
'jsii-diff',
'jsii-docgen',
'jsii-pacmak',
'jsii-rosetta',
'projen',
],
peerDeps: [
'projen',
'constructs'
],
appEnvironmentVariables: {
NPM_TOKEN: "${NPM_TOKEN:-}"
}
});
project.gitignore.addPatterns('tsconfig.json', '.jsii', 'lib/', 'todo');
project.package.addField('types', './lib/index.d.ts');
project.package.addField('jsii', {
targets: {},
excludeTypescript: ['./src/sample-code/*.ts'],
tsc: {
outDir: 'lib',
rootDir: 'src',
},
});
project.package.setScript('build', 'jsii --silence-warnings=reserved-word');
project.package.addField('files', ['lib', '.jsii', 'sample']);
const ignoreFile = new IgnoreFile(project, '.npmignore');
ignoreFile.addPatterns('node_modules/');
project.makefile.addRule({
targets: ['build'],
recipe: ['docker compose run --rm app bun run build'],
});
project.makefile.addRule({
targets: ['install'],
recipe: ['docker compose run --rm app bun i'],
});
new Version(project, {
versionInputFile: project.package.file.path,
artifactsDirectory: './lib',
});
project.makefile.addRule({
targets: ['publish'],
recipe: ['docker compose run --rm app npm publish'],
});
new GitHubCICDComponent(project, {
pushToMainWorkflowJobs: [
{
name: 'Build and Publish',
steps: [
{
name: 'Build',
commands: ['make install build'],
},
{
name: 'Bump Version',
commands: ['make bump'],
},
{
name: 'Commit Release',
commands: [
"git config --global user.name 'Github Actions'",
"git config --global user.email 'github@actions.com'",
"git commit -am 'chore(release)'",
'git tag $(cat ./lib/releasetag.txt)',
'git push',
'git push --tags',
],
},
{
name: 'Publish to NPM',
commands: ['make publish'],
environmentVariables: {
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}',
},
},
],
},
],
});
project.package.setScript('bump', 'bunx projen bump');
project.package.setScript('unbump', 'bunx projen bump');
const packageFile = await Bun.file(project.package.file.absolutePath).json();
project.package.addVersion(packageFile.version);
project.makefile.addRule({
targets: ['bump'],
recipe: ['docker compose run --rm app bun run bump'],
});
project.synth();