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

@tobiastengler/create-relay-app

v2.1.2

Published

Easy configuration of Relay for existing projects

Downloads

104

Readme

Motivation

Setting up Relay can be quite time consuming, since there are many setup steps that might differ depending on the toolchain you use.

The goal of this project is to automate the setup process as much as possible and give you a fast and consistent configuration experience across the most popular React toolchains.

Contrary to many existing tools that aim to solve similiar use cases, this project isn't simply scaffolding a pre-configured boilerplate. We actually analyze your existing code and only insert the necessary Relay configuration pieces.

Supported toolchains

create-relay-app supports:

Usage

  1. Scaffold a new project using the toolchain of your choice (as long as it's supported)
  2. If you are inside a Git repository, ensure your working directory is clean, by commiting or discarding any changes.
  3. Run the script inside of the scaffolded directory:
npm/yarn/pnpm create @tobiastengler/relay-app

Note: You can specify -i after the command to walk through an interactive prompt, instead of the script inferring your project's details.

  1. Follow the displayed Next steps to complete the setup (You can also find them here)

Arguments

npm/yarn/pnpm create @tobiastengler/relay-app [options]

Warning

npm requires you to pass -- before any command to a starter kit, e.g.

npm create @tobiastengler/relay-app -- --interactive.

-h, --help

Displays information about all of the available options.

-v, --version

Displays the current version of the script.

-i, --interactive

Displays an interactive prompt that allows you to manually input your project's details for options that weren't supplied as CLI arguments.

Default: false

-t, --toolchain <toolchain>

The toolchain, e.g. bundler and configuration, your project was setup with.

Expects:

  • next
  • vite
  • cra

Default: next, if the next package is installed. vite, if the vite package is installed and otherwise cra.

--typescript

If specified, we assume your project is built with TypeScript.

Default: true, if the typescript package is installed or there is a tsconfig.json file in the root directory of your project. Otherwise false.

-f, --schema-file <path>

Specifies the location of the GraphQL schema file inside of your project directory.

Expects:

A path relative to the root directory of your project and ending in the .graphql extension.

Default: ./src/schema.graphql, if the toolchain is next, otherwise the value of --src joined with schema.graphql.

-s, --src <path>

Specifies the source directory of your project, where the Relay compiler will be run on.

Expects:

A path to a directory relative to the root directory of your project.

Default: ./, if the toolchain is next, otherwise ./src.

-a, --artifact-directory <path>

Specifies a directory, where all artifacts generated by the Relay compiler will be placed.

Expects:

A path to a directory relative to the root directory of your project.

Default: ./__generated__, if the toolchain is next, otherwise it's not set.

--subscriptions

Adds support for GraphQL Subscriptions via graphql-ws to your network layer.

Default: Not set.

-p, --package-manager <manager>

Specify the Node.js package manager to use when packages need to be installed.

Expects:

  • npm
  • yarn
  • pnpm

Default: yarn, if there's a yarn.lock file and yarn is installed. pnpm, if there's a pnpm-lock.yml file and pnpm is installed. Otherwise the package manager that is executing the script will be used to install packages.

--ignore-git-changes

Does not exit the script, if it's run in a directory with un-commited Git changes.

Default: false

--skip-install

Skips the installation of packages.

Default: false

Additional documents