@codedrifters/configulator 0.0.306 → 0.0.308

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/lib/index.mjs CHANGED
@@ -18338,7 +18338,39 @@ var prReviewBundle = {
18338
18338
  }
18339
18339
  ],
18340
18340
  skills: [reviewPrSkill, reviewPrsSkill],
18341
- subAgents: [prReviewerSubAgent]
18341
+ subAgents: [prReviewerSubAgent],
18342
+ labels: [
18343
+ {
18344
+ name: "type:pr-review",
18345
+ color: "5319E7",
18346
+ description: "PR review tasks"
18347
+ },
18348
+ {
18349
+ name: "origin:issue-worker",
18350
+ color: "5319E7",
18351
+ description: "PR opened by the issue-worker agent"
18352
+ },
18353
+ {
18354
+ name: "review:auto-ok",
18355
+ color: "0E8A16",
18356
+ description: "Force auto-merge regardless of policy"
18357
+ },
18358
+ {
18359
+ name: "review:human-required",
18360
+ color: "D93F0B",
18361
+ description: "Force human review regardless of policy"
18362
+ },
18363
+ {
18364
+ name: "review:awaiting-human",
18365
+ color: "FBCA04",
18366
+ description: "Reviewer handed off; awaiting human merge decision"
18367
+ },
18368
+ {
18369
+ name: "review:fixing",
18370
+ color: "D4C5F9",
18371
+ description: "Short-lived lease while issue-worker applies feedback fixes"
18372
+ }
18373
+ ]
18342
18374
  };
18343
18375
 
18344
18376
  // src/agent/bundles/projen.ts
@@ -32721,8 +32753,88 @@ var JsiiFaker = class _JsiiFaker extends Component13 {
32721
32753
  }
32722
32754
  };
32723
32755
 
32724
- // src/projects/astro-project.ts
32756
+ // src/projects/add-playwright.ts
32725
32757
  import { SampleFile as SampleFile2 } from "projen";
32758
+ function addPlaywright(project) {
32759
+ project.addDevDeps("@playwright/test");
32760
+ project.tasks.addTask("e2e:install", {
32761
+ description: "Install Playwright browsers",
32762
+ steps: [{ exec: "npx playwright install --with-deps" }]
32763
+ });
32764
+ project.tasks.addTask("e2e", {
32765
+ description: "Run Playwright E2E tests (headless)",
32766
+ steps: [{ exec: "npx playwright test" }]
32767
+ });
32768
+ project.tasks.addTask("e2e:ui", {
32769
+ description: "Run Playwright in UI mode",
32770
+ steps: [{ exec: "npx playwright test --ui" }]
32771
+ });
32772
+ project.tasks.addTask("e2e:report", {
32773
+ description: "Open last HTML report",
32774
+ steps: [{ exec: "npx playwright show-report" }]
32775
+ });
32776
+ project.setScript("e2e:install", "npx projen e2e:install");
32777
+ project.setScript("e2e", "npx projen e2e");
32778
+ project.setScript("e2e:ui", "npx projen e2e:ui");
32779
+ project.setScript("e2e:report", "npx projen e2e:report");
32780
+ new SampleFile2(project, "playwright.config.ts", {
32781
+ contents: `import { defineConfig, devices } from '@playwright/test';
32782
+
32783
+ export default defineConfig({
32784
+ testDir: './tests',
32785
+ reporter: [['html', { open: 'never' }]],
32786
+ use: {
32787
+ baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:5173',
32788
+ trace: 'on-first-retry',
32789
+ },
32790
+ projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
32791
+ });
32792
+ `
32793
+ });
32794
+ project.gitignore.addPatterns("test-results/", "playwright-report/");
32795
+ }
32796
+
32797
+ // src/projects/add-storybook.ts
32798
+ import { SampleFile as SampleFile3 } from "projen";
32799
+ function addStorybook(project, options = {}) {
32800
+ const withDocs = options.withDocs ?? true;
32801
+ project.addDevDeps(
32802
+ "storybook",
32803
+ "@storybook/react@^9",
32804
+ "@storybook/react-vite@^9",
32805
+ ...withDocs ? ["@storybook/addon-docs@^9"] : []
32806
+ );
32807
+ project.tasks.addTask("storybook", {
32808
+ description: "Run Storybook (Vite)",
32809
+ steps: [{ exec: "storybook dev -p 6006" }]
32810
+ });
32811
+ project.tasks.addTask("build-storybook", {
32812
+ description: "Build static Storybook",
32813
+ steps: [{ exec: "storybook build" }]
32814
+ });
32815
+ project.setScript("storybook", "npx projen storybook");
32816
+ project.setScript("build-storybook", "npx projen build-storybook");
32817
+ new SampleFile3(project, ".storybook/main.ts", {
32818
+ contents: `import type { StorybookConfig } from '@storybook/react-vite';
32819
+
32820
+ const config: StorybookConfig = {
32821
+ stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
32822
+ addons: [${withDocs ? `'@storybook/addon-docs'` : ""}],
32823
+ framework: { name: '@storybook/react-vite', options: {} },
32824
+ };
32825
+ export default config;
32826
+ `
32827
+ });
32828
+ new SampleFile3(project, ".storybook/preview.ts", {
32829
+ contents: `import '../src/index.css';
32830
+ const preview = { parameters: { controls: { expanded: true } } };
32831
+ export default preview;
32832
+ `
32833
+ });
32834
+ }
32835
+
32836
+ // src/projects/astro-project.ts
32837
+ import { SampleFile as SampleFile4 } from "projen";
32726
32838
  import { merge as merge3 } from "ts-deepmerge";
