UNPKG

@shopify/app-bridge

Version:

[![Build Status](https://travis-ci.com/Shopify/app-bridge.svg?token=RBRyvqQyN525bnfz7J8p&branch=master)](https://travis-ci.com/Shopify/app-bridge) [![codecov](https://codecov.io/gh/Shopify/app-bridge/branch/master/graph/badge.svg?token=nZ21m39Dr6)](https:

58 lines (39 loc) 1.94 kB
# `@shopify/app-bridge` [![Build Status](https://travis-ci.com/Shopify/app-bridge.svg?token=RBRyvqQyN525bnfz7J8p&branch=master)](https://travis-ci.com/Shopify/app-bridge) [![codecov](https://codecov.io/gh/Shopify/app-bridge/branch/master/graph/badge.svg?token=nZ21m39Dr6)](https://codecov.io/gh/Shopify/app-bridge) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE.md) [![npm version](https://badge.fury.io/js/%40shopify%2Fapp-bridge.svg)](https://badge.fury.io/js/%40shopify%2Fapp-bridge.svg) [![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/@shopify/app-bridge.svg)](https://img.shields.io/bundlephobia/minzip/@shopify/app-bridge.svg) The App Bridge is a library that enables Apps on Shopify to access native Shopify features across different platforms. ## Installation ``` sh yarn add @shopify/app-bridge ``` ## Usage ### Set up your app Import the library from the `@shopify/app-bridge` package and provide a configuration: ``` ts import createApp, {getShopOrigin} from '@shopify/app-bridge'; const app = createApp({ apiKey: 'API key from Shopify Partner Dashboard', shopOrigin: getShopOrigin(), }); ``` ### Actions A list of available actions can be found in the [actions source folder](./src/actions). ## Contributing ### Useful scripts - `yarn start` Start a development server - `yarn build` Build the library, compiling the source TypeScript into JavaScript - `yarn clean` Remove any artefacts produced by the `build` script - `yarn lint` Run the source linter - `yarn check` Run the TypeScript type checker ### Running the tests - `yarn test` Run the tests - `yarn test:watch` Run the tests in watch mode and auto-rerun on changes - `yarn test:coverage` Run the tests and generate a coverage report ### Prettier config To enable automatic prettier formatting copy or link the pre-commit script to `.git/hooks/pre-commit` and make sure it's executable.