Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 1.28 KB

README.md

File metadata and controls

49 lines (35 loc) · 1.28 KB

Scripts

This directory is a Yarn workspace that contains zx scripts relevant to the repository.

Running Scripts

Scripts can be run from within this directory, or, ideally, from within the root of the repository. See ../CONTRIBUTING.md for more details, but tl;dr :

From the root:

yarn zx scripts/print-cwd.ts

From this directory:

yarn zx print-cwd.ts

Current Working Directory

When running scripts, process.cwd() will be the directory of the user calling the script. This is because the yarn zx alias in the root repository is not implemented with yarn workspace run (which would change the working directory to that of the workspace).

For example, try running yarn zx scripts/print-cwd.ts (from root), or yarn zx print-cwd.ts (from within scripts):

# From root of repository
❯ yarn zx scripts/print-cwd.ts
[CWD] /path/to/repo/madatdata

# Move to scripts directory and run againcd scripts/
❯ yarn zx print-cwd.ts
[CWD] /Users/mjr/exp/madatdata/scripts

Writing Scripts

For writing scripts, see the zx readme. Note that certain modules you might normally import from Node are exported from zx, like chalk, fs, os, and fetch.