@shopify/scripts-toolchain-as
v6.1.0
Published
Shopify's AssemblyScript toolchain to build, verify and bootstrap scripts
Downloads
226
Keywords
Readme
Shopify Scripts AssemblyScript Toolchain
About this repo | How to use this repo | Contribute to this repo
About this repo
Introduction: CLI to build and bootstrap script projects.
| | | |----------------|--------------------------------------------------------------------------------------------------------------------------------------| | Current status | Ongoing | | Owner | @Shopify/scripts | | Help | #scripts on Slack |
How to use this repo
Requirements
- npm
- All commands should be used inside a script project generated with Shopify's App CLI
Installation
npm install -g @shopify/scripts-toolchain-as
Available commands
shopify-scripts-toolchain-as bootstrap
Helper to bootstrap script projects from Shopify's extension pointsshopify-scripts-toolchain-as codegen
Helper to code generate MessagePack serializers for EP types in extension points.shopify-scripts-toolchain-as build
Wrapper around the AssemblyScript compiler. It used to build script projects ensuring compatibility with Shopify's runtime platform.
Usage
Bootstrap
shopify-scripts-toolchain-as bootstrap --from <extension-point-name> --dest <destination dir>
from
the source extension point from where the script project should be bootstrappeddest
the destination location where the bootstrapped script project is going to be placed
Codegen
shopify-scripts-toolchain-as codegen \
--interface-definition=EP/interface.ts \
-- --lib=./node_modules --optimize --use Date=
Build
shopify-scripts-toolchain-as build \
--src ./myscript.ts \
--binary ./myscript.wasm \
--metadata ./metadata.json
src
the name and location of the script's entrypointbinary
the name and the location to place the generated WebAssembly binarymetadata
the name and location to place the generated script's metadata
Since this tool is a wrapper around the AssemblyScript's compiler, additional commands can be passed down to the AssemblyScript compiler CLI
npx shopify-scripts-toolchain-as build \
--src=sample/script.ts \
--binary=sample/build.wasm \
--metadata ./metadata.json \
-- --lib=node_modules --lib=sample --validate --optimize
Contribute to this repo
Setup
- Clone the repository
- Install dependencies via
npm install
Running tests
- Run
npm test
Making changes
- Open a PR
- Request a review from someone from the Scripts team (@Shopify/scripts, @Shopify/scripts-experience)
- Once your PR is reviewed and approved, merge it
Deploying / releasing a new version
- Once your PR is merged, update the version of the
package.json
andpackage-lock.json
. You can do this manually, by runningnpm version <version>
or by runningyarn version
. In this repo we try to follow semantic versioning as much as possible, be mindful when releasing a new version. - Go to shipit and deploy your change. Please note that shipit only deploys changes that define a new version.