@warpgogol/repo-extract 1.2.9 → 1.3.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.
- package/dist/extract.js +6 -0
- package/dist/fs/discover.d.ts +1 -0
- package/dist/fs/discover.d.ts.map +1 -1
- package/dist/fs/discover.js +14 -0
- package/dist/fs/transform.d.ts.map +1 -1
- package/dist/fs/transform.js +12 -3
- package/package.json +1 -1
package/dist/extract.js
CHANGED
|
@@ -396,6 +396,12 @@ async function exportStandalonePackage(root, dest, config, logger, emit) {
|
|
|
396
396
|
// 5. Clean stray artifacts
|
|
397
397
|
logger.log("Cleaning stray artifacts...");
|
|
398
398
|
await cleanStrayArtifacts(dest);
|
|
399
|
+
// 5a. Run post-process rules
|
|
400
|
+
if (config.postProcess && config.postProcess.length > 0) {
|
|
401
|
+
logger.log("Running post-process rules...");
|
|
402
|
+
const ctx = { root, dest, config, packageDirs: [] };
|
|
403
|
+
await runPostProcess(ctx, config.postProcess, emit, logger);
|
|
404
|
+
}
|
|
399
405
|
// 5b. Generate CI workflow
|
|
400
406
|
logger.log("Generating CI workflow...");
|
|
401
407
|
const ciDir = path.join(dest, ".github", "workflows");
|
package/dist/fs/discover.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/fs/discover.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/fs/discover.ts"],"names":[],"mappings":"AAkBA,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EAAE,EACjB,iBAAiB,GAAE,MAAM,EAAO,GAC/B,OAAO,CAAC,MAAM,EAAE,CAAC,CAyCnB;AA6CD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUhG"}
|
package/dist/fs/discover.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
</MODULE_CONTRACT>
|
|
8
8
|
<CHANGE_SUMMARY>
|
|
9
9
|
<item>Ported discoverPackageDeps from scripts/export-clients-helpers.ts for RFC-0070. Supports both @syrokomskyi/ and @warpgogol/ prefixes.</item>
|
|
10
|
+
<item>ADR-0082: added resolveSourceVersion — reads a workspace package's version from the source monorepo so preserved deps can be pinned to ^<sourceVersion>.</item>
|
|
10
11
|
</CHANGE_SUMMARY>
|
|
11
12
|
*/
|
|
12
13
|
import { readFile, readdir } from "node:fs/promises";
|
|
@@ -90,6 +91,19 @@ async function resolveAppDeps(root, appDir, resolvePkg, workspacePrefixes) {
|
|
|
90
91
|
/* no-op */
|
|
91
92
|
}
|
|
92
93
|
}
|
|
94
|
+
export async function resolveSourceVersion(root, pkgName) {
|
|
95
|
+
const pkgDir = await findPackageDir(root, pkgName);
|
|
96
|
+
if (!pkgDir)
|
|
97
|
+
return null;
|
|
98
|
+
try {
|
|
99
|
+
const raw = await readFile(path.join(pkgDir, "package.json"), "utf-8");
|
|
100
|
+
const pkg = JSON.parse(raw);
|
|
101
|
+
return typeof pkg.version === "string" && pkg.version.length > 0 ? pkg.version : null;
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
93
107
|
async function findPackageDir(root, pkgName) {
|
|
94
108
|
const packagesDir = path.join(root, "packages");
|
|
95
109
|
async function searchDir(dir) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/fs/transform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/fs/transform.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,KAAK,EAAE,MAA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,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAoFf;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BrE;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,cAAc,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAqInF;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EACrB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAmCf;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,cAAc,EAClB,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAiEf;AAYD,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAe5F"}
|
package/dist/fs/transform.js
CHANGED
|
@@ -11,12 +11,15 @@
|
|
|
11
11
|
<item>RFC-0071: Replaced hardcoded org-specific values with config-driven options (stripScopes, preservePackages, rootPackageName, customConditions, onlyBuiltDependencies, packageManager, gitignoreMode).</item>
|
|
12
12
|
<item>RFC-0072: Parameterized buildRootPackageJson, generateRootFiles, generateCiWorkflow, fixStandalonePackageJson for pnpm/npm/yarn support.</item>
|
|
13
13
|
<item>Fix: Split generateCiWorkflow into ci + publish jobs — publish only on push to main, with registry-url for NODE_AUTH_TOKEN.</item>
|
|
14
|
+
<item>ADR-0082: preservePackages workspace:* deps now pin to ^<sourceVersion> instead of * — extracted lockfiles resolve the just-published sibling under pnpm minimumReleaseAge.</item>
|
|
15
|
+
<item>RFC-1081: Added gh release create step after npm publish with --generate-notes and || true for tag collision. Updated publish job permissions to contents: write. (Ported back from standalone repo — was committed there directly on 2026-09-13.)</item>
|
|
14
16
|
</CHANGE_SUMMARY>
|
|
15
17
|
*/
|
|
16
18
|
import { readFile, writeFile, rm, access, readdir } from "node:fs/promises";
|
|
17
19
|
import { readFileSync } from "node:fs";
|
|
18
20
|
import * as path from "node:path";
|
|
19
21
|
import { isIgnored } from "./copy.js";
|
|
22
|
+
import { resolveSourceVersion } from "./discover.js";
|
|
20
23
|
export async function transformPackageJson(dest, relPath, config, logger) {
|
|
21
24
|
const fullPath = path.join(dest, relPath);
|
|
22
25
|
let raw;
|
|
@@ -464,7 +467,7 @@ export function generateCiWorkflow(pm, ci) {
|
|
|
464
467
|
...buildSteps,
|
|
465
468
|
];
|
|
466
469
|
if (publish) {
|
|
467
|
-
lines.push("", " publish:", " needs: ci", " if: github.event_name == 'push'", " runs-on: ubuntu-latest", " timeout-minutes: 10", " permissions:", " contents:
|
|
470
|
+
lines.push("", " publish:", " needs: ci", " if: github.event_name == 'push'", " runs-on: ubuntu-latest", " timeout-minutes: 10", " permissions:", " contents: write", " id-token: write", " steps:", " - uses: actions/checkout@v5", ...pnpmSetup, " - uses: actions/setup-node@v5", " with:", ` node-version: ${nodeVersion}`, ` cache: ${cacheKey}`, " registry-url: https://registry.npmjs.org", ` - run: ${installCmd}`, ` - run: ${runPrefix} build`, " - run: npm publish --provenance --access public", " env:", " NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}", " - name: Create GitHub Release", " if: github.ref == 'refs/heads/main' && github.event_name == 'push'", " run: |", " VERSION=$(node -p \"require('./package.json').version\")", ' gh release create "v${VERSION}" \\', ' --title "v${VERSION}" \\', " --generate-notes \\", " --latest || true", " env:", " GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}");
|
|
468
471
|
}
|
|
469
472
|
if (ci?.deploy?.provider === "cloudflare-pages") {
|
|
470
473
|
const d = ci.deploy;
|
|
@@ -539,7 +542,7 @@ export async function fixStandalonePackageJson(dest, config, pm, root, logger) {
|
|
|
539
542
|
for (const key of Object.keys(pkg[depField])) {
|
|
540
543
|
if (depField === "peerDependencies") {
|
|
541
544
|
if (pkg[depField][key] === "workspace:*") {
|
|
542
|
-
pkg[depField][key] =
|
|
545
|
+
pkg[depField][key] = await rewriteWorkspaceSpecifier(key, preservePackages, root);
|
|
543
546
|
changed = true;
|
|
544
547
|
}
|
|
545
548
|
}
|
|
@@ -551,7 +554,7 @@ export async function fixStandalonePackageJson(dest, config, pm, root, logger) {
|
|
|
551
554
|
changed = true;
|
|
552
555
|
}
|
|
553
556
|
else if (pkg[depField][key] === "workspace:*") {
|
|
554
|
-
pkg[depField][key] =
|
|
557
|
+
pkg[depField][key] = await rewriteWorkspaceSpecifier(key, preservePackages, root);
|
|
555
558
|
changed = true;
|
|
556
559
|
}
|
|
557
560
|
}
|
|
@@ -573,6 +576,12 @@ export async function fixStandalonePackageJson(dest, config, pm, root, logger) {
|
|
|
573
576
|
(logger?.log ?? console.log)(" fixed standalone package.json (test script, workspace deps, packageManager)");
|
|
574
577
|
}
|
|
575
578
|
}
|
|
579
|
+
async function rewriteWorkspaceSpecifier(depName, preservePackages, root) {
|
|
580
|
+
if (!root || !preservePackages.includes(depName))
|
|
581
|
+
return "*";
|
|
582
|
+
const version = await resolveSourceVersion(root, depName);
|
|
583
|
+
return version ? `^${version}` : "*";
|
|
584
|
+
}
|
|
576
585
|
export async function fixStandaloneVitestConfig(dest, logger) {
|
|
577
586
|
const configPath = path.join(dest, "vitest.config.ts");
|
|
578
587
|
let raw;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warpgogol/repo-extract",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Extract apps and packages from a TurboRepo monorepo into standalone public repositories",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Andrii Syrokomskyi <andrii@syrokomskyi.com> (https://syrokomskyi.com)",
|