npm package has `src/` rather than `build/`

Summary:
We use custom npm scripts (`prepare-release`, `cleanup-release`) to

- move `src` to `src.orig`, and `build` to `src` before creating the tarball
- move everything back afterwards

We run these scripts with lerna before and after publishing. Custom hooks avoid problems with `prepublishOnly` and `postpublish` not being run at opportune times, `prepack` and `postpack` not being supported by npm v4 and yarn, and using `lerna run prepublishOnly` resulting in duplicated execution of the command.

This ensures that development is closer to what is pulled in from npm.

Reviewed By: jeanlauliac

Differential Revision: D5310133

fbshipit-source-id: 6b9885c88b936ef3fe5f1858738ad63d581a8731
This commit is contained in:
David Aurelio 2017-06-23 09:03:10 -07:00 committed by Facebook Github Bot
parent a0fcbd7f11
commit 08699062d5
4 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"lerna": "2.0.0-beta.38",
"version": "0.8.1",
"lerna": "2.0.0-rc.5",
"npmClient": "yarn",
"packages": [
"packages/*"

View File

@ -43,7 +43,8 @@
"lint": "eslint . --cache",
"lint-fix": "eslint . --fix --cache",
"postinstall": "node ./scripts/postinstall.js && node ./scripts/build.js",
"publish": "yarn run build-clean && yarn run build && lerna publish",
"publish": "yarn run build-clean && yarn run build && lerna run prepare-release && lerna publish",
"postpublish": "lerna run cleanup-release",
"test-ci": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest-coverage -- -i && node scripts/mapCoverage.js && codecov",
"test": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest && yarn run test-examples",
"typecheck": "flow check",

View File

@ -1,4 +1,5 @@
**/__mocks__/**
**/__tests__/**
src
build
src.real
yarn.lock

View File

@ -2,11 +2,15 @@
"version": "0.8.1",
"name": "metro-bundler",
"description": "🚇 The JavaScript bundler for React Native.",
"main": "build/index.js",
"main": "src/index.js",
"repository": {
"type": "git",
"url": "git@github.com:facebook/metro-bundler.git"
},
"scripts": {
"prepare-release": "test -d build && rm -rf src.real && mv src src.real && mv build src",
"cleanup-release": "test ! -e build && mv src build && mv src.real src"
},
"dependencies": {
"absolute-path": "^0.0.0",
"async": "^2.4.0",