@shopify/tophat
Tophat utilities for web development at Shopify
Last updated 2 months ago by shopify-dep .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @shopify/tophat 
SYNC missed versions from official npm registry.

Tophat Web

CLI for Tophatting Typescript packages at Shopify.

Getting Started

Install this package using yarn:

yarn add --dev @shopify/tophat

Or npm:

npm install --save-dev @shopify/tophat

Next add a tophat:build key to the scripts section of your package.json. This is the script that will be run to build the files for tophatting.

Example Package.json

{
  "scripts": {
    "tophat:build": "tsc -- --watch"
  }
}

Running from command line

yarn tophat [source] [destination]

When run with no arguments (yarn tophat), prompts will guide you through entering a source and destination.

source or [--source <string>]

This is the package name in the current working directory that you would like to tophat. The default is the current working directory's name field in package.json. If inside of a lerna structured repository, the source is automatically resolved to the packages directory. This package can optionally be set with the --souce command line flag.

Example

yarn tophat react-server

or

yarn tophat --source react-server

destination or [--dest <string>]

This is the destination project that you would like to tophat in. Note, the source must be installed in the destination's node_modules.

Example

yarn tophat react-server ../web
yarn tophat --source react-server --dest ../web

Additional Configuration

Tophat uses cosmiconfig to provide additional in the form of a configuration file. This means you can provide configuration in the following ways (in order of precedence):

  • A "tophat" key in your package.json file.
  • A .tophatrc file, written in JSON or YAML, with optional extensions: .json/.yaml/.yml (without extension takes precedence).
  • A .tophatrc.js or tophat.config.js file that exports an object.
  • A .tophatrc.toml file, written in TOML (the .toml extension is required).

Configuration Options

buildDirectory

Specify the build directory that is synced to the consuming repo. The default value is dist.

buildScript

Specify the build script that compiles the project. This is run in watch mode while tophatting. The default value is build.

Common Errors

Command "tophat" not found. Solution: run yarn then run the same command again

Module Y has no exported member X Solution: run yarn run build then run the same command again

Module Y has no exported member X Solution: run yarn run build then run the same command again

Cannot find source in X or Y. Are you sure it exists? Solution install the package you are trying to tophat in the destination directory with yarn add <packageName>

If you install new modules in the package you are installing, you will need to install them in the destination while tophatting.

Current Tags

  • 0.0.3                                ...           latest (2 months ago)

3 Versions

  • 0.0.3                                ...           2 months ago
  • 0.0.2                                ...           2 months ago
  • 0.0.1                                ...           2 months ago
Downloads
Today 0
This Week 3
This Month 3
Last Day 0
Last Week 0
Last Month 15
Dependencies (6)
Dev Dependencies (17)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |