@take-out/scripts 0.0.78 → 0.0.80

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 (2) hide show
  1. package/package.json +4 -4
  2. package/src/up.ts +42 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@take-out/scripts",
3
- "version": "0.0.78",
3
+ "version": "0.0.80",
4
4
  "type": "module",
5
5
  "main": "./src/run.ts",
6
6
  "sideEffects": false,
@@ -28,10 +28,10 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@take-out/helpers": "0.0.76"
31
+ "@take-out/helpers": "0.0.79"
32
32
  },
33
33
  "peerDependencies": {
34
- "vxrn": "*"
34
+ "vxrn": "^1.4.15"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "vxrn": {
@@ -39,6 +39,6 @@
39
39
  }
40
40
  },
41
41
  "devDependencies": {
42
- "vxrn": "1.4.10-1770207233041"
42
+ "vxrn": "1.4.15"
43
43
  }
44
44
  }
package/src/up.ts CHANGED
@@ -206,8 +206,10 @@ function updatePackageJsonVersions(
206
206
  depsObject[pkg] = newVersion
207
207
  } else {
208
208
  const currentVersion = depsObject[pkg]
209
- // skip wildcard ranges like "*" - they should stay as-is
209
+ // wildcard "*" means newly added placeholder, use ^ prefix
210
210
  if (currentVersion === '*') {
211
+ depsObject[pkg] = `^${newVersion}`
212
+ updatedCount++
211
213
  continue
212
214
  }
213
215
  const prefixMatch = currentVersion.match(/^([^\d]*)/)
@@ -389,14 +391,46 @@ async function main() {
389
391
  }
390
392
  }
391
393
 
392
- console.info(
393
- `Found ${allMatchingDeps.size} dependencies matching patterns: ${packagePatterns.join(', ')}`
394
- )
395
- console.info(`Found matches in ${packagesByWorkspace.size} workspace(s)`)
396
-
397
394
  if (allMatchingDeps.size === 0) {
398
- console.info('No matching packages found to update.')
399
- return
395
+ // no existing deps matched, but exact patterns (no wildcards) can be added fresh
396
+ const exactPatterns = packagePatterns.filter((p) => !p.includes('*'))
397
+ if (exactPatterns.length === 0) {
398
+ console.info(
399
+ `Found 0 dependencies matching patterns: ${packagePatterns.join(', ')}`
400
+ )
401
+ console.info('No matching packages found to update.')
402
+ return
403
+ }
404
+
405
+ // add as new dependencies to the root package.json
406
+ console.info(`No existing deps found, adding to root: ${exactPatterns.join(', ')}`)
407
+ const rootPkgPath = join(rootDir, 'package.json')
408
+
409
+ for (const pkg of exactPatterns) {
410
+ allMatchingDeps.add(pkg)
411
+ }
412
+
413
+ packagesByWorkspace.set('root', {
414
+ dir: rootDir,
415
+ packages: exactPatterns,
416
+ })
417
+
418
+ // insert placeholder so updatePackageJsonVersions can set the real version
419
+ const rootPkg = JSON.parse(readFileSync(rootPkgPath, 'utf-8'))
420
+ if (!rootPkg.dependencies) {
421
+ rootPkg.dependencies = {}
422
+ }
423
+ for (const pkg of exactPatterns) {
424
+ if (!rootPkg.dependencies[pkg] && !rootPkg.devDependencies?.[pkg]) {
425
+ rootPkg.dependencies[pkg] = '*'
426
+ }
427
+ }
428
+ writeFileSync(rootPkgPath, JSON.stringify(rootPkg, null, 2) + '\n')
429
+ } else {
430
+ console.info(
431
+ `Found ${allMatchingDeps.size} dependencies matching patterns: ${packagePatterns.join(', ')}`
432
+ )
433
+ console.info(`Found matches in ${packagesByWorkspace.size} workspace(s)`)
400
434
  }
401
435
 
402
436
  if (globalTag) {