@take-out/scripts 0.0.92 → 0.0.93

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 +2 -2
  2. package/src/release.ts +27 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@take-out/scripts",
3
- "version": "0.0.92",
3
+ "version": "0.0.93",
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.79"
31
+ "@take-out/helpers": "0.0.93"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "vxrn": "^1.4.15"
package/src/release.ts CHANGED
@@ -179,11 +179,8 @@ async function mainRelease() {
179
179
  const nextDeps = next[field]
180
180
  if (!nextDeps) continue
181
181
  for (const depName in nextDeps) {
182
- // only update non-workspace internal dependencies
183
- if (!nextDeps[depName].startsWith('workspace:')) {
184
- if (allPackageJsons.some((p) => p.name === depName)) {
185
- nextDeps[depName] = nextVersion
186
- }
182
+ if (allPackageJsons.some((p) => p.name === depName)) {
183
+ nextDeps[depName] = nextVersion
187
184
  }
188
185
  }
189
186
  }
@@ -241,6 +238,31 @@ async function mainRelease() {
241
238
 
242
239
  console.info(`✅ ${dryRun ? '[dry-run] ' : ''}Published\n`)
243
240
 
241
+ // restore workspace:* protocols after publishing
242
+ if (!dryRun) {
243
+ await Promise.all(
244
+ allPackageJsons.map(async ({ json, path }) => {
245
+ const current = await fs.readJSON(path)
246
+ for (const field of [
247
+ 'dependencies',
248
+ 'devDependencies',
249
+ 'optionalDependencies',
250
+ 'peerDependencies',
251
+ ]) {
252
+ const origDeps = json[field]
253
+ const currentDeps = current[field]
254
+ if (!origDeps || !currentDeps) continue
255
+ for (const depName in origDeps) {
256
+ if (origDeps[depName].startsWith('workspace:') && currentDeps[depName]) {
257
+ currentDeps[depName] = origDeps[depName]
258
+ }
259
+ }
260
+ }
261
+ await writeJSON(path, current, { spaces: 2 })
262
+ })
263
+ )
264
+ }
265
+
244
266
  // revert version changes after dry-run
245
267
  if (dryRun) {
246
268
  await run(`git checkout -- packages/*/package.json`, { silent: true })