create-disposabl-app 0.20.18 → 0.20.19
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
CHANGED
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.20.
|
|
1566
|
+
var version = "0.20.19";
|
|
1567
1567
|
|
|
1568
1568
|
// ../cli/telemetry.ts
|
|
1569
1569
|
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
@@ -12,25 +12,43 @@ name=$(node -p "require('./packages/$PACKAGE/package.json').name")
|
|
|
12
12
|
node .github/scripts/disposabl.mjs report "$platform" building
|
|
13
13
|
if GITHUB_TOKEN="$GH_TOKEN" npm_config_workspaces_update=false bun run --cwd "packages/$PACKAGE" release; then
|
|
14
14
|
version=$(node -p "require('./packages/$PACKAGE/package.json').version")
|
|
15
|
-
#
|
|
16
|
-
#
|
|
15
|
+
# A no-op release must still verify the exact latest stable tag, not npm's
|
|
16
|
+
# possibly stale latest dist-tag (for example while a publish is scanning).
|
|
17
|
+
if [[ "$version" == *development* ]]; then
|
|
18
|
+
version=""
|
|
19
|
+
tags=$(git tag --merged HEAD --sort=-version:refname --list "$name@[0-9]*")
|
|
20
|
+
while IFS= read -r tag; do
|
|
21
|
+
candidate=${tag#"$name@"}
|
|
22
|
+
if [[ "$candidate" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
23
|
+
version=$candidate
|
|
24
|
+
break
|
|
25
|
+
fi
|
|
26
|
+
done <<< "$tags"
|
|
27
|
+
if [[ -z "$version" ]]; then
|
|
28
|
+
node .github/scripts/disposabl.mjs report "$platform" failed 'Release completed without a stable package tag to verify.'
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
31
|
+
fi
|
|
17
32
|
published="$name@$version"
|
|
18
|
-
[[ "$version" != *development* ]] || published=$name
|
|
19
33
|
# npm scans newly published packages before they become visible. Retry a
|
|
20
34
|
# bounded number of times, but never report ready without registry proof.
|
|
21
35
|
available=false
|
|
22
|
-
|
|
23
|
-
|
|
36
|
+
registry_deadline=$((SECONDS + 600))
|
|
37
|
+
for attempt in {1..61}; do
|
|
38
|
+
(( SECONDS < registry_deadline )) || break
|
|
39
|
+
if PUBLISHED_VERSION=$(npm view "$published" version --prefer-online --fetch-retries=0 --fetch-timeout=5000); then
|
|
24
40
|
available=true
|
|
25
41
|
break
|
|
26
42
|
fi
|
|
27
|
-
|
|
43
|
+
remaining=$((registry_deadline - SECONDS))
|
|
44
|
+
(( remaining > 0 )) || break
|
|
45
|
+
if (( attempt < 61 )); then sleep "$((remaining < 10 ? remaining : 10))"; fi
|
|
28
46
|
done
|
|
29
47
|
if [[ "$available" != true ]]; then
|
|
30
48
|
node .github/scripts/disposabl.mjs report "$platform" failed 'Release finished, but npm availability could not be verified; check the registry lookup error.'
|
|
31
49
|
exit 1
|
|
32
50
|
fi
|
|
33
|
-
if [[ -z "$PUBLISHED_VERSION" ||
|
|
51
|
+
if [[ -z "$PUBLISHED_VERSION" || "$PUBLISHED_VERSION" != "$version" ]]; then
|
|
34
52
|
node .github/scripts/disposabl.mjs report "$platform" failed 'npm returned no matching published version.'
|
|
35
53
|
exit 1
|
|
36
54
|
fi
|
|
@@ -18,6 +18,7 @@ function release(options: {
|
|
|
18
18
|
available?: string;
|
|
19
19
|
failure?: boolean;
|
|
20
20
|
visibleAfter?: number;
|
|
21
|
+
tag?: string;
|
|
21
22
|
}) {
|
|
22
23
|
const directory = mkdtempSync(join(tmpdir(), "package-release-"));
|
|
23
24
|
try {
|
|
@@ -56,6 +57,7 @@ count=$(grep -c "^npm " calls)
|
|
|
56
57
|
printf '%s\\n' "$AVAILABLE"`,
|
|
57
58
|
);
|
|
58
59
|
executable("sleep", ":");
|
|
60
|
+
executable("git", `printf '%s\\n' "$TAG"`);
|
|
59
61
|
executable(
|
|
60
62
|
"node",
|
|
61
63
|
`if [[ "$1" == -p ]]; then
|
|
@@ -78,6 +80,7 @@ fi`,
|
|
|
78
80
|
AVAILABLE: options.available ?? "",
|
|
79
81
|
FAIL_RELEASE: String(options.failure ?? false),
|
|
80
82
|
VISIBLE_AFTER: String(options.visibleAfter ?? 0),
|
|
83
|
+
TAG: options.tag ?? "@fixture/sdk@1.2.3",
|
|
81
84
|
},
|
|
82
85
|
});
|
|
83
86
|
const calls = join(directory, "calls");
|
|
@@ -104,7 +107,7 @@ test("first publication runs before any registry lookup", () => {
|
|
|
104
107
|
test("no new release reports the existing public version", () => {
|
|
105
108
|
const result = release({ available: "1.2.3" });
|
|
106
109
|
assert.equal(result.status, 0, result.stderr);
|
|
107
|
-
assert.match(result.calls, /npm view @fixture\/sdk version/);
|
|
110
|
+
assert.match(result.calls, /npm view @fixture\/sdk@1\.2\.3 version/);
|
|
108
111
|
assert.match(result.calls, /ready version=1\.2\.3/);
|
|
109
112
|
});
|
|
110
113
|
|
|
@@ -115,15 +118,15 @@ test("release authorization failure is a failed job, not a successful skip", ()
|
|
|
115
118
|
assert.doesNotMatch(result.calls, /npm view| ready /);
|
|
116
119
|
});
|
|
117
120
|
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
for (const prepared of [undefined, "1.0.0"]) {
|
|
122
|
+
test(`unavailable registry cannot report ${prepared ? "new" : "existing"} release ready`, () => {
|
|
120
123
|
const result = release({ prepared });
|
|
121
124
|
assert.equal(result.status, 1);
|
|
122
125
|
assert.match(result.calls, /release\n/);
|
|
123
126
|
assert.match(result.calls, /availability could not be verified/);
|
|
124
127
|
assert.doesNotMatch(result.calls, / ready /);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
127
130
|
|
|
128
131
|
test("a mismatched registry version cannot report ready", () => {
|
|
129
132
|
const result = release({ prepared: "1.0.0", available: "0.9.0" });
|
|
@@ -142,3 +145,16 @@ test("new publication waits for delayed registry visibility", () => {
|
|
|
142
145
|
assert.equal((result.calls.match(/npm view/g) ?? []).length, 3);
|
|
143
146
|
assert.match(result.calls, /report typescript-sdk ready version=1\.0\.0/);
|
|
144
147
|
});
|
|
148
|
+
|
|
149
|
+
test("a stale registry version cannot satisfy a newer existing tag", () => {
|
|
150
|
+
const result = release({ tag: "@fixture/sdk@1.0.0", available: "0.0.1" });
|
|
151
|
+
assert.equal(result.status, 1);
|
|
152
|
+
assert.match(result.calls, /npm view @fixture\/sdk@1\.0\.0 version/);
|
|
153
|
+
assert.doesNotMatch(result.calls, / ready /);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test("no release tag fails closed", () => {
|
|
157
|
+
const result = release({ tag: "", available: "1.0.0" });
|
|
158
|
+
assert.equal(result.status, 1);
|
|
159
|
+
assert.doesNotMatch(result.calls, /npm view| ready /);
|
|
160
|
+
});
|