@langri-sha/projen-project 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +70 -0
- package/CHANGELOG.md +24 -0
- package/license +20 -0
- package/package.json +25 -0
- package/readme +24 -0
- package/src/__snapshots__/index.test.ts.snap +329 -0
- package/src/index.test.ts +48 -0
- package/src/index.ts +166 -0
- package/tsconfig.json +13 -0
package/CHANGELOG.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@langri-sha/projen-project",
|
|
3
|
+
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Tue, 30 Apr 2024 23:02:26 GMT",
|
|
6
|
+
"version": "0.2.0",
|
|
7
|
+
"tag": "@langri-sha/projen-project_v0.2.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "filip.dupanovic@gmail.com",
|
|
12
|
+
"package": "@langri-sha/projen-project",
|
|
13
|
+
"commit": "5b2b47f068f116b65549bd1b0c0a68c455ee319b",
|
|
14
|
+
"comment": "feat(projen): Add support for configuring Beachball"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "filip.dupanovic@gmail.com",
|
|
18
|
+
"package": "@langri-sha/projen-project",
|
|
19
|
+
"commit": "5b2b47f068f116b65549bd1b0c0a68c455ee319b",
|
|
20
|
+
"comment": "feat(projen): Remove top-level tasks"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "filip.dupanovic@gmail.com",
|
|
24
|
+
"package": "@langri-sha/projen-project",
|
|
25
|
+
"commit": "5b2b47f068f116b65549bd1b0c0a68c455ee319b",
|
|
26
|
+
"comment": "feat(projen): Configure PNPM workspaces"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "filip.dupanovic@gmail.com",
|
|
30
|
+
"package": "@langri-sha/projen-project",
|
|
31
|
+
"commit": "5b2b47f068f116b65549bd1b0c0a68c455ee319b",
|
|
32
|
+
"comment": "feat(projen-project): Configure ESM support"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "filip.dupanovic@gmail.com",
|
|
36
|
+
"package": "@langri-sha/projen-project",
|
|
37
|
+
"commit": "5b2b47f068f116b65549bd1b0c0a68c455ee319b",
|
|
38
|
+
"comment": "feat(projen-projent): Configure linters for synthesized files"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "filip.dupanovic@gmail.com",
|
|
42
|
+
"package": "@langri-sha/projen-project",
|
|
43
|
+
"commit": "5b2b47f068f116b65549bd1b0c0a68c455ee319b",
|
|
44
|
+
"comment": "feat(projen-project): Replace `deepMerge`"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"author": "filip.dupanovic@gmail.com",
|
|
48
|
+
"package": "@langri-sha/projen-project",
|
|
49
|
+
"commit": "5b2b47f068f116b65549bd1b0c0a68c455ee319b",
|
|
50
|
+
"comment": "feat(projen-project): Stub package"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "filip.dupanovic@gmail.com",
|
|
54
|
+
"package": "@langri-sha/projen-project",
|
|
55
|
+
"commit": "5b2b47f068f116b65549bd1b0c0a68c455ee319b",
|
|
56
|
+
"comment": "feat(projen-project): Configure default task"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"patch": [
|
|
60
|
+
{
|
|
61
|
+
"author": "filip.dupanovic@gmail.com",
|
|
62
|
+
"package": "@langri-sha/projen-project",
|
|
63
|
+
"commit": "5b2b47f068f116b65549bd1b0c0a68c455ee319b",
|
|
64
|
+
"comment": "fix(projen-project): Unignore projen config files"
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Change Log - @langri-sha/projen-project
|
|
2
|
+
|
|
3
|
+
This log was last generated on Tue, 30 Apr 2024 23:02:26 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
<!-- Start content -->
|
|
6
|
+
|
|
7
|
+
## 0.2.0
|
|
8
|
+
|
|
9
|
+
Tue, 30 Apr 2024 23:02:26 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- feat(projen): Add support for configuring Beachball (filip.dupanovic@gmail.com)
|
|
14
|
+
- feat(projen): Remove top-level tasks (filip.dupanovic@gmail.com)
|
|
15
|
+
- feat(projen): Configure PNPM workspaces (filip.dupanovic@gmail.com)
|
|
16
|
+
- feat(projen-project): Configure ESM support (filip.dupanovic@gmail.com)
|
|
17
|
+
- feat(projen-projent): Configure linters for synthesized files (filip.dupanovic@gmail.com)
|
|
18
|
+
- feat(projen-project): Replace `deepMerge` (filip.dupanovic@gmail.com)
|
|
19
|
+
- feat(projen-project): Stub package (filip.dupanovic@gmail.com)
|
|
20
|
+
- feat(projen-project): Configure default task (filip.dupanovic@gmail.com)
|
|
21
|
+
|
|
22
|
+
### Patches
|
|
23
|
+
|
|
24
|
+
- fix(projen-project): Unignore projen config files (filip.dupanovic@gmail.com)
|
package/license
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Filip Dupanović <filip.dupanovic@gmail.com> (https://langri-sha.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@langri-sha/projen-project",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@langri-sha/projen-lint-synthesized": "0.1.0",
|
|
9
|
+
"beachball": "2.43.1",
|
|
10
|
+
"ramda": "0.29.1"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@langri-sha/jest-test": "0.2.0",
|
|
14
|
+
"@langri-sha/tsconfig": "0.2.0",
|
|
15
|
+
"@types/ramda": "0.29.12",
|
|
16
|
+
"projen": "0.81.1"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"projen": "^0.81.1",
|
|
20
|
+
"typescript": "^5.0.0"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/readme
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @langri-sha/projen-project
|
|
2
|
+
|
|
3
|
+
Collection of [projen] templates for bootstraping monorepos and workspace
|
|
4
|
+
projects.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
### Defaults
|
|
9
|
+
|
|
10
|
+
- configures extensive list of Git ignore patterns
|
|
11
|
+
|
|
12
|
+
### Terraform
|
|
13
|
+
|
|
14
|
+
- adds lockfile
|
|
15
|
+
|
|
16
|
+
### TypeScript monorepo
|
|
17
|
+
|
|
18
|
+
- configures [`@langri-sha/tsconfig`]
|
|
19
|
+
- configures [PNPM] [workspaces]
|
|
20
|
+
|
|
21
|
+
[`@langri-sha/tsconfig`]: https://github.com/langri-sha/tsconfig
|
|
22
|
+
[pnpm]: https://pnpm.io
|
|
23
|
+
[projen]: https://projen.dev/
|
|
24
|
+
[workspaces]: https://pnpm.io/workspaces
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`defaults 1`] = `
|
|
4
|
+
{
|
|
5
|
+
".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
|
|
6
|
+
.*
|
|
7
|
+
!.babelrc
|
|
8
|
+
!.dockerignore
|
|
9
|
+
!.editorconfig
|
|
10
|
+
!.eslintignore
|
|
11
|
+
!.eslintrc.js
|
|
12
|
+
!.gitattributes
|
|
13
|
+
!.gitignore
|
|
14
|
+
!.gitkeep
|
|
15
|
+
!.husky
|
|
16
|
+
!.npmignore
|
|
17
|
+
!.openssl
|
|
18
|
+
!.prettierignore
|
|
19
|
+
!.projenrc*
|
|
20
|
+
*.db
|
|
21
|
+
*.log
|
|
22
|
+
!.github/
|
|
23
|
+
!.husky/
|
|
24
|
+
!.projen/
|
|
25
|
+
dist/
|
|
26
|
+
local/
|
|
27
|
+
node_modules/
|
|
28
|
+
!/.gitattributes
|
|
29
|
+
!/.projen/tasks.json
|
|
30
|
+
!/.projen/deps.json
|
|
31
|
+
!/.projen/files.json
|
|
32
|
+
",
|
|
33
|
+
".projen/files.json": {
|
|
34
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".",
|
|
35
|
+
"files": [
|
|
36
|
+
".gitattributes",
|
|
37
|
+
".gitignore",
|
|
38
|
+
".projen/deps.json",
|
|
39
|
+
".projen/files.json",
|
|
40
|
+
".projen/tasks.json",
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
".projen/tasks.json": {
|
|
44
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".",
|
|
45
|
+
"tasks": {
|
|
46
|
+
"default": {
|
|
47
|
+
"description": "Synthesize project files",
|
|
48
|
+
"name": "default",
|
|
49
|
+
"steps": [
|
|
50
|
+
{
|
|
51
|
+
"exec": "node --loader ts-node/esm .projenrc.mts",
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
"test": {
|
|
56
|
+
"description": "Run tests",
|
|
57
|
+
"name": "test",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
exports[`with Beachball configuration 1`] = `
|
|
65
|
+
{
|
|
66
|
+
".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
|
|
67
|
+
.*
|
|
68
|
+
!.babelrc
|
|
69
|
+
!.dockerignore
|
|
70
|
+
!.editorconfig
|
|
71
|
+
!.eslintignore
|
|
72
|
+
!.eslintrc.js
|
|
73
|
+
!.gitattributes
|
|
74
|
+
!.gitignore
|
|
75
|
+
!.gitkeep
|
|
76
|
+
!.husky
|
|
77
|
+
!.npmignore
|
|
78
|
+
!.openssl
|
|
79
|
+
!.prettierignore
|
|
80
|
+
!.projenrc*
|
|
81
|
+
*.db
|
|
82
|
+
*.log
|
|
83
|
+
!.github/
|
|
84
|
+
!.husky/
|
|
85
|
+
!.projen/
|
|
86
|
+
dist/
|
|
87
|
+
local/
|
|
88
|
+
node_modules/
|
|
89
|
+
!/.gitattributes
|
|
90
|
+
!/.projen/tasks.json
|
|
91
|
+
!/.projen/deps.json
|
|
92
|
+
!/.projen/files.json
|
|
93
|
+
!/beachball.config.js
|
|
94
|
+
",
|
|
95
|
+
".projen/files.json": {
|
|
96
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".",
|
|
97
|
+
"files": [
|
|
98
|
+
".gitattributes",
|
|
99
|
+
".gitignore",
|
|
100
|
+
".projen/deps.json",
|
|
101
|
+
".projen/files.json",
|
|
102
|
+
".projen/tasks.json",
|
|
103
|
+
"beachball.config.js",
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
".projen/tasks.json": {
|
|
107
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".",
|
|
108
|
+
"tasks": {
|
|
109
|
+
"default": {
|
|
110
|
+
"description": "Synthesize project files",
|
|
111
|
+
"name": "default",
|
|
112
|
+
"steps": [
|
|
113
|
+
{
|
|
114
|
+
"exec": "node --loader ts-node/esm .projenrc.mts",
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
"test": {
|
|
119
|
+
"description": "Run tests",
|
|
120
|
+
"name": "test",
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
"beachball.config.js": "/** @type {import('beachball').BeachballConfig} */
|
|
125
|
+
module.exports = {
|
|
126
|
+
"branch": "origin/main",
|
|
127
|
+
"gitTags": false,
|
|
128
|
+
"ignorePatterns": [
|
|
129
|
+
"*.test.*",
|
|
130
|
+
".*/**",
|
|
131
|
+
"__snapshots__/",
|
|
132
|
+
"dist/",
|
|
133
|
+
"node_modules/"
|
|
134
|
+
]
|
|
135
|
+
}",
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
|
|
139
|
+
exports[`with Terraform enabled 1`] = `
|
|
140
|
+
{
|
|
141
|
+
".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
|
|
142
|
+
.*
|
|
143
|
+
!.babelrc
|
|
144
|
+
!.dockerignore
|
|
145
|
+
!.editorconfig
|
|
146
|
+
!.eslintignore
|
|
147
|
+
!.eslintrc.js
|
|
148
|
+
!.gitattributes
|
|
149
|
+
!.gitignore
|
|
150
|
+
!.gitkeep
|
|
151
|
+
!.husky
|
|
152
|
+
!.npmignore
|
|
153
|
+
!.openssl
|
|
154
|
+
!.prettierignore
|
|
155
|
+
!.projenrc*
|
|
156
|
+
!.terraform.lock.hcl
|
|
157
|
+
*.db
|
|
158
|
+
*.log
|
|
159
|
+
!.github/
|
|
160
|
+
!.husky/
|
|
161
|
+
!.projen/
|
|
162
|
+
dist/
|
|
163
|
+
local/
|
|
164
|
+
node_modules/
|
|
165
|
+
!/.gitattributes
|
|
166
|
+
!/.projen/tasks.json
|
|
167
|
+
!/.projen/deps.json
|
|
168
|
+
!/.projen/files.json
|
|
169
|
+
",
|
|
170
|
+
".projen/files.json": {
|
|
171
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".",
|
|
172
|
+
"files": [
|
|
173
|
+
".gitattributes",
|
|
174
|
+
".gitignore",
|
|
175
|
+
".projen/deps.json",
|
|
176
|
+
".projen/files.json",
|
|
177
|
+
".projen/tasks.json",
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
".projen/tasks.json": {
|
|
181
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".",
|
|
182
|
+
"tasks": {
|
|
183
|
+
"default": {
|
|
184
|
+
"description": "Synthesize project files",
|
|
185
|
+
"name": "default",
|
|
186
|
+
"steps": [
|
|
187
|
+
{
|
|
188
|
+
"exec": "node --loader ts-node/esm .projenrc.mts",
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
"test": {
|
|
193
|
+
"description": "Run tests",
|
|
194
|
+
"name": "test",
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
}
|
|
199
|
+
`;
|
|
200
|
+
|
|
201
|
+
exports[`with TypeScript enabled 1`] = `
|
|
202
|
+
{
|
|
203
|
+
".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
|
|
204
|
+
.*
|
|
205
|
+
!.babelrc
|
|
206
|
+
!.dockerignore
|
|
207
|
+
!.editorconfig
|
|
208
|
+
!.eslintignore
|
|
209
|
+
!.eslintrc.js
|
|
210
|
+
!.gitattributes
|
|
211
|
+
!.gitignore
|
|
212
|
+
!.gitkeep
|
|
213
|
+
!.husky
|
|
214
|
+
!.npmignore
|
|
215
|
+
!.openssl
|
|
216
|
+
!.prettierignore
|
|
217
|
+
!.projenrc*
|
|
218
|
+
*.db
|
|
219
|
+
*.log
|
|
220
|
+
*.tsbuildinfo
|
|
221
|
+
!.github/
|
|
222
|
+
!.husky/
|
|
223
|
+
!.projen/
|
|
224
|
+
dist/
|
|
225
|
+
local/
|
|
226
|
+
node_modules/
|
|
227
|
+
!/.gitattributes
|
|
228
|
+
!/.projen/tasks.json
|
|
229
|
+
!/.projen/deps.json
|
|
230
|
+
!/.projen/files.json
|
|
231
|
+
",
|
|
232
|
+
".projen/files.json": {
|
|
233
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".",
|
|
234
|
+
"files": [
|
|
235
|
+
".gitattributes",
|
|
236
|
+
".gitignore",
|
|
237
|
+
".projen/deps.json",
|
|
238
|
+
".projen/files.json",
|
|
239
|
+
".projen/tasks.json",
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
".projen/tasks.json": {
|
|
243
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".",
|
|
244
|
+
"tasks": {
|
|
245
|
+
"default": {
|
|
246
|
+
"description": "Synthesize project files",
|
|
247
|
+
"name": "default",
|
|
248
|
+
"steps": [
|
|
249
|
+
{
|
|
250
|
+
"exec": "node --loader ts-node/esm .projenrc.mts",
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
},
|
|
254
|
+
"test": {
|
|
255
|
+
"description": "Run tests",
|
|
256
|
+
"name": "test",
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
}
|
|
261
|
+
`;
|
|
262
|
+
|
|
263
|
+
exports[`with workspaces 1`] = `
|
|
264
|
+
{
|
|
265
|
+
".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
|
|
266
|
+
.*
|
|
267
|
+
!.babelrc
|
|
268
|
+
!.dockerignore
|
|
269
|
+
!.editorconfig
|
|
270
|
+
!.eslintignore
|
|
271
|
+
!.eslintrc.js
|
|
272
|
+
!.gitattributes
|
|
273
|
+
!.gitignore
|
|
274
|
+
!.gitkeep
|
|
275
|
+
!.husky
|
|
276
|
+
!.npmignore
|
|
277
|
+
!.openssl
|
|
278
|
+
!.prettierignore
|
|
279
|
+
!.projenrc*
|
|
280
|
+
*.db
|
|
281
|
+
*.log
|
|
282
|
+
!.github/
|
|
283
|
+
!.husky/
|
|
284
|
+
!.projen/
|
|
285
|
+
dist/
|
|
286
|
+
local/
|
|
287
|
+
node_modules/
|
|
288
|
+
!/.gitattributes
|
|
289
|
+
!/.projen/tasks.json
|
|
290
|
+
!/.projen/deps.json
|
|
291
|
+
!/.projen/files.json
|
|
292
|
+
!/pnpm-workspace.yaml
|
|
293
|
+
",
|
|
294
|
+
".projen/files.json": {
|
|
295
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".",
|
|
296
|
+
"files": [
|
|
297
|
+
".gitattributes",
|
|
298
|
+
".gitignore",
|
|
299
|
+
".projen/deps.json",
|
|
300
|
+
".projen/files.json",
|
|
301
|
+
".projen/tasks.json",
|
|
302
|
+
"pnpm-workspace.yaml",
|
|
303
|
+
],
|
|
304
|
+
},
|
|
305
|
+
".projen/tasks.json": {
|
|
306
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".",
|
|
307
|
+
"tasks": {
|
|
308
|
+
"default": {
|
|
309
|
+
"description": "Synthesize project files",
|
|
310
|
+
"name": "default",
|
|
311
|
+
"steps": [
|
|
312
|
+
{
|
|
313
|
+
"exec": "node --loader ts-node/esm .projenrc.mts",
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
},
|
|
317
|
+
"test": {
|
|
318
|
+
"description": "Run tests",
|
|
319
|
+
"name": "test",
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
"pnpm-workspace.yaml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
|
|
324
|
+
|
|
325
|
+
packages:
|
|
326
|
+
- packages/*
|
|
327
|
+
",
|
|
328
|
+
}
|
|
329
|
+
`;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { synthSnapshot } from 'projen/lib/util/synth'
|
|
2
|
+
import { expect, test } from '@langri-sha/jest-test'
|
|
3
|
+
|
|
4
|
+
import { Project } from './index'
|
|
5
|
+
|
|
6
|
+
test('defaults', () => {
|
|
7
|
+
const project = new Project({
|
|
8
|
+
name: 'test-project',
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
expect(synthSnapshot(project)).toMatchSnapshot()
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test('with Beachball configuration', () => {
|
|
15
|
+
const project = new Project({
|
|
16
|
+
name: 'test-project',
|
|
17
|
+
beachballConfig: {},
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
expect(synthSnapshot(project)).toMatchSnapshot()
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
test('with Terraform enabled', () => {
|
|
24
|
+
const project = new Project({
|
|
25
|
+
name: 'test-project',
|
|
26
|
+
withTerraform: true,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
expect(synthSnapshot(project)).toMatchSnapshot()
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
test('with TypeScript enabled', () => {
|
|
33
|
+
const project = new Project({
|
|
34
|
+
name: 'test-project',
|
|
35
|
+
withTypeScript: true,
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
expect(synthSnapshot(project)).toMatchSnapshot()
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
test('with workspaces', () => {
|
|
42
|
+
const project = new Project({
|
|
43
|
+
name: 'test-project',
|
|
44
|
+
workspaces: ['packages/*'],
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
expect(synthSnapshot(project)).toMatchSnapshot()
|
|
48
|
+
})
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Project as BaseProject,
|
|
3
|
+
type ProjectOptions as BaseProjectOptions,
|
|
4
|
+
TextFile,
|
|
5
|
+
YamlFile,
|
|
6
|
+
} from 'projen'
|
|
7
|
+
|
|
8
|
+
import * as R from 'ramda'
|
|
9
|
+
import { type BeachballConfig } from 'beachball'
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
LintSynthesized,
|
|
13
|
+
type LintSynthesizedOptions,
|
|
14
|
+
} from '@langri-sha/projen-lint-synthesized'
|
|
15
|
+
|
|
16
|
+
export interface ProjectOptions extends BaseProjectOptions {
|
|
17
|
+
/*
|
|
18
|
+
* Pass in to set up Beachball.
|
|
19
|
+
*/
|
|
20
|
+
beachballConfig?: BeachballConfig
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* Options for the linting synthesized files.
|
|
24
|
+
*/
|
|
25
|
+
lintSynthesizedOptions?: LintSynthesizedOptions
|
|
26
|
+
/*
|
|
27
|
+
* Whether to use Terrafom.
|
|
28
|
+
*/
|
|
29
|
+
withTerraform?: boolean
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
* Whether to use TypeScript.
|
|
33
|
+
*/
|
|
34
|
+
withTypeScript?: boolean
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* PNPM workspaces to generate.
|
|
38
|
+
*/
|
|
39
|
+
workspaces?: string[]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class Project extends BaseProject {
|
|
43
|
+
constructor(options: ProjectOptions) {
|
|
44
|
+
super({
|
|
45
|
+
...options,
|
|
46
|
+
gitIgnoreOptions: getGitIgnoreOptions(options),
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
// Clean up tasks not required at top-level.
|
|
50
|
+
this.tasks.removeTask('build')
|
|
51
|
+
this.tasks.removeTask('compile')
|
|
52
|
+
this.tasks.removeTask('eject')
|
|
53
|
+
this.tasks.removeTask('package')
|
|
54
|
+
this.tasks.removeTask('post-compile')
|
|
55
|
+
this.tasks.removeTask('pre-compile')
|
|
56
|
+
this.tasks.removeTask('watch')
|
|
57
|
+
|
|
58
|
+
this.#configureBeachball(options)
|
|
59
|
+
this.#configureDefaultTask()
|
|
60
|
+
this.#configureLintSynthesized(options)
|
|
61
|
+
this.#createPnpmWorkspaces(options)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
#configureBeachball({ beachballConfig }: ProjectOptions) {
|
|
65
|
+
if (!beachballConfig) {
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const options = deepMerge(beachballConfig, {
|
|
70
|
+
branch: 'origin/main',
|
|
71
|
+
gitTags: false,
|
|
72
|
+
ignorePatterns: [
|
|
73
|
+
'*.test.*',
|
|
74
|
+
'.*/**',
|
|
75
|
+
'__snapshots__/',
|
|
76
|
+
'dist/',
|
|
77
|
+
'node_modules/',
|
|
78
|
+
],
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const file = new TextFile(this, 'beachball.config.js', {
|
|
82
|
+
readonly: true,
|
|
83
|
+
marker: true,
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
for (const line of [
|
|
87
|
+
`/** @type {import('beachball').BeachballConfig} */`,
|
|
88
|
+
`module.exports = ${JSON.stringify(options, null, 2)}`,
|
|
89
|
+
]) {
|
|
90
|
+
file.addLine(line)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
#configureDefaultTask() {
|
|
95
|
+
this.tasks
|
|
96
|
+
.tryFind('default')
|
|
97
|
+
?.exec(`node --loader ts-node/esm .projenrc.mts`)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
#configureLintSynthesized({ lintSynthesizedOptions }: ProjectOptions) {
|
|
101
|
+
new LintSynthesized(
|
|
102
|
+
this,
|
|
103
|
+
lintSynthesizedOptions ?? {
|
|
104
|
+
'*.{js,jsx,ts,tsx}': 'pnpm eslint --fix',
|
|
105
|
+
'*': 'pnpm prettier --write --ignore-unknown',
|
|
106
|
+
},
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
#createPnpmWorkspaces({ workspaces }: ProjectOptions) {
|
|
111
|
+
if (!workspaces) {
|
|
112
|
+
return
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
new YamlFile(this, 'pnpm-workspace.yaml', {
|
|
116
|
+
readonly: true,
|
|
117
|
+
marker: true,
|
|
118
|
+
obj: {
|
|
119
|
+
packages: workspaces,
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const getGitIgnoreOptions = ({
|
|
126
|
+
withTerraform,
|
|
127
|
+
withTypeScript,
|
|
128
|
+
...options
|
|
129
|
+
}: ProjectOptions): ProjectOptions['gitIgnoreOptions'] => ({
|
|
130
|
+
...options.gitIgnoreOptions,
|
|
131
|
+
ignorePatterns: [
|
|
132
|
+
...`
|
|
133
|
+
.*
|
|
134
|
+
!.babelrc
|
|
135
|
+
!.dockerignore
|
|
136
|
+
!.editorconfig
|
|
137
|
+
!.eslintignore
|
|
138
|
+
!.eslintrc.js
|
|
139
|
+
!.gitattributes
|
|
140
|
+
!.gitignore
|
|
141
|
+
!.gitkeep
|
|
142
|
+
!.husky
|
|
143
|
+
!.npmignore
|
|
144
|
+
!.openssl
|
|
145
|
+
!.prettierignore
|
|
146
|
+
!.projenrc*
|
|
147
|
+
${withTerraform ? '!.terraform.lock.hcl' : ''}
|
|
148
|
+
*.db
|
|
149
|
+
*.log
|
|
150
|
+
${withTypeScript ? '*.tsbuildinfo' : ''}
|
|
151
|
+
|
|
152
|
+
!.github/
|
|
153
|
+
!.husky/
|
|
154
|
+
!.projen/
|
|
155
|
+
dist/
|
|
156
|
+
local/
|
|
157
|
+
node_modules/
|
|
158
|
+
`
|
|
159
|
+
.split('\n')
|
|
160
|
+
.map((pattern) => pattern.trim())
|
|
161
|
+
.filter((pattern) => pattern.length > 0),
|
|
162
|
+
...(options.gitIgnoreOptions?.ignorePatterns ?? []),
|
|
163
|
+
],
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
const deepMerge = R.mergeDeepWith(R.concat)
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "@langri-sha/tsconfig/project.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"baseUrl": ".",
|
|
6
|
+
"outDir": ".tsbuild"
|
|
7
|
+
},
|
|
8
|
+
"references": [
|
|
9
|
+
{ "path": "../jest-test" },
|
|
10
|
+
{ "path": "../projen-lint-synthesized" },
|
|
11
|
+
{ "path": "../tsconfig" }
|
|
12
|
+
]
|
|
13
|
+
}
|