Skip to content

Commit 8d27e6f

Browse files
committed
Change names to @php-wasm/dev-*
1 parent ec24f9f commit 8d27e6f

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

.github/workflows/compile-php-wasm.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,17 @@ jobs:
176176
VERSION="${CURRENT}-wasm.${COMPACT}"
177177
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
178178
179-
- name: Inject version into dist package.json
179+
- name: Inject version and dev name into dist package.json
180+
# Dev builds are published under a distinct name
181+
# (`@php-wasm/dev-<suffix>`) so they're visibly segregated from
182+
# the production `@php-wasm/<suffix>` packages on npm. The
183+
# source package.json is untouched — only the dist copy is
184+
# renamed for publish.
180185
run: |
181186
node -e "
182187
const pkgPath = 'dist/packages/php-wasm/${{ matrix.platform }}-builds/${{ matrix.phpVersionSlug }}/package.json';
183188
const pkg = JSON.parse(require('fs').readFileSync(pkgPath, 'utf8'));
189+
pkg.name = '@php-wasm/dev-${{ matrix.packageSuffix }}';
184190
pkg.version = '${{ steps.version.outputs.version }}';
185191
require('fs').writeFileSync(pkgPath, JSON.stringify(pkg, null, '\t') + '\n');
186192
"
@@ -195,7 +201,7 @@ jobs:
195201
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
196202

197203
- name: Output published version
198-
run: echo "Published @php-wasm/${{ matrix.packageSuffix }}@${{ steps.version.outputs.version }}"
204+
run: echo "Published @php-wasm/dev-${{ matrix.packageSuffix }}@${{ steps.version.outputs.version }}"
199205

200206
post-comment:
201207
needs: [read-matrix, publish]
@@ -213,7 +219,7 @@ jobs:
213219
const lines = matrix.include.map(item => {
214220
const compact = item.requestedAt.replace(/[-:.Z]/g, '').slice(0, 15);
215221
const version = `${lernaVersion}-wasm.${compact}`;
216-
return `- \`@php-wasm/${item.packageSuffix}@${version}\``;
222+
return `- \`@php-wasm/dev-${item.packageSuffix}@${version}\``;
217223
});
218224
const body = [
219225
'### PHP WASM packages published',

tools/scripts/download-wasm.mjs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,33 +123,39 @@ for (const key of allKeys) {
123123
}
124124
}
125125

126+
// Dev/pre-release builds are published under `@php-wasm/dev-<key>`;
127+
// stable releases keep the plain `@php-wasm/<key>` name.
128+
let pkgName = `@php-wasm/${key}`;
129+
126130
if (latestRequestedAt) {
127131
const compact = latestRequestedAt.replace(/[-:.Z]/g, '').slice(0, 15);
128132
const wasmVersion = `${lernaVersion}-wasm.${compact}`;
133+
const devPkgName = `@php-wasm/dev-${key}`;
129134

130135
// Check whether CI has already published this pre-release version.
131136
try {
132-
execSync(`npm view @php-wasm/${key}@${wasmVersion} version`, {
137+
execSync(`npm view ${devPkgName}@${wasmVersion} version`, {
133138
stdio: 'pipe',
134139
});
135140
version = wasmVersion;
141+
pkgName = devPkgName;
136142
} catch {
137143
console.warn(
138-
`[warn] @php-wasm/${key}@${wasmVersion} not yet on npm.\n` +
144+
`[warn] ${devPkgName}@${wasmVersion} not yet on npm.\n` +
139145
` CI may still be running. Using stable binaries for now.\n` +
140146
` Re-run prepare-wasm once the "Compile PHP WASM" job completes.\n`
141147
);
142148
}
143149
}
144150

145151
console.log(
146-
`[download] @php-wasm/${key}@${version} (missing: ${missingVariants.join(', ')})`
152+
`[download] ${pkgName}@${version} (missing: ${missingVariants.join(', ')})`
147153
);
148154
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), `php-wasm-${key}-`));
149155

150156
try {
151157
// npm pack downloads the tarball without installing
152-
execSync(`npm pack @php-wasm/${key}@${version} --pack-destination .`, {
158+
execSync(`npm pack ${pkgName}@${version} --pack-destination .`, {
153159
cwd: tmpDir,
154160
stdio: 'pipe',
155161
});
@@ -188,7 +194,7 @@ for (const key of allKeys) {
188194
++downloaded;
189195
} catch (err) {
190196
console.error(
191-
`[error] Failed to download @php-wasm/${key}@${version}: ${err.message}`
197+
`[error] Failed to download ${pkgName}@${version}: ${err.message}`
192198
);
193199
process.exit(1);
194200
} finally {

0 commit comments

Comments
 (0)