@take-out/scripts 0.0.57 → 0.0.59

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@take-out/scripts",
3
- "version": "0.0.57",
3
+ "version": "0.0.59",
4
4
  "type": "module",
5
5
  "main": "./src/run.ts",
6
6
  "sideEffects": false,
@@ -28,7 +28,7 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@take-out/helpers": "0.0.57"
31
+ "@take-out/helpers": "0.0.59"
32
32
  },
33
33
  "devDependencies": {
34
34
  "vxrn": "*1.4.0"
package/src/release.ts CHANGED
@@ -227,7 +227,11 @@ async function main() {
227
227
  const val = obj[key]
228
228
  if (typeof val === 'object' && val !== null) {
229
229
  swapTypes(val)
230
- } else if (key === 'types' && typeof val === 'string' && val.includes('/src/')) {
230
+ } else if (
231
+ key === 'types' &&
232
+ typeof val === 'string' &&
233
+ val.includes('/src/')
234
+ ) {
231
235
  obj[key] = val.replace('/src/', '/types/').replace('.ts', '.d.ts')
232
236
  }
233
237
  }
package/src/up.ts CHANGED
@@ -89,16 +89,54 @@ function findPackageJsonFiles(dir: string): string[] {
89
89
  }
90
90
 
91
91
  for (const workspace of workspacePaths) {
92
- const workspaceDir = workspace.replace(/\/\*$/, '')
93
- if (existsSync(join(dir, workspaceDir))) {
94
- const subdirs = readdirSync(join(dir, workspaceDir), { withFileTypes: true })
95
- .filter((dirent) => dirent.isDirectory())
96
- .map((dirent) => join(dir, workspaceDir, dirent.name))
97
-
98
- for (const subdir of subdirs) {
99
- if (existsSync(join(subdir, 'package.json'))) {
100
- results.push(join(subdir, 'package.json'))
92
+ // handle glob patterns like "packages/*", "code/**/*", "./code/ui/**/*"
93
+ const normalizedWorkspace = workspace.replace(/^\.\//, '')
94
+
95
+ if (normalizedWorkspace.includes('**')) {
96
+ // nested glob pattern - use glob to find all package.json files
97
+ const baseDir = normalizedWorkspace.split('**')[0].replace(/\/$/, '')
98
+ const basePath = join(dir, baseDir)
99
+
100
+ if (existsSync(basePath)) {
101
+ const findPackages = (searchDir: string) => {
102
+ try {
103
+ const entries = readdirSync(searchDir, { withFileTypes: true })
104
+ for (const entry of entries) {
105
+ if (entry.isDirectory() && entry.name !== 'node_modules') {
106
+ const subPath = join(searchDir, entry.name)
107
+ const pkgPath = join(subPath, 'package.json')
108
+ if (existsSync(pkgPath)) {
109
+ results.push(pkgPath)
110
+ }
111
+ // recurse into subdirectories
112
+ findPackages(subPath)
113
+ }
114
+ }
115
+ } catch (_e) {
116
+ // ignore permission errors
117
+ }
101
118
  }
119
+ findPackages(basePath)
120
+ }
121
+ } else if (normalizedWorkspace.includes('*')) {
122
+ // simple glob pattern like "packages/*"
123
+ const workspaceDir = normalizedWorkspace.replace(/\/\*$/, '')
124
+ if (existsSync(join(dir, workspaceDir))) {
125
+ const subdirs = readdirSync(join(dir, workspaceDir), { withFileTypes: true })
126
+ .filter((dirent) => dirent.isDirectory())
127
+ .map((dirent) => join(dir, workspaceDir, dirent.name))
128
+
129
+ for (const subdir of subdirs) {
130
+ if (existsSync(join(subdir, 'package.json'))) {
131
+ results.push(join(subdir, 'package.json'))
132
+ }
133
+ }
134
+ }
135
+ } else {
136
+ // exact path like "code/tamagui.dev" or "./code/sandbox"
137
+ const pkgPath = join(dir, normalizedWorkspace, 'package.json')
138
+ if (existsSync(pkgPath)) {
139
+ results.push(pkgPath)
102
140
  }
103
141
  }
104
142
  }