@langri-sha/projen-project 0.7.0 → 0.8.1
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 +99 -1
- package/CHANGELOG.md +32 -2
- package/lib/index.d.ts +31 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +132 -44
- 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 -9
- package/src/index.ts +177 -50
- package/src/lib/index.ts +1 -0
- package/src/lib/projenrc.ts +34 -0
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,105 @@
|
|
|
2
2
|
"name": "@langri-sha/projen-project",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 21 May 2024 07:47:31 GMT",
|
|
6
|
+
"version": "0.8.1",
|
|
7
|
+
"tag": "@langri-sha/projen-project_v0.8.1",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "filip.dupanovic@gmail.com",
|
|
12
|
+
"package": "@langri-sha/projen-project",
|
|
13
|
+
"commit": "5620ce2f2f89b683bc0dba64ed440cfa14425c12",
|
|
14
|
+
"comment": "fix(project): Remove default tasks for subprojects"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Tue, 21 May 2024 05:22:50 GMT",
|
|
21
|
+
"version": "0.8.0",
|
|
22
|
+
"tag": "@langri-sha/projen-project_v0.8.0",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "email not defined",
|
|
27
|
+
"package": "@langri-sha/projen-project",
|
|
28
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
29
|
+
"comment": "chore(deps): chore(deps): update dependency projen to v0.81.13"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"author": "email not defined",
|
|
33
|
+
"package": "@langri-sha/projen-project",
|
|
34
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
35
|
+
"comment": "chore(deps): chore(deps): update dependency projen to v0.81.15"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"author": "filip.dupanovic@gmail.com",
|
|
39
|
+
"package": "@langri-sha/projen-project",
|
|
40
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
41
|
+
"comment": "fix(project): Transpile sources only for default task"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"author": "filip.dupanovic@gmail.com",
|
|
45
|
+
"package": "@langri-sha/projen-project",
|
|
46
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
47
|
+
"comment": "fix(project): Correct Renovate dependency matching"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"author": "filip.dupanovic@gmail.com",
|
|
51
|
+
"package": "@langri-sha/projen-project",
|
|
52
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
53
|
+
"comment": "fix(projen-project): Lint only package modules"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"author": "filip.dupanovic@gmail.com",
|
|
57
|
+
"package": "@langri-sha/projen-project",
|
|
58
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
59
|
+
"comment": "fix(project): Add looser dependency matching"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"minor": [
|
|
63
|
+
{
|
|
64
|
+
"author": "filip.dupanovic@gmail.com",
|
|
65
|
+
"package": "@langri-sha/projen-project",
|
|
66
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
67
|
+
"comment": "feat(projen): Add component for Beacbhall support"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"author": "filip.dupanovic@gmail.com",
|
|
71
|
+
"package": "@langri-sha/projen-project",
|
|
72
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
73
|
+
"comment": "feat(project): Add stub projen configuration file"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"author": "filip.dupanovic@gmail.com",
|
|
77
|
+
"package": "@langri-sha/projen-project",
|
|
78
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
79
|
+
"comment": "feat(project): Upgrade PNPM with Renovate"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"author": "filip.dupanovic@gmail.com",
|
|
83
|
+
"package": "@langri-sha/projen-project",
|
|
84
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
85
|
+
"comment": "feat(project): Add support for Node.js packages"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"author": "filip.dupanovic@gmail.com",
|
|
89
|
+
"package": "@langri-sha/projen-project",
|
|
90
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
91
|
+
"comment": "feat(project): Match deps in modules with Renovate"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"author": "filip.dupanovic@gmail.com",
|
|
95
|
+
"package": "@langri-sha/projen-project",
|
|
96
|
+
"commit": "f95709138a43b934997a15555d3e42655a02bee3",
|
|
97
|
+
"comment": "feat(project): Add support for subprojects"
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"date": "Wed, 15 May 2024 06:47:18 GMT",
|
|
6
104
|
"version": "0.7.0",
|
|
7
105
|
"tag": "@langri-sha/projen-project_v0.7.0",
|
|
8
106
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,42 @@
|
|
|
1
1
|
# Change Log - @langri-sha/projen-project
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 21 May 2024 07:47:31 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.8.1
|
|
8
|
+
|
|
9
|
+
Tue, 21 May 2024 07:47:31 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- fix(project): Remove default tasks for subprojects (filip.dupanovic@gmail.com)
|
|
14
|
+
|
|
15
|
+
## 0.8.0
|
|
16
|
+
|
|
17
|
+
Tue, 21 May 2024 05:22:50 GMT
|
|
18
|
+
|
|
19
|
+
### Minor changes
|
|
20
|
+
|
|
21
|
+
- feat(projen): Add component for Beacbhall support (filip.dupanovic@gmail.com)
|
|
22
|
+
- feat(project): Add stub projen configuration file (filip.dupanovic@gmail.com)
|
|
23
|
+
- feat(project): Upgrade PNPM with Renovate (filip.dupanovic@gmail.com)
|
|
24
|
+
- feat(project): Add support for Node.js packages (filip.dupanovic@gmail.com)
|
|
25
|
+
- feat(project): Match deps in modules with Renovate (filip.dupanovic@gmail.com)
|
|
26
|
+
- feat(project): Add support for subprojects (filip.dupanovic@gmail.com)
|
|
27
|
+
|
|
28
|
+
### Patches
|
|
29
|
+
|
|
30
|
+
- chore(deps): chore(deps): update dependency projen to v0.81.13 (email not defined)
|
|
31
|
+
- chore(deps): chore(deps): update dependency projen to v0.81.15 (email not defined)
|
|
32
|
+
- fix(project): Transpile sources only for default task (filip.dupanovic@gmail.com)
|
|
33
|
+
- fix(project): Correct Renovate dependency matching (filip.dupanovic@gmail.com)
|
|
34
|
+
- fix(projen-project): Lint only package modules (filip.dupanovic@gmail.com)
|
|
35
|
+
- fix(project): Add looser dependency matching (filip.dupanovic@gmail.com)
|
|
36
|
+
|
|
7
37
|
## 0.7.0
|
|
8
38
|
|
|
9
|
-
Wed, 15 May 2024 06:
|
|
39
|
+
Wed, 15 May 2024 06:47:18 GMT
|
|
10
40
|
|
|
11
41
|
### Minor changes
|
|
12
42
|
|
package/lib/index.d.ts
CHANGED
|
@@ -1,13 +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';
|
|
8
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';
|
|
9
11
|
export interface ProjectOptions extends Omit<BaseProjectOptions, 'renovatebot' | 'renovatebotOptions'> {
|
|
10
|
-
|
|
12
|
+
beachballOptions?: BeachballOptions;
|
|
11
13
|
codeownersOptions?: CodeownersOptions;
|
|
12
14
|
/**
|
|
13
15
|
* EditorConfig options.
|
|
@@ -19,13 +21,35 @@ export interface ProjectOptions extends Omit<BaseProjectOptions, 'renovatebot' |
|
|
|
19
21
|
huskyOptions?: HuskyOptions;
|
|
20
22
|
renovateOptions?: RenovateOptions;
|
|
21
23
|
lintSynthesizedOptions?: LintSynthesizedOptions;
|
|
24
|
+
/**
|
|
25
|
+
* Package configuration options.
|
|
26
|
+
*/
|
|
27
|
+
package?: javascript.NodePackageOptions;
|
|
28
|
+
/**
|
|
29
|
+
* TypeScript configuration options.
|
|
30
|
+
*/
|
|
22
31
|
typeScriptConfigOptions?: TypeScriptConfigOptions;
|
|
23
32
|
withTerraform?: boolean;
|
|
24
33
|
workspaces?: string[];
|
|
25
34
|
}
|
|
26
35
|
export declare class Project extends BaseProject {
|
|
27
36
|
#private;
|
|
37
|
+
beachball?: Beachball;
|
|
38
|
+
codeowners?: Codeowners;
|
|
39
|
+
editorConfig?: EditorConfig;
|
|
40
|
+
husky?: Husky;
|
|
41
|
+
package?: javascript.NodePackage;
|
|
42
|
+
projenrc?: ProjenrcFile;
|
|
43
|
+
renovate?: Renovate;
|
|
28
44
|
typeScriptConfig?: TypeScriptConfig;
|
|
29
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;
|
|
30
54
|
}
|
|
31
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,EA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,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;IAkCnC;;OAEG;IACH,aAAa,CAAC,cAAc,EAAE,cAAc;IAO5C;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CA2NtC"}
|
package/lib/index.js
CHANGED
|
@@ -3,8 +3,8 @@ 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';
|
|
@@ -12,6 +12,9 @@ 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
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';
|
|
15
18
|
export class Project extends BaseProject {
|
|
16
19
|
constructor(options) {
|
|
17
20
|
super({
|
|
@@ -27,22 +30,57 @@ export class Project extends BaseProject {
|
|
|
27
30
|
this.tasks.removeTask('post-compile');
|
|
28
31
|
this.tasks.removeTask('pre-compile');
|
|
29
32
|
this.tasks.removeTask('watch');
|
|
33
|
+
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configurePackage).call(this, options);
|
|
30
34
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureTypeScript).call(this, options);
|
|
35
|
+
if (this.parent) {
|
|
36
|
+
this.tasks.tryFind('default')?.reset();
|
|
37
|
+
this.tasks.tryFind('install')?.reset();
|
|
38
|
+
this.tasks.tryFind('install:ci')?.reset();
|
|
39
|
+
}
|
|
31
40
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureBeachball).call(this, options);
|
|
32
41
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureCodeowners).call(this, options);
|
|
33
|
-
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureDefaultTask).call(this);
|
|
34
42
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureEditorConfig).call(this, options);
|
|
35
43
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureHusky).call(this, options);
|
|
36
44
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureLintSynthesized).call(this, options);
|
|
45
|
+
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureProjenrc).call(this);
|
|
37
46
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_configureRenovate).call(this, options);
|
|
38
47
|
__classPrivateFieldGet(this, _Project_instances, "m", _Project_createPnpmWorkspaces).call(this, options);
|
|
39
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Add a subproject.
|
|
51
|
+
*/
|
|
52
|
+
addSubproject(projectOptions) {
|
|
53
|
+
return new Project({
|
|
54
|
+
parent: this,
|
|
55
|
+
...projectOptions,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Find a project by it's name, e.g. `@acme/some`.
|
|
60
|
+
*/
|
|
61
|
+
findSubproject(name) {
|
|
62
|
+
const subprojects = [];
|
|
63
|
+
const addSubproject = (project) => {
|
|
64
|
+
for (const subproject of project.subprojects) {
|
|
65
|
+
subprojects.push(subproject);
|
|
66
|
+
if (subproject.subprojects.length) {
|
|
67
|
+
addSubproject(subproject);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
addSubproject(this.root);
|
|
72
|
+
const result = subprojects.find((subproject) => subproject.name === name);
|
|
73
|
+
if (result instanceof Project) {
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
throw new Error(`Cannot find subproject ${name}`);
|
|
77
|
+
}
|
|
40
78
|
}
|
|
41
|
-
_Project_instances = new WeakSet(), _Project_configureBeachball = function _Project_configureBeachball({
|
|
42
|
-
if (!
|
|
79
|
+
_Project_instances = new WeakSet(), _Project_configureBeachball = function _Project_configureBeachball({ beachballOptions }) {
|
|
80
|
+
if (!beachballOptions || this.parent) {
|
|
43
81
|
return;
|
|
44
82
|
}
|
|
45
|
-
const options = deepMerge(
|
|
83
|
+
const options = deepMerge(beachballOptions, {
|
|
46
84
|
branch: 'origin/main',
|
|
47
85
|
gitTags: false,
|
|
48
86
|
ignorePatterns: [
|
|
@@ -53,28 +91,16 @@ _Project_instances = new WeakSet(), _Project_configureBeachball = function _Proj
|
|
|
53
91
|
'node_modules/',
|
|
54
92
|
],
|
|
55
93
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
marker: true,
|
|
59
|
-
});
|
|
60
|
-
for (const line of [
|
|
61
|
-
`/** @type {import('beachball').BeachballConfig} */`,
|
|
62
|
-
`module.exports = ${JSON.stringify(options, null, 2)}`,
|
|
63
|
-
]) {
|
|
64
|
-
file.addLine(line);
|
|
65
|
-
}
|
|
94
|
+
this.beachball = new Beachball(this, options);
|
|
95
|
+
this.package?.addDevDeps('beachball@2.43.1');
|
|
66
96
|
this.typeScriptConfig?.addFile('beachball.config.js');
|
|
67
97
|
}, _Project_configureCodeowners = function _Project_configureCodeowners({ codeownersOptions }) {
|
|
68
98
|
if (!codeownersOptions) {
|
|
69
99
|
return;
|
|
70
100
|
}
|
|
71
|
-
new Codeowners(this, codeownersOptions);
|
|
72
|
-
}, _Project_configureDefaultTask = function _Project_configureDefaultTask() {
|
|
73
|
-
this.tasks
|
|
74
|
-
.tryFind('default')
|
|
75
|
-
?.exec(`node --loader ts-node/esm .projenrc.mts`);
|
|
101
|
+
this.codeowners = new Codeowners(this, codeownersOptions);
|
|
76
102
|
}, _Project_configureEditorConfig = function _Project_configureEditorConfig({ editorConfigOptions }) {
|
|
77
|
-
if (!editorConfigOptions) {
|
|
103
|
+
if (!editorConfigOptions || this.parent) {
|
|
78
104
|
return;
|
|
79
105
|
}
|
|
80
106
|
const defaults = {
|
|
@@ -90,19 +116,47 @@ _Project_instances = new WeakSet(), _Project_configureBeachball = function _Proj
|
|
|
90
116
|
indent_style: 'tab',
|
|
91
117
|
},
|
|
92
118
|
};
|
|
93
|
-
new EditorConfig(this, deepMerge(editorConfigOptions ?? {}, defaults));
|
|
119
|
+
this.editorConfig = new EditorConfig(this, deepMerge(editorConfigOptions ?? {}, defaults));
|
|
94
120
|
}, _Project_configureHusky = function _Project_configureHusky({ huskyOptions }) {
|
|
95
|
-
if (!huskyOptions) {
|
|
121
|
+
if (!huskyOptions || this.parent) {
|
|
96
122
|
return;
|
|
97
123
|
}
|
|
98
|
-
new Husky(this, huskyOptions);
|
|
124
|
+
this.husky = new Husky(this, huskyOptions);
|
|
125
|
+
this.package?.addDevDeps('husky@9.0.11');
|
|
126
|
+
this.package?.setScript('prepare', 'husky');
|
|
127
|
+
this.tryFindObjectFile('package.json')?.addDeletionOverride('pnpm');
|
|
99
128
|
}, _Project_configureLintSynthesized = function _Project_configureLintSynthesized({ lintSynthesizedOptions }) {
|
|
100
129
|
new LintSynthesized(this, lintSynthesizedOptions ?? {
|
|
130
|
+
'package.json': 'pnpx sort-package-json',
|
|
101
131
|
'*.{js,jsx,ts,tsx}': 'pnpm eslint --fix',
|
|
102
132
|
'*': 'pnpm prettier --write --ignore-unknown',
|
|
103
133
|
});
|
|
134
|
+
}, _Project_configurePackage = function _Project_configurePackage({ package: pkg }) {
|
|
135
|
+
if (!pkg) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const defaults = {
|
|
139
|
+
entrypoint: 'src/index.ts',
|
|
140
|
+
packageManager: javascript.NodePackageManager.PNPM,
|
|
141
|
+
minNodeVersion: '20.12.0',
|
|
142
|
+
};
|
|
143
|
+
this.package = new javascript.NodePackage(this, deepMerge(defaults, pkg));
|
|
144
|
+
if (!this.parent) {
|
|
145
|
+
this.package.addDevDeps('@langri-sha/projen-project@*');
|
|
146
|
+
this.package.addDevDeps('projen@0.81.15');
|
|
147
|
+
}
|
|
148
|
+
this.package.removeScript('start');
|
|
149
|
+
this.package.removeScript('test');
|
|
150
|
+
if (this.parent) {
|
|
151
|
+
this.package.removeScript('default');
|
|
152
|
+
}
|
|
153
|
+
}, _Project_configureProjenrc = function _Project_configureProjenrc() {
|
|
154
|
+
if (this.parent) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
this.projenrc = new ProjenrcFile(this, {});
|
|
104
158
|
}, _Project_configureRenovate = function _Project_configureRenovate({ renovateOptions }) {
|
|
105
|
-
if (!renovateOptions) {
|
|
159
|
+
if (!renovateOptions || this.parent) {
|
|
106
160
|
return;
|
|
107
161
|
}
|
|
108
162
|
const defaults = {
|
|
@@ -110,18 +164,52 @@ _Project_instances = new WeakSet(), _Project_configureBeachball = function _Proj
|
|
|
110
164
|
extends: ['config:recommended'],
|
|
111
165
|
labels: ['dependencies'],
|
|
112
166
|
reviewersFromCodeOwners: true,
|
|
167
|
+
customManagers: [
|
|
168
|
+
{
|
|
169
|
+
customType: 'regex',
|
|
170
|
+
datasourceTemplate: 'npm',
|
|
171
|
+
fileMatch: ['\\.?projen.*.(js|cjs|mjs|ts|mts|cts)$'],
|
|
172
|
+
matchStrings: [
|
|
173
|
+
"\\.(?<depType>addDep|addDevDep|addPeerDep)\\('(?<depName>[a-zA-Z0-9-]+)@(?<currentValue>[^']+)'\\)",
|
|
174
|
+
],
|
|
175
|
+
depTypeTemplate: "{{#if (equals depType 'addDevDep')}}devDependencies{{else if (equals depType 'addPeerDep')}}peerDependencies{{else}}dependencies{{/if}}",
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
customType: 'regex',
|
|
179
|
+
datasourceTemplate: 'npm',
|
|
180
|
+
fileMatch: ['\\.?projen.*.(js|cjs|mjs|ts|mts|cts)$'],
|
|
181
|
+
matchStrings: ["pnpm@(?<currentValue>[^']+)"],
|
|
182
|
+
depNameTemplate: 'pnpm',
|
|
183
|
+
depTypeTemplate: 'dependencies',
|
|
184
|
+
},
|
|
185
|
+
],
|
|
113
186
|
};
|
|
114
|
-
new Renovate(this, deepMerge(defaults, renovateOptions));
|
|
115
|
-
}, _Project_configureTypeScript = function _Project_configureTypeScript({ typeScriptConfigOptions }) {
|
|
187
|
+
this.renovate = new Renovate(this, deepMerge(defaults, renovateOptions));
|
|
188
|
+
}, _Project_configureTypeScript = function _Project_configureTypeScript({ parent, typeScriptConfigOptions }) {
|
|
116
189
|
if (!typeScriptConfigOptions) {
|
|
117
190
|
return;
|
|
118
191
|
}
|
|
119
|
-
const defaults =
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
192
|
+
const defaults = parent
|
|
193
|
+
? {
|
|
194
|
+
config: {
|
|
195
|
+
extends: '@langri-sha/tsconfig/project.json',
|
|
196
|
+
compilerOptions: {
|
|
197
|
+
baseUrl: '.',
|
|
198
|
+
outDir: '.tsbuild',
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
}
|
|
202
|
+
: {
|
|
203
|
+
config: {
|
|
204
|
+
extends: '@langri-sha/tsconfig',
|
|
205
|
+
},
|
|
206
|
+
};
|
|
124
207
|
this.typeScriptConfig = new TypeScriptConfig(this, deepMerge(defaults, typeScriptConfigOptions));
|
|
208
|
+
if (!this.parent) {
|
|
209
|
+
this.package?.addDevDeps('typescript@5.4.5');
|
|
210
|
+
this.package?.addDevDeps('ts-node@10.9.2');
|
|
211
|
+
}
|
|
212
|
+
this.package?.addDevDeps('@langri-sha/tsconfig@*');
|
|
125
213
|
}, _Project_createPnpmWorkspaces = function _Project_createPnpmWorkspaces({ workspaces }) {
|
|
126
214
|
if (!workspaces) {
|
|
127
215
|
return;
|
|
@@ -134,10 +222,11 @@ _Project_instances = new WeakSet(), _Project_configureBeachball = function _Proj
|
|
|
134
222
|
},
|
|
135
223
|
});
|
|
136
224
|
};
|
|
137
|
-
const getGitIgnoreOptions = ({ huskyOptions, typeScriptConfigOptions, withTerraform, ...options }) =>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
225
|
+
const getGitIgnoreOptions = ({ huskyOptions, typeScriptConfigOptions, withTerraform, parent, gitIgnoreOptions, ...options }) => parent
|
|
226
|
+
? gitIgnoreOptions
|
|
227
|
+
: {
|
|
228
|
+
ignorePatterns: [
|
|
229
|
+
...`
|
|
141
230
|
.*
|
|
142
231
|
!.babelrc
|
|
143
232
|
!.dockerignore
|
|
@@ -148,7 +237,6 @@ const getGitIgnoreOptions = ({ huskyOptions, typeScriptConfigOptions, withTerraf
|
|
|
148
237
|
!.npmignore
|
|
149
238
|
!.openssl
|
|
150
239
|
!.prettierignore
|
|
151
|
-
!.projenrc*
|
|
152
240
|
${withTerraform ? '!.terraform.lock.hcl' : ''}
|
|
153
241
|
*.db
|
|
154
242
|
*.log
|
|
@@ -160,11 +248,11 @@ const getGitIgnoreOptions = ({ huskyOptions, typeScriptConfigOptions, withTerraf
|
|
|
160
248
|
${options.workspaces?.map((workspace) => `${workspace}/lib/`).join('\n') ?? ''}
|
|
161
249
|
node_modules/
|
|
162
250
|
`
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
251
|
+
.split('\n')
|
|
252
|
+
.map((pattern) => pattern.trim())
|
|
253
|
+
.filter((pattern) => pattern.length > 0),
|
|
254
|
+
...(gitIgnoreOptions?.ignorePatterns ?? []),
|
|
255
|
+
],
|
|
256
|
+
};
|
|
169
257
|
const deepMerge = R.mergeDeepWith(R.concat);
|
|
170
258
|
//# 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,EAAE,KAAK,EAAqB,MAAM,0BAA0B,CAAA;AACnE,OAAO,EACL,gBAAgB,GAEjB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAoB,MAAM,8BAA8B,CAAA;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,cAAc,sCAAsC,CAAA;AAuDpD,MAAM,OAAO,OAAQ,SAAQ,WAAW;IAUt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,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.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -8,20 +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
|
-
"@langri-sha/projen-
|
|
17
|
-
"
|
|
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",
|
|
18
18
|
"ramda": "0.30.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@langri-sha/jest-test": "0.7.1",
|
|
22
22
|
"@langri-sha/tsconfig": "0.9.0",
|
|
23
23
|
"@types/ramda": "0.30.0",
|
|
24
|
-
"projen": "0.81.
|
|
24
|
+
"projen": "0.81.15"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
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,
|
|
@@ -26,13 +25,18 @@ import {
|
|
|
26
25
|
TypeScriptConfig,
|
|
27
26
|
type TypeScriptConfigOptions,
|
|
28
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'
|
|
29
33
|
|
|
30
34
|
export interface ProjectOptions
|
|
31
35
|
extends Omit<BaseProjectOptions, 'renovatebot' | 'renovatebotOptions'> {
|
|
32
36
|
/*
|
|
33
37
|
* Pass in to set up Beachball.
|
|
34
38
|
*/
|
|
35
|
-
|
|
39
|
+
beachballOptions?: BeachballOptions
|
|
36
40
|
|
|
37
41
|
/*
|
|
38
42
|
* Pass in to set up Beachball.
|
|
@@ -59,8 +63,13 @@ export interface ProjectOptions
|
|
|
59
63
|
*/
|
|
60
64
|
lintSynthesizedOptions?: LintSynthesizedOptions
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
*
|
|
66
|
+
/**
|
|
67
|
+
* Package configuration options.
|
|
68
|
+
*/
|
|
69
|
+
package?: javascript.NodePackageOptions
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* TypeScript configuration options.
|
|
64
73
|
*/
|
|
65
74
|
typeScriptConfigOptions?: TypeScriptConfigOptions
|
|
66
75
|
|
|
@@ -76,6 +85,13 @@ export interface ProjectOptions
|
|
|
76
85
|
}
|
|
77
86
|
|
|
78
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
|
|
79
95
|
typeScriptConfig?: TypeScriptConfig
|
|
80
96
|
|
|
81
97
|
constructor(options: ProjectOptions) {
|
|
@@ -93,24 +109,68 @@ export class Project extends BaseProject {
|
|
|
93
109
|
this.tasks.removeTask('pre-compile')
|
|
94
110
|
this.tasks.removeTask('watch')
|
|
95
111
|
|
|
112
|
+
this.#configurePackage(options)
|
|
96
113
|
this.#configureTypeScript(options)
|
|
97
114
|
|
|
115
|
+
if (this.parent) {
|
|
116
|
+
this.tasks.tryFind('default')?.reset()
|
|
117
|
+
this.tasks.tryFind('install')?.reset()
|
|
118
|
+
this.tasks.tryFind('install:ci')?.reset()
|
|
119
|
+
}
|
|
120
|
+
|
|
98
121
|
this.#configureBeachball(options)
|
|
99
122
|
this.#configureCodeowners(options)
|
|
100
|
-
this.#configureDefaultTask()
|
|
101
123
|
this.#configureEditorConfig(options)
|
|
102
124
|
this.#configureHusky(options)
|
|
103
125
|
this.#configureLintSynthesized(options)
|
|
126
|
+
this.#configureProjenrc()
|
|
104
127
|
this.#configureRenovate(options)
|
|
105
128
|
this.#createPnpmWorkspaces(options)
|
|
106
129
|
}
|
|
107
130
|
|
|
108
|
-
|
|
109
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Add a subproject.
|
|
133
|
+
*/
|
|
134
|
+
addSubproject(projectOptions: ProjectOptions) {
|
|
135
|
+
return new Project({
|
|
136
|
+
parent: this,
|
|
137
|
+
...projectOptions,
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Find a project by it's name, e.g. `@acme/some`.
|
|
143
|
+
*/
|
|
144
|
+
findSubproject(name: string): Project {
|
|
145
|
+
const subprojects: Array<BaseProject> = []
|
|
146
|
+
|
|
147
|
+
const addSubproject = (project: BaseProject) => {
|
|
148
|
+
for (const subproject of project.subprojects) {
|
|
149
|
+
subprojects.push(subproject)
|
|
150
|
+
|
|
151
|
+
if (subproject.subprojects.length) {
|
|
152
|
+
addSubproject(subproject)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
addSubproject(this.root)
|
|
158
|
+
|
|
159
|
+
const result = subprojects.find((subproject) => subproject.name === name)
|
|
160
|
+
|
|
161
|
+
if (result instanceof Project) {
|
|
162
|
+
return result
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
throw new Error(`Cannot find subproject ${name}`)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
#configureBeachball({ beachballOptions }: ProjectOptions) {
|
|
169
|
+
if (!beachballOptions || this.parent) {
|
|
110
170
|
return
|
|
111
171
|
}
|
|
112
172
|
|
|
113
|
-
const options = deepMerge(
|
|
173
|
+
const options = deepMerge(beachballOptions, {
|
|
114
174
|
branch: 'origin/main',
|
|
115
175
|
gitTags: false,
|
|
116
176
|
ignorePatterns: [
|
|
@@ -122,18 +182,9 @@ export class Project extends BaseProject {
|
|
|
122
182
|
],
|
|
123
183
|
})
|
|
124
184
|
|
|
125
|
-
|
|
126
|
-
readonly: true,
|
|
127
|
-
marker: true,
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
for (const line of [
|
|
131
|
-
`/** @type {import('beachball').BeachballConfig} */`,
|
|
132
|
-
`module.exports = ${JSON.stringify(options, null, 2)}`,
|
|
133
|
-
]) {
|
|
134
|
-
file.addLine(line)
|
|
135
|
-
}
|
|
185
|
+
this.beachball = new Beachball(this, options)
|
|
136
186
|
|
|
187
|
+
this.package?.addDevDeps('beachball@2.43.1')
|
|
137
188
|
this.typeScriptConfig?.addFile('beachball.config.js')
|
|
138
189
|
}
|
|
139
190
|
|
|
@@ -142,17 +193,11 @@ export class Project extends BaseProject {
|
|
|
142
193
|
return
|
|
143
194
|
}
|
|
144
195
|
|
|
145
|
-
new Codeowners(this, codeownersOptions)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
#configureDefaultTask() {
|
|
149
|
-
this.tasks
|
|
150
|
-
.tryFind('default')
|
|
151
|
-
?.exec(`node --loader ts-node/esm .projenrc.mts`)
|
|
196
|
+
this.codeowners = new Codeowners(this, codeownersOptions)
|
|
152
197
|
}
|
|
153
198
|
|
|
154
199
|
#configureEditorConfig({ editorConfigOptions }: ProjectOptions) {
|
|
155
|
-
if (!editorConfigOptions) {
|
|
200
|
+
if (!editorConfigOptions || this.parent) {
|
|
156
201
|
return
|
|
157
202
|
}
|
|
158
203
|
|
|
@@ -170,29 +215,71 @@ export class Project extends BaseProject {
|
|
|
170
215
|
},
|
|
171
216
|
}
|
|
172
217
|
|
|
173
|
-
new EditorConfig(
|
|
218
|
+
this.editorConfig = new EditorConfig(
|
|
219
|
+
this,
|
|
220
|
+
deepMerge(editorConfigOptions ?? {}, defaults),
|
|
221
|
+
)
|
|
174
222
|
}
|
|
175
223
|
|
|
176
224
|
#configureHusky({ huskyOptions }: ProjectOptions) {
|
|
177
|
-
if (!huskyOptions) {
|
|
225
|
+
if (!huskyOptions || this.parent) {
|
|
178
226
|
return
|
|
179
227
|
}
|
|
180
228
|
|
|
181
|
-
new Husky(this, huskyOptions)
|
|
229
|
+
this.husky = new Husky(this, huskyOptions)
|
|
230
|
+
|
|
231
|
+
this.package?.addDevDeps('husky@9.0.11')
|
|
232
|
+
this.package?.setScript('prepare', 'husky')
|
|
233
|
+
this.tryFindObjectFile('package.json')?.addDeletionOverride('pnpm')
|
|
182
234
|
}
|
|
183
235
|
|
|
184
236
|
#configureLintSynthesized({ lintSynthesizedOptions }: ProjectOptions) {
|
|
185
237
|
new LintSynthesized(
|
|
186
238
|
this,
|
|
187
239
|
lintSynthesizedOptions ?? {
|
|
240
|
+
'package.json': 'pnpx sort-package-json',
|
|
188
241
|
'*.{js,jsx,ts,tsx}': 'pnpm eslint --fix',
|
|
189
242
|
'*': 'pnpm prettier --write --ignore-unknown',
|
|
190
243
|
},
|
|
191
244
|
)
|
|
192
245
|
}
|
|
193
246
|
|
|
247
|
+
#configurePackage({ package: pkg }: ProjectOptions) {
|
|
248
|
+
if (!pkg) {
|
|
249
|
+
return
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const defaults: javascript.NodePackageOptions = {
|
|
253
|
+
entrypoint: 'src/index.ts',
|
|
254
|
+
packageManager: javascript.NodePackageManager.PNPM,
|
|
255
|
+
minNodeVersion: '20.12.0',
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
this.package = new javascript.NodePackage(this, deepMerge(defaults, pkg))
|
|
259
|
+
|
|
260
|
+
if (!this.parent) {
|
|
261
|
+
this.package.addDevDeps('@langri-sha/projen-project@*')
|
|
262
|
+
this.package.addDevDeps('projen@0.81.15')
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
this.package.removeScript('start')
|
|
266
|
+
this.package.removeScript('test')
|
|
267
|
+
|
|
268
|
+
if (this.parent) {
|
|
269
|
+
this.package.removeScript('default')
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
#configureProjenrc() {
|
|
274
|
+
if (this.parent) {
|
|
275
|
+
return
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
this.projenrc = new ProjenrcFile(this, {})
|
|
279
|
+
}
|
|
280
|
+
|
|
194
281
|
#configureRenovate({ renovateOptions }: ProjectOptions) {
|
|
195
|
-
if (!renovateOptions) {
|
|
282
|
+
if (!renovateOptions || this.parent) {
|
|
196
283
|
return
|
|
197
284
|
}
|
|
198
285
|
|
|
@@ -201,26 +288,63 @@ export class Project extends BaseProject {
|
|
|
201
288
|
extends: ['config:recommended'],
|
|
202
289
|
labels: ['dependencies'],
|
|
203
290
|
reviewersFromCodeOwners: true,
|
|
291
|
+
customManagers: [
|
|
292
|
+
{
|
|
293
|
+
customType: 'regex',
|
|
294
|
+
datasourceTemplate: 'npm',
|
|
295
|
+
fileMatch: ['\\.?projen.*.(js|cjs|mjs|ts|mts|cts)$'],
|
|
296
|
+
matchStrings: [
|
|
297
|
+
"\\.(?<depType>addDep|addDevDep|addPeerDep)\\('(?<depName>[a-zA-Z0-9-]+)@(?<currentValue>[^']+)'\\)",
|
|
298
|
+
],
|
|
299
|
+
depTypeTemplate:
|
|
300
|
+
"{{#if (equals depType 'addDevDep')}}devDependencies{{else if (equals depType 'addPeerDep')}}peerDependencies{{else}}dependencies{{/if}}",
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
customType: 'regex',
|
|
304
|
+
datasourceTemplate: 'npm',
|
|
305
|
+
fileMatch: ['\\.?projen.*.(js|cjs|mjs|ts|mts|cts)$'],
|
|
306
|
+
matchStrings: ["pnpm@(?<currentValue>[^']+)"],
|
|
307
|
+
depNameTemplate: 'pnpm',
|
|
308
|
+
depTypeTemplate: 'dependencies',
|
|
309
|
+
},
|
|
310
|
+
],
|
|
204
311
|
}
|
|
205
312
|
|
|
206
|
-
new Renovate(this, deepMerge(defaults, renovateOptions))
|
|
313
|
+
this.renovate = new Renovate(this, deepMerge(defaults, renovateOptions))
|
|
207
314
|
}
|
|
208
315
|
|
|
209
|
-
#configureTypeScript({ typeScriptConfigOptions }: ProjectOptions) {
|
|
316
|
+
#configureTypeScript({ parent, typeScriptConfigOptions }: ProjectOptions) {
|
|
210
317
|
if (!typeScriptConfigOptions) {
|
|
211
318
|
return
|
|
212
319
|
}
|
|
213
320
|
|
|
214
|
-
const defaults: TypeScriptConfigOptions =
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
321
|
+
const defaults: TypeScriptConfigOptions = parent
|
|
322
|
+
? {
|
|
323
|
+
config: {
|
|
324
|
+
extends: '@langri-sha/tsconfig/project.json',
|
|
325
|
+
compilerOptions: {
|
|
326
|
+
baseUrl: '.',
|
|
327
|
+
outDir: '.tsbuild',
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
}
|
|
331
|
+
: {
|
|
332
|
+
config: {
|
|
333
|
+
extends: '@langri-sha/tsconfig',
|
|
334
|
+
},
|
|
335
|
+
}
|
|
219
336
|
|
|
220
337
|
this.typeScriptConfig = new TypeScriptConfig(
|
|
221
338
|
this,
|
|
222
339
|
deepMerge(defaults, typeScriptConfigOptions),
|
|
223
340
|
)
|
|
341
|
+
|
|
342
|
+
if (!this.parent) {
|
|
343
|
+
this.package?.addDevDeps('typescript@5.4.5')
|
|
344
|
+
this.package?.addDevDeps('ts-node@10.9.2')
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
this.package?.addDevDeps('@langri-sha/tsconfig@*')
|
|
224
348
|
}
|
|
225
349
|
|
|
226
350
|
#createPnpmWorkspaces({ workspaces }: ProjectOptions) {
|
|
@@ -242,11 +366,15 @@ const getGitIgnoreOptions = ({
|
|
|
242
366
|
huskyOptions,
|
|
243
367
|
typeScriptConfigOptions,
|
|
244
368
|
withTerraform,
|
|
369
|
+
parent,
|
|
370
|
+
gitIgnoreOptions,
|
|
245
371
|
...options
|
|
246
|
-
}: ProjectOptions): ProjectOptions['gitIgnoreOptions'] =>
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
372
|
+
}: ProjectOptions): ProjectOptions['gitIgnoreOptions'] =>
|
|
373
|
+
parent
|
|
374
|
+
? gitIgnoreOptions
|
|
375
|
+
: {
|
|
376
|
+
ignorePatterns: [
|
|
377
|
+
...`
|
|
250
378
|
.*
|
|
251
379
|
!.babelrc
|
|
252
380
|
!.dockerignore
|
|
@@ -257,7 +385,6 @@ const getGitIgnoreOptions = ({
|
|
|
257
385
|
!.npmignore
|
|
258
386
|
!.openssl
|
|
259
387
|
!.prettierignore
|
|
260
|
-
!.projenrc*
|
|
261
388
|
${withTerraform ? '!.terraform.lock.hcl' : ''}
|
|
262
389
|
*.db
|
|
263
390
|
*.log
|
|
@@ -269,11 +396,11 @@ const getGitIgnoreOptions = ({
|
|
|
269
396
|
${options.workspaces?.map((workspace) => `${workspace}/lib/`).join('\n') ?? ''}
|
|
270
397
|
node_modules/
|
|
271
398
|
`
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
399
|
+
.split('\n')
|
|
400
|
+
.map((pattern) => pattern.trim())
|
|
401
|
+
.filter((pattern) => pattern.length > 0),
|
|
402
|
+
...(gitIgnoreOptions?.ignorePatterns ?? []),
|
|
403
|
+
],
|
|
404
|
+
}
|
|
278
405
|
|
|
279
406
|
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
|
+
}
|