@warpgogol/repo-extract 1.2.10 → 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 +17 -29
- 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,13 +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>
|
|
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>
|
|
15
16
|
</CHANGE_SUMMARY>
|
|
16
17
|
*/
|
|
17
18
|
import { readFile, writeFile, rm, access, readdir } from "node:fs/promises";
|
|
18
19
|
import { readFileSync } from "node:fs";
|
|
19
20
|
import * as path from "node:path";
|
|
20
21
|
import { isIgnored } from "./copy.js";
|
|
22
|
+
import { resolveSourceVersion } from "./discover.js";
|
|
21
23
|
export async function transformPackageJson(dest, relPath, config, logger) {
|
|
22
24
|
const fullPath = path.join(dest, relPath);
|
|
23
25
|
let raw;
|
|
@@ -53,11 +55,7 @@ export async function transformPackageJson(dest, relPath, config, logger) {
|
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
|
-
for (const depField of [
|
|
57
|
-
"dependencies",
|
|
58
|
-
"devDependencies",
|
|
59
|
-
"peerDependencies",
|
|
60
|
-
]) {
|
|
58
|
+
for (const depField of ["dependencies", "devDependencies", "peerDependencies"]) {
|
|
61
59
|
if (pkg[depField]) {
|
|
62
60
|
for (const key of Object.keys(pkg[depField])) {
|
|
63
61
|
const shouldStrip = stripScopes.some((scope) => key.startsWith(scope));
|
|
@@ -336,8 +334,7 @@ export async function generateRootFiles(dest, root, config, packageDirs, appDirs
|
|
|
336
334
|
.map((e) => ` - ${e}`),
|
|
337
335
|
"",
|
|
338
336
|
];
|
|
339
|
-
if (config.onlyBuiltDependencies &&
|
|
340
|
-
config.onlyBuiltDependencies.length > 0) {
|
|
337
|
+
if (config.onlyBuiltDependencies && config.onlyBuiltDependencies.length > 0) {
|
|
341
338
|
workspaceYamlLines.push("onlyBuiltDependencies:");
|
|
342
339
|
for (const dep of config.onlyBuiltDependencies) {
|
|
343
340
|
workspaceYamlLines.push(` - '${dep}'`);
|
|
@@ -376,10 +373,7 @@ export async function generateRootFiles(dest, root, config, packageDirs, appDirs
|
|
|
376
373
|
/* no tsconfig.json at this level — skip */
|
|
377
374
|
}
|
|
378
375
|
}
|
|
379
|
-
const references = [
|
|
380
|
-
...packageDirs.map((d) => ({ path: `./${d}` })),
|
|
381
|
-
...appRefs,
|
|
382
|
-
];
|
|
376
|
+
const references = [...packageDirs.map((d) => ({ path: `./${d}` })), ...appRefs];
|
|
383
377
|
const tsconfig = {
|
|
384
378
|
extends: "./tsconfig.base.json",
|
|
385
379
|
compileOnSave: false,
|
|
@@ -478,18 +472,10 @@ export function generateCiWorkflow(pm, ci) {
|
|
|
478
472
|
if (ci?.deploy?.provider === "cloudflare-pages") {
|
|
479
473
|
const d = ci.deploy;
|
|
480
474
|
const envLines = [
|
|
481
|
-
" " +
|
|
482
|
-
d.apiTokenSecret +
|
|
483
|
-
": ${{ secrets." +
|
|
484
|
-
d.apiTokenSecret +
|
|
485
|
-
" }}",
|
|
475
|
+
" " + d.apiTokenSecret + ": ${{ secrets." + d.apiTokenSecret + " }}",
|
|
486
476
|
];
|
|
487
477
|
if (d.accountIdSecret) {
|
|
488
|
-
envLines.push(" " +
|
|
489
|
-
d.accountIdSecret +
|
|
490
|
-
": ${{ secrets." +
|
|
491
|
-
d.accountIdSecret +
|
|
492
|
-
" }}");
|
|
478
|
+
envLines.push(" " + d.accountIdSecret + ": ${{ secrets." + d.accountIdSecret + " }}");
|
|
493
479
|
}
|
|
494
480
|
lines.push("", " deploy:", " needs: ci", " if: github.event_name == 'push'", " runs-on: ubuntu-latest", " timeout-minutes: 15", " permissions:", " contents: read", " steps:", " - uses: actions/checkout@v5", ...pnpmSetup, " - uses: actions/setup-node@v5", " with:", ` node-version: ${nodeVersion}`, ` cache: ${cacheKey}`, ` - run: ${installCmd}`, ` - run: ${d.buildCommand}`, ` - run: npx wrangler deploy`, " working-directory: " + d.outputDir, " env:", ...envLines);
|
|
495
481
|
}
|
|
@@ -551,16 +537,12 @@ export async function fixStandalonePackageJson(dest, config, pm, root, logger) {
|
|
|
551
537
|
changed = true;
|
|
552
538
|
}
|
|
553
539
|
}
|
|
554
|
-
for (const depField of [
|
|
555
|
-
"dependencies",
|
|
556
|
-
"devDependencies",
|
|
557
|
-
"peerDependencies",
|
|
558
|
-
]) {
|
|
540
|
+
for (const depField of ["dependencies", "devDependencies", "peerDependencies"]) {
|
|
559
541
|
if (pkg[depField]) {
|
|
560
542
|
for (const key of Object.keys(pkg[depField])) {
|
|
561
543
|
if (depField === "peerDependencies") {
|
|
562
544
|
if (pkg[depField][key] === "workspace:*") {
|
|
563
|
-
pkg[depField][key] =
|
|
545
|
+
pkg[depField][key] = await rewriteWorkspaceSpecifier(key, preservePackages, root);
|
|
564
546
|
changed = true;
|
|
565
547
|
}
|
|
566
548
|
}
|
|
@@ -572,7 +554,7 @@ export async function fixStandalonePackageJson(dest, config, pm, root, logger) {
|
|
|
572
554
|
changed = true;
|
|
573
555
|
}
|
|
574
556
|
else if (pkg[depField][key] === "workspace:*") {
|
|
575
|
-
pkg[depField][key] =
|
|
557
|
+
pkg[depField][key] = await rewriteWorkspaceSpecifier(key, preservePackages, root);
|
|
576
558
|
changed = true;
|
|
577
559
|
}
|
|
578
560
|
}
|
|
@@ -594,6 +576,12 @@ export async function fixStandalonePackageJson(dest, config, pm, root, logger) {
|
|
|
594
576
|
(logger?.log ?? console.log)(" fixed standalone package.json (test script, workspace deps, packageManager)");
|
|
595
577
|
}
|
|
596
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
|
+
}
|
|
597
585
|
export async function fixStandaloneVitestConfig(dest, logger) {
|
|
598
586
|
const configPath = path.join(dest, "vitest.config.ts");
|
|
599
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)",
|