create-disposabl-app 0.17.5 → 0.17.6
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/disposabl.js +2 -2
- package/dist/index.js +1 -1
- package/dist/templates/default/packages/cli/build.ts +4 -0
- package/dist/templates/default/packages/cli/package.json +2 -1
- package/dist/templates/default/packages/disposabl-kit/server/release/clients.mjs +28 -1
- package/dist/templates/default/packages/disposabl-kit/server/release/verify-metadata.mjs +64 -0
- package/dist/templates/default/packages/sdk/build.ts +8 -0
- package/dist/templates/default/packages/sdk/package.json +3 -2
- package/dist/verify-metadata.mjs +64 -0
- package/package.json +3 -2
package/dist/disposabl.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// ../cli/auth.ts
|
|
4
4
|
import { lock } from "proper-lockfile";
|
|
5
5
|
// ../cli/package.json
|
|
6
|
-
var version = "0.17.
|
|
6
|
+
var version = "0.17.6";
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@disposabl/cli",
|
|
9
9
|
version,
|
|
@@ -14,7 +14,7 @@ var package_default = {
|
|
|
14
14
|
files: ["dist", "README.md"],
|
|
15
15
|
engines: { node: ">=22.12.0" },
|
|
16
16
|
publishConfig: { access: "public" },
|
|
17
|
-
scripts: { build: "bun build.ts", typecheck: "bun check", lint: "bun check", release: "semantic-release" },
|
|
17
|
+
scripts: { build: "bun build.ts", typecheck: "bun check", lint: "bun check", release: "semantic-release", prepack: "node dist/verify-metadata.mjs" },
|
|
18
18
|
dependencies: { "@modelcontextprotocol/sdk": "1.32.2", commander: "15.0.0", "proper-lockfile": "4.1.2" },
|
|
19
19
|
devDependencies: { "@types/bun": "1.4.4", typescript: "~6.0.3", "@types/proper-lockfile": "4.1.4", "semantic-release": "25.0.9", "@semantic-release/exec": "7.1.0", "conventional-changelog-conventionalcommits": "9.3.1" },
|
|
20
20
|
repository: { type: "git", url: "git+https://github.com/disposabl-dev/create-disposabl-app.git", directory: "packages/cli" }
|
package/dist/index.js
CHANGED
|
@@ -1563,7 +1563,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
1563
1563
|
import { Command, CommanderError } from "commander";
|
|
1564
1564
|
import * as p2 from "@clack/prompts";
|
|
1565
1565
|
// package.json
|
|
1566
|
-
var version = "0.17.
|
|
1566
|
+
var version = "0.17.6";
|
|
1567
1567
|
|
|
1568
1568
|
// ../cli/telemetry.ts
|
|
1569
1569
|
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
@@ -11,5 +11,9 @@ const result = await Bun.build({
|
|
|
11
11
|
: telemetryBuildDefine("0.0.0-development", {}),
|
|
12
12
|
});
|
|
13
13
|
if (!result.success) throw new AggregateError(result.logs, "CLI build failed");
|
|
14
|
+
await Bun.write(
|
|
15
|
+
"dist/verify-metadata.mjs",
|
|
16
|
+
Bun.file("../disposabl-kit/server/release/verify-metadata.mjs"),
|
|
17
|
+
);
|
|
14
18
|
|
|
15
19
|
export {};
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"build": "bun build.ts",
|
|
22
22
|
"typecheck": "bun check",
|
|
23
23
|
"lint": "bun check",
|
|
24
|
-
"release": "semantic-release"
|
|
24
|
+
"release": "semantic-release",
|
|
25
|
+
"prepack": "node dist/verify-metadata.mjs"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
@@ -3,6 +3,7 @@ import { readFileSync, writeFileSync, realpathSync } from "node:fs";
|
|
|
3
3
|
import { basename, relative, resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { analyzeCommits as conventional } from "@semantic-release/commit-analyzer";
|
|
6
|
+
import { verifyMetadata } from "./verify-metadata.mjs";
|
|
6
7
|
|
|
7
8
|
const contract = "packages/backend/generated/openapi.json";
|
|
8
9
|
const git = (cwd, ...args) =>
|
|
@@ -86,14 +87,40 @@ export async function analyzeCommits(_, context) {
|
|
|
86
87
|
return release;
|
|
87
88
|
}
|
|
88
89
|
|
|
90
|
+
// Use semantic-release's original repository URL, before it injects Git credentials.
|
|
91
|
+
export function publicRepositoryUrl(original) {
|
|
92
|
+
if (typeof original !== "string")
|
|
93
|
+
throw new Error("Missing original repository URL");
|
|
94
|
+
const scp = /^(?:[^@/]+@)?([^:/]+):(.+)$/.exec(original);
|
|
95
|
+
const input =
|
|
96
|
+
scp && !original.includes("://")
|
|
97
|
+
? `https://${scp[1]}/${scp[2]}`
|
|
98
|
+
: original.replace(/^git\+/, "");
|
|
99
|
+
let url;
|
|
100
|
+
try {
|
|
101
|
+
url = new URL(input);
|
|
102
|
+
} catch {
|
|
103
|
+
throw new Error("Invalid repository URL");
|
|
104
|
+
}
|
|
105
|
+
if (!["http:", "https:", "ssh:"].includes(url.protocol))
|
|
106
|
+
throw new Error("Unsupported repository URL");
|
|
107
|
+
if (url.protocol === "ssh:") return `git+https://${url.host}${url.pathname}`;
|
|
108
|
+
url.username = "";
|
|
109
|
+
url.password = "";
|
|
110
|
+
url.search = "";
|
|
111
|
+
url.hash = "";
|
|
112
|
+
return `git+${url.href}`;
|
|
113
|
+
}
|
|
114
|
+
|
|
89
115
|
// Generated apps acquire their own repository metadata at release time.
|
|
90
116
|
export function verifyConditions(_, { cwd, options }) {
|
|
91
117
|
const path = resolve(cwd, "package.json");
|
|
92
118
|
const manifest = JSON.parse(readFileSync(path, "utf8"));
|
|
93
119
|
manifest.repository = {
|
|
94
120
|
type: "git",
|
|
95
|
-
url: options.
|
|
121
|
+
url: publicRepositoryUrl(options.originalRepositoryURL),
|
|
96
122
|
directory: `packages/${basename(cwd)}`,
|
|
97
123
|
};
|
|
124
|
+
verifyMetadata(manifest);
|
|
98
125
|
writeFileSync(path, JSON.stringify(manifest, null, 2) + "\n");
|
|
99
126
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { readFileSync, realpathSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
|
|
5
|
+
// Package metadata must never publish authenticated or signed URLs.
|
|
6
|
+
export function verifyMetadata(manifest) {
|
|
7
|
+
function inspect(value, field) {
|
|
8
|
+
if (typeof value === "string") {
|
|
9
|
+
const candidate = value
|
|
10
|
+
.trim()
|
|
11
|
+
.replace(/[\u0000-\u0020]/g, "")
|
|
12
|
+
.replace(/^git\+/i, "");
|
|
13
|
+
if (
|
|
14
|
+
/^[a-z][a-z\d+.-]*:/i.test(candidate) ||
|
|
15
|
+
/^[\\/]{2}/.test(candidate)
|
|
16
|
+
) {
|
|
17
|
+
let url;
|
|
18
|
+
try {
|
|
19
|
+
url = new URL(
|
|
20
|
+
candidate,
|
|
21
|
+
/^[\\/]{2}/.test(candidate)
|
|
22
|
+
? "https://metadata.invalid"
|
|
23
|
+
: undefined,
|
|
24
|
+
);
|
|
25
|
+
} catch {
|
|
26
|
+
throw new Error(`Invalid URL in package metadata: ${field}`);
|
|
27
|
+
}
|
|
28
|
+
if (url.username || url.password || url.search || url.hash)
|
|
29
|
+
throw new Error(`Unsafe URL in package metadata: ${field}`);
|
|
30
|
+
} else if (/^[^/]+@[^/]+:/.test(candidate)) {
|
|
31
|
+
throw new Error(`Unsafe URL in package metadata: ${field}`);
|
|
32
|
+
}
|
|
33
|
+
} else if (Array.isArray(value)) {
|
|
34
|
+
value.forEach((item) => inspect(item, field));
|
|
35
|
+
} else if (value && typeof value === "object") {
|
|
36
|
+
for (const item of Object.values(value)) inspect(item, field);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
for (const field of [
|
|
40
|
+
"repository",
|
|
41
|
+
"homepage",
|
|
42
|
+
"bugs",
|
|
43
|
+
"funding",
|
|
44
|
+
"author",
|
|
45
|
+
"contributors",
|
|
46
|
+
"maintainers",
|
|
47
|
+
"publishConfig",
|
|
48
|
+
])
|
|
49
|
+
inspect(manifest[field], field);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (
|
|
53
|
+
process.argv[1] &&
|
|
54
|
+
import.meta.url === pathToFileURL(realpathSync(resolve(process.argv[1]))).href
|
|
55
|
+
)
|
|
56
|
+
try {
|
|
57
|
+
verifyMetadata(
|
|
58
|
+
JSON.parse(readFileSync(process.argv[2] ?? "package.json", "utf8")),
|
|
59
|
+
);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (error instanceof SyntaxError)
|
|
62
|
+
throw new Error("Invalid package metadata JSON");
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"generate": "openapi-ts && bun fmt src/generated",
|
|
22
|
-
"build": "bun
|
|
22
|
+
"build": "bun build.ts",
|
|
23
23
|
"typecheck": "bun run generate && tsc --noEmit",
|
|
24
24
|
"lint": "bun check",
|
|
25
|
-
"release": "semantic-release"
|
|
25
|
+
"release": "semantic-release",
|
|
26
|
+
"prepack": "node dist/verify-metadata.mjs"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
29
|
"@hey-api/openapi-ts": "0.99.0",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { readFileSync, realpathSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
|
|
5
|
+
// Package metadata must never publish authenticated or signed URLs.
|
|
6
|
+
export function verifyMetadata(manifest) {
|
|
7
|
+
function inspect(value, field) {
|
|
8
|
+
if (typeof value === "string") {
|
|
9
|
+
const candidate = value
|
|
10
|
+
.trim()
|
|
11
|
+
.replace(/[\u0000-\u0020]/g, "")
|
|
12
|
+
.replace(/^git\+/i, "");
|
|
13
|
+
if (
|
|
14
|
+
/^[a-z][a-z\d+.-]*:/i.test(candidate) ||
|
|
15
|
+
/^[\\/]{2}/.test(candidate)
|
|
16
|
+
) {
|
|
17
|
+
let url;
|
|
18
|
+
try {
|
|
19
|
+
url = new URL(
|
|
20
|
+
candidate,
|
|
21
|
+
/^[\\/]{2}/.test(candidate)
|
|
22
|
+
? "https://metadata.invalid"
|
|
23
|
+
: undefined,
|
|
24
|
+
);
|
|
25
|
+
} catch {
|
|
26
|
+
throw new Error(`Invalid URL in package metadata: ${field}`);
|
|
27
|
+
}
|
|
28
|
+
if (url.username || url.password || url.search || url.hash)
|
|
29
|
+
throw new Error(`Unsafe URL in package metadata: ${field}`);
|
|
30
|
+
} else if (/^[^/]+@[^/]+:/.test(candidate)) {
|
|
31
|
+
throw new Error(`Unsafe URL in package metadata: ${field}`);
|
|
32
|
+
}
|
|
33
|
+
} else if (Array.isArray(value)) {
|
|
34
|
+
value.forEach((item) => inspect(item, field));
|
|
35
|
+
} else if (value && typeof value === "object") {
|
|
36
|
+
for (const item of Object.values(value)) inspect(item, field);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
for (const field of [
|
|
40
|
+
"repository",
|
|
41
|
+
"homepage",
|
|
42
|
+
"bugs",
|
|
43
|
+
"funding",
|
|
44
|
+
"author",
|
|
45
|
+
"contributors",
|
|
46
|
+
"maintainers",
|
|
47
|
+
"publishConfig",
|
|
48
|
+
])
|
|
49
|
+
inspect(manifest[field], field);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (
|
|
53
|
+
process.argv[1] &&
|
|
54
|
+
import.meta.url === pathToFileURL(realpathSync(resolve(process.argv[1]))).href
|
|
55
|
+
)
|
|
56
|
+
try {
|
|
57
|
+
verifyMetadata(
|
|
58
|
+
JSON.parse(readFileSync(process.argv[2] ?? "package.json", "utf8")),
|
|
59
|
+
);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (error instanceof SyntaxError)
|
|
62
|
+
throw new Error("Invalid package metadata JSON");
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-disposabl-app",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.6",
|
|
4
4
|
"description": "Create a Disposabl app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"typecheck": "bun check",
|
|
27
27
|
"lint": "cd ../.. && eslint --config packages/create-disposabl-app/eslint.config.ts packages/create-disposabl-app reset.ts",
|
|
28
28
|
"format": "bun fmt",
|
|
29
|
-
"verify:starter": "bun ../tests/starter-ci.ts"
|
|
29
|
+
"verify:starter": "bun ../tests/starter-ci.ts",
|
|
30
|
+
"prepack": "node dist/verify-metadata.mjs"
|
|
30
31
|
},
|
|
31
32
|
"publishConfig": {
|
|
32
33
|
"access": "public"
|