@fnd-platform/core 1.0.0-alpha.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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +166 -0
  3. package/lib/components/index.d.ts +22 -0
  4. package/lib/components/index.d.ts.map +1 -0
  5. package/lib/components/index.js +25 -0
  6. package/lib/components/index.js.map +1 -0
  7. package/lib/components/nx-config.d.ts +67 -0
  8. package/lib/components/nx-config.d.ts.map +1 -0
  9. package/lib/components/nx-config.js +102 -0
  10. package/lib/components/nx-config.js.map +1 -0
  11. package/lib/components/pnpm-workspace.d.ts +34 -0
  12. package/lib/components/pnpm-workspace.d.ts.map +1 -0
  13. package/lib/components/pnpm-workspace.js +34 -0
  14. package/lib/components/pnpm-workspace.js.map +1 -0
  15. package/lib/components/shared-eslint.d.ts +51 -0
  16. package/lib/components/shared-eslint.d.ts.map +1 -0
  17. package/lib/components/shared-eslint.js +72 -0
  18. package/lib/components/shared-eslint.js.map +1 -0
  19. package/lib/components/shared-prettier.d.ts +66 -0
  20. package/lib/components/shared-prettier.d.ts.map +1 -0
  21. package/lib/components/shared-prettier.js +36 -0
  22. package/lib/components/shared-prettier.js.map +1 -0
  23. package/lib/components/shared-typescript.d.ts +71 -0
  24. package/lib/components/shared-typescript.d.ts.map +1 -0
  25. package/lib/components/shared-typescript.js +51 -0
  26. package/lib/components/shared-typescript.js.map +1 -0
  27. package/lib/components/shared-vitest.d.ts +85 -0
  28. package/lib/components/shared-vitest.d.ts.map +1 -0
  29. package/lib/components/shared-vitest.js +76 -0
  30. package/lib/components/shared-vitest.js.map +1 -0
  31. package/lib/index.d.ts +14 -0
  32. package/lib/index.d.ts.map +1 -0
  33. package/lib/index.js +24 -0
  34. package/lib/index.js.map +1 -0
  35. package/lib/monorepo-project.d.ts +81 -0
  36. package/lib/monorepo-project.d.ts.map +1 -0
  37. package/lib/monorepo-project.js +151 -0
  38. package/lib/monorepo-project.js.map +1 -0
  39. package/lib/options.d.ts +92 -0
  40. package/lib/options.d.ts.map +1 -0
  41. package/lib/options.js +3 -0
  42. package/lib/options.js.map +1 -0
  43. package/package.json +49 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 fnd-platform contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,166 @@
1
+ # @fnd-platform/core
2
+
3
+ Core package for the fnd-platform toolkit, providing Projen project classes for scaffolding production-ready monorepo projects.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -D @fnd-platform/core projen
9
+ # or
10
+ pnpm add -D @fnd-platform/core projen
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ Create a `.projenrc.ts` file in your project root:
16
+
17
+ ```typescript
18
+ import { FndMonorepoProject } from '@fnd-platform/core';
19
+
20
+ const project = new FndMonorepoProject({
21
+ name: 'my-app',
22
+ defaultReleaseBranch: 'main',
23
+ });
24
+
25
+ project.synth();
26
+ ```
27
+
28
+ Run Projen to generate all configuration files:
29
+
30
+ ```bash
31
+ npx projen
32
+ ```
33
+
34
+ ## What Gets Generated
35
+
36
+ Running synthesis with `FndMonorepoProject` generates:
37
+
38
+ - `package.json` - Root package with workspace scripts
39
+ - `pnpm-workspace.yaml` - pnpm workspace configuration
40
+ - `nx.json` - NX build orchestration with caching
41
+ - `tsconfig.base.json` - Shared TypeScript configuration
42
+ - `.eslintrc.js` - Shared ESLint configuration
43
+ - `.prettierrc` - Shared Prettier configuration
44
+ - `vitest.config.ts` - Vitest test configuration
45
+ - `.gitignore` - Standard git ignores
46
+ - `packages/` - Directory for workspace packages
47
+
48
+ ## Configuration Options
49
+
50
+ ```typescript
51
+ interface FndMonorepoProjectOptions {
52
+ // Required
53
+ name: string; // Project name
54
+ defaultReleaseBranch: string; // Default branch for releases
55
+
56
+ // Optional
57
+ workspacePackages?: string[]; // Package directories (default: ['packages/*'])
58
+ nxCache?: boolean; // Enable NX caching (default: true)
59
+ nxCacheableOperations?: string[]; // Operations to cache (default: ['build', 'test', 'lint'])
60
+ description?: string; // Project description
61
+ repository?: string; // Git repository URL
62
+ authorName?: string; // Author name
63
+ authorEmail?: string; // Author email
64
+ }
65
+ ```
66
+
67
+ ## Examples
68
+
69
+ ### Custom Workspace Layout
70
+
71
+ ```typescript
72
+ const project = new FndMonorepoProject({
73
+ name: 'my-app',
74
+ defaultReleaseBranch: 'main',
75
+ workspacePackages: ['packages/*', 'apps/*', 'tools/*'],
76
+ });
77
+ ```
78
+
79
+ ### Disable NX Caching
80
+
81
+ ```typescript
82
+ const project = new FndMonorepoProject({
83
+ name: 'my-app',
84
+ defaultReleaseBranch: 'main',
85
+ nxCache: false,
86
+ });
87
+ ```
88
+
89
+ ### Add Custom Cacheable Operations
90
+
91
+ ```typescript
92
+ const project = new FndMonorepoProject({
93
+ name: 'my-app',
94
+ defaultReleaseBranch: 'main',
95
+ nxCacheableOperations: ['build', 'test', 'lint', 'e2e'],
96
+ });
97
+ ```
98
+
99
+ ## API Reference
100
+
101
+ See the [full API documentation](../../docs/api/modules/core_src.html) for detailed type definitions and examples.
102
+
103
+ ### Project Classes
104
+
105
+ - `FndMonorepoProject` - Main project class for creating monorepos
106
+
107
+ ### Types
108
+
109
+ ```typescript
110
+ import type { FndMonorepoProjectOptions, NxTargetConfig } from '@fnd-platform/core';
111
+ ```
112
+
113
+ ### Components
114
+
115
+ The package also exports individual components for advanced usage:
116
+
117
+ ```typescript
118
+ import {
119
+ PnpmWorkspace,
120
+ NxConfig,
121
+ SharedTypeScript,
122
+ SharedEslint,
123
+ SharedPrettier,
124
+ SharedVitest,
125
+ } from '@fnd-platform/core';
126
+
127
+ // Component options types
128
+ import type {
129
+ PnpmWorkspaceOptions,
130
+ NxConfigOptions,
131
+ SharedTypescriptOptions,
132
+ SharedEslintOptions,
133
+ SharedPrettierOptions,
134
+ SharedVitestOptions,
135
+ } from '@fnd-platform/core';
136
+ ```
137
+
138
+ Each component can be used independently with any Projen project.
139
+
140
+ ## Generated Scripts
141
+
142
+ The following npm scripts are added to the root `package.json`:
143
+
144
+ | Script | Description |
145
+ | --------------- | -------------------------------- |
146
+ | `build` | Build all packages with NX |
147
+ | `test` | Run tests across all packages |
148
+ | `test:coverage` | Run tests with coverage |
149
+ | `lint` | Lint all packages |
150
+ | `format` | Format all files with Prettier |
151
+ | `format:check` | Check formatting without changes |
152
+
153
+ ## Requirements
154
+
155
+ - Node.js 20+
156
+ - pnpm 8+
157
+ - Projen 0.80+
158
+
159
+ ## Related
160
+
161
+ - [fnd-platform documentation](../../docs/README.md)
162
+ - [Projen documentation](https://projen.io/docs/)
163
+
164
+ ## License
165
+
166
+ MIT
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Projen components for generating monorepo configuration files.
3
+ *
4
+ * Each component is responsible for generating a specific configuration file
5
+ * or set of files. Components can be used independently or through the
6
+ * FndMonorepoProject class.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ export { PnpmWorkspace } from './pnpm-workspace';
11
+ export type { PnpmWorkspaceOptions } from './pnpm-workspace';
12
+ export { NxConfig } from './nx-config';
13
+ export type { NxConfigOptions } from './nx-config';
14
+ export { SharedTypeScript } from './shared-typescript';
15
+ export type { SharedTypescriptOptions } from './shared-typescript';
16
+ export { SharedEslint } from './shared-eslint';
17
+ export type { SharedEslintOptions } from './shared-eslint';
18
+ export { SharedPrettier } from './shared-prettier';
19
+ export type { SharedPrettierOptions } from './shared-prettier';
20
+ export { SharedVitest } from './shared-vitest';
21
+ export type { SharedVitestOptions } from './shared-vitest';
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**
3
+ * Projen components for generating monorepo configuration files.
4
+ *
5
+ * Each component is responsible for generating a specific configuration file
6
+ * or set of files. Components can be used independently or through the
7
+ * FndMonorepoProject class.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SharedVitest = exports.SharedPrettier = exports.SharedEslint = exports.SharedTypeScript = exports.NxConfig = exports.PnpmWorkspace = void 0;
13
+ var pnpm_workspace_1 = require("./pnpm-workspace");
14
+ Object.defineProperty(exports, "PnpmWorkspace", { enumerable: true, get: function () { return pnpm_workspace_1.PnpmWorkspace; } });
15
+ var nx_config_1 = require("./nx-config");
16
+ Object.defineProperty(exports, "NxConfig", { enumerable: true, get: function () { return nx_config_1.NxConfig; } });
17
+ var shared_typescript_1 = require("./shared-typescript");
18
+ Object.defineProperty(exports, "SharedTypeScript", { enumerable: true, get: function () { return shared_typescript_1.SharedTypeScript; } });
19
+ var shared_eslint_1 = require("./shared-eslint");
20
+ Object.defineProperty(exports, "SharedEslint", { enumerable: true, get: function () { return shared_eslint_1.SharedEslint; } });
21
+ var shared_prettier_1 = require("./shared-prettier");
22
+ Object.defineProperty(exports, "SharedPrettier", { enumerable: true, get: function () { return shared_prettier_1.SharedPrettier; } });
23
+ var shared_vitest_1 = require("./shared-vitest");
24
+ Object.defineProperty(exports, "SharedVitest", { enumerable: true, get: function () { return shared_vitest_1.SharedVitest; } });
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AAGtB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AAGjB,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AAGzB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AAGrB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AAGvB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA"}
@@ -0,0 +1,67 @@
1
+ import { Component, Project } from 'projen';
2
+ import type { NxTargetConfig } from '../options';
3
+ /**
4
+ * Options for the NxConfig component.
5
+ */
6
+ export interface NxConfigOptions {
7
+ /**
8
+ * Enable caching for NX tasks.
9
+ *
10
+ * @default true
11
+ */
12
+ readonly cacheEnabled?: boolean;
13
+ /**
14
+ * Operations that should be cached by NX.
15
+ *
16
+ * @default ['build', 'test', 'lint']
17
+ */
18
+ readonly cacheableOperations?: string[];
19
+ /**
20
+ * Default configurations for NX targets.
21
+ *
22
+ * These settings apply to all projects unless overridden.
23
+ */
24
+ readonly targetDefaults?: Record<string, NxTargetConfig>;
25
+ /**
26
+ * Named inputs that can be referenced by targets.
27
+ *
28
+ * Define reusable sets of files that affect target execution.
29
+ */
30
+ readonly namedInputs?: Record<string, string[]>;
31
+ }
32
+ /**
33
+ * Generates an nx.json configuration file for build orchestration.
34
+ *
35
+ * This component creates the NX configuration that enables:
36
+ * - Intelligent caching for build, test, and lint operations
37
+ * - Dependency-based task ordering
38
+ * - Named inputs for cache computation
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * new NxConfig(project, {
43
+ * cacheEnabled: true,
44
+ * cacheableOperations: ['build', 'test', 'lint'],
45
+ * });
46
+ * ```
47
+ */
48
+ export declare class NxConfig extends Component {
49
+ /**
50
+ * Whether caching is enabled.
51
+ */
52
+ readonly cacheEnabled: boolean;
53
+ /**
54
+ * Operations that are cached.
55
+ */
56
+ readonly cacheableOperations: string[];
57
+ /**
58
+ * Target default configurations.
59
+ */
60
+ readonly targetDefaults: Record<string, NxTargetConfig>;
61
+ /**
62
+ * Named inputs for cache computation.
63
+ */
64
+ readonly namedInputs: Record<string, string[]>;
65
+ constructor(project: Project, options?: NxConfigOptions);
66
+ }
67
+ //# sourceMappingURL=nx-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nx-config.d.ts","sourceRoot":"","sources":["../../src/components/nx-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAY,MAAM,QAAQ,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAExC;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEzD;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACjD;AAoCD;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,QAAS,SAAQ,SAAS;IACrC;;OAEG;IACH,SAAgB,YAAY,EAAE,OAAO,CAAC;IAEtC;;OAEG;IACH,SAAgB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAE9C;;OAEG;IACH,SAAgB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAE/D;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;gBAE1C,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,eAAoB;CAiC5D"}
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NxConfig = void 0;
4
+ const projen_1 = require("projen");
5
+ /**
6
+ * Default target configurations for a monorepo.
7
+ */
8
+ const DEFAULT_TARGET_DEFAULTS = {
9
+ build: {
10
+ dependsOn: ['^build'],
11
+ cache: true,
12
+ },
13
+ test: {
14
+ cache: true,
15
+ },
16
+ lint: {
17
+ cache: true,
18
+ },
19
+ };
20
+ /**
21
+ * Default named inputs for NX cache computation.
22
+ */
23
+ const DEFAULT_NAMED_INPUTS = {
24
+ default: ['{projectRoot}/**/*', 'sharedGlobals'],
25
+ production: [
26
+ 'default',
27
+ '!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)',
28
+ '!{projectRoot}/tsconfig.spec.json',
29
+ '!{projectRoot}/.eslintrc.json',
30
+ ],
31
+ sharedGlobals: [
32
+ '{workspaceRoot}/tsconfig.base.json',
33
+ '{workspaceRoot}/.eslintrc.js',
34
+ '{workspaceRoot}/.prettierrc',
35
+ ],
36
+ };
37
+ /**
38
+ * Generates an nx.json configuration file for build orchestration.
39
+ *
40
+ * This component creates the NX configuration that enables:
41
+ * - Intelligent caching for build, test, and lint operations
42
+ * - Dependency-based task ordering
43
+ * - Named inputs for cache computation
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * new NxConfig(project, {
48
+ * cacheEnabled: true,
49
+ * cacheableOperations: ['build', 'test', 'lint'],
50
+ * });
51
+ * ```
52
+ */
53
+ class NxConfig extends projen_1.Component {
54
+ /**
55
+ * Whether caching is enabled.
56
+ */
57
+ cacheEnabled;
58
+ /**
59
+ * Operations that are cached.
60
+ */
61
+ cacheableOperations;
62
+ /**
63
+ * Target default configurations.
64
+ */
65
+ targetDefaults;
66
+ /**
67
+ * Named inputs for cache computation.
68
+ */
69
+ namedInputs;
70
+ constructor(project, options = {}) {
71
+ super(project);
72
+ this.cacheEnabled = options.cacheEnabled ?? true;
73
+ this.cacheableOperations = options.cacheableOperations ?? ['build', 'test', 'lint'];
74
+ this.targetDefaults = {
75
+ ...DEFAULT_TARGET_DEFAULTS,
76
+ ...options.targetDefaults,
77
+ };
78
+ this.namedInputs = {
79
+ ...DEFAULT_NAMED_INPUTS,
80
+ ...options.namedInputs,
81
+ };
82
+ // Build the nx.json configuration
83
+ const nxConfig = {
84
+ $schema: './node_modules/nx/schemas/nx-schema.json',
85
+ tasksRunnerOptions: {
86
+ default: {
87
+ runner: 'nx/tasks-runners/default',
88
+ options: {
89
+ cacheableOperations: this.cacheEnabled ? this.cacheableOperations : [],
90
+ },
91
+ },
92
+ },
93
+ targetDefaults: this.targetDefaults,
94
+ namedInputs: this.namedInputs,
95
+ };
96
+ new projen_1.JsonFile(project, 'nx.json', {
97
+ obj: nxConfig,
98
+ });
99
+ }
100
+ }
101
+ exports.NxConfig = NxConfig;
102
+ //# sourceMappingURL=nx-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nx-config.js","sourceRoot":"","sources":["../../src/components/nx-config.ts"],"names":[],"mappings":";;;AAAA,mCAAsD;AAoCtD;;GAEG;AACH,MAAM,uBAAuB,GAAmC;IAC9D,KAAK,EAAE;QACL,SAAS,EAAE,CAAC,QAAQ,CAAC;QACrB,KAAK,EAAE,IAAI;KACZ;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,IAAI;KACZ;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,IAAI;KACZ;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,oBAAoB,GAA6B;IACrD,OAAO,EAAE,CAAC,oBAAoB,EAAE,eAAe,CAAC;IAChD,UAAU,EAAE;QACV,SAAS;QACT,uDAAuD;QACvD,mCAAmC;QACnC,+BAA+B;KAChC;IACD,aAAa,EAAE;QACb,oCAAoC;QACpC,8BAA8B;QAC9B,6BAA6B;KAC9B;CACF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAa,QAAS,SAAQ,kBAAS;IACrC;;OAEG;IACa,YAAY,CAAU;IAEtC;;OAEG;IACa,mBAAmB,CAAW;IAE9C;;OAEG;IACa,cAAc,CAAiC;IAE/D;;OAEG;IACa,WAAW,CAA2B;IAEtD,YAAY,OAAgB,EAAE,UAA2B,EAAE;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC;QACjD,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACpF,IAAI,CAAC,cAAc,GAAG;YACpB,GAAG,uBAAuB;YAC1B,GAAG,OAAO,CAAC,cAAc;SAC1B,CAAC;QACF,IAAI,CAAC,WAAW,GAAG;YACjB,GAAG,oBAAoB;YACvB,GAAG,OAAO,CAAC,WAAW;SACvB,CAAC;QAEF,kCAAkC;QAClC,MAAM,QAAQ,GAA4B;YACxC,OAAO,EAAE,0CAA0C;YACnD,kBAAkB,EAAE;gBAClB,OAAO,EAAE;oBACP,MAAM,EAAE,0BAA0B;oBAClC,OAAO,EAAE;wBACP,mBAAmB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE;qBACvE;iBACF;aACF;YACD,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;QAEF,IAAI,iBAAQ,CAAC,OAAO,EAAE,SAAS,EAAE;YAC/B,GAAG,EAAE,QAAQ;SACd,CAAC,CAAC;IACL,CAAC;CACF;AAtDD,4BAsDC"}
@@ -0,0 +1,34 @@
1
+ import { Component, Project } from 'projen';
2
+ /**
3
+ * Options for the PnpmWorkspace component.
4
+ */
5
+ export interface PnpmWorkspaceOptions {
6
+ /**
7
+ * Glob patterns for workspace package directories.
8
+ *
9
+ * @example ['packages/*']
10
+ * @example ['packages/*', 'apps/*', 'tools/*']
11
+ */
12
+ readonly packages: string[];
13
+ }
14
+ /**
15
+ * Generates a pnpm-workspace.yaml file for configuring pnpm workspaces.
16
+ *
17
+ * This component creates the workspace configuration that tells pnpm
18
+ * which directories contain packages in the monorepo.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * new PnpmWorkspace(project, {
23
+ * packages: ['packages/*', 'apps/*'],
24
+ * });
25
+ * ```
26
+ */
27
+ export declare class PnpmWorkspace extends Component {
28
+ /**
29
+ * The patterns for workspace packages.
30
+ */
31
+ readonly packages: string[];
32
+ constructor(project: Project, options: PnpmWorkspaceOptions);
33
+ }
34
+ //# sourceMappingURL=pnpm-workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pnpm-workspace.d.ts","sourceRoot":"","sources":["../../src/components/pnpm-workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAY,MAAM,QAAQ,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC1C;;OAEG;IACH,SAAgB,QAAQ,EAAE,MAAM,EAAE,CAAC;gBAEvB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,oBAAoB;CAW5D"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PnpmWorkspace = void 0;
4
+ const projen_1 = require("projen");
5
+ /**
6
+ * Generates a pnpm-workspace.yaml file for configuring pnpm workspaces.
7
+ *
8
+ * This component creates the workspace configuration that tells pnpm
9
+ * which directories contain packages in the monorepo.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * new PnpmWorkspace(project, {
14
+ * packages: ['packages/*', 'apps/*'],
15
+ * });
16
+ * ```
17
+ */
18
+ class PnpmWorkspace extends projen_1.Component {
19
+ /**
20
+ * The patterns for workspace packages.
21
+ */
22
+ packages;
23
+ constructor(project, options) {
24
+ super(project);
25
+ this.packages = options.packages;
26
+ new projen_1.YamlFile(project, 'pnpm-workspace.yaml', {
27
+ obj: {
28
+ packages: this.packages,
29
+ },
30
+ });
31
+ }
32
+ }
33
+ exports.PnpmWorkspace = PnpmWorkspace;
34
+ //# sourceMappingURL=pnpm-workspace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pnpm-workspace.js","sourceRoot":"","sources":["../../src/components/pnpm-workspace.ts"],"names":[],"mappings":";;;AAAA,mCAAsD;AAetD;;;;;;;;;;;;GAYG;AACH,MAAa,aAAc,SAAQ,kBAAS;IAC1C;;OAEG;IACa,QAAQ,CAAW;IAEnC,YAAY,OAAgB,EAAE,OAA6B;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAEjC,IAAI,iBAAQ,CAAC,OAAO,EAAE,qBAAqB,EAAE;YAC3C,GAAG,EAAE;gBACH,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAjBD,sCAiBC"}
@@ -0,0 +1,51 @@
1
+ import { Component, Project } from 'projen';
2
+ /**
3
+ * Options for the SharedEslint component.
4
+ */
5
+ export interface SharedEslintOptions {
6
+ /**
7
+ * ECMAScript version for parsing.
8
+ *
9
+ * @default 2022
10
+ */
11
+ readonly ecmaVersion?: number;
12
+ /**
13
+ * Source type (module or script).
14
+ *
15
+ * @default 'module'
16
+ */
17
+ readonly sourceType?: 'module' | 'script';
18
+ /**
19
+ * Patterns to ignore.
20
+ *
21
+ * @default ['dist/', 'node_modules/', '*.js', '!.eslintrc.js', 'coverage/', '.nx/']
22
+ */
23
+ readonly ignorePatterns?: string[];
24
+ /**
25
+ * Warn on explicit any usage instead of error.
26
+ *
27
+ * @default true
28
+ */
29
+ readonly warnOnExplicitAny?: boolean;
30
+ /**
31
+ * Additional rules to include.
32
+ */
33
+ readonly additionalRules?: Record<string, unknown>;
34
+ }
35
+ /**
36
+ * Generates a .eslintrc.js configuration file for code linting.
37
+ *
38
+ * This component creates an ESLint configuration using TypeScript parser
39
+ * and recommended rules. It's designed for TypeScript-first monorepos.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * new SharedEslint(project, {
44
+ * warnOnExplicitAny: true,
45
+ * });
46
+ * ```
47
+ */
48
+ export declare class SharedEslint extends Component {
49
+ constructor(project: Project, options?: SharedEslintOptions);
50
+ }
51
+ //# sourceMappingURL=shared-eslint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-eslint.d.ts","sourceRoot":"","sources":["../../src/components/shared-eslint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAY,MAAM,QAAQ,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAE1C;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnC;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpD;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAa,SAAQ,SAAS;gBAC7B,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,mBAAwB;CAuDhE"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SharedEslint = void 0;
4
+ const projen_1 = require("projen");
5
+ /**
6
+ * Generates a .eslintrc.js configuration file for code linting.
7
+ *
8
+ * This component creates an ESLint configuration using TypeScript parser
9
+ * and recommended rules. It's designed for TypeScript-first monorepos.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * new SharedEslint(project, {
14
+ * warnOnExplicitAny: true,
15
+ * });
16
+ * ```
17
+ */
18
+ class SharedEslint extends projen_1.Component {
19
+ constructor(project, options = {}) {
20
+ super(project);
21
+ const ecmaVersion = options.ecmaVersion ?? 2022;
22
+ const sourceType = options.sourceType ?? 'module';
23
+ const warnOnExplicitAny = options.warnOnExplicitAny ?? true;
24
+ const ignorePatterns = options.ignorePatterns ?? [
25
+ 'dist/',
26
+ 'node_modules/',
27
+ '*.js',
28
+ '!.eslintrc.js',
29
+ 'coverage/',
30
+ '.nx/',
31
+ ];
32
+ // Build additional rules
33
+ const additionalRulesStr = options.additionalRules
34
+ ? Object.entries(options.additionalRules)
35
+ .map(([key, value]) => ` '${key}': ${JSON.stringify(value)},`)
36
+ .join('\n')
37
+ : '';
38
+ const configContent = `module.exports = {
39
+ root: true,
40
+ parser: '@typescript-eslint/parser',
41
+ parserOptions: {
42
+ ecmaVersion: ${ecmaVersion},
43
+ sourceType: '${sourceType}',
44
+ },
45
+ plugins: ['@typescript-eslint'],
46
+ extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
47
+ rules: {
48
+ '@typescript-eslint/no-explicit-any': '${warnOnExplicitAny ? 'warn' : 'error'}',
49
+ '@typescript-eslint/explicit-function-return-type': 'off',
50
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
51
+ '@typescript-eslint/no-unused-vars': [
52
+ 'error',
53
+ {
54
+ argsIgnorePattern: '^_',
55
+ varsIgnorePattern: '^_',
56
+ },
57
+ ],
58
+ ${additionalRulesStr} },
59
+ ignorePatterns: ${JSON.stringify(ignorePatterns)},
60
+ env: {
61
+ node: true,
62
+ es2022: true,
63
+ },
64
+ };
65
+ `;
66
+ new projen_1.TextFile(project, '.eslintrc.js', {
67
+ lines: configContent.split('\n'),
68
+ });
69
+ }
70
+ }
71
+ exports.SharedEslint = SharedEslint;
72
+ //# sourceMappingURL=shared-eslint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-eslint.js","sourceRoot":"","sources":["../../src/components/shared-eslint.ts"],"names":[],"mappings":";;;AAAA,mCAAsD;AAwCtD;;;;;;;;;;;;GAYG;AACH,MAAa,YAAa,SAAQ,kBAAS;IACzC,YAAY,OAAgB,EAAE,UAA+B,EAAE;QAC7D,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,IAAI,CAAC;QAChD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,QAAQ,CAAC;QAClD,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,IAAI,IAAI,CAAC;QAC5D,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI;YAC/C,OAAO;YACP,eAAe;YACf,MAAM;YACN,eAAe;YACf,WAAW;YACX,MAAM;SACP,CAAC;QAEF,yBAAyB;QACzB,MAAM,kBAAkB,GAAG,OAAO,CAAC,eAAe;YAChD,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC;iBACpC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC;iBAChE,IAAI,CAAC,IAAI,CAAC;YACf,CAAC,CAAC,EAAE,CAAC;QAEP,MAAM,aAAa,GAAG;;;;mBAIP,WAAW;mBACX,UAAU;;;;;6CAKgB,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;;;;;;;;;;EAU/E,kBAAkB;oBACA,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;;;;;;CAMjD,CAAC;QAEE,IAAI,iBAAQ,CAAC,OAAO,EAAE,cAAc,EAAE;YACpC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC;SACjC,CAAC,CAAC;IACL,CAAC;CACF;AAxDD,oCAwDC"}