3.4.2 • Published 10 days ago

expo-module-scripts v3.4.2

Weekly downloads
1,921
License
MIT
Repository
github
Last release
10 days ago

Expo Module Scripts

This package contains a collection of common scripts for all Expo modules and the Expo SDK package. This sets us up to have a consistent way of compiling JS, testing, linting, and other common tasks so that the Expo SDK is coherent and unified. Knowledge and experience from working on an Expo module in this repository will carry over to working on other modules. And ultimately, we want the development experience for Expo developers to be similar across modules. A structurally unified way of developing Expo modules helps us achieve these goals.

This is the package that installs Babel CLI, TypeScript, Jest, and other common development dependencies. Update the dependencies in this package when changing them for the Expo repository.

Commands

This package defines a program called expo-module that accepts a command (ex: expo-module build). This allows us to add more commands without changing the behavior of existing commands while not needing to define more programs. Typically, you'd invoke these commands from Yarn:

$ cd expo-example-module
$ yarn expo-module test

# For commonly run commands, add "expo-module test" as an npm script named "test"
$ yarn test

For scripts that need to run as part of the npm lifecycle, you'd invoke the commands from npm scripts in package.json:

{
  "scripts": {
    "prepare": "expo-module prepare",
    "prepublishOnly": "expo-module prepublishOnly",
  }
}

These are the commands:

configure

This generates common configuration files like tsonfig.json for the package. These auto-generated files are meant to be read-only and committed to Git.

typecheck

This type checks the source TypeScript with tsc. This command is separate from build and does not emit compiled JS.

build

This compiles the source JS or TypeScript to "compiled" JS that Expo can load. We use tsc instead of the Babel TypeScript plugin since tsc has complete support for the TypeScript language, while the Babel plugin has some limitations. tsc also performs type checking in the same way that VS Code and other IDEs do.

If we wished to switch to using just Babel with the TypeScript plugin, this package would let us change the implementation of the build command and apply it to all packages automatically.

test

We run tests using Jest with ts-jest, which runs TypeScript and Babel. This setup type checks test files and mimics the build command's approach of running tsc followed by Babel.

If we were to use just Babel with the TypeScript plugin for the build command, Jest with babel-jest would be more closely aligned.

lint

This is not yet implemented. We need to see in practice how using ESLint with a TypeScript plugin would work for us compared to TSLint.

clean

This deletes the build directory.

Lifecycle Commands

These are commands to run as part of the npm scripts lifecycle.

prepare (npm lifecycle)

Runs clean and build.

prepublishOnly (npm lifecycle)

Runs npm-proofread, which ensures a dist-tag is specified when publishing a prerelease version.

Unified dependencies

This package depends on common development dependencies like Babel and Jest. The commands for compiling and testing JS need these dependencies, and the most important benefit is that all Expo module packages use the same version of Babel, Jest, their various plugins, and other development dependencies. This does remove the flexibility to customize the dependency versions for each module. We intentionally make this tradeoff to prioritize Expo as a whole over individual modules.

3.5.1

10 days ago

3.5.0

14 days ago

3.4.2

18 days ago

3.4.1

3 months ago

3.4.0

5 months ago

3.3.0

6 months ago

3.2.0

7 months ago

3.1.1

8 months ago

3.1.0

8 months ago

3.0.12

9 months ago

3.0.10

11 months ago

3.0.11

10 months ago

3.0.9

11 months ago

3.0.8

12 months ago

3.0.7

1 year ago

3.0.6

1 year ago

3.0.4

1 year ago

3.0.3

1 year ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.5

1 year ago

3.0.0

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.0

3 years ago

2.0.0-alpha.0

3 years ago

1.2.0

4 years ago

1.1.1

5 years ago

1.1.1-rc.0

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago