@doikayt/typescript-build-config 0.1.9 → 0.1.11

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@doikayt/typescript-build-config",
3
- "version": "0.1.9",
4
- "description": "Shared build configuration for TypeScript projects — ESLint, and future tsconfig/Prettier presets",
3
+ "version": "0.1.11",
4
+ "description": "Shared build configuration for TypeScript projects — ESLint, Prettier, tsconfig, and Playwright presets",
5
5
  "_comments": {
6
6
  "exports": "This block lists the config files that will be extended by files in in src/toplevel - which are copied to consuming project root folder. An example: eslint.config.js imports from '@doikayt/typescript-build-config/eslint'.",
7
7
  "files": "These are the files included in the package tarball. Dotfiles like .gitignore are excluded by npm by default and must be listed explicitly alongside src/."
@@ -11,11 +11,13 @@
11
11
  "exports": {
12
12
  "./eslint": "./src/eslint.js",
13
13
  "./prettier": "./src/prettier.js",
14
- "./tsconfig": "./src/tsconfig.base.json"
14
+ "./tsconfig": "./src/tsconfig.base.json",
15
+ "./playwright": "./src/playwright.js"
15
16
  },
16
17
  "files": [
17
18
  "src/",
18
- "src/top-level/.gitignore"
19
+ "src/top-level/.gitignore",
20
+ "assets/"
19
21
  ],
20
22
  "scripts": {
21
23
  "prepack": "echo no build step required",
@@ -33,7 +35,8 @@
33
35
  },
34
36
  "devDependencies": {
35
37
  "@changesets/cli": "^2.29.8",
36
- "@datalackey/update-markdown-toc": "^1.4.14"
38
+ "@doikayt/update-markdown-toc": "^1.4.17",
39
+ "@playwright/test": "^1.40.0"
37
40
  },
38
41
  "dependencies": {
39
42
  "@typescript-eslint/eslint-plugin": "^8.0.0",
@@ -46,7 +49,8 @@
46
49
  "typescript",
47
50
  "config",
48
51
  "build",
49
- "tooling"
52
+ "tooling",
53
+ "playwright"
50
54
  ],
51
55
  "license": "MIT",
52
56
  "repository": {
@@ -55,6 +59,12 @@
55
59
  },
56
60
  "peerDependencies": {
57
61
  "@typescript-eslint/eslint-plugin": "^8.57.1",
58
- "@typescript-eslint/parser": "^8.57.1"
62
+ "@typescript-eslint/parser": "^8.57.1",
63
+ "@playwright/test": ">=1.40.0"
64
+ },
65
+ "peerDependenciesMeta": {
66
+ "@playwright/test": {
67
+ "optional": true
68
+ }
59
69
  }
60
70
  }
@@ -0,0 +1,50 @@
1
+ import { execSync } from "child_process";
2
+ import { existsSync } from "fs";
3
+ import { defineConfig } from "@playwright/test";
4
+
5
+ const FALLBACK_PATHS = [
6
+ "/run/current-system/sw/bin/chromium",
7
+ "/usr/bin/chromium",
8
+ "/usr/bin/chromium-browser",
9
+ "/usr/local/bin/chromium",
10
+ "/usr/local/bin/chromium-browser",
11
+ ];
12
+
13
+ // Returns {} (not an error) when no system Chromium is found — Playwright
14
+ // then falls back silently to its own bundled browser.
15
+ export function nixChromiumLaunchOptions() {
16
+ const envPath = process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH;
17
+ if (envPath) return { executablePath: envPath };
18
+
19
+ for (const cmd of ["chromium", "chromium-browser"]) {
20
+ try {
21
+ const p = execSync(`which ${cmd}`, { encoding: "utf8" }).trim();
22
+ if (p) return { executablePath: p };
23
+ } catch {
24
+ // not in PATH
25
+ }
26
+ }
27
+
28
+ for (const p of FALLBACK_PATHS) {
29
+ if (existsSync(p)) return { executablePath: p };
30
+ }
31
+
32
+ return {};
33
+ }
34
+
35
+ // Merges nixChromiumLaunchOptions() into overrides.use.launchOptions so that
36
+ // consumer-supplied launchOptions are preserved and the NixOS path wins only
37
+ // when the env var or a discoverable system binary is present.
38
+ export function definePlaywrightConfig(overrides) {
39
+ const nixLaunchOptions = nixChromiumLaunchOptions();
40
+ return defineConfig({
41
+ ...overrides,
42
+ use: {
43
+ ...overrides.use,
44
+ launchOptions: {
45
+ ...overrides.use?.launchOptions,
46
+ ...nixLaunchOptions,
47
+ },
48
+ },
49
+ });
50
+ }
@@ -108,6 +108,36 @@ for (const { src, dest } of pipelineFiles) {
108
108
  }
109
109
  }
110
110
 
111
+ // --- Asset files: seeded into docs/assets/, same per-file copy/warn as pipeline ---
112
+
113
+ const assetDir = new URL("../assets", import.meta.url).pathname;
114
+
115
+ const assetFiles = [
116
+ { src: "doikayt-logo.png", dest: "docs/assets/doikayt-logo.png" },
117
+ { src: "doikayt-logo.svg", dest: "docs/assets/doikayt-logo.svg" },
118
+ ];
119
+
120
+ for (const { src, dest } of assetFiles) {
121
+ const srcPath = resolve(assetDir, src);
122
+ const destPath = resolve(projectRoot, dest);
123
+
124
+ if (!existsSync(destPath)) {
125
+ mkdirSync(dirname(destPath), { recursive: true });
126
+ copyFileSync(srcPath, destPath);
127
+ console.log(`${PREFIX} Copied ${src} -> ${dest}`);
128
+ continue;
129
+ }
130
+
131
+ const canonical = readFileSync(srcPath);
132
+ const existing = readFileSync(destPath);
133
+ if (canonical.equals(existing)) continue;
134
+
135
+ console.warn(
136
+ `${PREFIX} WARNING: ${dest} differs from canonical version — skipping. ` +
137
+ `To resync: cp node_modules/@doikayt/typescript-build-config/assets/${src} ${dest}`,
138
+ );
139
+ }
140
+
111
141
  // --- update-all-format convention check ---
112
142
 
113
143
  let hasUpdateAllFormat = !!projectPkg.scripts?.["update-all-format"];
@@ -1,10 +1,40 @@
1
- .idea/
2
1
 
3
- **/node_modules/
4
- **/dist/
5
- *.tsbuildinfo
2
+ # Local claude stuff
3
+ **/.claude/settings.local.json
4
+
6
5
 
6
+
7
+ *.tsbuildinfo
7
8
  coverage/
9
+
10
+ dist
11
+ **/dist/
12
+
13
+ **/node_modules/
8
14
  .nx/
9
15
  .env
10
16
 
17
+
18
+
19
+
20
+ ## no idea crap allowed
21
+ .idea/
22
+ .idea/*
23
+
24
+ *.ipr
25
+ *.iml
26
+ *.iws
27
+
28
+
29
+ # Terraform local state and provider cache — contains real infra details, don't commit
30
+ .terraform/
31
+ .terraform.lock.hcl
32
+ *.tfstate
33
+ *.tfstate.*
34
+ crash.log
35
+ crash.*.log
36
+
37
+ # Real secrets — only the .example file should be committed
38
+ terraform.tfvars
39
+ *.auto.tfvars
40
+