mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
feat: add apps/p2 (imported from pi-private at 7dadff697)
p2 (Pi Mobile on Chord v2) moves from pi-private into pi as one commit. Root scripts that loop all workspaces use --if-present; npm test, ./test.sh and the release script cover packages/* only (p2: cd apps/p2 && npm test); sync-versions also updates apps' workspace pins.
This commit is contained in:
parent
f409847473
commit
05dc8d239d
630 changed files with 119796 additions and 13 deletions
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
/**
|
||||
* Validates lockstep versions for published packages, then synchronizes
|
||||
* exact internal dependency versions in all workspace packages, including private ones.
|
||||
* exact internal dependency versions in all workspace packages, including private ones,
|
||||
* and in the apps next to the packages directory (`apps/*`, never published).
|
||||
*/
|
||||
|
||||
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
||||
|
|
@ -11,13 +12,22 @@ import { findPackageDirectories } from "./package-workspaces.mjs";
|
|||
|
||||
const GENERATED_PACKAGE_SUFFIXES = [join("coding-agent", "install-lock")];
|
||||
|
||||
const packageRoot = process.argv[2] ?? "packages";
|
||||
const workspacePackages = findPackageDirectories(packageRoot)
|
||||
.filter((directory) => !GENERATED_PACKAGE_SUFFIXES.some((suffix) => directory.endsWith(suffix)))
|
||||
.map((directory) => {
|
||||
function readManifests(directories) {
|
||||
return directories.map((directory) => {
|
||||
const path = join(directory, "package.json");
|
||||
return { data: JSON.parse(readFileSync(path, "utf8")), path };
|
||||
});
|
||||
}
|
||||
|
||||
const packageRoot = process.argv[2] ?? "packages";
|
||||
const workspacePackages = readManifests(
|
||||
findPackageDirectories(packageRoot).filter(
|
||||
(directory) => !GENERATED_PACKAGE_SUFFIXES.some((suffix) => directory.endsWith(suffix)),
|
||||
),
|
||||
);
|
||||
// Apps pin the workspace packages exactly too; stale pins would make npm install them from the registry.
|
||||
const appRoot = join(dirname(packageRoot), "apps");
|
||||
const appPackages = existsSync(appRoot) ? readManifests(findPackageDirectories(appRoot)) : [];
|
||||
const publishedPackages = workspacePackages.filter((pkg) => pkg.data.private !== true);
|
||||
const versionMap = new Map(workspacePackages.map((pkg) => [pkg.data.name, pkg.data.version]));
|
||||
|
||||
|
|
@ -40,7 +50,7 @@ console.log("\nAll non-private packages are at the same version (lockstep).");
|
|||
|
||||
let totalUpdates = 0;
|
||||
const updatedPackages = new Set();
|
||||
for (const pkg of workspacePackages) {
|
||||
for (const pkg of [...workspacePackages, ...appPackages]) {
|
||||
for (const dependencyType of ["dependencies", "devDependencies", "optionalDependencies"]) {
|
||||
const dependencies = pkg.data[dependencyType];
|
||||
if (!dependencies) {
|
||||
|
|
|
|||
|
|
@ -55,6 +55,14 @@ test("pins published and private dependencies without touching registry aliases,
|
|||
"@mariozechner/pi-ai": "npm:@earendil-works/pi-ai@1.0.0",
|
||||
},
|
||||
});
|
||||
await writeManifest(root, "apps/p2", {
|
||||
name: "p2",
|
||||
version: "0.0.1",
|
||||
private: true,
|
||||
dependencies: {
|
||||
"@earendil-works/pi-ai": "1.0.0",
|
||||
},
|
||||
});
|
||||
await writeManifest(root, "packages/coding-agent/install-lock", {
|
||||
name: "generated-install-lock",
|
||||
version: "0.0.0",
|
||||
|
|
@ -74,6 +82,9 @@ test("pins published and private dependencies without touching registry aliases,
|
|||
const evalsManifest = await readManifest(root, "packages/evals");
|
||||
assert.equal(evalsManifest.dependencies["@earendil-works/pi-coding-agent"], "2.0.0");
|
||||
assert.equal(evalsManifest.dependencies["@mariozechner/pi-ai"], "npm:@earendil-works/pi-ai@1.0.0");
|
||||
const appManifest = await readManifest(root, "apps/p2");
|
||||
assert.equal(appManifest.dependencies["@earendil-works/pi-ai"], "2.0.0");
|
||||
assert.equal(appManifest.version, "0.0.1");
|
||||
const generatedManifest = await readManifest(root, "packages/coding-agent/install-lock");
|
||||
assert.equal(generatedManifest.dependencies["@earendil-works/pi-coding-agent"], "^1.0.0");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue