@icebreakers/monorepo 2.1.6 → 3.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.
@@ -61,7 +61,7 @@ body:
61
61
  id: system-info
62
62
  attributes:
63
63
  label: System Info
64
- description: Output of `npx envinfo --system --npmPackages --binaries`
64
+ description: Output of `npx -y envinfo@latest --system --npmPackages --binaries`
65
65
  render: shell
66
66
  placeholder: System, Binaries
67
67
  - type: textarea
@@ -50,11 +50,11 @@
50
50
  "@types/fs-extra": "^11.0.4",
51
51
  "@types/node": "^24.10.1",
52
52
  "@types/semver": "^7.7.1",
53
- "@vitest/coverage-v8": "~4.0.8",
53
+ "@vitest/coverage-v8": "~4.0.10",
54
54
  "ci-info": "^4.3.1",
55
55
  "cross-env": "^10.1.0",
56
56
  "defu": "^6.1.4",
57
- "es-toolkit": "^1.41.0",
57
+ "es-toolkit": "^1.42.0",
58
58
  "eslint": "^9.39.1",
59
59
  "execa": "^9.6.0",
60
60
  "fs-extra": "^11.3.2",
@@ -65,7 +65,7 @@
65
65
  "pkg-types": "^2.3.0",
66
66
  "rimraf": "^6.1.0",
67
67
  "stylelint": "^16.25.0",
68
- "tsdown": "^0.16.4",
68
+ "tsdown": "^0.16.5",
69
69
  "tslib": "^2.8.1",
70
70
  "tsup": "^8.5.1",
71
71
  "tsx": "^4.20.6",
@@ -73,7 +73,7 @@
73
73
  "type-fest": "^5.2.0",
74
74
  "typescript": "^5.9.3",
75
75
  "unbuild": "^3.6.1",
76
- "vitest": "~4.0.8",
76
+ "vitest": "~4.0.10",
77
77
  "yaml": "^2.8.1"
78
78
  },
79
79
  "publishConfig": {
@@ -2,20 +2,74 @@ import fs from 'node:fs'
2
2
  import path from 'node:path'
3
3
  import { fileURLToPath } from 'node:url'
4
4
  import { defineConfig } from 'vitest/config'
5
+ import YAML from 'yaml'
5
6
 
6
7
  const ROOT_DIR = path.dirname(fileURLToPath(new URL(import.meta.url)))
7
- const PROJECT_ROOTS = [
8
- 'packages',
9
- 'apps',
10
- ]
11
- const CONFIG_CANDIDATES = [
8
+ const WORKSPACE_FILE = path.resolve(ROOT_DIR, 'pnpm-workspace.yaml')
9
+ const CONFIG_FILENAMES = [
12
10
  'vitest.config.ts',
13
11
  'vitest.config.mts',
12
+ 'vitest.config.cts',
14
13
  'vitest.config.js',
15
14
  'vitest.config.cjs',
16
- 'vitest.workspace.ts',
17
- 'vitest.workspace.mts',
18
- ]
15
+ 'vitest.config.mjs',
16
+ ] as const
17
+
18
+ function extractBaseDirFromGlob(pattern: string): string | null {
19
+ if (!pattern) {
20
+ return null
21
+ }
22
+
23
+ const normalized = pattern
24
+ .replace(/\\/g, '/')
25
+ .replace(/^\.\//, '')
26
+ const globIndex = normalized.search(/[*?[{]/)
27
+ const base = globIndex === -1
28
+ ? normalized
29
+ : normalized.slice(0, globIndex)
30
+
31
+ const cleaned = base.replace(/\/+$/, '')
32
+ return cleaned || null
33
+ }
34
+
35
+ function loadProjectRootsFromWorkspace(): string[] {
36
+ if (!fs.existsSync(WORKSPACE_FILE)) {
37
+ return []
38
+ }
39
+
40
+ try {
41
+ const workspaceContent = fs.readFileSync(WORKSPACE_FILE, 'utf8')
42
+ const workspace = YAML.parse(workspaceContent) ?? {}
43
+ const packages: unknown[] = Array.isArray(workspace.packages) ? workspace.packages : []
44
+ const roots = packages
45
+ .map(entry => typeof entry === 'string' ? entry.trim() : '')
46
+ .filter(entry => entry && !entry.startsWith('!'))
47
+ .map(extractBaseDirFromGlob)
48
+ .filter((entry): entry is string => Boolean(entry))
49
+
50
+ return roots.length ? Array.from(new Set(roots)) : []
51
+ }
52
+ catch (error) {
53
+ console.warn('[vitest] Failed to parse pnpm-workspace.yaml, no project roots will be used.', error)
54
+ return []
55
+ }
56
+ }
57
+
58
+ const PROJECT_ROOTS = loadProjectRootsFromWorkspace()
59
+
60
+ if (!PROJECT_ROOTS.length) {
61
+ console.warn('[vitest] No project roots detected. Check pnpm-workspace.yaml to define workspace packages.')
62
+ }
63
+
64
+ function findConfig(basePath: string): string | null {
65
+ for (const filename of CONFIG_FILENAMES) {
66
+ const candidate = path.join(basePath, filename)
67
+ if (fs.existsSync(candidate)) {
68
+ return candidate
69
+ }
70
+ }
71
+ return null
72
+ }
19
73
 
20
74
  function resolveProjects(): string[] {
21
75
  const projects: string[] = []
@@ -26,6 +80,11 @@ function resolveProjects(): string[] {
26
80
  continue
27
81
  }
28
82
 
83
+ const rootConfig = findConfig(rootPath)
84
+ if (rootConfig) {
85
+ projects.push(path.relative(ROOT_DIR, rootConfig))
86
+ }
87
+
29
88
  const entries = fs.readdirSync(rootPath, { withFileTypes: true })
30
89
  for (const entry of entries) {
31
90
  if (!entry.isDirectory()) {
@@ -33,10 +92,7 @@ function resolveProjects(): string[] {
33
92
  }
34
93
 
35
94
  const projectDir = path.join(rootPath, entry.name)
36
- const configPath = CONFIG_CANDIDATES
37
- .map(candidate => path.join(projectDir, candidate))
38
- .find(fs.existsSync)
39
-
95
+ const configPath = findConfig(projectDir)
40
96
  if (configPath) {
41
97
  projects.push(path.relative(ROOT_DIR, configPath))
42
98
  }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '../dist/cli.mjs'