@aws/nx-plugin 0.0.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/README.md +63 -0
- package/generators.json +52 -0
- package/package.json +27 -0
- package/src/cloudscape-website/app/README.md +253 -0
- package/src/cloudscape-website/app/__snapshots__/generator.spec.ts.snap +539 -0
- package/src/cloudscape-website/app/files/app/src/config.ts.template +4 -0
- package/src/cloudscape-website/app/files/app/src/layouts/App/index.tsx.template +132 -0
- package/src/cloudscape-website/app/files/app/src/layouts/App/navitems.ts.template +8 -0
- package/src/cloudscape-website/app/files/app/src/layouts/Routes/index.tsx.template +18 -0
- package/src/cloudscape-website/app/files/app/src/main.tsx.template +22 -0
- package/src/cloudscape-website/app/files/app/src/pages/Home/index.tsx.template +25 -0
- package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/cloudfront-web-acl.ts.template +317 -0
- package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/index.ts.template +4 -0
- package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/static-website.ts.template +237 -0
- package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/webacl_event_handler/index.ts.template +301 -0
- package/src/cloudscape-website/app/files/e2e/cypress/src/e2e/app.cy.ts.template +13 -0
- package/src/cloudscape-website/app/files/e2e/cypress/src/support/app.po.ts.template +1 -0
- package/src/cloudscape-website/app/files/e2e/playwright/src/example.spec.ts.template +6 -0
- package/src/cloudscape-website/app/generator.d.ts +4 -0
- package/src/cloudscape-website/app/generator.js +177 -0
- package/src/cloudscape-website/app/generator.js.map +1 -0
- package/src/cloudscape-website/app/schema.d.js +6 -0
- package/src/cloudscape-website/app/schema.d.js.map +1 -0
- package/src/cloudscape-website/app/schema.d.ts +35 -0
- package/src/cloudscape-website/app/schema.json +189 -0
- package/src/cloudscape-website/cognito-auth/README.md +172 -0
- package/src/cloudscape-website/cognito-auth/__snapshots__/generator.spec.ts.snap +238 -0
- package/src/cloudscape-website/cognito-auth/files/app/components/CognitoAuth/index.tsx.template +50 -0
- package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/index.ts.template +4 -0
- package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/user-identity.ts.template +69 -0
- package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/userpool-with-mfa.ts.template +70 -0
- package/src/cloudscape-website/cognito-auth/generator.d.ts +4 -0
- package/src/cloudscape-website/cognito-auth/generator.js +100 -0
- package/src/cloudscape-website/cognito-auth/generator.js.map +1 -0
- package/src/cloudscape-website/cognito-auth/schema.d.js +6 -0
- package/src/cloudscape-website/cognito-auth/schema.d.js.map +1 -0
- package/src/cloudscape-website/cognito-auth/schema.d.ts +4 -0
- package/src/cloudscape-website/cognito-auth/schema.json +36 -0
- package/src/cloudscape-website/runtime-config/__snapshots__/generator.spec.ts.snap +112 -0
- package/src/cloudscape-website/runtime-config/files/app/components/RuntimeConfig/index.tsx.template +46 -0
- package/src/cloudscape-website/runtime-config/generator.d.ts +4 -0
- package/src/cloudscape-website/runtime-config/generator.js +74 -0
- package/src/cloudscape-website/runtime-config/generator.js.map +1 -0
- package/src/cloudscape-website/runtime-config/schema.d.js +6 -0
- package/src/cloudscape-website/runtime-config/schema.d.js.map +1 -0
- package/src/cloudscape-website/runtime-config/schema.d.ts +3 -0
- package/src/cloudscape-website/runtime-config/schema.json +19 -0
- package/src/gitlab/files/.gitlab-ci.yml.template +26 -0
- package/src/gitlab/generator.d.ts +4 -0
- package/src/gitlab/generator.js +26 -0
- package/src/gitlab/generator.js.map +1 -0
- package/src/gitlab/schema.d.js +6 -0
- package/src/gitlab/schema.d.js.map +1 -0
- package/src/gitlab/schema.d.ts +5 -0
- package/src/gitlab/schema.json +52 -0
- package/src/index.d.ts +0 -0
- package/src/index.js +3 -0
- package/src/index.js.map +1 -0
- package/src/infra/app/README.md +175 -0
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +864 -0
- package/src/infra/app/files/cdk.json +67 -0
- package/src/infra/app/files/src/main.ts.template +37 -0
- package/src/infra/app/files/src/stacks/application-stack.ts.template +10 -0
- package/src/infra/app/generator.d.ts +4 -0
- package/src/infra/app/generator.js +75 -0
- package/src/infra/app/generator.js.map +1 -0
- package/src/infra/app/schema.d.js +6 -0
- package/src/infra/app/schema.d.js.map +1 -0
- package/src/infra/app/schema.d.ts +6 -0
- package/src/infra/app/schema.json +35 -0
- package/src/trpc/backend/README.md +549 -0
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +110 -0
- package/src/trpc/backend/files/backend/src/index.ts.template +1 -0
- package/src/trpc/backend/files/backend/src/lambdas/index.ts.template +1 -0
- package/src/trpc/backend/files/backend/src/lambdas/middleware.ts.template +146 -0
- package/src/trpc/backend/files/backend/src/lambdas/router.ts.template +36 -0
- package/src/trpc/backend/files/common/constructs/src/__apiNameKebabCase__/index.ts.template +64 -0
- package/src/trpc/backend/files/schema/src/index.ts.template +7 -0
- package/src/trpc/backend/generator.d.ts +4 -0
- package/src/trpc/backend/generator.js +128 -0
- package/src/trpc/backend/generator.js.map +1 -0
- package/src/trpc/backend/schema.d.js +6 -0
- package/src/trpc/backend/schema.d.js.map +1 -0
- package/src/trpc/backend/schema.d.ts +8 -0
- package/src/trpc/backend/schema.json +44 -0
- package/src/trpc/react/README.md +320 -0
- package/src/trpc/react/__snapshots__/generator.spec.ts.snap +98 -0
- package/src/trpc/react/files/src/components/TRPCClientProvider/index.tsx.template +34 -0
- package/src/trpc/react/files/src/hooks/useTrpc.tsx.template +5 -0
- package/src/trpc/react/generator.d.ts +4 -0
- package/src/trpc/react/generator.js +81 -0
- package/src/trpc/react/generator.js.map +1 -0
- package/src/trpc/react/schema.d.js +6 -0
- package/src/trpc/react/schema.d.js.map +1 -0
- package/src/trpc/react/schema.d.ts +5 -0
- package/src/trpc/react/schema.json +32 -0
- package/src/ts/cjs-to-esm/generator.d.ts +8 -0
- package/src/ts/cjs-to-esm/generator.js +201 -0
- package/src/ts/cjs-to-esm/generator.js.map +1 -0
- package/src/ts/cjs-to-esm/schema.d.js +6 -0
- package/src/ts/cjs-to-esm/schema.d.js.map +1 -0
- package/src/ts/cjs-to-esm/schema.d.ts +5 -0
- package/src/ts/cjs-to-esm/schema.json +28 -0
- package/src/ts/lib/README.md +149 -0
- package/src/ts/lib/__snapshots__/generator.spec.ts.snap +260 -0
- package/src/ts/lib/eslint.d.ts +3 -0
- package/src/ts/lib/eslint.js +41 -0
- package/src/ts/lib/eslint.js.map +1 -0
- package/src/ts/lib/files/src/index.ts.template +3 -0
- package/src/ts/lib/generator.d.ts +21 -0
- package/src/ts/lib/generator.js +61 -0
- package/src/ts/lib/generator.js.map +1 -0
- package/src/ts/lib/schema.d.js +6 -0
- package/src/ts/lib/schema.d.js.map +1 -0
- package/src/ts/lib/schema.d.ts +13 -0
- package/src/ts/lib/schema.json +46 -0
- package/src/ts/lib/ts-project-utils.d.ts +6 -0
- package/src/ts/lib/ts-project-utils.js +107 -0
- package/src/ts/lib/ts-project-utils.js.map +1 -0
- package/src/ts/lib/types.d.ts +10 -0
- package/src/ts/lib/types.js +6 -0
- package/src/ts/lib/types.js.map +1 -0
- package/src/ts/lib/vitest.d.ts +3 -0
- package/src/ts/lib/vitest.js +67 -0
- package/src/ts/lib/vitest.js.map +1 -0
- package/src/utils/files/common/constructs/src/index.ts.template +1 -0
- package/src/utils/files/common/constructs/src/runtime-config/index.ts.template +1 -0
- package/src/utils/files/common/constructs/src/runtime-config/runtime-config.ts.template +33 -0
- package/src/utils/files/common/types/src/index.ts.template +1 -0
- package/src/utils/files/common/types/src/runtime-config.ts.template +13 -0
- package/src/utils/npm-scope.d.ts +7 -0
- package/src/utils/npm-scope.js +37 -0
- package/src/utils/npm-scope.js.map +1 -0
- package/src/utils/paths.d.ts +3 -0
- package/src/utils/paths.js +32 -0
- package/src/utils/paths.js.map +1 -0
- package/src/utils/shared-constructs.d.ts +7 -0
- package/src/utils/shared-constructs.js +72 -0
- package/src/utils/shared-constructs.js.map +1 -0
- package/src/utils/versions.d.ts +31 -0
- package/src/utils/versions.js +49 -0
- package/src/utils/versions.js.map +1 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`ts lib generator > should generate library with custom directory > custom-dir-index.ts 1`] = `
|
|
4
|
+
"export function hello() {
|
|
5
|
+
return "Hello!";
|
|
6
|
+
}
|
|
7
|
+
"
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
exports[`ts lib generator > should generate library with custom directory > custom-dir-project.json 1`] = `
|
|
11
|
+
"{
|
|
12
|
+
"name": "@proj/test-lib",
|
|
13
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
14
|
+
"sourceRoot": "libs/test-lib/src",
|
|
15
|
+
"projectType": "library",
|
|
16
|
+
"tags": [],
|
|
17
|
+
"targets": {
|
|
18
|
+
"build": {
|
|
19
|
+
"dependsOn": [
|
|
20
|
+
"compile",
|
|
21
|
+
"lint",
|
|
22
|
+
"test"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"lint": {
|
|
26
|
+
"executor": "@nx/eslint:lint"
|
|
27
|
+
},
|
|
28
|
+
"test": {
|
|
29
|
+
"executor": "@nx/vite:test",
|
|
30
|
+
"outputs": [
|
|
31
|
+
"{options.reportsDirectory}"
|
|
32
|
+
],
|
|
33
|
+
"options": {
|
|
34
|
+
"reportsDirectory": "../../coverage/libs/test-lib"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"compile": {
|
|
38
|
+
"executor": "@nx/js:tsc",
|
|
39
|
+
"outputs": [
|
|
40
|
+
"{options.outputPath}"
|
|
41
|
+
],
|
|
42
|
+
"options": {
|
|
43
|
+
"outputPath": "dist/libs/test-lib",
|
|
44
|
+
"main": "libs/test-lib/src/index.ts",
|
|
45
|
+
"tsConfig": "libs/test-lib/tsconfig.lib.json",
|
|
46
|
+
"assets": [
|
|
47
|
+
"libs/test-lib/*.md"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
"
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
exports[`ts lib generator > should generate library with custom directory > custom-dir-tsconfig.json 1`] = `
|
|
57
|
+
"{
|
|
58
|
+
"extends": "../../tsconfig.base.json",
|
|
59
|
+
"compilerOptions": {},
|
|
60
|
+
"files": [],
|
|
61
|
+
"include": [],
|
|
62
|
+
"references": [
|
|
63
|
+
{
|
|
64
|
+
"path": "./tsconfig.lib.json"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"path": "./tsconfig.spec.json"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
"
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
exports[`ts lib generator > should generate library with custom scope > scoped-project.json 1`] = `
|
|
75
|
+
"{
|
|
76
|
+
"name": "@custom/test-lib",
|
|
77
|
+
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
|
78
|
+
"sourceRoot": "test-lib/src",
|
|
79
|
+
"projectType": "library",
|
|
80
|
+
"tags": [],
|
|
81
|
+
"targets": {
|
|
82
|
+
"build": {
|
|
83
|
+
"dependsOn": [
|
|
84
|
+
"compile",
|
|
85
|
+
"lint",
|
|
86
|
+
"test"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"lint": {
|
|
90
|
+
"executor": "@nx/eslint:lint"
|
|
91
|
+
},
|
|
92
|
+
"test": {
|
|
93
|
+
"executor": "@nx/vite:test",
|
|
94
|
+
"outputs": [
|
|
95
|
+
"{options.reportsDirectory}"
|
|
96
|
+
],
|
|
97
|
+
"options": {
|
|
98
|
+
"reportsDirectory": "../coverage/test-lib"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"compile": {
|
|
102
|
+
"executor": "@nx/js:tsc",
|
|
103
|
+
"outputs": [
|
|
104
|
+
"{options.outputPath}"
|
|
105
|
+
],
|
|
106
|
+
"options": {
|
|
107
|
+
"outputPath": "dist/test-lib",
|
|
108
|
+
"main": "test-lib/src/index.ts",
|
|
109
|
+
"tsConfig": "test-lib/tsconfig.lib.json",
|
|
110
|
+
"assets": [
|
|
111
|
+
"test-lib/*.md"
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
"
|
|
118
|
+
`;
|
|
119
|
+
|
|
120
|
+
exports[`ts lib generator > should generate library with default options > index.ts 1`] = `
|
|
121
|
+
"export function hello() {
|
|
122
|
+
return "Hello!";
|
|
123
|
+
}
|
|
124
|
+
"
|
|
125
|
+
`;
|
|
126
|
+
|
|
127
|
+
exports[`ts lib generator > should generate library with default options > project.json 1`] = `
|
|
128
|
+
"{
|
|
129
|
+
"name": "@proj/test-lib",
|
|
130
|
+
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
|
131
|
+
"sourceRoot": "test-lib/src",
|
|
132
|
+
"projectType": "library",
|
|
133
|
+
"tags": [],
|
|
134
|
+
"targets": {
|
|
135
|
+
"build": {
|
|
136
|
+
"dependsOn": [
|
|
137
|
+
"compile",
|
|
138
|
+
"lint",
|
|
139
|
+
"test"
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
"lint": {
|
|
143
|
+
"executor": "@nx/eslint:lint"
|
|
144
|
+
},
|
|
145
|
+
"test": {
|
|
146
|
+
"executor": "@nx/vite:test",
|
|
147
|
+
"outputs": [
|
|
148
|
+
"{options.reportsDirectory}"
|
|
149
|
+
],
|
|
150
|
+
"options": {
|
|
151
|
+
"reportsDirectory": "../coverage/test-lib"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"compile": {
|
|
155
|
+
"executor": "@nx/js:tsc",
|
|
156
|
+
"outputs": [
|
|
157
|
+
"{options.outputPath}"
|
|
158
|
+
],
|
|
159
|
+
"options": {
|
|
160
|
+
"outputPath": "dist/test-lib",
|
|
161
|
+
"main": "test-lib/src/index.ts",
|
|
162
|
+
"tsConfig": "test-lib/tsconfig.lib.json",
|
|
163
|
+
"assets": [
|
|
164
|
+
"test-lib/*.md"
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
"
|
|
171
|
+
`;
|
|
172
|
+
|
|
173
|
+
exports[`ts lib generator > should generate library with default options > tsconfig.json 1`] = `
|
|
174
|
+
"{
|
|
175
|
+
"extends": "../tsconfig.base.json",
|
|
176
|
+
"compilerOptions": {},
|
|
177
|
+
"files": [],
|
|
178
|
+
"include": [],
|
|
179
|
+
"references": [
|
|
180
|
+
{
|
|
181
|
+
"path": "./tsconfig.lib.json"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"path": "./tsconfig.spec.json"
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
"
|
|
189
|
+
`;
|
|
190
|
+
|
|
191
|
+
exports[`ts lib generator > should generate library with subdirectory > subdir-index.ts 1`] = `
|
|
192
|
+
"export function hello() {
|
|
193
|
+
return "Hello!";
|
|
194
|
+
}
|
|
195
|
+
"
|
|
196
|
+
`;
|
|
197
|
+
|
|
198
|
+
exports[`ts lib generator > should generate library with subdirectory > subdir-project.json 1`] = `
|
|
199
|
+
"{
|
|
200
|
+
"name": "@proj/test-lib",
|
|
201
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
202
|
+
"sourceRoot": "feature/test-lib/src",
|
|
203
|
+
"projectType": "library",
|
|
204
|
+
"tags": [],
|
|
205
|
+
"targets": {
|
|
206
|
+
"build": {
|
|
207
|
+
"dependsOn": [
|
|
208
|
+
"compile",
|
|
209
|
+
"lint",
|
|
210
|
+
"test"
|
|
211
|
+
]
|
|
212
|
+
},
|
|
213
|
+
"lint": {
|
|
214
|
+
"executor": "@nx/eslint:lint"
|
|
215
|
+
},
|
|
216
|
+
"test": {
|
|
217
|
+
"executor": "@nx/vite:test",
|
|
218
|
+
"outputs": [
|
|
219
|
+
"{options.reportsDirectory}"
|
|
220
|
+
],
|
|
221
|
+
"options": {
|
|
222
|
+
"reportsDirectory": "../../coverage/feature/test-lib"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"compile": {
|
|
226
|
+
"executor": "@nx/js:tsc",
|
|
227
|
+
"outputs": [
|
|
228
|
+
"{options.outputPath}"
|
|
229
|
+
],
|
|
230
|
+
"options": {
|
|
231
|
+
"outputPath": "dist/feature/test-lib",
|
|
232
|
+
"main": "feature/test-lib/src/index.ts",
|
|
233
|
+
"tsConfig": "feature/test-lib/tsconfig.lib.json",
|
|
234
|
+
"assets": [
|
|
235
|
+
"feature/test-lib/*.md"
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
"
|
|
242
|
+
`;
|
|
243
|
+
|
|
244
|
+
exports[`ts lib generator > should generate library with subdirectory > subdir-tsconfig.json 1`] = `
|
|
245
|
+
"{
|
|
246
|
+
"extends": "../../tsconfig.base.json",
|
|
247
|
+
"compilerOptions": {},
|
|
248
|
+
"files": [],
|
|
249
|
+
"include": [],
|
|
250
|
+
"references": [
|
|
251
|
+
{
|
|
252
|
+
"path": "./tsconfig.lib.json"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"path": "./tsconfig.spec.json"
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
"
|
|
260
|
+
`;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "configureEslint", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return configureEslint;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _extends = require("@swc/helpers/_/_extends");
|
|
12
|
+
const _devkit = require("@nx/devkit");
|
|
13
|
+
const configureEslint = (tree, options)=>{
|
|
14
|
+
// Configure the lint task
|
|
15
|
+
const projectConfiguration = (0, _devkit.readProjectConfiguration)(tree, options.fullyQualifiedName);
|
|
16
|
+
if (!projectConfiguration.targets.lint) {
|
|
17
|
+
projectConfiguration.targets.lint = {
|
|
18
|
+
executor: "@nx/eslint:lint",
|
|
19
|
+
options: {
|
|
20
|
+
fix: true
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
(0, _devkit.updateProjectConfiguration)(tree, options.fullyQualifiedName, projectConfiguration);
|
|
24
|
+
}
|
|
25
|
+
const nxJson = (0, _devkit.readNxJson)(tree);
|
|
26
|
+
var _nxJson_targetDefaults;
|
|
27
|
+
(0, _devkit.updateNxJson)(tree, _extends._({}, nxJson, {
|
|
28
|
+
targetDefaults: _extends._({}, (_nxJson_targetDefaults = nxJson.targetDefaults) != null ? _nxJson_targetDefaults : {}, {
|
|
29
|
+
lint: {
|
|
30
|
+
cache: true,
|
|
31
|
+
inputs: [
|
|
32
|
+
'default',
|
|
33
|
+
'{workspaceRoot}/eslint.config.js',
|
|
34
|
+
'{projectRoot}/eslint.config.js'
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=eslint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/eslint.ts"],"sourcesContent":["import { readProjectConfiguration, Tree, updateProjectConfiguration, updateNxJson, readNxJson } from \"@nx/devkit\";\nimport { ConfigureProjectOptions } from \"./types\";\n\n\nexport const configureEslint = (tree: Tree, options: ConfigureProjectOptions) => {\n // Configure the lint task\n const projectConfiguration = readProjectConfiguration(tree, options.fullyQualifiedName);\n if (!projectConfiguration.targets.lint) {\n projectConfiguration.targets.lint = {\n executor: \"@nx/eslint:lint\",\n options: {\n fix: true,\n },\n }\n\n updateProjectConfiguration(tree, options.fullyQualifiedName, projectConfiguration);\n }\n\n const nxJson = readNxJson(tree);\n updateNxJson(tree, {\n ...nxJson,\n targetDefaults: {\n ...(nxJson.targetDefaults ?? {}),\n lint: {\n cache: true,\n inputs: [\n 'default',\n '{workspaceRoot}/eslint.config.js',\n '{projectRoot}/eslint.config.js',\n ],\n },\n },\n })\n}\n"],"names":["configureEslint","tree","options","projectConfiguration","readProjectConfiguration","fullyQualifiedName","targets","lint","executor","fix","updateProjectConfiguration","nxJson","readNxJson","updateNxJson","targetDefaults","cache","inputs"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAIaA;;;eAAAA;;;;wBAJwF;AAI9F,MAAMA,kBAAkB,CAACC,MAAYC;IAC1C,0BAA0B;IAC1B,MAAMC,uBAAuBC,IAAAA,gCAAwB,EAACH,MAAMC,QAAQG,kBAAkB;IACtF,IAAI,CAACF,qBAAqBG,OAAO,CAACC,IAAI,EAAE;QACtCJ,qBAAqBG,OAAO,CAACC,IAAI,GAAG;YAClCC,UAAU;YACVN,SAAS;gBACPO,KAAK;YACP;QACF;QAEAC,IAAAA,kCAA0B,EAACT,MAAMC,QAAQG,kBAAkB,EAAEF;IAC/D;IAEA,MAAMQ,SAASC,IAAAA,kBAAU,EAACX;QAIlBU;IAHRE,IAAAA,oBAAY,EAACZ,MAAM,eACdU;QACHG,gBAAgB,eACVH,CAAAA,yBAAAA,OAAOG,cAAc,YAArBH,yBAAyB,CAAC;YAC9BJ,MAAM;gBACJQ,OAAO;gBACPC,QAAQ;oBACN;oBACA;oBACA;iBACD;YACH;;;AAGN"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GeneratorCallback, Tree } from "@nx/devkit";
|
|
2
|
+
import { TsLibGeneratorSchema } from "./schema";
|
|
3
|
+
export interface TsLibDetails {
|
|
4
|
+
/**
|
|
5
|
+
* Full package name including scope (eg @foo/bar)
|
|
6
|
+
*/
|
|
7
|
+
readonly fullyQualifiedName: string;
|
|
8
|
+
/**
|
|
9
|
+
* Directory of the library relative to the root
|
|
10
|
+
*/
|
|
11
|
+
readonly dir: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Returns details about the TS library to be created
|
|
15
|
+
*/
|
|
16
|
+
export declare const getTsLibDetails: (tree: Tree, schema: TsLibGeneratorSchema) => TsLibDetails;
|
|
17
|
+
/**
|
|
18
|
+
* Generates a typescript library
|
|
19
|
+
*/
|
|
20
|
+
export declare const tsLibGenerator: (tree: Tree, schema: TsLibGeneratorSchema) => Promise<GeneratorCallback>;
|
|
21
|
+
export default tsLibGenerator;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
default: function() {
|
|
13
|
+
return _default;
|
|
14
|
+
},
|
|
15
|
+
getTsLibDetails: function() {
|
|
16
|
+
return getTsLibDetails;
|
|
17
|
+
},
|
|
18
|
+
tsLibGenerator: function() {
|
|
19
|
+
return tsLibGenerator;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _extends = require("@swc/helpers/_/_extends");
|
|
23
|
+
const _devkit = require("@nx/devkit");
|
|
24
|
+
const _js = require("@nx/js");
|
|
25
|
+
const _npmscope = require("../../utils/npm-scope");
|
|
26
|
+
const _tsprojectutils = require("./ts-project-utils");
|
|
27
|
+
const getTsLibDetails = (tree, schema)=>{
|
|
28
|
+
const scope = schema.scope ? `${schema.scope}/` : (0, _npmscope.getNpmScopePrefix)(tree);
|
|
29
|
+
const fullyQualifiedName = `${scope}${schema.name}`;
|
|
30
|
+
var _schema_directory, _schema_subDirectory;
|
|
31
|
+
const dir = (0, _devkit.joinPathFragments)((_schema_directory = schema.directory) != null ? _schema_directory : '.', (_schema_subDirectory = schema.subDirectory) != null ? _schema_subDirectory : schema.name);
|
|
32
|
+
return {
|
|
33
|
+
dir,
|
|
34
|
+
fullyQualifiedName
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const tsLibGenerator = async (tree, schema)=>{
|
|
38
|
+
const { fullyQualifiedName, dir } = getTsLibDetails(tree, schema);
|
|
39
|
+
await (0, _js.libraryGenerator)(tree, _extends._({}, schema, {
|
|
40
|
+
name: fullyQualifiedName,
|
|
41
|
+
directory: dir,
|
|
42
|
+
projectNameAndRootFormat: 'as-provided',
|
|
43
|
+
skipPackageJson: true,
|
|
44
|
+
bundler: "tsc"
|
|
45
|
+
}));
|
|
46
|
+
// Replace with simpler sample source code
|
|
47
|
+
tree.delete((0, _devkit.joinPathFragments)(dir, 'src'));
|
|
48
|
+
(0, _devkit.generateFiles)(tree, (0, _devkit.joinPathFragments)(__dirname, 'files', 'src'), (0, _devkit.joinPathFragments)(dir, 'src'), {});
|
|
49
|
+
(0, _tsprojectutils.configureTsProject)(tree, {
|
|
50
|
+
dir,
|
|
51
|
+
fullyQualifiedName
|
|
52
|
+
});
|
|
53
|
+
return ()=>{
|
|
54
|
+
if (!schema.skipInstall) {
|
|
55
|
+
(0, _devkit.installPackagesTask)(tree);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const _default = tsLibGenerator;
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/generator.ts"],"sourcesContent":["import { GeneratorCallback, Tree, generateFiles, installPackagesTask, joinPathFragments } from \"@nx/devkit\";\nimport { TsLibGeneratorSchema } from \"./schema\";\nimport { libraryGenerator } from \"@nx/js\";\nimport { getNpmScopePrefix } from \"../../utils/npm-scope\";\nimport { configureTsProject } from \"./ts-project-utils\";\n\nexport interface TsLibDetails {\n /**\n * Full package name including scope (eg @foo/bar)\n */\n readonly fullyQualifiedName: string;\n /**\n * Directory of the library relative to the root\n */\n readonly dir: string;\n}\n\n/**\n * Returns details about the TS library to be created\n */\nexport const getTsLibDetails = (tree: Tree, schema: TsLibGeneratorSchema): TsLibDetails => {\n const scope = schema.scope ? `${schema.scope}/` : getNpmScopePrefix(tree);\n const fullyQualifiedName = `${scope}${schema.name}`;\n const dir = joinPathFragments(schema.directory ?? '.', schema.subDirectory ?? schema.name);\n\n return { dir, fullyQualifiedName };\n};\n\n/**\n * Generates a typescript library\n */\nexport const tsLibGenerator = async (tree: Tree, schema: TsLibGeneratorSchema): Promise<GeneratorCallback> => {\n const { fullyQualifiedName, dir } = getTsLibDetails(tree, schema);\n\n await libraryGenerator(tree, {\n ...schema,\n name: fullyQualifiedName,\n directory: dir,\n projectNameAndRootFormat: 'as-provided',\n skipPackageJson: true,\n bundler: \"tsc\", // TODO: consider supporting others\n });\n\n // Replace with simpler sample source code\n tree.delete(joinPathFragments(dir, 'src'));\n generateFiles(\n tree, \n joinPathFragments(__dirname, 'files', 'src'), \n joinPathFragments(dir, 'src'), \n {}\n );\n\n configureTsProject(tree, {\n dir,\n fullyQualifiedName,\n });\n\n return () => {\n if (!schema.skipInstall) {\n installPackagesTask(tree);\n }\n };\n};\n\nexport default tsLibGenerator;\n"],"names":["getTsLibDetails","tsLibGenerator","tree","schema","scope","getNpmScopePrefix","fullyQualifiedName","name","dir","joinPathFragments","directory","subDirectory","libraryGenerator","projectNameAndRootFormat","skipPackageJson","bundler","delete","generateFiles","__dirname","configureTsProject","skipInstall","installPackagesTask"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAgEA,OAA8B;eAA9B;;IA5CaA,eAAe;eAAfA;;IAWAC,cAAc;eAAdA;;;;wBA/BkF;oBAE9D;0BACC;gCACC;AAgB5B,MAAMD,kBAAkB,CAACE,MAAYC;IAC1C,MAAMC,QAAQD,OAAOC,KAAK,GAAG,CAAC,EAAED,OAAOC,KAAK,CAAC,CAAC,CAAC,GAAGC,IAAAA,2BAAiB,EAACH;IACpE,MAAMI,qBAAqB,CAAC,EAAEF,MAAM,EAAED,OAAOI,IAAI,CAAC,CAAC;QACrBJ,mBAAyBA;IAAvD,MAAMK,MAAMC,IAAAA,yBAAiB,EAACN,CAAAA,oBAAAA,OAAOO,SAAS,YAAhBP,oBAAoB,KAAKA,CAAAA,uBAAAA,OAAOQ,YAAY,YAAnBR,uBAAuBA,OAAOI,IAAI;IAEzF,OAAO;QAAEC;QAAKF;IAAmB;AACnC;AAKO,MAAML,iBAAiB,OAAOC,MAAYC;IAC/C,MAAM,EAAEG,kBAAkB,EAAEE,GAAG,EAAE,GAAGR,gBAAgBE,MAAMC;IAE1D,MAAMS,IAAAA,oBAAgB,EAACV,MAAM,eACxBC;QACHI,MAAMD;QACNI,WAAWF;QACXK,0BAA0B;QAC1BC,iBAAiB;QACjBC,SAAS;;IAGX,0CAA0C;IAC1Cb,KAAKc,MAAM,CAACP,IAAAA,yBAAiB,EAACD,KAAK;IACnCS,IAAAA,qBAAa,EACXf,MACAO,IAAAA,yBAAiB,EAACS,WAAW,SAAS,QACtCT,IAAAA,yBAAiB,EAACD,KAAK,QACvB,CAAC;IAGHW,IAAAA,kCAAkB,EAACjB,MAAM;QACvBM;QACAF;IACF;IAEA,OAAO;QACL,IAAI,CAACH,OAAOiB,WAAW,EAAE;YACvBC,IAAAA,2BAAmB,EAACnB;QACtB;IACF;AACF;MAEA,WAAeD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/schema.d.ts"],"names":[],"rangeMappings":"","mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LibraryGeneratorSchema } from "@nx/js/src/utils/schema";
|
|
2
|
+
|
|
3
|
+
export interface TsLibGeneratorSchema {
|
|
4
|
+
name: LibraryGeneratorSchema['name'];
|
|
5
|
+
directory?: string;
|
|
6
|
+
unitTestRunner?: LibraryGeneratorSchema['unitTestRunner'];
|
|
7
|
+
// TODO: test and consider exposing alternate bundlers
|
|
8
|
+
// bundler?: LibraryGeneratorSchema['bundler'];
|
|
9
|
+
linter?: LibraryGeneratorSchema['linter'];
|
|
10
|
+
scope?: string;
|
|
11
|
+
subDirectory?: string;
|
|
12
|
+
skipInstall?: boolean;
|
|
13
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "TsLib",
|
|
4
|
+
"title": "Create a TypeScript Library",
|
|
5
|
+
"description": "Create a TypeScript Library.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "Library name.",
|
|
11
|
+
"x-priority": "important"
|
|
12
|
+
},
|
|
13
|
+
"directory": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Parent directory where the library is placed.",
|
|
16
|
+
"default": "packages",
|
|
17
|
+
"x-prompt": "Which directory do you want to create the library in?"
|
|
18
|
+
},
|
|
19
|
+
"linter": {
|
|
20
|
+
"description": "The tool to use for running lint checks.",
|
|
21
|
+
"type": "string",
|
|
22
|
+
"enum": ["none", "eslint"],
|
|
23
|
+
"default": "eslint",
|
|
24
|
+
"x-priority": "important"
|
|
25
|
+
},
|
|
26
|
+
"unitTestRunner": {
|
|
27
|
+
"description": "Test runner to use for unit tests.",
|
|
28
|
+
"type": "string",
|
|
29
|
+
"enum": ["none", "jest", "vitest"],
|
|
30
|
+
"default": "none",
|
|
31
|
+
"x-priority": "important"
|
|
32
|
+
},
|
|
33
|
+
"scope": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "Scope for your package, e.g. @my-company. If omitted this will be inferred",
|
|
36
|
+
"pattern": "^@[a-z0-9-]+(?:/[a-z0-9-]+)?$",
|
|
37
|
+
"x-prompt": "What namespace would you like your library to have? i.e: @myapi"
|
|
38
|
+
},
|
|
39
|
+
"subDirectory": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"description": "The sub directory the lib is placed in. By default this is the library name.",
|
|
42
|
+
"x-prompt": "Which sub directory do you want to create the library in? (By default this is the library name)"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": ["name"]
|
|
46
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "configureTsProject", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return configureTsProject;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _extends = require("@swc/helpers/_/_extends");
|
|
12
|
+
const _devkit = require("@nx/devkit");
|
|
13
|
+
const _path = require("path");
|
|
14
|
+
const _generator = require("../cjs-to-esm/generator");
|
|
15
|
+
const _npmscope = require("../../utils/npm-scope");
|
|
16
|
+
const _vitest = require("./vitest");
|
|
17
|
+
const _eslint = require("./eslint");
|
|
18
|
+
const configureTsProject = (tree, options)=>{
|
|
19
|
+
// Remove conflicting commonjs module from tsconfig
|
|
20
|
+
(0, _devkit.updateJson)(tree, (0, _path.join)(options.dir, "tsconfig.json"), (tsConfig)=>{
|
|
21
|
+
var _tsConfig_compilerOptions, _tsConfig_compilerOptions1;
|
|
22
|
+
return _extends._({}, tsConfig, {
|
|
23
|
+
compilerOptions: _extends._({}, tsConfig.compilerOptions, {
|
|
24
|
+
module: ((_tsConfig_compilerOptions = tsConfig.compilerOptions) == null ? void 0 : _tsConfig_compilerOptions.module) === "commonjs" ? undefined : (_tsConfig_compilerOptions1 = tsConfig.compilerOptions) == null ? void 0 : _tsConfig_compilerOptions1.module
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
const outDirToRootRelativePath = (0, _path.relative)((0, _path.join)(tree.root, options.dir), tree.root);
|
|
29
|
+
const distDir = (0, _path.join)(outDirToRootRelativePath, "dist", options.dir);
|
|
30
|
+
// Remove baseUrl and rootDir from the tsconfig.lib.json
|
|
31
|
+
if (tree.exists((0, _path.join)(options.dir, "tsconfig.lib.json"))) {
|
|
32
|
+
(0, _devkit.updateJson)(tree, (0, _path.join)(options.dir, "tsconfig.lib.json"), (tsConfig)=>_extends._({}, tsConfig, {
|
|
33
|
+
compilerOptions: _extends._({}, tsConfig.compilerOptions, {
|
|
34
|
+
baseUrl: undefined,
|
|
35
|
+
rootDir: undefined,
|
|
36
|
+
outDir: distDir,
|
|
37
|
+
tsBuildInfoFile: (0, _path.join)(distDir, "tsconfig.lib.tsbuildinfo")
|
|
38
|
+
}),
|
|
39
|
+
include: undefined
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
// Update root project tsconfig
|
|
43
|
+
(0, _devkit.updateJson)(tree, "tsconfig.base.json", (tsConfig)=>{
|
|
44
|
+
var _tsConfig_compilerOptions;
|
|
45
|
+
var _tsConfig_compilerOptions_paths;
|
|
46
|
+
return _extends._({}, tsConfig, {
|
|
47
|
+
compilerOptions: _extends._({}, tsConfig.compilerOptions, {
|
|
48
|
+
baseUrl: '.',
|
|
49
|
+
rootDir: '.',
|
|
50
|
+
paths: _extends._({}, Object.fromEntries(Object.entries((_tsConfig_compilerOptions_paths = (_tsConfig_compilerOptions = tsConfig.compilerOptions) == null ? void 0 : _tsConfig_compilerOptions.paths) != null ? _tsConfig_compilerOptions_paths : {}).filter(([k])=>k !== options.fullyQualifiedName)), {
|
|
51
|
+
// Add aliases which begin with colon (eg :foo/bar) to avoid sniping attacks
|
|
52
|
+
[(0, _npmscope.toScopeAlias)(options.fullyQualifiedName)]: [
|
|
53
|
+
(0, _devkit.joinPathFragments)(options.dir, 'src', 'index.ts'),
|
|
54
|
+
(0, _devkit.joinPathFragments)('dist', options.dir, 'src', 'index.d.ts')
|
|
55
|
+
]
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
if (tree.exists("tsconfig.json")) {
|
|
61
|
+
(0, _devkit.updateJson)(tree, "tsconfig.json", (tsConfig)=>{
|
|
62
|
+
var _tsConfig_references;
|
|
63
|
+
return _extends._({}, tsConfig, {
|
|
64
|
+
references: [
|
|
65
|
+
// Add project references, ensuring no duplication
|
|
66
|
+
...((_tsConfig_references = tsConfig.references) != null ? _tsConfig_references : []).filter((ref)=>ref.path !== `./${options.dir}`),
|
|
67
|
+
{
|
|
68
|
+
path: `./${options.dir}`
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
// Update the root package.json
|
|
75
|
+
(0, _devkit.updateJson)(tree, "package.json", (packageJson)=>_extends._({}, packageJson, {
|
|
76
|
+
type: "module"
|
|
77
|
+
}));
|
|
78
|
+
// Remove package.json if it exists
|
|
79
|
+
if (tree.exists((0, _path.join)(options.dir, "package.json"))) {
|
|
80
|
+
tree.delete((0, _path.join)(options.dir, "package.json"));
|
|
81
|
+
}
|
|
82
|
+
// Convert cjs files to esm for eslint configs and source code, including root monorepo config.
|
|
83
|
+
(0, _generator.cjsToEsm)(tree, '.', {
|
|
84
|
+
include: [
|
|
85
|
+
"eslint.config.js",
|
|
86
|
+
"**/eslint.config.js",
|
|
87
|
+
"**/src/**/*.ts"
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
// Build task should both test and lint, so move build to compile and compose build as compile + test + lint
|
|
91
|
+
const projectConfiguration = (0, _devkit.readProjectConfiguration)(tree, options.fullyQualifiedName);
|
|
92
|
+
if (projectConfiguration.targets.build && projectConfiguration.targets.build.executor === "@nx/js:tsc") {
|
|
93
|
+
projectConfiguration.targets.compile = projectConfiguration.targets.build;
|
|
94
|
+
projectConfiguration.targets.build = {
|
|
95
|
+
dependsOn: [
|
|
96
|
+
"compile",
|
|
97
|
+
"lint",
|
|
98
|
+
"test"
|
|
99
|
+
]
|
|
100
|
+
};
|
|
101
|
+
(0, _devkit.updateProjectConfiguration)(tree, options.fullyQualifiedName, projectConfiguration);
|
|
102
|
+
}
|
|
103
|
+
(0, _eslint.configureEslint)(tree, options);
|
|
104
|
+
(0, _vitest.configureVitest)(tree, options);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=ts-project-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/ts-project-utils.ts"],"sourcesContent":["import { joinPathFragments, readProjectConfiguration, Tree, updateJson, updateProjectConfiguration } from \"@nx/devkit\";\nimport { join, relative } from \"path\";\nimport { cjsToEsm } from \"../cjs-to-esm/generator\";\nimport { toScopeAlias } from \"../../utils/npm-scope\";\nimport { ConfigureProjectOptions } from \"./types\";\nimport { configureVitest } from \"./vitest\";\nimport { configureEslint } from \"./eslint\";\n\n/**\n * Updates typescript projects\n */\nexport const configureTsProject = (tree: Tree, options: ConfigureProjectOptions) => {\n // Remove conflicting commonjs module from tsconfig\n updateJson(tree, join(options.dir, \"tsconfig.json\"), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n module: tsConfig.compilerOptions?.module === \"commonjs\" ? undefined : tsConfig.compilerOptions?.module,\n },\n }));\n\n const outDirToRootRelativePath = relative(join(tree.root, options.dir), tree.root);\n const distDir = join(outDirToRootRelativePath, \"dist\", options.dir);\n\n // Remove baseUrl and rootDir from the tsconfig.lib.json\n if (tree.exists(join(options.dir, \"tsconfig.lib.json\"))) {\n updateJson(tree, join(options.dir, \"tsconfig.lib.json\"), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n baseUrl: undefined,\n rootDir: undefined,\n outDir: distDir,\n tsBuildInfoFile: join(distDir, \"tsconfig.lib.tsbuildinfo\"),\n },\n include: undefined,\n }));\n }\n\n // Update root project tsconfig\n updateJson(tree, \"tsconfig.base.json\", (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n baseUrl: '.',\n rootDir: '.',\n paths: {\n // Remove any path aliases for this project with the npm scope prefix (eg remove @foo/bar)\n ...Object.fromEntries(Object.entries(tsConfig.compilerOptions?.paths ?? {}).filter(([k]) => k !== options.fullyQualifiedName)),\n // Add aliases which begin with colon (eg :foo/bar) to avoid sniping attacks\n [toScopeAlias(options.fullyQualifiedName)]: [\n joinPathFragments(options.dir, 'src', 'index.ts'),\n joinPathFragments('dist', options.dir, 'src', 'index.d.ts'),\n ],\n },\n },\n }));\n\n if (tree.exists(\"tsconfig.json\")) {\n updateJson(tree, \"tsconfig.json\", (tsConfig) => ({\n ...tsConfig,\n references: [\n // Add project references, ensuring no duplication\n ...(tsConfig.references ?? []).filter(ref => ref.path !== `./${options.dir}`),\n {\n path: `./${options.dir}`,\n },\n ],\n }));\n }\n\n // Update the root package.json\n updateJson(tree, \"package.json\", (packageJson) => ({\n ...packageJson,\n type: \"module\",\n }));\n\n // Remove package.json if it exists\n if (tree.exists(join(options.dir, \"package.json\"))) {\n tree.delete(join(options.dir, \"package.json\"));\n }\n\n // Convert cjs files to esm for eslint configs and source code, including root monorepo config.\n cjsToEsm(tree, '.', {\n include: [\"eslint.config.js\", \"**/eslint.config.js\", \"**/src/**/*.ts\"],\n });\n\n // Build task should both test and lint, so move build to compile and compose build as compile + test + lint\n const projectConfiguration = readProjectConfiguration(tree, options.fullyQualifiedName);\n if (projectConfiguration.targets.build && projectConfiguration.targets.build.executor === \"@nx/js:tsc\") {\n projectConfiguration.targets.compile = projectConfiguration.targets.build;\n projectConfiguration.targets.build = {\n dependsOn: [\"compile\", \"lint\", \"test\"],\n };\n\n updateProjectConfiguration(tree, options.fullyQualifiedName, projectConfiguration);\n }\n\n configureEslint(tree, options);\n configureVitest(tree, options);\n};\n"],"names":["configureTsProject","tree","options","updateJson","join","dir","tsConfig","compilerOptions","module","undefined","outDirToRootRelativePath","relative","root","distDir","exists","baseUrl","rootDir","outDir","tsBuildInfoFile","include","paths","Object","fromEntries","entries","filter","k","fullyQualifiedName","toScopeAlias","joinPathFragments","references","ref","path","packageJson","type","delete","cjsToEsm","projectConfiguration","readProjectConfiguration","targets","build","executor","compile","dependsOn","updateProjectConfiguration","configureEslint","configureVitest"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/types.ts"],"names":[],"rangeMappings":"","mappings":""}
|