@withgoogle/stitch-sdk
v0.1.5
Published
cli for the stitch design platform
Downloads
635
Maintainers
Readme
stitch-sdk
<one-line description of what stitch-sdk does>
Install
Run it without installing:
npx stitch-sdk --helpOr install globally:
npm install -g stitch-sdk
stitch-sdk --helpUsage
stitch-sdk [options] [args]
Options:
-h, --help Show help and exit
-v, --version Show version and exitImplementing your logic
All of the package plumbing is done. The only file you need to edit is
bin/cli.js — look for the marked TODO block:
// TODO: YOUR IMPLEMENTATION GOES HERE.
// `args` is an array of the CLI arguments (everything after the command).
// Return 0 on success, or a non-zero number to signal an error.--help and --version already work, and arguments are parsed for you.
The preinstall hook
This package includes an example lifecycle hook at
scripts/preinstall.js, wired up in package.json:
"scripts": {
"preinstall": "node scripts/preinstall.js"
}npm runs preinstall automatically on every npm install, before
dependencies are installed — both while you develop the package and when someone
installs it as a dependency. The example here is deliberately benign: it warns
(without failing) if the user's Node is older than engines.node, and prints a
short notice.
Output visibility: npm shows lifecycle-script output when you run
npm installinside this package (development), but hides it when stitch-sdk is installed as someone's dependency — unless they passnpm install --foreground-scripts. The hook still runs; only its console output is suppressed. (One more reason a preinstall hook must never be essential to how the package works.)
⚠️ Security:
preinstall/install/postinstallscripts execute arbitrary code on the installing machine and are a known supply-chain attack surface. Keep them minimal and transparent — never download remote code, phone home, or touch files outside the package. Security-conscious users may install withnpm install --ignore-scripts, so nothing in a lifecycle hook should be load-bearing for the package to function.
Don't want it? Delete scripts/preinstall.js and remove the "preinstall"
entry from package.json.
Development
npm install # also triggers the preinstall hook, so you can see it run
npm test # runs the smoke tests via `node --test`
npm start # runs ./bin/cli.jsPublishing
See PUBLISHING.md for step-by-step release instructions.
Note: the published tarball is controlled by the files whitelist in
package.json (so test/ and dev files are never shipped). Run
npm pack --dry-run to preview exactly what will be published.
License
MIT © <YOUR NAME>
