@shopify/scripts-sdk-as v11.0.0
Scripts AssemblyScript SDK
About this repo | Commands | How to use this repo | Contribute to this repo | Resources
About this repo
The Scripts AssemblyScript SDK is a library of useful classes and functions that are available for all script extension point authors to use when building their extension point API. Their purpose is to provide a standardized set of models to be shared across extension points. This saves extension point authors time and maintains consistency across different script extension point APIs.
Some examples of the models:
Money
- A representation of a ShopifyMoney
object with operations such as rounding and calculations.Int
,Float
,OverflowableInteger
- Numeric types supportConfiguration
- A representation of a script's configuration.
The exported models are distributed as part of the @shopify/scripts-sdk-as
NPM package.
Current status | Ongoing |
Owner | @Shopify/scripts-experience (Vault, Slack) |
Help | Ping us in #scripts-v2-experience |
Commands
Unit tests
dev test
runs all unit tests.
Update docs
npm run docs:update
regenerates the TypeDoc API docs. This generally needs to be done whenever an API or doc comment changes.
Build currencies
npm run build:currencies
regenerates the assembly/Money/Currency/Currencies.ts
file based on the contents of scripts/currencies/currencies.json
. This needs to be done whenever the currencies.json
file is updated.
Formatting
npm run fmt
will format all AssemblyScript files according to the Prettier config.
npm run fmt:check
will validate all AssemblyScript files are formatted properly according to the Prettier config. This command is useful for CI checks.
Linting
npm run lint
will run ESLint across the codebase.
How to use this repo
Requirements
- NPM
- An AssemblyScript project, such as an extension point project or a Shopify script
Installation
Installing this package into your AssemblyScript project can be done with the following NPM command:
npm install @shopify/scripts-sdk-as
Usage
Once included in your project, you can import classes and functions from this package using the ES6 import command. For example:
import {Money} from '@shopify/scripts-sdk-as`;
Documentation
API documentation can be found here: https://shopify.github.io/scripts-sdk-as/api/
Contribute to this repo
Setup
Just dev up
and you're good to go 🎉
Testing
Code changes to this repository needs to be accompanied by unit tests. To write unit tests, create a corresponding test file to your source file in the test
directory. Your test file needs to have the same filename as your source file except with a .spec.ts
extension.
Requesting PR reviews
Add @Shopify/scripts as a reviewer to your PR for a review. All code needs to be reviewed before merging to master
.
Deploying
To release a new version of the SDK, perform the following steps:
- In a new branch, increment the version in
package.json
with the appropriate bump based on the changes (major, minor, or patch). - Run
npm install
to update thepackage-lock.json
file. - Put up a PR for the version bump.
- Once your PR is approved and merged, create a release. Name the release with
v{versionNumber}
whereversionNumber
is the version inpackage.json
. - Go to Shipit and hit deploy. This will release the package to NPM.
Resources
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago