@langri-sha/projen-project 0.2.0 → 0.3.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 +16 -1
- package/CHANGELOG.md +10 -2
- package/package.json +3 -2
- package/src/__snapshots__/index.test.ts.snap +78 -0
- package/src/index.test.ts +9 -0
- package/src/index.ts +33 -0
- package/tsconfig.json +1 -0
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
"name": "@langri-sha/projen-project",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Wed, 01 May 2024 23:11:10 GMT",
|
|
6
|
+
"version": "0.3.0",
|
|
7
|
+
"tag": "@langri-sha/projen-project_v0.3.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "filip.dupanovic@gmail.com",
|
|
12
|
+
"package": "@langri-sha/projen-project",
|
|
13
|
+
"commit": "71b1eccec703fc7903cea5182a198e66f5c765ce",
|
|
14
|
+
"comment": "feat(project): Add EditorConfig support"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Tue, 30 Apr 2024 23:02:33 GMT",
|
|
6
21
|
"version": "0.2.0",
|
|
7
22
|
"tag": "@langri-sha/projen-project_v0.2.0",
|
|
8
23
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Change Log - @langri-sha/projen-project
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 01 May 2024 23:11:10 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.3.0
|
|
8
|
+
|
|
9
|
+
Wed, 01 May 2024 23:11:10 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- feat(project): Add EditorConfig support (filip.dupanovic@gmail.com)
|
|
14
|
+
|
|
7
15
|
## 0.2.0
|
|
8
16
|
|
|
9
|
-
Tue, 30 Apr 2024 23:02:
|
|
17
|
+
Tue, 30 Apr 2024 23:02:33 GMT
|
|
10
18
|
|
|
11
19
|
### Minor changes
|
|
12
20
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langri-sha/projen-project",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@langri-sha/projen-
|
|
8
|
+
"@langri-sha/projen-editorconfig": "0.2.0",
|
|
9
|
+
"@langri-sha/projen-lint-synthesized": "0.1.1",
|
|
9
10
|
"beachball": "2.43.1",
|
|
10
11
|
"ramda": "0.29.1"
|
|
11
12
|
},
|
|
@@ -136,6 +136,84 @@ module.exports = {
|
|
|
136
136
|
}
|
|
137
137
|
`;
|
|
138
138
|
|
|
139
|
+
exports[`with EditorConfig options 1`] = `
|
|
140
|
+
{
|
|
141
|
+
".editorconfig": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
|
|
142
|
+
|
|
143
|
+
root=true
|
|
144
|
+
|
|
145
|
+
[*]
|
|
146
|
+
charset=utf-8
|
|
147
|
+
end_of_line=lf
|
|
148
|
+
indent_style=space
|
|
149
|
+
indent_size=2
|
|
150
|
+
insert_final_newline=true
|
|
151
|
+
trim_trailing_whitespace=true
|
|
152
|
+
|
|
153
|
+
[Dockerfile]
|
|
154
|
+
indent_style=tab
|
|
155
|
+
",
|
|
156
|
+
".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
|
|
157
|
+
.*
|
|
158
|
+
!.babelrc
|
|
159
|
+
!.dockerignore
|
|
160
|
+
!.editorconfig
|
|
161
|
+
!.eslintignore
|
|
162
|
+
!.eslintrc.js
|
|
163
|
+
!.gitattributes
|
|
164
|
+
!.gitignore
|
|
165
|
+
!.gitkeep
|
|
166
|
+
!.husky
|
|
167
|
+
!.npmignore
|
|
168
|
+
!.openssl
|
|
169
|
+
!.prettierignore
|
|
170
|
+
!.projenrc*
|
|
171
|
+
*.db
|
|
172
|
+
*.log
|
|
173
|
+
!.github/
|
|
174
|
+
!.husky/
|
|
175
|
+
!.projen/
|
|
176
|
+
dist/
|
|
177
|
+
local/
|
|
178
|
+
node_modules/
|
|
179
|
+
!/.gitattributes
|
|
180
|
+
!/.projen/tasks.json
|
|
181
|
+
!/.projen/deps.json
|
|
182
|
+
!/.projen/files.json
|
|
183
|
+
!/.editorconfig
|
|
184
|
+
",
|
|
185
|
+
".projen/files.json": {
|
|
186
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".",
|
|
187
|
+
"files": [
|
|
188
|
+
".editorconfig",
|
|
189
|
+
".gitattributes",
|
|
190
|
+
".gitignore",
|
|
191
|
+
".projen/deps.json",
|
|
192
|
+
".projen/files.json",
|
|
193
|
+
".projen/tasks.json",
|
|
194
|
+
],
|
|
195
|
+
},
|
|
196
|
+
".projen/tasks.json": {
|
|
197
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".",
|
|
198
|
+
"tasks": {
|
|
199
|
+
"default": {
|
|
200
|
+
"description": "Synthesize project files",
|
|
201
|
+
"name": "default",
|
|
202
|
+
"steps": [
|
|
203
|
+
{
|
|
204
|
+
"exec": "node --loader ts-node/esm .projenrc.mts",
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
},
|
|
208
|
+
"test": {
|
|
209
|
+
"description": "Run tests",
|
|
210
|
+
"name": "test",
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
}
|
|
215
|
+
`;
|
|
216
|
+
|
|
139
217
|
exports[`with Terraform enabled 1`] = `
|
|
140
218
|
{
|
|
141
219
|
".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
|
package/src/index.test.ts
CHANGED
|
@@ -20,6 +20,15 @@ test('with Beachball configuration', () => {
|
|
|
20
20
|
expect(synthSnapshot(project)).toMatchSnapshot()
|
|
21
21
|
})
|
|
22
22
|
|
|
23
|
+
test('with EditorConfig options', () => {
|
|
24
|
+
const project = new Project({
|
|
25
|
+
name: 'test-project',
|
|
26
|
+
editorConfigOptions: {},
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
expect(synthSnapshot(project)).toMatchSnapshot()
|
|
30
|
+
})
|
|
31
|
+
|
|
23
32
|
test('with Terraform enabled', () => {
|
|
24
33
|
const project = new Project({
|
|
25
34
|
name: 'test-project',
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,10 @@ import {
|
|
|
12
12
|
LintSynthesized,
|
|
13
13
|
type LintSynthesizedOptions,
|
|
14
14
|
} from '@langri-sha/projen-lint-synthesized'
|
|
15
|
+
import {
|
|
16
|
+
EditorConfig,
|
|
17
|
+
type EditorConfigOptions,
|
|
18
|
+
} from '@langri-sha/projen-editorconfig'
|
|
15
19
|
|
|
16
20
|
export interface ProjectOptions extends BaseProjectOptions {
|
|
17
21
|
/*
|
|
@@ -19,6 +23,11 @@ export interface ProjectOptions extends BaseProjectOptions {
|
|
|
19
23
|
*/
|
|
20
24
|
beachballConfig?: BeachballConfig
|
|
21
25
|
|
|
26
|
+
/**
|
|
27
|
+
* EditorConfig options.
|
|
28
|
+
*/
|
|
29
|
+
editorConfigOptions?: EditorConfigOptions
|
|
30
|
+
|
|
22
31
|
/*
|
|
23
32
|
* Options for the linting synthesized files.
|
|
24
33
|
*/
|
|
@@ -57,6 +66,7 @@ export class Project extends BaseProject {
|
|
|
57
66
|
|
|
58
67
|
this.#configureBeachball(options)
|
|
59
68
|
this.#configureDefaultTask()
|
|
69
|
+
this.#configureEditorConfig(options)
|
|
60
70
|
this.#configureLintSynthesized(options)
|
|
61
71
|
this.#createPnpmWorkspaces(options)
|
|
62
72
|
}
|
|
@@ -107,6 +117,29 @@ export class Project extends BaseProject {
|
|
|
107
117
|
)
|
|
108
118
|
}
|
|
109
119
|
|
|
120
|
+
#configureEditorConfig({ editorConfigOptions }: ProjectOptions) {
|
|
121
|
+
if (!editorConfigOptions) {
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const defaults: EditorConfigOptions = {
|
|
126
|
+
'*': {
|
|
127
|
+
// eslint-disable-next-line unicorn/text-encoding-identifier-case
|
|
128
|
+
charset: 'utf-8',
|
|
129
|
+
end_of_line: 'lf',
|
|
130
|
+
indent_style: 'space',
|
|
131
|
+
indent_size: 2,
|
|
132
|
+
insert_final_newline: true,
|
|
133
|
+
trim_trailing_whitespace: true,
|
|
134
|
+
},
|
|
135
|
+
Dockerfile: {
|
|
136
|
+
indent_style: 'tab',
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
new EditorConfig(this, deepMerge(editorConfigOptions ?? {}, defaults))
|
|
141
|
+
}
|
|
142
|
+
|
|
110
143
|
#createPnpmWorkspaces({ workspaces }: ProjectOptions) {
|
|
111
144
|
if (!workspaces) {
|
|
112
145
|
return
|