32727
32839
 
32728
32840
  // src/projects/monorepo-layout.ts
@@ -32741,6 +32853,7 @@ var LAYOUT_ROOT_BY_PROJECT_TYPE = {
32741
32853
  TypeScriptProject: MONOREPO_LAYOUT.PACKAGES,
32742
32854
  AwsCdkProject: MONOREPO_LAYOUT.APPS,
32743
32855
  AstroProject: MONOREPO_LAYOUT.SITES,
32856
+ ReactViteSiteProject: MONOREPO_LAYOUT.SITES,
32744
32857
  StarlightProject: MONOREPO_LAYOUT.DOCS
32745
32858
  };
32746
32859
  function validateMonorepoLayout(root) {
@@ -32864,6 +32977,9 @@ function resolveAwsCdkProjectOutdir(packageName) {
32864
32977
  function resolveAstroProjectOutdir(packageName) {
32865
32978
  return resolveOutdirFromPackageName(packageName, MONOREPO_LAYOUT.SITES);
32866
32979
  }
32980
+ function resolveReactViteSiteProjectOutdir(packageName) {
32981
+ return resolveOutdirFromPackageName(packageName, MONOREPO_LAYOUT.SITES);
32982
+ }
32867
32983
 
32868
32984
  // src/projects/typescript-project.ts
32869
32985
  import { typescript } from "projen";
@@ -34175,10 +34291,10 @@ var AstroProject = class extends TypeScriptProject {
34175
34291
  adapter: options.adapter
34176
34292
  });
34177
34293
  if (options.sampleCode === true) {
34178
- new SampleFile2(this, "src/pages/index.astro", {
34294
+ new SampleFile4(this, "src/pages/index.astro", {
34179
34295
  contents: DEFAULT_INDEX_ASTRO
34180
34296
  });
34181
- new SampleFile2(this, "public/favicon.svg", {
34297
+ new SampleFile4(this, "public/favicon.svg", {
34182
34298
  contents: DEFAULT_FAVICON_SVG
34183
34299
  });
34184
34300
  }
@@ -34883,8 +34999,305 @@ var AwsCdkProject = class extends awscdk.AwsCdkTypeScriptApp {
34883
34999
  }
34884
35000
  };
34885
35001
 
35002
+ // src/projects/react-vite-site-project.ts
35003
+ import { SampleFile as SampleFile5, TextFile as TextFile7 } from "projen";
35004
+ import { merge as merge5 } from "ts-deepmerge";
35005
+ var ReactViteSiteProject = class extends TypeScriptProject {
35006
+ constructor(userOptions) {
35007
+ const resolvedOutdir = userOptions.outdir ?? resolveReactViteSiteProjectOutdir(
35008
+ userOptions.packageName ?? userOptions.name
35009
+ );
35010
+ const defaultOptions = {
35011
+ testRunner: TestRunner.VITEST,
35012
+ apiExtractor: false,
35013
+ // ESLint inherited from TypeScriptProject lints `src` by default;
35014
+ // skip projen's `.projenrc.ts` lint pass since downstream sites
35015
+ // configure projen through their own root project.
35016
+ eslintOptions: {
35017
+ dirs: ["src"],
35018
+ lintProjenRc: false
35019
+ },
35020
+ // VSCode workspace defaults (Prettier formatter, ESLint on save)
35021
+ // need a project-level `.vscode/` folder. The inherited
35022
+ // TypeScriptProject does not enable it on sub-projects by
35023
+ // default; flip it on so the React-site VSCode wiring below
35024
+ // actually renders.
35025
+ vscode: true,
35026
+ tsconfig: {
35027
+ compilerOptions: {
35028
+ declaration: false
35029
+ }
35030
+ }
35031
+ };
35032
+ const merged = merge5(
35033
+ defaultOptions,
35034
+ userOptions
35035
+ );
35036
+ const options = {
35037
+ ...merged,
35038
+ outdir: resolvedOutdir
35039
+ };
35040
+ super(options);
35041
+ this.package.addField("type", "module");
35042
+ new TextFile7(this, ".nvmrc", { lines: ["v24.11.0"] });
35043
+ this.tsconfig?.file.addOverride("compilerOptions.target", "ES2020");
35044
+ this.tsconfig?.file.addOverride("compilerOptions.lib", [
35045
+ "ES2020",
35046
+ "DOM",
35047
+ "DOM.Iterable"
35048
+ ]);
35049
+ this.tsconfig?.file.addOverride("compilerOptions.module", "ESNext");
35050
+ this.tsconfig?.file.addOverride(
35051
+ "compilerOptions.moduleResolution",
35052
+ "bundler"
35053
+ );
35054
+ this.tsconfig?.file.addOverride("compilerOptions.jsx", "react-jsxdev");
35055
+ this.tsconfig?.file.addOverride("compilerOptions.noEmit", true);
35056
+ this.tsconfig?.file.addOverride("compilerOptions.skipLibCheck", true);
35057
+ this.tsconfig?.file.addOverride("compilerOptions.strict", true);
35058
+ this.tsconfig?.file.addOverride("compilerOptions.resolveJsonModule", true);
35059
+ this.tsconfig?.file.addOverride("compilerOptions.declaration", false);
35060
+ this.tsconfig?.file.addOverride("compilerOptions.paths", {
35061
+ "@/*": ["./src/*"]
35062
+ });
35063
+ this.tsconfig?.file.addOverride("include", ["src"]);
35064
+ this.tsconfigDev?.file.addOverride("compilerOptions.types", [
35065
+ "vitest/globals",
35066
+ "vite/client"
35067
+ ]);
35068
+ this.tsconfigDev?.file.addOverride("include", [
35069
+ "src",
35070
+ "tests",
35071
+ "**/*.test.ts",
35072
+ "**/*.test.tsx",
35073
+ "**/*.spec.ts",
35074
+ "**/*.spec.tsx",
35075
+ "vitest.config.ts"
35076
+ ]);
35077
+ this.tsconfigDev?.file.addOverride("exclude", [
35078
+ "node_modules",
35079
+ "dist",
35080
+ "build",
35081
+ ".turbo"
35082
+ ]);
35083
+ new SampleFile5(this, "vite.config.ts", {
35084
+ contents: `import { defineConfig } from 'vite';
35085
+ import react from '@vitejs/plugin-react';
35086
+ import tailwindcss from '@tailwindcss/vite';
35087
+ import path from 'path';
35088
+
35089
+ export default defineConfig({
35090
+ plugins: [tailwindcss(), react()],
35091
+ resolve: { alias: { '@': path.resolve(__dirname, 'src') } },
35092
+ });
35093
+ `
35094
+ });
35095
+ if (options.testRunner !== TestRunner.JEST) {
35096
+ this.tryRemoveFile("vitest.config.ts");
35097
+ new SampleFile5(this, "vitest.config.ts", {
35098
+ contents: `import { defineConfig, mergeConfig } from 'vitest/config';
35099
+ import react from '@vitejs/plugin-react';
35100
+ import viteConfig from './vite.config';
35101
+
35102
+ export default mergeConfig(
35103
+ viteConfig,
35104
+ defineConfig({
35105
+ plugins: [react()],
35106
+ test: {
35107
+ environment: 'jsdom',
35108
+ globals: true,
35109
+ setupFiles: ['./src/setupTests.ts'],
35110
+ passWithNoTests: true,
35111
+ },
35112
+ })
35113
+ );
35114
+ `
35115
+ });
35116
+ }
35117
+ this.compileTask.reset();
35118
+ this.compileTask.exec("vite build");
35119
+ this.packageTask.reset();
35120
+ this.tasks.tryFind("watch")?.reset("vite");
35121
+ if (!this.tasks.tryFind("dev")) {
35122
+ this.addTask("dev", {
35123
+ description: "Start the Vite dev server",
35124
+ exec: "vite",
35125
+ receiveArgs: true
35126
+ });
35127
+ }
35128
+ if (!this.tasks.tryFind("preview")) {
35129
+ this.addTask("preview", {
35130
+ description: "Preview the built site locally",
35131
+ exec: "vite preview",
35132
+ receiveArgs: true
35133
+ });
35134
+ }
35135
+ this.addDeps("react", "react-dom", "react-router-dom");
35136
+ this.addDevDeps(
35137
+ "vite",
35138
+ "@vitejs/plugin-react",
35139
+ "@tailwindcss/vite",
35140
+ "tailwindcss",
35141
+ "jsdom",
35142
+ "@testing-library/react",
35143
+ "@testing-library/jest-dom",
35144
+ "@testing-library/user-event",
35145
+ "@types/react",
35146
+ "@types/react-dom",
35147
+ "eslint-plugin-react",
35148
+ "eslint-plugin-react-hooks"
35149
+ );
35150
+ this.eslint?.addExtends("plugin:react/recommended");
35151
+ this.eslint?.addExtends("plugin:react/jsx-runtime");
35152
+ this.eslint?.addExtends("plugin:react-hooks/recommended");
35153
+ this.eslint?.addOverride({
35154
+ files: ["**/*.{tsx,jsx}"],
35155
+ // Projen's ESLint override type does not include `settings`, but
35156
+ // `settings` is a valid ESLint override key. Cast to `any` so the
35157
+ // generated `.eslintrc.json` carries the React-version detection
35158
+ // settings on the JSX glob.
35159
+ settings: {
35160
+ react: {
35161
+ version: "detect"
35162
+ }
35163
+ }
35164
+ });
35165
+ this.eslint?.addRules({
35166
+ // We use TypeScript; prop-types are unnecessary.
35167
+ "react/prop-types": "off",
35168
+ // New JSX transform — React no longer needs to be in scope.
35169
+ "react/react-in-jsx-scope": "off"
35170
+ });
35171
+ this.eslint?.addOverride({
35172
+ files: [
35173
+ "**/*.{test,spec}.ts",
35174
+ "**/*.{test,spec}.tsx",
35175
+ "**/__tests__/**",
35176
+ "src/setupTests.ts"
35177
+ ],
35178
+ rules: {
35179
+ "import/no-extraneous-dependencies": [
35180
+ "error",
35181
+ { devDependencies: true }
35182
+ ]
35183
+ }
35184
+ });
35185
+ this.vscode?.settings.addSettings({
35186
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
35187
+ "editor.formatOnSave": true,
35188
+ // Prettier must format the whole file; "modifications" mode is
35189
+ // known to mis-merge ranges with Prettier and can corrupt saves.
35190
+ "editor.formatOnSaveMode": "file",
35191
+ "prettier.requireConfig": true,
35192
+ "eslint.useFlatConfig": false,
35193
+ "eslint.workingDirectories": [{ directory: ".", changeProcessCWD: true }],
35194
+ // Prettier is the default formatter; ESLint's fixAll must not
35195
+ // re-apply prettier/prettier (would double-format).
35196
+ "eslint.codeActionsOnSave.rules": ["!prettier/prettier", "*"],
35197
+ "eslint.format.enable": false,
35198
+ "[typescript]": {
35199
+ "editor.codeActionsOnSave": {
35200
+ "source.fixAll.eslint": "always",
35201
+ "source.organizeImports": "always"
35202
+ }
35203
+ },
35204
+ "[typescriptreact]": {
35205
+ "editor.codeActionsOnSave": {
35206
+ "source.fixAll.eslint": "always",
35207
+ "source.organizeImports": "always"
35208
+ }
35209
+ },
35210
+ "[javascript]": {
35211
+ "editor.codeActionsOnSave": {
35212
+ "source.fixAll.eslint": "always"
35213
+ }
35214
+ },
35215
+ "[javascriptreact]": {
35216
+ "editor.codeActionsOnSave": {
35217
+ "source.fixAll.eslint": "always"
35218
+ }
35219
+ },
35220
+ "eslint.validate": [
35221
+ "javascript",
35222
+ "javascriptreact",
35223
+ "typescript",
35224
+ "typescriptreact"
35225
+ ]
35226
+ });
35227
+ this.vscode?.extensions.addRecommendations("dbaeumer.vscode-eslint");
35228
+ this.vscode?.extensions.addRecommendations("esbenp.prettier-vscode");
35229
+ const turbo = TurboRepo.of(this);
35230
+ if (turbo?.compileTask) {
35231
+ turbo.compileTask.inputs.push(
35232
+ "public/**",
35233
+ "index.html",
35234
+ "vite.config.ts"
35235
+ );
35236
+ }
35237
+ if (userOptions.sampleCode === true) {
35238
+ const siteName = options.name;
35239
+ new SampleFile5(this, "index.html", {
35240
+ contents: `<!doctype html>
35241
+ <html>
35242
+ <head>
35243
+ <meta charset="utf-8"/>
35244
+ <meta name="viewport" content="width=device-width, initial-scale=1"/>
35245
+ <title>${siteName}</title>
35246
+ </head>
35247
+ <body>
35248
+ <div id="root"></div>
35249
+ <script type="module" src="/src/main.tsx"></script>
35250
+ </body>
35251
+ </html>
35252
+ `
35253
+ });
35254
+ new SampleFile5(this, "src/routes.tsx", {
35255
+ contents: `import { createBrowserRouter } from 'react-router-dom';
35256
+ import App from './App';
35257
+
35258
+ export const router = createBrowserRouter([
35259
+ { path: '/', element: <App /> },
35260
+ ]);
35261
+ `
35262
+ });
35263
+ new SampleFile5(this, "src/main.tsx", {
35264
+ contents: `import React from 'react';
35265
+ import ReactDOM from 'react-dom/client';
35266
+ import { RouterProvider } from 'react-router-dom';
35267
+ import { router } from './routes';
35268
+ import './index.css';
35269
+
35270
+ ReactDOM.createRoot(document.getElementById('root')!).render(
35271
+ <React.StrictMode>
35272
+ <RouterProvider router={router} />
35273
+ </React.StrictMode>
35274
+ );
35275
+ `
35276
+ });
35277
+ new SampleFile5(this, "src/App.tsx", {
35278
+ contents: `export default function App() {
35279
+ return (
35280
+ <main className="p-4">
35281
+ <h1 className="text-2xl font-bold">Hello from ${siteName}</h1>
35282
+ </main>
35283
+ );
35284
+ }
35285
+ `
35286
+ });
35287
+ new SampleFile5(this, "src/index.css", {
35288
+ contents: `@import "tailwindcss";
35289
+ `
35290
+ });
35291
+ new SampleFile5(this, "src/setupTests.ts", {
35292
+ contents: `import '@testing-library/jest-dom';
35293
+ `
35294
+ });
35295
+ }
35296
+ }
35297
+ };
35298
+
34886
35299
  // src/projects/starlight-project.ts
34887
- import { SampleFile as SampleFile3 } from "projen";
35300
+ import { SampleFile as SampleFile6 } from "projen";
34888
35301
  var STARLIGHT_ROLE = {
34889
35302
  DOCS: "docs",
34890
35303
  SITE: "site"
@@ -34926,10 +35339,10 @@ var StarlightProject = class extends AstroProject {
34926
35339
  turbo.compileTask.inputs.push("src/content/**");
34927
35340
  }
34928
35341
  if (userOptions.sampleContent === true) {
34929
- new SampleFile3(this, "src/content/docs/index.mdx", {
35342
+ new SampleFile6(this, "src/content/docs/index.mdx", {
34930
35343
  contents: DEFAULT_INDEX_MDX
34931
35344
  });
34932
- new SampleFile3(this, "src/content.config.ts", {
35345
+ new SampleFile6(this, "src/content.config.ts", {
34933
35346
  contents: DEFAULT_CONTENT_CONFIG_TS
34934
35347
  });
34935
35348
  }
@@ -35105,6 +35518,7 @@ export {
35105
35518
  REQUIREMENTS_WRITER_PATHS,
35106
35519
  ROOT_CI_TASK_NAME,
35107
35520
  ROOT_TURBO_TASK_NAME,
35521
+ ReactViteSiteProject,
35108
35522
  ResetTask,
35109
35523
  SCHEDULED_TASK_MODEL_VALUES,
35110
35524
  SCOPE_CLASS_VALUES,
@@ -35131,6 +35545,8 @@ export {
35131
35545
  Vitest,
35132
35546
  addApproveMergeUpgradeWorkflow,
35133
35547
  addBuildCompleteJob,
35548
+ addPlaywright,
35549
+ addStorybook,
35134
35550
  addSyncLabelsWorkflow,
35135
35551
  agendaBundle,
35136
35552
  analyzeTsDocCoverage,
@@ -35258,6 +35674,7 @@ export {
35258
35674
  resolveOutdirFromPackageName,
35259
35675
  resolveOverrideForLabels,
35260
35676
  resolveProgressFiles,
35677
+ resolveReactViteSiteProjectOutdir,
35261
35678
  resolveRunRatio,
35262
35679
  resolveScheduledTasks,
35263
35680
  resolveScopeGate,