# @shopify/scripts-sdk-as

> The AssemblyScript Shopify SDK

Latest version **11.0.0** (published 2021-06-22) · UNLICENSED license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @shopify/scripts-sdk-as
pnpm add @shopify/scripts-sdk-as
yarn add @shopify/scripts-sdk-as
bun add @shopify/scripts-sdk-as
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 11.0.0 |
| Published | 2021-06-22 |
| First published | 2020-03-06 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 580.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Shopify |
| Maintainers | bpscott, marytal, themallen, thomaskelly, nathanpjf, shopify-dep, ismail.syed, goodforonefare, lemonmade, huguestennier, wizardlyhel, antoine.grant, tsov, andyw8-shopify, henrytao, hannachen, andrewapperley, iainmcampbell, vividviolet |

## Links

- npm: https://www.npmjs.com/package/@shopify/scripts-sdk-as
- Repository: https://github.com/Shopify/scripts-sdk-as
- Homepage: https://github.com/Shopify/scripts-sdk-as#readme
- Issues: https://github.com/Shopify/scripts-sdk-as/issues
- npm.io page: https://npm.io/package/@shopify/scripts-sdk-as

## Dependencies (2)

- [as-wasi](https://npm.io/package/as-wasi.md) ^0.4.4
- [@wapc/as-msgpack](https://npm.io/package/@wapc/as-msgpack.md) github:shopify/as-msgpack#bb60ef5757c7eaf7122863259762a0f2c6329ea0

## Recent versions

- 11.0.0 (latest) — 2021-06-22
- 10.1.0 — 2021-06-07
- 10.0.0 — 2021-05-13
- 9.2.0 — 2021-03-30
- 9.1.0 — 2021-03-18
- 9.0.1 — 2021-03-09
- 8.1.0 — 2021-03-05
- 8.0.1 — 2021-03-03
- 8.0.0 — 2021-03-02
- 7.0.1 — 2021-01-27
- 7.0.0 — 2020-10-13
- 6.3.0 — 2020-07-30
- 6.2.1 — 2020-06-11
- 6.2.0 — 2020-06-05
- 6.1.0 — 2020-06-02
- … 18 more at https://npm.io/package/@shopify/scripts-sdk-as/versions

## README

# Scripts AssemblyScript SDK

[![Build status](https://badge.buildkite.com/cc1e44ebaf2f2f946f0e318affd8d0b1b75493eb40be42fdd6.svg?branch=master)](https://buildkite.com/shopify/scripts-sdk-as)

[About this repo](#about-this-repo) | [Commands](#commands) | [How to use this repo](#how-to-use-this-repo) | [Contribute to this repo](#contribute-to-this-repo) | [Resources](#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](https://github.com/Shopify/extension-points/blob/master/README.md). 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 Shopify `Money` object with operations such as rounding and calculations.
- `Int`, `Float`, `OverflowableInteger` - Numeric types support
- `Configuration` - A representation of a [script's configuration.](https://docs.google.com/document/d/1xXDQh9jM8Yx2B6SBJXTRO_LQ87whQK_wLDBfmxuwvBU/edit#heading=h.eslmu3zxzij)

The exported models are distributed as part of the `@shopify/scripts-sdk-as` NPM package.

|                |                                                                                                                                                    |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| Current status | Ongoing                                                                                                                                            |
| Owner          | @Shopify/scripts-experience ([Vault](https://vault.shopify.io/teams/110-Shopify-Scripts), [Slack](https://shopify.slack.com/archives/C01CE9L44P3)) |
| Help           | Ping us in [#scripts-v2-experience](https://shopify.slack.com/archives/C01CE9L44P3)                                                                |

## 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:

```typescript
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:

1. In a new branch, increment the version in `package.json` with the appropriate bump based on the changes (major, minor, or patch).
2. Run `npm install` to update the `package-lock.json` file.
3. Put up a PR for the version bump.
4. Once your PR is approved and merged, create a [release](https://github.com/Shopify/scripts-sdk-as/releases). Name the release with `v{versionNumber}` where `versionNumber` is the version in `package.json`.
5. Go to [Shipit](https://shipit.shopify.io/shopify/scripts-sdk-as/production) and hit deploy. This will release the package to NPM.

## Resources

- [The Scripts Book](https://docs.google.com/document/d/12g8XYqrM1l7g-0-s8YppghpAGx2853PxASPp3D2FOpo/edit#heading=h.912bycrwscdx)
- [Extension point authoring tutorial](https://docs.google.com/document/d/1CXpmzwNr76z0Po8CkmYzQWdAFPEFShEqhCktSKHZCSM)
- [AssemblyScript docs](https://www.assemblyscript.org/introduction.html)
- [as-pect](https://tenner-joshua.gitbook.io/as-pect/)

---
_Source: https://npm.io/package/@shopify/scripts-sdk-as · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
