Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Use scoped npm publication with short 67js install alias

Nguyen Xuan An0c127c20692c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d2ca0706..ade9fca8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog
+## 0.2.2
+
+- Publish under `@codepawl_vn/67js` because npm rejects the unscoped name.
+- Install with the local alias `67js` to preserve the short import path.
+
## 0.2.1
- Include the bundled gl-matrix copyright notice in package and browser downloads.
diff --git a/README.md b/README.md
index d7a9b4b0..be87565a 100644
--- a/README.md
+++ b/README.md
@@ -17,10 +17,10 @@ The studio renders on demand. Continuous animation pauses in hidden tabs.
## Install
```sh
-npm install 67js
+npm install 67js@npm:@codepawl_vn/67js
```
-The package name is `67js`. The project brand is 67.js. The library is ESM and bundles its runtime dependencies. Core exports include `Renderer67`, `box`, `cylinder`, `sphere`, `torus`, `assemblyOffset`, `exportGlb`, render budget helpers and `VERSION`. Scene constructors are separate addons. Browser module downloads and the guide are available at https://67js.codepawl.com.
+The registry package is `@codepawl_vn/67js`. Its local alias is `67js`, so imports stay short. The project brand is 67.js. The library is ESM and bundles its runtime dependencies. Core exports include `Renderer67`, `box`, `cylinder`, `sphere`, `torus`, `assemblyOffset`, `exportGlb`, render budget helpers and `VERSION`. Scene constructors are separate addons. Browser module downloads and the guide are available at https://67js.codepawl.com.
## Run
diff --git a/package-lock.json b/package-lock.json
index 13ce84f3..2539e8e9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
- "name": "67js",
- "version": "0.2.1",
+ "name": "@codepawl_vn/67js",
+ "version": "0.2.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
- "name": "67js",
- "version": "0.2.1",
+ "name": "@codepawl_vn/67js",
+ "version": "0.2.2",
"license": "MIT",
"devDependencies": {
"gl-matrix": "3.4.4",
diff --git a/package.json b/package.json
index 9b355a02..7d39d39f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
- "name": "67js",
- "version": "0.2.1",
+ "name": "@codepawl_vn/67js",
+ "version": "0.2.2",
"private": false,
"type": "module",
"description": "A focused WebGL2 renderer and procedural 3D studio",
diff --git a/scripts/deploy.mjs b/scripts/deploy.mjs
index bb5b445a..fb19c0aa 100644
--- a/scripts/deploy.mjs
+++ b/scripts/deploy.mjs
@@ -17,10 +17,14 @@ run(process.execPath, ['node_modules/vite/bin/vite.js', 'build']);
run(process.execPath, ['node_modules/wrangler/bin/wrangler.js', 'deploy']);
const release = JSON.parse(await readFile('dist/release.json', 'utf8'));
let response;
+let live;
for (let attempt = 0; attempt < 6; attempt++) {
try {
- response = await fetch('https://67js.codepawl.com/release.json', { cache: 'no-store', signal: AbortSignal.timeout(10000) });
- if (response.ok) break;
+ response = await fetch(`https://67js.codepawl.com/release.json?commit=${commit}`, { cache: 'no-store', signal: AbortSignal.timeout(10000) });
+ if (response.ok) {
+ live = await response.json();
+ if (live.commit === commit && live.version === release.version && live.integrity === release.integrity) break;
+ }
} catch (error) {
if (attempt === 5) throw error;
}
@@ -28,6 +32,5 @@ for (let attempt = 0; attempt < 6; attempt++) {
await delay(5000);
}
if (!response.ok) throw new Error(`Live release verification failed: HTTP ${response.status}.`);
-const live = await response.json();
if (live.commit !== commit || live.version !== release.version || live.integrity !== release.integrity) throw new Error('Live release differs from the pushed build.');
console.log(`Verified live ${live.packageName}@${live.version} at ${live.commit}.`);
diff --git a/scripts/prepare-release.mjs b/scripts/prepare-release.mjs
index f186c4ac..dabb1c6b 100644
--- a/scripts/prepare-release.mjs
+++ b/scripts/prepare-release.mjs
@@ -8,7 +8,7 @@ import { fileURLToPath } from 'node:url';
const root = fileURLToPath(new URL('..', import.meta.url));
const metadata = JSON.parse(await readFile(resolve(root, 'package.json'), 'utf8'));
if (!/^\d+\.\d+\.\d+(?:-[a-z0-9.-]+)?$/.test(metadata.version)) throw new Error('Release version must be valid semver.');
-if (metadata.name !== '67js') throw new Error('Unexpected package name.');
+if (metadata.name !== '@codepawl_vn/67js') throw new Error('Unexpected package name.');
function run(executable, argumentsList, capture = false) {
const result = spawnSync(executable, argumentsList, { cwd: root, windowsHide: true, encoding: 'utf8', stdio: capture ? 'pipe' : 'inherit' });
@@ -49,8 +49,9 @@ try {
const release = {
version: metadata.version,
packageName: metadata.name,
+ packageAlias: '67js',
commit,
- installCommand: registryPublished ? `npm install ${metadata.name}@${metadata.version}` : `npm install https://67js.codepawl.com${tarball}`,
+ installCommand: registryPublished ? `npm install 67js@npm:${metadata.name}@${metadata.version}` : `npm install 67js@https://67js.codepawl.com${tarball}`,
tarball,
module: `/releases/${metadata.version}/67.module.js`,
registryPublished,
diff --git a/scripts/smoke-package.mjs b/scripts/smoke-package.mjs
index 547d428d..f2411828 100644
--- a/scripts/smoke-package.mjs
+++ b/scripts/smoke-package.mjs
@@ -10,13 +10,14 @@ const release = JSON.parse(await readFile('public/release.json', 'utf8'));
const archive = resolve('public', release.tarball.slice(1));
const binary = await readFile(archive);
assert.equal(release.version, metadata.version);
-assert.equal(release.packageName, '67js');
+assert.equal(release.packageName, metadata.name);
+assert.equal(release.packageAlias, '67js');
assert.equal(release.integrity, `sha512-${createHash('sha512').update(binary).digest('base64')}`);
assert.ok(binary.length < 100000, 'Library archive must not contain preview media.');
const consumer = await mkdtemp(resolve(tmpdir(), '67js-consumer-'));
await writeFile(resolve(consumer, 'package.json'), JSON.stringify({ private: true, type: 'module' }));
const npmCli = process.env.npm_execpath ?? resolve(dirname(process.execPath), 'node_modules/npm/bin/npm-cli.js');
-const installed = spawnSync(process.execPath, [npmCli, 'install', archive, '--ignore-scripts', '--no-audit', '--no-fund'], { cwd: consumer, windowsHide: true, encoding: 'utf8' });
+const installed = spawnSync(process.execPath, [npmCli, 'install', `67js@file:${archive.replaceAll('\\', '/')}`, '--ignore-scripts', '--no-audit', '--no-fund'], { cwd: consumer, windowsHide: true, encoding: 'utf8' });
assert.equal(installed.status, 0, installed.stderr);
const example = `import assert from 'node:assert/strict';
import { VERSION, Renderer67, box, assemblyOffset } from '67js';