Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/PROJECT_PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**Stage:** Phase 5 — Upstash Redis adapter, in-tree, unpublished.
`@pegma/cache-core`, `@pegma/cache-conformance`, `@pegma/cache-redis`,
`@pegma/cache-azure-redis`, `@pegma/cache-elasticache`, and
`@pegma/cache-upstash-redis` are `0.1.0` and not published.
`@pegma/cache-upstash-redis` are `0.1.1` and not published.

**License:** MIT

Expand Down
10 changes: 5 additions & 5 deletions packages/cache-azure-redis/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pegma/cache-azure-redis",
"version": "0.1.0",
"version": "0.1.1",
"description": "Azure Cache for Redis adapter for @pegma/cache-core.",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -29,17 +29,17 @@
"directory": "packages/cache-azure-redis"
},
"dependencies": {
"@pegma/cache-core": "0.1.0",
"@pegma/cache-redis": "0.1.0",
"@pegma/cache-core": "0.1.1",
"@pegma/cache-redis": "0.1.1",
"@pegma/spine": "0.1.2"
},
"devDependencies": {
"@pegma/cache-conformance": "0.1.0",
"@pegma/cache-conformance": "0.1.1",
"ioredis": "^5.8.2"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"check": "tsc -p tsconfig.json --noEmit",
"prepack": "pnpm run build"
"prepack": "tsc -p tsconfig.json"
}
}
6 changes: 3 additions & 3 deletions packages/cache-conformance/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pegma/cache-conformance",
"version": "0.1.0",
"version": "0.1.1",
"description": "Executable conformance suite every @pegma/cache-core adapter must pass.",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -29,12 +29,12 @@
"directory": "packages/cache-conformance"
},
"dependencies": {
"@pegma/cache-core": "0.1.0",
"@pegma/cache-core": "0.1.1",
"@pegma/spine": "0.1.2"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"check": "tsc -p tsconfig.json --noEmit",
"prepack": "pnpm run build"
"prepack": "tsc -p tsconfig.json"
}
}
4 changes: 2 additions & 2 deletions packages/cache-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pegma/cache-core",
"version": "0.1.0",
"version": "0.1.1",
"description": "Provider-neutral ephemeral caching: namespaced keys, cache-aside getOrCompute, and an in-memory store.",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -34,6 +34,6 @@
"scripts": {
"build": "tsc -p tsconfig.json",
"check": "tsc -p tsconfig.json --noEmit",
"prepack": "pnpm run build"
"prepack": "tsc -p tsconfig.json"
}
}
10 changes: 5 additions & 5 deletions packages/cache-elasticache/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pegma/cache-elasticache",
"version": "0.1.0",
"version": "0.1.1",
"description": "Amazon ElastiCache adapter for @pegma/cache-core.",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -29,17 +29,17 @@
"directory": "packages/cache-elasticache"
},
"dependencies": {
"@pegma/cache-core": "0.1.0",
"@pegma/cache-redis": "0.1.0",
"@pegma/cache-core": "0.1.1",
"@pegma/cache-redis": "0.1.1",
"@pegma/spine": "0.1.2"
},
"devDependencies": {
"@pegma/cache-conformance": "0.1.0",
"@pegma/cache-conformance": "0.1.1",
"ioredis": "^5.8.2"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"check": "tsc -p tsconfig.json --noEmit",
"prepack": "pnpm run build"
"prepack": "tsc -p tsconfig.json"
}
}
8 changes: 4 additions & 4 deletions packages/cache-redis/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pegma/cache-redis",
"version": "0.1.0",
"version": "0.1.1",
"description": "Generic Redis adapter for @pegma/cache-core.",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -29,16 +29,16 @@
"directory": "packages/cache-redis"
},
"dependencies": {
"@pegma/cache-core": "0.1.0",
"@pegma/cache-core": "0.1.1",
"@pegma/spine": "0.1.2",
"ioredis": "^5.8.2"
},
"devDependencies": {
"@pegma/cache-conformance": "0.1.0"
"@pegma/cache-conformance": "0.1.1"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"check": "tsc -p tsconfig.json --noEmit",
"prepack": "pnpm run build"
"prepack": "tsc -p tsconfig.json"
}
}
10 changes: 5 additions & 5 deletions packages/cache-upstash-redis/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pegma/cache-upstash-redis",
"version": "0.1.0",
"version": "0.1.1",
"description": "Upstash Redis adapter for @pegma/cache-core.",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -29,18 +29,18 @@
"directory": "packages/cache-upstash-redis"
},
"dependencies": {
"@pegma/cache-core": "0.1.0",
"@pegma/cache-redis": "0.1.0",
"@pegma/cache-core": "0.1.1",
"@pegma/cache-redis": "0.1.1",
"@pegma/spine": "0.1.2",
"@upstash/redis": "^1.38.2"
},
"devDependencies": {
"@pegma/cache-conformance": "0.1.0",
"@pegma/cache-conformance": "0.1.1",
"ioredis": "^5.8.2"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"check": "tsc -p tsconfig.json --noEmit",
"prepack": "pnpm run build"
"prepack": "tsc -p tsconfig.json"
}
}
24 changes: 12 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions scripts/release-packages.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export function validateReleaseTag(options?: {
readonly expectedReleaseCommit?: string;
}): { headCommit: string; releaseTag: string };

