@dcl/abgen 0.0.1 → 0.14.2

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/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # @dcl/abgen
2
+
3
+ Prebuilt binaries for [abgen](https://github.com/decentraland/abgen): the standalone Decentraland
4
+ asset-bundle converter + ab-cdn-compatible JIT server. Installing this package pulls the binary for
5
+ your platform through an `optionalDependency`:
6
+
7
+ | Platform | Package |
8
+ |---|---|
9
+ | Linux x64 (glibc >= 2.35) | `@dcl/abgen-linux-x64` |
10
+ | Linux arm64 (glibc >= 2.35) | `@dcl/abgen-linux-arm64` |
11
+ | Windows x64 | `@dcl/abgen-win32-x64` |
12
+ | Windows arm64 | `@dcl/abgen-win32-arm64` |
13
+ | macOS arm64 (Apple Silicon) | `@dcl/abgen-darwin-arm64` |
14
+ | macOS x64 (Intel) | `@dcl/abgen-darwin-x64` |
15
+
16
+ Each platform package carries the binary plus the `template/` and `shader/` runtime assets it
17
+ resolves from its own directory - no configuration needed. The binaries are the same reproducible
18
+ artifacts attached to the GitHub release of the matching tag.
19
+
20
+ ## Run the server
21
+
22
+ ```bash
23
+ npx @dcl/abgen # ab-cdn-compatible server on 127.0.0.1:5147
24
+ ABGEN_CATALYST_URL=https://peer.decentraland.org/content npx @dcl/abgen
25
+ ```
26
+
27
+ All configuration is environment variables - see the
28
+ [repository README](https://github.com/decentraland/abgen#environment-variables).
29
+
30
+ ## Embed in a tool
31
+
32
+ ```js
33
+ const { binPath } = require('@dcl/abgen')
34
+ // spawn binPath() with the ABGEN_* environment you need
35
+ ```
36
+
37
+ `binPath()` returns the absolute path of the platform binary, and throws with an actionable
38
+ message on unsupported platforms or when the optional platform package was omitted at install
39
+ time. `@dcl/sdk-commands` uses this to boot the asset-bundle preview sidecar.
40
+
41
+ ## License
42
+
43
+ AGPL-3.0-or-later. Full text and vendored third-party notices in the
44
+ [repository](https://github.com/decentraland/abgen).
package/bin/abgen.js ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ const { spawn } = require('child_process')
3
+ const { binPath } = require('../index.js')
4
+
5
+ const child = spawn(binPath(), process.argv.slice(2), { stdio: 'inherit' })
6
+ child.on('error', (error) => {
7
+ console.error(`@dcl/abgen: ${error.message}`)
8
+ process.exit(1)
9
+ })
10
+ for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
11
+ process.on(signal, () => child.kill(signal))
12
+ }
13
+ child.on('exit', (code) => {
14
+ process.exit(code === null ? 1 : code)
15
+ })
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export function binPath(): string
2
+ export const PLATFORM_PACKAGES: Record<string, readonly [pkg: string, bin: string]>
package/index.js ADDED
@@ -0,0 +1,36 @@
1
+ const PLATFORM_PACKAGES = {
2
+ 'linux-x64': ['@dcl/abgen-linux-x64', 'abgen'],
3
+ 'linux-arm64': ['@dcl/abgen-linux-arm64', 'abgen'],
4
+ 'win32-x64': ['@dcl/abgen-win32-x64', 'abgen.exe'],
5
+ 'win32-arm64': ['@dcl/abgen-win32-arm64', 'abgen.exe'],
6
+ 'darwin-arm64': ['@dcl/abgen-darwin-arm64', 'abgen'],
7
+ 'darwin-x64': ['@dcl/abgen-darwin-x64', 'abgen']
8
+ }
9
+
10
+ function binPath() {
11
+ const key = `${process.platform}-${process.arch}`
12
+ const entry = PLATFORM_PACKAGES[key]
13
+ if (!entry) {
14
+ throw new Error(
15
+ `@dcl/abgen: no prebuilt binary for ${key} (available: ${Object.keys(PLATFORM_PACKAGES).join(', ')}). ` +
16
+ 'Build abgen from source (https://github.com/decentraland/abgen) and put it on the PATH instead.'
17
+ )
18
+ }
19
+ const [pkg, bin] = entry
20
+ try {
21
+ return require.resolve(`${pkg}/${bin}`)
22
+ } catch {
23
+ // file:/link installs resolve this module to its realpath, where the platform
24
+ // package is not a sibling - fall back to the consumer's working directory.
25
+ try {
26
+ return require.resolve(`${pkg}/${bin}`, { paths: [process.cwd()] })
27
+ } catch {
28
+ throw new Error(
29
+ `@dcl/abgen: ${pkg} is missing. It installs as an optionalDependency of @dcl/abgen - ` +
30
+ 'reinstall without --omit=optional / --no-optional, or add it as a direct dependency.'
31
+ )
32
+ }
33
+ }
34
+ }
35
+
36
+ module.exports = { binPath, PLATFORM_PACKAGES }
package/package.json CHANGED
@@ -1,5 +1,31 @@
1
1
  {
2
2
  "name": "@dcl/abgen",
3
- "version": "0.0.1",
4
- "description": "Placeholder to bootstrap Trusted Publishing; superseded by the first CI release."
3
+ "version": "0.14.2",
4
+ "description": "Decentraland asset-bundle converter + ab-cdn-compatible JIT server. Installs the prebuilt abgen binary for your platform.",
5
+ "license": "AGPL-3.0-or-later",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/decentraland/abgen.git"
9
+ },
10
+ "main": "index.js",
11
+ "types": "index.d.ts",
12
+ "bin": {
13
+ "abgen": "bin/abgen.js"
14
+ },
15
+ "files": [
16
+ "index.js",
17
+ "index.d.ts",
18
+ "bin/abgen.js"
19
+ ],
20
+ "engines": {
21
+ "node": ">=18"
22
+ },
23
+ "optionalDependencies": {
24
+ "@dcl/abgen-linux-x64": "0.14.2",
25
+ "@dcl/abgen-linux-arm64": "0.14.2",
26
+ "@dcl/abgen-win32-x64": "0.14.2",
27
+ "@dcl/abgen-win32-arm64": "0.14.2",
28
+ "@dcl/abgen-darwin-arm64": "0.14.2",
29
+ "@dcl/abgen-darwin-x64": "0.14.2"
30
+ }
5
31
  }