Repository navigation
Expose the registry as the root package's bin #159
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or requestpriority: highMust be addressed in current sprintMust be addressed in current sprint
Description
User story / Problem statement
Nothing in this repository is installable as an npm package. The root manifest
is named canton-token-forge, has no bin, no files, no repository, and
declares "type": "commonjs" while the service it would ship is ESM.
registry/ is private: true and lives in a subdirectory, and neither npm nor
pnpm can install a git dependency from a subdirectory. A consumer has no way to
say "give me this service" in a manifest.
Expected outcome
npm pack at the root produces a tarball carrying the built service, the
OpenAPI specs it reads at runtime, and the environment template. Installing that
tarball links one executable named canton-token-forge-registry.
Acceptance criteria
Package identity
- Name
@bootnodedev/canton-token-forge, version0.2.0,"type": "module",
arepositoryfield, andengines.nodeat>=18 -
binmapscanton-token-forge-registrytoregistry/dist/index.js -
registry/src/index.tsstarts with#!/usr/bin/env node
Pack contents
-
npm packproduces a tarball containing every file underregistry/dist,
all fourregistry/openapi/*.yaml, andregistry/.env.example -
package/registry/dist/index.jsis present in the archive, since it is the
bin target - Installing that tarball links an executable at
node_modules/.bin/canton-token-forge-registry
Nothing regresses
-
git check-ignorestill reportsregistry/dist/index.jsas ignored, and
git statuslists no build output -
registry/'s own build, suite typecheck and unit suite still pass -
daml/canton-token-forge/daml.yamlis untouched
Alternatives considered
- Commit a prebuilt
registry/dist. Rejected: it puts generated output in
review diffs and goes stale silently.preparebuilds it at install time
instead. - Publish
registry/as its own package from the subdirectory. Rejected:
neither npm nor pnpm can install a git dependency from a subdirectory, which is
the original blocker. - Add a
registry/.npmignoreinstead of moving the ignore rule. Both work
and both were verified. The root.gitignorewas chosen so the repository
keeps one ignore mechanism rather than two files whose interaction has to be
explained to every reader.
Technical notes
- The trap that makes this issue non-obvious.
filesis an allowlist, but
npm applies a nested ignore file to the pack walk even for a path the
allowlist names.registry/.gitignoreignoresdist, so
files: ["registry/dist"]ships zero dist files and the tarball's bin
target does not exist. The root.gitignoreis not applied that way, so
moving the single linedistout ofregistry/.gitignoreand into the root as
registry/distfixes it while leaving git's behaviour identical. Verify both
halves:tar tzfon the archive, andgit check-ignore -von the path. - The tarball is never only what
fileslists.LICENSEandREADME.mdare
always included, and the!.env.examplenegation inregistry/.gitignore
force-includesregistry/.env.exampleregardless of the allowlist. Listing
registry/.env.exampleinfilesmakes that deliberate, and matches the
wallet service's ownfiles: ["dist", ".env.example"]. "type": "module"is required, not cosmetic.registry/package.jsondoes
not travel in the tarball, so the root manifest is the only thing that can tell
node the shippeddistis ESM. It is safe here because the only JavaScript
outsideregistry/isscripts/seed.mjs, which carries its own extension.tscemits a shebang as the first line of its output, so the bin needs no
wrapper file, and npm sets the exec bit when it links it.- The npm version and the Daml version are independent and always have been.
daml/canton-token-forge/daml.yamlstays at0.0.1, so the DAR filename and
its sha256 do not move. package-lock.jsonembeds the package name and version, so it must be
regenerated.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpriority: highMust be addressed in current sprintMust be addressed in current sprint
Type
Projects
- StatusShow more project fieldsDone
Activity