export function parseNpmJson(stdout: string): unknown;

export function decidePublication(
localIntegrity: string,
registryIntegrity: string | null,
Expand Down
30 changes: 20 additions & 10 deletions scripts/release-packages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,17 @@ function runNpm(arguments_, options = {}) {
});
}

function runPnpm(arguments_, options = {}) {
return run(process.platform === "win32" ? "pnpm.cmd" : "pnpm", arguments_, {
...options,
shell: process.platform === "win32",
});
/**
* npm --json writes a JSON value to stdout. A lifecycle script may print a
* human banner first (`> @scope/name@version build /path`). Parse only the
* JSON value; never JSON.parse the whole stream.
*/
export function parseNpmJson(stdout) {
const start = stdout.search(/^\s*[\[{"']/mu);
if (start === -1) {
fail("npm produced no JSON output");
}
return JSON.parse(stdout.slice(start));
}

function unquoteYamlScalar(value) {
Expand Down Expand Up @@ -403,12 +409,16 @@ async function validatePackage(root, definition, lockfile) {
) {
fail(`${definition.name} must publish only its dist allowlist`);
}
const prepack = manifest.scripts?.prepack;
if (
typeof manifest.scripts?.prepack !== "string" ||
!manifest.scripts.prepack.includes("build")
typeof prepack !== "string" ||
!(prepack.includes("build") || prepack.includes("tsc"))
) {
fail(`${definition.name} must build during prepack`);
}
if (/\bpnpm\b/u.test(prepack)) {
fail(`${definition.name} prepack must not invoke pnpm`);
}
const targets = exportTargets(manifest.exports);
if (
targets.length === 0 ||
Expand Down Expand Up @@ -687,7 +697,7 @@ function queryRegistryIntegrity(name, version) {
allowFailure: true,
});
if (result.status === 0) {
const integrity = JSON.parse(result.stdout);
const integrity = parseNpmJson(result.stdout);
if (typeof integrity !== "string" || integrity.length === 0) {
fail(`${spec} exists without dist.integrity`);
}
Expand Down Expand Up @@ -732,7 +742,7 @@ export async function prepareRelease(options = {}) {
fail(`release output directory must be empty: ${output}`);
}

runPnpm(["run", "build"], { cwd: root });
runNpm(["run", "build"], { cwd: root });
const records = [];
const tagVersion = releaseTag?.slice(1);
for (const { definition, manifest } of packages) {
Expand All @@ -746,7 +756,7 @@ export async function prepareRelease(options = {}) {
],
{ cwd: root, capture: true },
);
const [packed] = JSON.parse(result.stdout);
const [packed] = parseNpmJson(result.stdout);
if (
packed?.name !== definition.name ||
packed?.version !== manifest.version ||
Expand Down
Loading
Loading