@langri-sha/projen-project 0.6.1 → 0.8.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 +107 -1
- package/CHANGELOG.md +36 -2
- package/lib/index.d.ts +34 -8
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +139 -39
- package/lib/index.js.map +1 -1
- package/lib/lib/index.d.ts +2 -0
- package/lib/lib/index.d.ts.map +1 -0
- package/lib/lib/index.js +2 -0
- package/lib/lib/index.js.map +1 -0
- package/lib/lib/projenrc.d.ts +13 -0
- package/lib/lib/projenrc.d.ts.map +1 -0
- package/lib/lib/projenrc.js +17 -0
- package/lib/lib/projenrc.js.map +1 -0
- package/package.json +9 -8
- package/src/index.ts +201 -48
- package/src/lib/index.ts +1 -0
- package/src/lib/projenrc.ts +34 -0
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,113 @@
|
|
|
2
2
|
"name": "@langri-sha/projen-project",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Tue,
|
|
5
|
+
"date": "Tue, 21 May 2024 05:21:31 GMT",
|
|
6
|
+
"version": "0.8.0",
|
|
7
|
+
"tag": "@langri-sha/projen-project_v0.8.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "email not defined",
|
|
12
|
+
"package": "@langri-sha/projen-project",
|
|
13
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
14
|
+
"comment": "chore(deps): chore(deps): update dependency projen to v0.81.13"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "email not defined",
|
|
18
|
+
"package": "@langri-sha/projen-project",
|
|
19
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
20
|
+
"comment": "chore(deps): chore(deps): update dependency projen to v0.81.15"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "filip.dupanovic@gmail.com",
|
|
24
|
+
"package": "@langri-sha/projen-project",
|
|
25
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
26
|
+
"comment": "fix(project): Transpile sources only for default task"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "filip.dupanovic@gmail.com",
|
|
30
|
+
"package": "@langri-sha/projen-project",
|
|
31
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
32
|
+
"comment": "fix(project): Correct Renovate dependency matching"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "filip.dupanovic@gmail.com",
|
|
36
|
+
"package": "@langri-sha/projen-project",
|
|
37
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
38
|
+
"comment": "fix(projen-project): Lint only package modules"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "filip.dupanovic@gmail.com",
|
|
42
|
+
"package": "@langri-sha/projen-project",
|
|
43
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
44
|
+
"comment": "fix(project): Add looser dependency matching"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"minor": [
|
|
48
|
+
{
|
|
49
|
+
"author": "filip.dupanovic@gmail.com",
|
|
50
|
+
"package": "@langri-sha/projen-project",
|
|
51
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
52
|
+
"comment": "feat(projen): Add component for Beacbhall support"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"author": "filip.dupanovic@gmail.com",
|
|
56
|
+
"package": "@langri-sha/projen-project",
|
|
57
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
58
|
+
"comment": "feat(project): Add stub projen configuration file"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"author": "filip.dupanovic@gmail.com",
|
|
62
|
+
"package": "@langri-sha/projen-project",
|
|
63
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
64
|
+
"comment": "feat(project): Upgrade PNPM with Renovate"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"author": "filip.dupanovic@gmail.com",
|
|
68
|
+
"package": "@langri-sha/projen-project",
|
|
69
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
70
|
+
"comment": "feat(project): Add support for Node.js packages"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"author": "filip.dupanovic@gmail.com",
|
|
74
|
+
"package": "@langri-sha/projen-project",
|
|
75
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
76
|
+
"comment": "feat(project): Match deps in modules with Renovate"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"author": "filip.dupanovic@gmail.com",
|
|
80
|
+
"package": "@langri-sha/projen-project",
|
|
81
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
82
|
+
"comment": "feat(project): Add support for subprojects"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"date": "Wed, 15 May 2024 06:47:18 GMT",
|
|
89
|
+
"version": "0.7.0",
|
|
90
|
+
"tag": "@langri-sha/projen-project_v0.7.0",
|
|
91
|
+
"comments": {
|
|
92
|
+
"patch": [
|
|
93
|
+
{
|
|
94
|
+
"author": "email not defined",
|
|
95
|
+
"package": "@langri-sha/projen-project",
|
|
96
|
+
"commit": "92c7d4c9ac50342a39af3fc029307a2899f0ae34",
|
|
97
|
+
"comment": "chore(deps): chore(deps): update dependency projen to v0.81.11"
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"minor": [
|
|
101
|
+
{
|
|
102
|
+
"author": "filip.dupanovic@gmail.com",
|
|
103
|
+
"package": "@langri-sha/projen-project",
|
|
104
|
+
"commit": "92c7d4c9ac50342a39af3fc029307a2899f0ae34",
|
|
105
|
+
"comment": "feat(projen-project): Add support for configuring TypeScript\""
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"date": "Tue, 14 May 2024 20:41:06 GMT",
|
|
6
112
|
"version": "0.6.1",
|
|
7
113
|
"tag": "@langri-sha/projen-project_v0.6.1",
|
|
8
114
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,46 @@
|
|
|
1
1
|
# Change Log - @langri-sha/projen-project
|
|
2
2
|
|
|
3
|
-
This log was last generated on Tue,
|
|
3
|
+
This log was last generated on Tue, 21 May 2024 05:21:31 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.8.0
|
|
8
|
+
|
|
9
|
+
Tue, 21 May 2024 05:21:31 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- feat(projen): Add component for Beacbhall support (filip.dupanovic@gmail.com)
|
|
14
|
+
- feat(project): Add stub projen configuration file (filip.dupanovic@gmail.com)
|
|
15
|
+
- feat(project): Upgrade PNPM with Renovate (filip.dupanovic@gmail.com)
|
|
16
|
+
- feat(project): Add support for Node.js packages (filip.dupanovic@gmail.com)
|
|
17
|
+
- feat(project): Match deps in modules with Renovate (filip.dupanovic@gmail.com)
|
|
18
|
+
- feat(project): Add support for subprojects (filip.dupanovic@gmail.com)
|
|
19
|
+
|
|
20
|
+
### Patches
|
|
21
|
+
|
|
22
|
+
- chore(deps): chore(deps): update dependency projen to v0.81.13 (email not defined)
|
|
23
|
+
- chore(deps): chore(deps): update dependency projen to v0.81.15 (email not defined)
|
|
24
|
+
- fix(project): Transpile sources only for default task (filip.dupanovic@gmail.com)
|
|
25
|
+
- fix(project): Correct Renovate dependency matching (filip.dupanovic@gmail.com)
|
|
26
|
+
- fix(projen-project): Lint only package modules (filip.dupanovic@gmail.com)
|
|
27
|
+
- fix(project): Add looser dependency matching (filip.dupanovic@gmail.com)
|
|
28
|
+
|
|
29
|
+
## 0.7.0
|
|
30
|
+
|
|
31
|
+
Wed, 15 May 2024 06:47:18 GMT
|
|
32
|
+
|
|
33
|
+
### Minor changes
|
|
34
|
+
|
|
35
|
+
- feat(projen-project): Add support for configuring TypeScript" (filip.dupanovic@gmail.com)
|
|
36
|
+
|
|
37
|
+
### Patches
|
|
38
|
+
|
|
39
|
+
- chore(deps): chore(deps): update dependency projen to v0.81.11 (email not defined)
|
|
40
|
+
|
|
7
41
|
## 0.6.1
|
|
8
42
|
|
|
9
|
-
Tue, 14 May 2024 20:
|
|
43
|
+
Tue, 14 May 2024 20:41:06 GMT
|
|
10
44
|
|
|
11
45
|
### Patches
|
|
12
46
|
|
package/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { Project as BaseProject, type ProjectOptions as BaseProjectOptions } from 'projen';
|
|
2
|
-
import { type BeachballConfig } from 'beachball';
|
|
1
|
+
import { Project as BaseProject, type ProjectOptions as BaseProjectOptions, javascript } from 'projen';
|
|
3
2
|
import { type LintSynthesizedOptions } from '@langri-sha/projen-lint-synthesized';
|
|
4
|
-
import { type EditorConfigOptions } from '@langri-sha/projen-editorconfig';
|
|
5
|
-
import { type CodeownersOptions } from '@langri-sha/projen-codeowners';
|
|
6
|
-
import { type RenovateOptions } from '@langri-sha/projen-renovate';
|
|
7
|
-
import { type HuskyOptions } from '@langri-sha/projen-husky';
|
|
3
|
+
import { EditorConfig, type EditorConfigOptions } from '@langri-sha/projen-editorconfig';
|
|
4
|
+
import { Codeowners, type CodeownersOptions } from '@langri-sha/projen-codeowners';
|
|
5
|
+
import { Renovate, type RenovateOptions } from '@langri-sha/projen-renovate';
|
|
6
|
+
import { Husky, type HuskyOptions } from '@langri-sha/projen-husky';
|
|
7
|
+
import { TypeScriptConfig, type TypeScriptConfigOptions } from '@langri-sha/projen-typescript-config';
|
|
8
|
+
import { Beachball, BeachballOptions } from '@langri-sha/projen-beachball';
|
|
9
|
+
import { ProjenrcFile } from './lib/index.js';
|
|
10
|
+
export * from '@langri-sha/projen-typescript-config';
|
|
8
11
|
export interface ProjectOptions extends Omit<BaseProjectOptions, 'renovatebot' | 'renovatebotOptions'> {
|
|
9
|
-
|
|
12
|
+
beachballOptions?: BeachballOptions;
|
|
10
13
|
codeownersOptions?: CodeownersOptions;
|
|
11
14
|
/**
|
|
12
15
|
* EditorConfig options.
|
|
@@ -18,12 +21,35 @@ export interface ProjectOptions extends Omit<BaseProjectOptions, 'renovatebot' |
|
|
|
18
21
|
huskyOptions?: HuskyOptions;
|
|
19
22
|
renovateOptions?: RenovateOptions;
|
|
20
23
|
lintSynthesizedOptions?: LintSynthesizedOptions;
|
|
24
|
+
/**
|
|
25
|
+
* Package configuration options.
|
|
26
|
+
*/
|
|
27
|
+
package?: javascript.NodePackageOptions;
|
|
28
|
+
/**
|
|
29
|
+
* TypeScript configuration options.
|
|
30
|
+
*/
|
|
31
|
+
typeScriptConfigOptions?: TypeScriptConfigOptions;
|
|
21
32
|
withTerraform?: boolean;
|
|
22
|
-
withTypeScript?: boolean;
|
|
23
33
|
workspaces?: string[];
|
|
24
34
|
}
|
|
25
35
|
export declare class Project extends BaseProject {
|
|
26
36
|
#private;
|
|
37
|
+
beachball?: Beachball;
|
|
38
|
+
codeowners?: Codeowners;
|
|
39
|
+
editorConfig?: EditorConfig;
|
|
40
|
+
husky?: Husky;
|
|
41
|
+
package?: javascript.NodePackage;
|
|
42
|
+
projenrc?: ProjenrcFile;
|
|
43
|
+
renovate?: Renovate;
|
|
44
|
+
typeScriptConfig?: TypeScriptConfig;
|
|
27
45
|
constructor(options: ProjectOptions);
|
|
46
|
+
/**
|
|
47
|
+
* Add a subproject.
|
|
48
|
+
*/
|
|
49
|
+
addSubproject(projectOptions: ProjectOptions): Project;
|
|
50
|
+
/**
|
|
51
|
+
* Find a project by it's name, e.g. `@acme/some`.
|
|
52
|
+
*/
|
|
53
|
+
findSubproject(name: string): Project;
|
|
28
54
|
}
|
|
29
55
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,KAAK,cAAc,IAAI,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,KAAK,cAAc,IAAI,kBAAkB,EAEzC,UAAU,EACX,MAAM,QAAQ,CAAA;AAIf,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACzB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,UAAU,EACV,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC5E,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,EAC7B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,cAAc,sCAAsC,CAAA;AAEpD,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,aAAa,GAAG,oBAAoB,CAAC;IAItE,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IAKnC,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IAErC;;OAEG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;IAEzC;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,CAAA;IAK3B,eAAe,CAAC,EAAE,eAAe,CAAA;IAKjC,sBAAsB,CAAC,EAAE,sBAAsB,CAAA;IAE/C;;OAEG;IACH,OAAO,CAAC,EAAE,UAAU,CAAC,kBAAkB,CAAA;IAEvC;;OAEG;IACH,uBAAuB,CAAC,EAAE,uBAAuB,CAAA;IAKjD,aAAa,CAAC,EAAE,OAAO,CAAA;IAKvB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB;AAED,qBAAa,OAAQ,SAAQ,WAAW;;IACtC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,OAAO,CAAC,EAAE,UAAU,CAAC,WAAW,CAAA;IAChC,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;gBAEvB,OAAO,EAAE,cAAc;IAiCnC;;OAEG;IACH,aAAa,CAAC,cAAc,EAAE,cAAc;IAO5C;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CA2NtC"}
|
package/lib/index.js
CHANGED
|
@@ -3,14 +3,18 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _Project_instances, _Project_configureBeachball, _Project_configureCodeowners,
|
|
7
|
-
import { Project as BaseProject,
|
|
6
|
+
var _Project_instances, _Project_configureBeachball, _Project_configureCodeowners, _Project_configureEditorConfig, _Project_configureHusky, _Project_configureLintSynthesized, _Project_configurePackage, _Project_configureProjenrc, _Project_configureRenovate, _Project_configureTypeScript, _Project_createPnpmWorkspaces;
|
|
7
|
+
import { Project as BaseProject, YamlFile, javascript, } from 'projen';
|
|
8
8
|
import * as R from 'ramda';
|
|
9
9
|
import { LintSynthesized, } from '@langri-sha/projen-lint-synthesized';
|
|
10
10
|
import { EditorConfig, } from '@langri-sha/projen-editorconfig';
|
|
11
11
|
import { Codeowners, } from '@langri-sha/projen-codeowners';
|
|
12
12
|
import { Renovate } from '@langri-sha/projen-renovate';
|
|
13
13
|
import { Husky } from '@langri-sha/projen-husky';
|
|
14
|
+
import { TypeScriptConfig, } from '@langri-sha/projen-typescript-config';
|
|
15
|
+
import { Beachball } from '@langri-sha/projen-beachball';
|
|
16
|
+
import { ProjenrcFile } from './lib/index.js';
|
|
17
|
+
export * from '@langri-sha/projen-typescript-config';
|
|
14
18
|
export class Project extends BaseProject {
|
|
15
19
|
constructor(options) {
|
|
16
20
|
super({
|
|
@@ -26,21 +30,56 @@ export class Project extends BaseProject {
|
|
|
26
30
|
this.tasks.removeTask('post-compile');
|
|
27
31
|
this.tasks.removeTask('pre-compile');
|
|
28
32
|
this.tasks.removeTask('watch');
|
|
33
|
+
if (!this.parent) {
|
|
34
|
+
this.tasks.removeTask('install');
|
|
35
|
+
this.tasks.removeTask('install:ci');
|
|
36
|
+
}
|
|
37
|
+
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configurePackage).call(this, options);
|
|
38
|
+
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureTypeScript).call(this, options);
|
|
29
39
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureBeachball).call(this, options);
|
|
30
40
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureCodeowners).call(this, options);
|
|
31
|
-
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureDefaultTask).call(this);
|
|
32
41
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureEditorConfig).call(this, options);
|
|
33
42
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureHusky).call(this, options);
|
|
34
43
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureLintSynthesized).call(this, options);
|
|
44
|
+
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureProjenrc).call(this);
|
|
35
45
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureRenovate).call(this, options);
|
|
36
46
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_createPnpmWorkspaces).call(this, options);
|
|
37
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Add a subproject.
|
|
50
|
+
*/
|
|
51
|
+
addSubproject(projectOptions) {
|
|
52
|
+
return new Project({
|
|
53
|
+
parent: this,
|
|
54
|
+
...projectOptions,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Find a project by it's name, e.g. `@acme/some`.
|
|
59
|
+
*/
|
|
60
|
+
findSubproject(name) {
|
|
61
|
+
const subprojects = [];
|
|
62
|
+
const addSubproject = (project) => {
|
|
63
|
+
for (const subproject of project.subprojects) {
|
|
64
|
+
subprojects.push(subproject);
|
|
65
|
+
if (subproject.subprojects.length) {
|
|
66
|
+
addSubproject(subproject);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
addSubproject(this.root);
|
|
71
|
+
const result = subprojects.find((subproject) => subproject.name === name);
|
|
72
|
+
if (result instanceof Project) {
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
throw new Error(`Cannot find subproject ${name}`);
|
|
76
|
+
}
|
|
38
77
|
}
|
|
39
|
-
_Project_instances = new WeakSet(), _Project_configureBeachball = function _Project_configureBeachball({
|
|
40
|
-
if (!
|
|
78
|
+
_Project_instances = new WeakSet(), _Project_configureBeachball = function _Project_configureBeachball({ beachballOptions }) {
|
|
79
|
+
if (!beachballOptions || this.parent) {
|
|
41
80
|
return;
|
|
42
81
|
}
|
|
43
|
-
const options = deepMerge(
|
|
82
|
+
const options = deepMerge(beachballOptions, {
|
|
44
83
|
branch: 'origin/main',
|
|
45
84
|
gitTags: false,
|
|
46
85
|
ignorePatterns: [
|
|
@@ -51,27 +90,16 @@ _Project_instances = new WeakSet(), _Project_configureBeachball = function _Proj
|
|
|
51
90
|
'node_modules/',
|
|
52
91
|
],
|
|
53
92
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
for (const line of [
|
|
59
|
-
`/** @type {import('beachball').BeachballConfig} */`,
|
|
60
|
-
`module.exports = ${JSON.stringify(options, null, 2)}`,
|
|
61
|
-
]) {
|
|
62
|
-
file.addLine(line);
|
|
63
|
-
}
|
|
93
|
+
this.beachball = new Beachball(this, options);
|
|
94
|
+
this.package?.addDevDeps('beachball@2.43.1');
|
|
95
|
+
this.typeScriptConfig?.addFile('beachball.config.js');
|
|
64
96
|
}, _Project_configureCodeowners = function _Project_configureCodeowners({ codeownersOptions }) {
|
|
65
97
|
if (!codeownersOptions) {
|
|
66
98
|
return;
|
|
67
99
|
}
|
|
68
|
-
new Codeowners(this, codeownersOptions);
|
|
69
|
-
}, _Project_configureDefaultTask = function _Project_configureDefaultTask() {
|
|
70
|
-
this.tasks
|
|
71
|
-
.tryFind('default')
|
|
72
|
-
?.exec(`node --loader ts-node/esm .projenrc.mts`);
|
|
100
|
+
this.codeowners = new Codeowners(this, codeownersOptions);
|
|
73
101
|
}, _Project_configureEditorConfig = function _Project_configureEditorConfig({ editorConfigOptions }) {
|
|
74
|
-
if (!editorConfigOptions) {
|
|
102
|
+
if (!editorConfigOptions || this.parent) {
|
|
75
103
|
return;
|
|
76
104
|
}
|
|
77
105
|
const defaults = {
|
|
@@ -87,19 +115,47 @@ _Project_instances = new WeakSet(), _Project_configureBeachball = function _Proj
|
|
|
87
115
|
indent_style: 'tab',
|
|
88
116
|
},
|
|
89
117
|
};
|
|
90
|
-
new EditorConfig(this, deepMerge(editorConfigOptions ?? {}, defaults));
|
|
118
|
+
this.editorConfig = new EditorConfig(this, deepMerge(editorConfigOptions ?? {}, defaults));
|
|
91
119
|
}, _Project_configureHusky = function _Project_configureHusky({ huskyOptions }) {
|
|
92
|
-
if (!huskyOptions) {
|
|
120
|
+
if (!huskyOptions || this.parent) {
|
|
93
121
|
return;
|
|
94
122
|
}
|
|
95
|
-
new Husky(this, huskyOptions);
|
|
123
|
+
this.husky = new Husky(this, huskyOptions);
|
|
124
|
+
this.package?.addDevDeps('husky@9.0.11');
|
|
125
|
+
this.package?.setScript('prepare', 'husky');
|
|
126
|
+
this.tryFindObjectFile('package.json')?.addDeletionOverride('pnpm');
|
|
96
127
|
}, _Project_configureLintSynthesized = function _Project_configureLintSynthesized({ lintSynthesizedOptions }) {
|
|
97
128
|
new LintSynthesized(this, lintSynthesizedOptions ?? {
|
|
129
|
+
'package.json': 'pnpx sort-package-json',
|
|
98
130
|
'*.{js,jsx,ts,tsx}': 'pnpm eslint --fix',
|
|
99
131
|
'*': 'pnpm prettier --write --ignore-unknown',
|
|
100
132
|
});
|
|
133
|
+
}, _Project_configurePackage = function _Project_configurePackage({ package: pkg }) {
|
|
134
|
+
if (!pkg) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const defaults = {
|
|
138
|
+
entrypoint: 'src/index.ts',
|
|
139
|
+
packageManager: javascript.NodePackageManager.PNPM,
|
|
140
|
+
minNodeVersion: '20.12.0',
|
|
141
|
+
};
|
|
142
|
+
this.package = new javascript.NodePackage(this, deepMerge(defaults, pkg));
|
|
143
|
+
if (!this.parent) {
|
|
144
|
+
this.package.addDevDeps('@langri-sha/projen-project@*');
|
|
145
|
+
this.package.addDevDeps('projen@0.81.15');
|
|
146
|
+
}
|
|
147
|
+
this.package.removeScript('start');
|
|
148
|
+
this.package.removeScript('test');
|
|
149
|
+
if (this.parent) {
|
|
150
|
+
this.package.removeScript('default');
|
|
151
|
+
}
|
|
152
|
+
}, _Project_configureProjenrc = function _Project_configureProjenrc() {
|
|
153
|
+
if (this.parent) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.projenrc = new ProjenrcFile(this, {});
|
|
101
157
|
}, _Project_configureRenovate = function _Project_configureRenovate({ renovateOptions }) {
|
|
102
|
-
if (!renovateOptions) {
|
|
158
|
+
if (!renovateOptions || this.parent) {
|
|
103
159
|
return;
|
|
104
160
|
}
|
|
105
161
|
const defaults = {
|
|
@@ -107,8 +163,52 @@ _Project_instances = new WeakSet(), _Project_configureBeachball = function _Proj
|
|
|
107
163
|
extends: ['config:recommended'],
|
|
108
164
|
labels: ['dependencies'],
|
|
109
165
|
reviewersFromCodeOwners: true,
|
|
166
|
+
customManagers: [
|
|
167
|
+
{
|
|
168
|
+
customType: 'regex',
|
|
169
|
+
datasourceTemplate: 'npm',
|
|
170
|
+
fileMatch: ['\\.?projen.*.(js|cjs|mjs|ts|mts|cts)$'],
|
|
171
|
+
matchStrings: [
|
|
172
|
+
"\\.(?<depType>addDep|addDevDep|addPeerDep)\\('(?<depName>[a-zA-Z0-9-]+)@(?<currentValue>[^']+)'\\)",
|
|
173
|
+
],
|
|
174
|
+
depTypeTemplate: "{{#if (equals depType 'addDevDep')}}devDependencies{{else if (equals depType 'addPeerDep')}}peerDependencies{{else}}dependencies{{/if}}",
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
customType: 'regex',
|
|
178
|
+
datasourceTemplate: 'npm',
|
|
179
|
+
fileMatch: ['\\.?projen.*.(js|cjs|mjs|ts|mts|cts)$'],
|
|
180
|
+
matchStrings: ["pnpm@(?<currentValue>[^']+)"],
|
|
181
|
+
depNameTemplate: 'pnpm',
|
|
182
|
+
depTypeTemplate: 'dependencies',
|
|
183
|
+
},
|
|
184
|
+
],
|
|
110
185
|
};
|
|
111
|
-
new Renovate(this, deepMerge(defaults, renovateOptions));
|
|
186
|
+
this.renovate = new Renovate(this, deepMerge(defaults, renovateOptions));
|
|
187
|
+
}, _Project_configureTypeScript = function _Project_configureTypeScript({ parent, typeScriptConfigOptions }) {
|
|
188
|
+
if (!typeScriptConfigOptions) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const defaults = parent
|
|
192
|
+
? {
|
|
193
|
+
config: {
|
|
194
|
+
extends: '@langri-sha/tsconfig/project.json',
|
|
195
|
+
compilerOptions: {
|
|
196
|
+
baseUrl: '.',
|
|
197
|
+
outDir: '.tsbuild',
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
}
|
|
201
|
+
: {
|
|
202
|
+
config: {
|
|
203
|
+
extends: '@langri-sha/tsconfig',
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
this.typeScriptConfig = new TypeScriptConfig(this, deepMerge(defaults, typeScriptConfigOptions));
|
|
207
|
+
if (!this.parent) {
|
|
208
|
+
this.package?.addDevDeps('typescript@5.4.5');
|
|
209
|
+
this.package?.addDevDeps('ts-node@10.9.2');
|
|
210
|
+
}
|
|
211
|
+
this.package?.addDevDeps('@langri-sha/tsconfig@*');
|
|
112
212
|
}, _Project_createPnpmWorkspaces = function _Project_createPnpmWorkspaces({ workspaces }) {
|
|
113
213
|
if (!workspaces) {
|
|
114
214
|
return;
|
|
@@ -121,10 +221,11 @@ _Project_instances = new WeakSet(), _Project_configureBeachball = function _Proj
|
|
|
121
221
|
},
|
|
122
222
|
});
|
|
123
223
|
};
|
|
124
|
-
const getGitIgnoreOptions = ({ huskyOptions, withTerraform,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
224
|
+
const getGitIgnoreOptions = ({ huskyOptions, typeScriptConfigOptions, withTerraform, parent, gitIgnoreOptions, ...options }) => parent
|
|
225
|
+
? gitIgnoreOptions
|
|
226
|
+
: {
|
|
227
|
+
ignorePatterns: [
|
|
228
|
+
...`
|
|
128
229
|
.*
|
|
129
230
|
!.babelrc
|
|
130
231
|
!.dockerignore
|
|
@@ -135,11 +236,10 @@ const getGitIgnoreOptions = ({ huskyOptions, withTerraform, withTypeScript, ...o
|
|
|
135
236
|
!.npmignore
|
|
136
237
|
!.openssl
|
|
137
238
|
!.prettierignore
|
|
138
|
-
!.projenrc*
|
|
139
239
|
${withTerraform ? '!.terraform.lock.hcl' : ''}
|
|
140
240
|
*.db
|
|
141
241
|
*.log
|
|
142
|
-
${
|
|
242
|
+
${typeScriptConfigOptions ? '*.tsbuildinfo' : ''}
|
|
143
243
|
|
|
144
244
|
!.github/
|
|
145
245
|
${huskyOptions ? '!.husky/' : ''}
|
|
@@ -147,11 +247,11 @@ const getGitIgnoreOptions = ({ huskyOptions, withTerraform, withTypeScript, ...o
|
|
|
147
247
|
${options.workspaces?.map((workspace) => `${workspace}/lib/`).join('\n') ?? ''}
|
|
148
248
|
node_modules/
|
|
149
249
|
`
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
250
|
+
.split('\n')
|
|
251
|
+
.map((pattern) => pattern.trim())
|
|
252
|
+
.filter((pattern) => pattern.length > 0),
|
|
253
|
+
...(gitIgnoreOptions?.ignorePatterns ?? []),
|
|
254
|
+
],
|
|
255
|
+
};
|
|
156
256
|
const deepMerge = R.mergeDeepWith(R.concat);
|
|
157
257
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,OAAO,IAAI,WAAW,EAEtB,QAAQ,EACR,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,OAAO,IAAI,WAAW,EAEtB,QAAQ,EACR,UAAU,GACX,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,CAAC,MAAM,OAAO,CAAA;AAE1B,OAAO,EACL,eAAe,GAEhB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,YAAY,GAEb,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,UAAU,GAEX,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAwB,MAAM,6BAA6B,CAAA;AAC5E,OAAO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,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE;;;MAG9C,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;;MAE9B,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,SAAS,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;;KAE7E;iBACQ,KAAK,CAAC,IAAI,CAAC;iBACX,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;iBAChC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;YAC1C,GAAG,CAAC,gBAAgB,EAAE,cAAc,IAAI,EAAE,CAAC;SAC5C;KACF,CAAA;AAEP,MAAM,SAAS,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
package/lib/lib/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ProjenrcFile as BaseProjenrcFile, Project } from 'projen';
|
|
2
|
+
export interface ProjenrcOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The name of the projenrc file.
|
|
5
|
+
* @default ".projenrc.mts"
|
|
6
|
+
*/
|
|
7
|
+
readonly filename?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class ProjenrcFile extends BaseProjenrcFile {
|
|
10
|
+
readonly filePath: string;
|
|
11
|
+
constructor(project: Project, { filename }: ProjenrcOptions);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=projenrc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projenrc.d.ts","sourceRoot":"","sources":["../../src/lib/projenrc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,OAAO,EAAc,MAAM,QAAQ,CAAA;AAE9E,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,qBAAa,YAAa,SAAQ,gBAAgB;IAChD,SAAyB,QAAQ,EAAE,MAAM,CAAA;gBAGvC,OAAO,EAAE,OAAO,EAChB,EAAE,QAA0B,EAAE,EAAE,eAAe;CAkBlD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ProjenrcFile as BaseProjenrcFile, SampleFile } from 'projen';
|
|
2
|
+
export class ProjenrcFile extends BaseProjenrcFile {
|
|
3
|
+
constructor(project, { filename = '.projenrc.mts' }) {
|
|
4
|
+
super(project);
|
|
5
|
+
this.filePath = filename;
|
|
6
|
+
this.project.defaultTask?.exec(`node --loader ts-node/esm/transpile-only ${filename}`);
|
|
7
|
+
new SampleFile(project, filename, {
|
|
8
|
+
contents: `import { Project } from '@langri-sha/projen-project'
|
|
9
|
+
|
|
10
|
+
const project = new Project()
|
|
11
|
+
|
|
12
|
+
project.synth()
|
|
13
|
+
`,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=projenrc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projenrc.js","sourceRoot":"","sources":["../../src/lib/projenrc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAW,UAAU,EAAE,MAAM,QAAQ,CAAA;AAU9E,MAAM,OAAO,YAAa,SAAQ,gBAAgB;IAGhD,YACE,OAAgB,EAChB,EAAE,QAAQ,GAAG,eAAe,EAAmB;QAE/C,KAAK,CAAC,OAAO,CAAC,CAAA;QAEd,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAC5B,4CAA4C,QAAQ,EAAE,CACvD,CAAA;QAED,IAAI,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE;YAChC,QAAQ,EAAE;;;;;OAKT;SACF,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langri-sha/projen-project",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -8,19 +8,20 @@
|
|
|
8
8
|
"prepublishOnly": "rm -rf lib; tsc --project tsconfig.build.json"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@langri-sha/projen-
|
|
12
|
-
"@langri-sha/projen-
|
|
13
|
-
"@langri-sha/projen-
|
|
14
|
-
"@langri-sha/projen-
|
|
15
|
-
"@langri-sha/projen-
|
|
16
|
-
"
|
|
11
|
+
"@langri-sha/projen-beachball": "0.1.0",
|
|
12
|
+
"@langri-sha/projen-codeowners": "0.2.3",
|
|
13
|
+
"@langri-sha/projen-editorconfig": "0.3.4",
|
|
14
|
+
"@langri-sha/projen-husky": "0.1.3",
|
|
15
|
+
"@langri-sha/projen-lint-synthesized": "0.2.5",
|
|
16
|
+
"@langri-sha/projen-renovate": "0.2.3",
|
|
17
|
+
"@langri-sha/projen-typescript-config": "0.2.1",
|
|
17
18
|
"ramda": "0.30.0"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
21
|
"@langri-sha/jest-test": "0.7.1",
|
|
21
22
|
"@langri-sha/tsconfig": "0.9.0",
|
|
22
23
|
"@types/ramda": "0.30.0",
|
|
23
|
-
"projen": "0.81.
|
|
24
|
+
"projen": "0.81.15"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|
|
26
27
|
"projen": "^0.81.1",
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Project as BaseProject,
|
|
3
3
|
type ProjectOptions as BaseProjectOptions,
|
|
4
|
-
TextFile,
|
|
5
4
|
YamlFile,
|
|
5
|
+
javascript,
|
|
6
6
|
} from 'projen'
|
|
7
7
|
|
|
8
8
|
import * as R from 'ramda'
|
|
9
|
-
import { type BeachballConfig } from 'beachball'
|
|
10
9
|
|
|
11
10
|
import {
|
|
12
11
|
LintSynthesized,
|
|
@@ -22,13 +21,22 @@ import {
|
|
|
22
21
|
} from '@langri-sha/projen-codeowners'
|
|
23
22
|
import { Renovate, type RenovateOptions } from '@langri-sha/projen-renovate'
|
|
24
23
|
import { Husky, type HuskyOptions } from '@langri-sha/projen-husky'
|
|
24
|
+
import {
|
|
25
|
+
TypeScriptConfig,
|
|
26
|
+
type TypeScriptConfigOptions,
|
|
27
|
+
} from '@langri-sha/projen-typescript-config'
|
|
28
|
+
import { Beachball, BeachballOptions } from '@langri-sha/projen-beachball'
|
|
29
|
+
|
|
30
|
+
import { ProjenrcFile } from './lib/index.js'
|
|
31
|
+
|
|
32
|
+
export * from '@langri-sha/projen-typescript-config'
|
|
25
33
|
|
|
26
34
|
export interface ProjectOptions
|
|
27
35
|
extends Omit<BaseProjectOptions, 'renovatebot' | 'renovatebotOptions'> {
|
|
28
36
|
/*
|
|
29
37
|
* Pass in to set up Beachball.
|
|
30
38
|
*/
|
|
31
|
-
|
|
39
|
+
beachballOptions?: BeachballOptions
|
|
32
40
|
|
|
33
41
|
/*
|
|
34
42
|
* Pass in to set up Beachball.
|
|
@@ -55,15 +63,20 @@ export interface ProjectOptions
|
|
|
55
63
|
*/
|
|
56
64
|
lintSynthesizedOptions?: LintSynthesizedOptions
|
|
57
65
|
|
|
58
|
-
|
|
59
|
-
*
|
|
66
|
+
/**
|
|
67
|
+
* Package configuration options.
|
|
60
68
|
*/
|
|
61
|
-
|
|
69
|
+
package?: javascript.NodePackageOptions
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* TypeScript configuration options.
|
|
73
|
+
*/
|
|
74
|
+
typeScriptConfigOptions?: TypeScriptConfigOptions
|
|
62
75
|
|
|
63
76
|
/*
|
|
64
|
-
* Whether to use
|
|
77
|
+
* Whether to use Terrafom.
|
|
65
78
|
*/
|
|
66
|
-
|
|
79
|
+
withTerraform?: boolean
|
|
67
80
|
|
|
68
81
|
/*
|
|
69
82
|
* PNPM workspaces to generate.
|
|
@@ -72,6 +85,15 @@ export interface ProjectOptions
|
|
|
72
85
|
}
|
|
73
86
|
|
|
74
87
|
export class Project extends BaseProject {
|
|
88
|
+
beachball?: Beachball
|
|
89
|
+
codeowners?: Codeowners
|
|
90
|
+
editorConfig?: EditorConfig
|
|
91
|
+
husky?: Husky
|
|
92
|
+
package?: javascript.NodePackage
|
|
93
|
+
projenrc?: ProjenrcFile
|
|
94
|
+
renovate?: Renovate
|
|
95
|
+
typeScriptConfig?: TypeScriptConfig
|
|
96
|
+
|
|
75
97
|
constructor(options: ProjectOptions) {
|
|
76
98
|
super({
|
|
77
99
|
...options,
|
|
@@ -87,22 +109,67 @@ export class Project extends BaseProject {
|
|
|
87
109
|
this.tasks.removeTask('pre-compile')
|
|
88
110
|
this.tasks.removeTask('watch')
|
|
89
111
|
|
|
112
|
+
if (!this.parent) {
|
|
113
|
+
this.tasks.removeTask('install')
|
|
114
|
+
this.tasks.removeTask('install:ci')
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
this.#configurePackage(options)
|
|
118
|
+
this.#configureTypeScript(options)
|
|
119
|
+
|
|
90
120
|
this.#configureBeachball(options)
|
|
91
121
|
this.#configureCodeowners(options)
|
|
92
|
-
this.#configureDefaultTask()
|
|
93
122
|
this.#configureEditorConfig(options)
|
|
94
123
|
this.#configureHusky(options)
|
|
95
124
|
this.#configureLintSynthesized(options)
|
|
125
|
+
this.#configureProjenrc()
|
|
96
126
|
this.#configureRenovate(options)
|
|
97
127
|
this.#createPnpmWorkspaces(options)
|
|
98
128
|
}
|
|
99
129
|
|
|
100
|
-
|
|
101
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Add a subproject.
|
|
132
|
+
*/
|
|
133
|
+
addSubproject(projectOptions: ProjectOptions) {
|
|
134
|
+
return new Project({
|
|
135
|
+
parent: this,
|
|
136
|
+
...projectOptions,
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Find a project by it's name, e.g. `@acme/some`.
|
|
142
|
+
*/
|
|
143
|
+
findSubproject(name: string): Project {
|
|
144
|
+
const subprojects: Array<BaseProject> = []
|
|
145
|
+
|
|
146
|
+
const addSubproject = (project: BaseProject) => {
|
|
147
|
+
for (const subproject of project.subprojects) {
|
|
148
|
+
subprojects.push(subproject)
|
|
149
|
+
|
|
150
|
+
if (subproject.subprojects.length) {
|
|
151
|
+
addSubproject(subproject)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
addSubproject(this.root)
|
|
157
|
+
|
|
158
|
+
const result = subprojects.find((subproject) => subproject.name === name)
|
|
159
|
+
|
|
160
|
+
if (result instanceof Project) {
|
|
161
|
+
return result
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
throw new Error(`Cannot find subproject ${name}`)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
#configureBeachball({ beachballOptions }: ProjectOptions) {
|
|
168
|
+
if (!beachballOptions || this.parent) {
|
|
102
169
|
return
|
|
103
170
|
}
|
|
104
171
|
|
|
105
|
-
const options = deepMerge(
|
|
172
|
+
const options = deepMerge(beachballOptions, {
|
|
106
173
|
branch: 'origin/main',
|
|
107
174
|
gitTags: false,
|
|
108
175
|
ignorePatterns: [
|
|
@@ -114,17 +181,10 @@ export class Project extends BaseProject {
|
|
|
114
181
|
],
|
|
115
182
|
})
|
|
116
183
|
|
|
117
|
-
|
|
118
|
-
readonly: true,
|
|
119
|
-
marker: true,
|
|
120
|
-
})
|
|
184
|
+
this.beachball = new Beachball(this, options)
|
|
121
185
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
`module.exports = ${JSON.stringify(options, null, 2)}`,
|
|
125
|
-
]) {
|
|
126
|
-
file.addLine(line)
|
|
127
|
-
}
|
|
186
|
+
this.package?.addDevDeps('beachball@2.43.1')
|
|
187
|
+
this.typeScriptConfig?.addFile('beachball.config.js')
|
|
128
188
|
}
|
|
129
189
|
|
|
130
190
|
#configureCodeowners({ codeownersOptions }: ProjectOptions) {
|
|
@@ -132,17 +192,11 @@ export class Project extends BaseProject {
|
|
|
132
192
|
return
|
|
133
193
|
}
|
|
134
194
|
|
|
135
|
-
new Codeowners(this, codeownersOptions)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
#configureDefaultTask() {
|
|
139
|
-
this.tasks
|
|
140
|
-
.tryFind('default')
|
|
141
|
-
?.exec(`node --loader ts-node/esm .projenrc.mts`)
|
|
195
|
+
this.codeowners = new Codeowners(this, codeownersOptions)
|
|
142
196
|
}
|
|
143
197
|
|
|
144
198
|
#configureEditorConfig({ editorConfigOptions }: ProjectOptions) {
|
|
145
|
-
if (!editorConfigOptions) {
|
|
199
|
+
if (!editorConfigOptions || this.parent) {
|
|
146
200
|
return
|
|
147
201
|
}
|
|
148
202
|
|
|
@@ -160,29 +214,71 @@ export class Project extends BaseProject {
|
|
|
160
214
|
},
|
|
161
215
|
}
|
|
162
216
|
|
|
163
|
-
new EditorConfig(
|
|
217
|
+
this.editorConfig = new EditorConfig(
|
|
218
|
+
this,
|
|
219
|
+
deepMerge(editorConfigOptions ?? {}, defaults),
|
|
220
|
+
)
|
|
164
221
|
}
|
|
165
222
|
|
|
166
223
|
#configureHusky({ huskyOptions }: ProjectOptions) {
|
|
167
|
-
if (!huskyOptions) {
|
|
224
|
+
if (!huskyOptions || this.parent) {
|
|
168
225
|
return
|
|
169
226
|
}
|
|
170
227
|
|
|
171
|
-
new Husky(this, huskyOptions)
|
|
228
|
+
this.husky = new Husky(this, huskyOptions)
|
|
229
|
+
|
|
230
|
+
this.package?.addDevDeps('husky@9.0.11')
|
|
231
|
+
this.package?.setScript('prepare', 'husky')
|
|
232
|
+
this.tryFindObjectFile('package.json')?.addDeletionOverride('pnpm')
|
|
172
233
|
}
|
|
173
234
|
|
|
174
235
|
#configureLintSynthesized({ lintSynthesizedOptions }: ProjectOptions) {
|
|
175
236
|
new LintSynthesized(
|
|
176
237
|
this,
|
|
177
238
|
lintSynthesizedOptions ?? {
|
|
239
|
+
'package.json': 'pnpx sort-package-json',
|
|
178
240
|
'*.{js,jsx,ts,tsx}': 'pnpm eslint --fix',
|
|
179
241
|
'*': 'pnpm prettier --write --ignore-unknown',
|
|
180
242
|
},
|
|
181
243
|
)
|
|
182
244
|
}
|
|
183
245
|
|
|
246
|
+
#configurePackage({ package: pkg }: ProjectOptions) {
|
|
247
|
+
if (!pkg) {
|
|
248
|
+
return
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const defaults: javascript.NodePackageOptions = {
|
|
252
|
+
entrypoint: 'src/index.ts',
|
|
253
|
+
packageManager: javascript.NodePackageManager.PNPM,
|
|
254
|
+
minNodeVersion: '20.12.0',
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
this.package = new javascript.NodePackage(this, deepMerge(defaults, pkg))
|
|
258
|
+
|
|
259
|
+
if (!this.parent) {
|
|
260
|
+
this.package.addDevDeps('@langri-sha/projen-project@*')
|
|
261
|
+
this.package.addDevDeps('projen@0.81.15')
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
this.package.removeScript('start')
|
|
265
|
+
this.package.removeScript('test')
|
|
266
|
+
|
|
267
|
+
if (this.parent) {
|
|
268
|
+
this.package.removeScript('default')
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
#configureProjenrc() {
|
|
273
|
+
if (this.parent) {
|
|
274
|
+
return
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
this.projenrc = new ProjenrcFile(this, {})
|
|
278
|
+
}
|
|
279
|
+
|
|
184
280
|
#configureRenovate({ renovateOptions }: ProjectOptions) {
|
|
185
|
-
if (!renovateOptions) {
|
|
281
|
+
if (!renovateOptions || this.parent) {
|
|
186
282
|
return
|
|
187
283
|
}
|
|
188
284
|
|
|
@@ -191,9 +287,63 @@ export class Project extends BaseProject {
|
|
|
191
287
|
extends: ['config:recommended'],
|
|
192
288
|
labels: ['dependencies'],
|
|
193
289
|
reviewersFromCodeOwners: true,
|
|
290
|
+
customManagers: [
|
|
291
|
+
{
|
|
292
|
+
customType: 'regex',
|
|
293
|
+
datasourceTemplate: 'npm',
|
|
294
|
+
fileMatch: ['\\.?projen.*.(js|cjs|mjs|ts|mts|cts)$'],
|
|
295
|
+
matchStrings: [
|
|
296
|
+
"\\.(?<depType>addDep|addDevDep|addPeerDep)\\('(?<depName>[a-zA-Z0-9-]+)@(?<currentValue>[^']+)'\\)",
|
|
297
|
+
],
|
|
298
|
+
depTypeTemplate:
|
|
299
|
+
"{{#if (equals depType 'addDevDep')}}devDependencies{{else if (equals depType 'addPeerDep')}}peerDependencies{{else}}dependencies{{/if}}",
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
customType: 'regex',
|
|
303
|
+
datasourceTemplate: 'npm',
|
|
304
|
+
fileMatch: ['\\.?projen.*.(js|cjs|mjs|ts|mts|cts)$'],
|
|
305
|
+
matchStrings: ["pnpm@(?<currentValue>[^']+)"],
|
|
306
|
+
depNameTemplate: 'pnpm',
|
|
307
|
+
depTypeTemplate: 'dependencies',
|
|
308
|
+
},
|
|
309
|
+
],
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
this.renovate = new Renovate(this, deepMerge(defaults, renovateOptions))
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
#configureTypeScript({ parent, typeScriptConfigOptions }: ProjectOptions) {
|
|
316
|
+
if (!typeScriptConfigOptions) {
|
|
317
|
+
return
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const defaults: TypeScriptConfigOptions = parent
|
|
321
|
+
? {
|
|
322
|
+
config: {
|
|
323
|
+
extends: '@langri-sha/tsconfig/project.json',
|
|
324
|
+
compilerOptions: {
|
|
325
|
+
baseUrl: '.',
|
|
326
|
+
outDir: '.tsbuild',
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
}
|
|
330
|
+
: {
|
|
331
|
+
config: {
|
|
332
|
+
extends: '@langri-sha/tsconfig',
|
|
333
|
+
},
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
this.typeScriptConfig = new TypeScriptConfig(
|
|
337
|
+
this,
|
|
338
|
+
deepMerge(defaults, typeScriptConfigOptions),
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
if (!this.parent) {
|
|
342
|
+
this.package?.addDevDeps('typescript@5.4.5')
|
|
343
|
+
this.package?.addDevDeps('ts-node@10.9.2')
|
|
194
344
|
}
|
|
195
345
|
|
|
196
|
-
|
|
346
|
+
this.package?.addDevDeps('@langri-sha/tsconfig@*')
|
|
197
347
|
}
|
|
198
348
|
|
|
199
349
|
#createPnpmWorkspaces({ workspaces }: ProjectOptions) {
|
|
@@ -213,13 +363,17 @@ export class Project extends BaseProject {
|
|
|
213
363
|
|
|
214
364
|
const getGitIgnoreOptions = ({
|
|
215
365
|
huskyOptions,
|
|
366
|
+
typeScriptConfigOptions,
|
|
216
367
|
withTerraform,
|
|
217
|
-
|
|
368
|
+
parent,
|
|
369
|
+
gitIgnoreOptions,
|
|
218
370
|
...options
|
|
219
|
-
}: ProjectOptions): ProjectOptions['gitIgnoreOptions'] =>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
371
|
+
}: ProjectOptions): ProjectOptions['gitIgnoreOptions'] =>
|
|
372
|
+
parent
|
|
373
|
+
? gitIgnoreOptions
|
|
374
|
+
: {
|
|
375
|
+
ignorePatterns: [
|
|
376
|
+
...`
|
|
223
377
|
.*
|
|
224
378
|
!.babelrc
|
|
225
379
|
!.dockerignore
|
|
@@ -230,11 +384,10 @@ const getGitIgnoreOptions = ({
|
|
|
230
384
|
!.npmignore
|
|
231
385
|
!.openssl
|
|
232
386
|
!.prettierignore
|
|
233
|
-
!.projenrc*
|
|
234
387
|
${withTerraform ? '!.terraform.lock.hcl' : ''}
|
|
235
388
|
*.db
|
|
236
389
|
*.log
|
|
237
|
-
${
|
|
390
|
+
${typeScriptConfigOptions ? '*.tsbuildinfo' : ''}
|
|
238
391
|
|
|
239
392
|
!.github/
|
|
240
393
|
${huskyOptions ? '!.husky/' : ''}
|
|
@@ -242,11 +395,11 @@ const getGitIgnoreOptions = ({
|
|
|
242
395
|
${options.workspaces?.map((workspace) => `${workspace}/lib/`).join('\n') ?? ''}
|
|
243
396
|
node_modules/
|
|
244
397
|
`
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
398
|
+
.split('\n')
|
|
399
|
+
.map((pattern) => pattern.trim())
|
|
400
|
+
.filter((pattern) => pattern.length > 0),
|
|
401
|
+
...(gitIgnoreOptions?.ignorePatterns ?? []),
|
|
402
|
+
],
|
|
403
|
+
}
|
|
251
404
|
|
|
252
405
|
const deepMerge = R.mergeDeepWith(R.concat)
|
package/src/lib/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './projenrc.js'
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ProjenrcFile as BaseProjenrcFile, Project, SampleFile } from 'projen'
|
|
2
|
+
|
|
3
|
+
export interface ProjenrcOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The name of the projenrc file.
|
|
6
|
+
* @default ".projenrc.mts"
|
|
7
|
+
*/
|
|
8
|
+
readonly filename?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class ProjenrcFile extends BaseProjenrcFile {
|
|
12
|
+
public override readonly filePath: string
|
|
13
|
+
|
|
14
|
+
constructor(
|
|
15
|
+
project: Project,
|
|
16
|
+
{ filename = '.projenrc.mts' }: ProjenrcOptions,
|
|
17
|
+
) {
|
|
18
|
+
super(project)
|
|
19
|
+
|
|
20
|
+
this.filePath = filename
|
|
21
|
+
this.project.defaultTask?.exec(
|
|
22
|
+
`node --loader ts-node/esm/transpile-only ${filename}`,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
new SampleFile(project, filename, {
|
|
26
|
+
contents: `import { Project } from '@langri-sha/projen-project'
|
|
27
|
+
|
|
28
|
+
const project = new Project()
|
|
29
|
+
|
|
30
|
+
project.synth()
|
|
31
|
+
`,
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
}
|