npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shopify-scopes-sync

v1.0.3

Published

Syncs Shopify access scopes from app.toml to .env

Downloads

80

Readme

npm monthly downloads current version npm

Shopify Scopes Sync

The shopify-scopes-sync package ensures that the Shopify access scopes specified in your project's shopify.app.toml file are automatically synchronized with the SCOPES variable in your .env file. This synchronization helps maintain consistency in your development and deployment environments, reducing the risk of scope-related errors in your Shopify applications.

Background: Authentication Works In Local Dev Mode But Not In Production (AWS EC2)

At Site Chat, we wrapped our site and service into a Shopify App using its Remix template. When migrating from local testing to AWS EC2, authentication and billing APIs stopped working, even though they ran fine on a local machine. If you've encountered a similar issue as described on Shopify Community and Shopify Github, the root cause might be that the API access scopes are out of sync in the .env file (production deployment) and the shopify.app.toml (local test). This problem led to the creation of a solution to smoothly sync scopes.

Installation

To install shopify-scopes-sync, run the following command in your project directory:

npm install shopify-scopes-sync --save

or

yarn add shopify-scopes-sync -D -W

This command adds shopify-scopes-sync to your project's dependencies.

Usage

After installing shopify-scopes-sync, you need to add a script to your package.json to run the synchronization process. Here's how to set it up:

  1. Open your project's package.json file.
  2. Add a new script named predeploy in the scripts section:
  3. Update your deploy command to ensure that scope is synced.
"scripts": {
  "predeploy": "shopify-scopes-sync",
  "deploy": "npm run predeploy && shopify app deploy",
}
  1. Save the changes to your package.json file.

Now, you can run the following command to synchronize your Shopify access scopes:

npm run sync-scopes

or

npm run deploy

This script executes shopify-scopes-sync, which reads the scopes from your shopify.app.toml and updates the SCOPES variable in your .env file accordingly.

Custom Usage

If your .env or shopify.app.toml files are located in non-standard locations, you can pass the paths to these files as arguments to the script:

"scripts": {
  "sync-scopes": "shopify-scopes-sync --env ./path/to/.env --toml ./path/to/shopify.app.toml"
}

Replace ./path/to/.env and ./path/to/shopify.app.toml with the actual paths to your files.

Contributing

We welcome contributions to shopify-scopes-sync! If you have suggestions for improvements or encounter any issues, please open an issue or submit a pull request on our GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.