Skip to content

Commit c75e138

Browse files
committed
Deploy to npm from Travis
1 parent fa38856 commit c75e138

File tree

6 files changed

+34
-70
lines changed

6 files changed

+34
-70
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1+
build
12
node_modules
2-
dist

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: node_js
2+
node_js: node
3+
cache: yarn
4+
env:
5+
global:
6+
- secure: J1Ws1BJjGPgYEKX27UN1AUxZsvX4pbiYAYMn7XxfXqhVj2ZZo7NM/wKXWw8u3RqyDZFR3YrE8Ww14DWvmfMAyu4EPTHKqAmKydi8eI78ZotSsqtvvcnpmltzKlvGM6hdkWe2A4sOizLA5BTfCf0iIJXMwQ6zJreye9HsgaeRCsEvni653QfxAftF8kqfWNfuD5GxHPkUX7vYvL1BbaUE/0RFh9lXNiOmu8jGzIK6YSSe2+yFbeuSSJXLveuIaq9D4YzqiAXscwQXhz7RIw5/4sBc/ClmyNcDWEjvjmYsKV1mQJiCGzSv2kf/iwphMansAgCw7dxG82PWPznGls5o49X44gQqEMbXkO3PDyJjpwAm7X7Faob1Y4LmZw0+Lcrw21jnjtBlaSWMGRdPW3EgKTkCgCfQqK3xfkc44yVKlnIoIbbPejZ7nP8JfWWu3mXH6y4nVB22Lw4pZQIGY3JNpF3AK0jNhi9IP7MxcgJn6LbgWFqSbWZnCuEoPaKEsCK32eVI/CYP198lCA/4EN8p9XW72ZipwVCl/hblDPbUnjZNMZ48ouZqumysmBle2gJhi1z+hL0w6LQsWO7REAX9ckUU5RHQHFWg340FEhYcuX6vd+eslOuKTnsdzlb5y12VntQiOLY3Kky6oz9DsLRuvp93DB5+SChIdUeqoRMNSqA=
7+
- NPM_TAG=$([[ "$TRAVIS_TAG" == *-* ]] && echo "next" || echo "latest")
8+
script: yarn test
9+
deploy:
10+
provider: npm
11+
12+
api_key: "$NPM_TOKEN"
13+
tag: "$NPM_TAG"
14+
on: tags

package.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@
66
"license": "MIT",
77
"bin": "./bin/react-stdio",
88
"preferGlobal": true,
9-
"repository": {
10-
"type": "git",
11-
"url": "https://github.com/ReactTraining/react-stdio"
12-
},
9+
"repository": "ReactTraining/react-stdio",
1310
"files": ["bin", "server.js"],
1411
"scripts": {
15-
"release": "node ./scripts/release.js",
16-
"test": "jest",
17-
"dist:binary":
18-
"pkg ./bin/react-stdio -t $npm_package_config_platform -o ./dist/$npm_package_config_version/$npm_package_config_platform/react-stdio"
12+
"build": "node ./scripts/build.js",
13+
"test": "jest"
1914
},
2015
"dependencies": {
2116
"JSONStream": "^1.0.7",
@@ -26,8 +21,7 @@
2621
},
2722
"devDependencies": {
2823
"jest": "^22.1.4",
29-
"pkg": "^4.3.0",
30-
"readline-sync": "^1.4.1"
24+
"pkg": "^4.3.0"
3125
},
3226
"jest": {
3327
"testPathIgnorePatterns": ["/node_modules/", "__tests__/mocks"]

scripts/build.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const execSync = require("child_process").execSync;
2+
3+
const tag = process.env.TRAVIS_TAG || `v${process.env.npm_package_version}`
4+
const platforms = ["win-x64", "win-x86", "linux-x64", "linux-x86", "macos"];
5+
6+
platforms.forEach(platform => {
7+
console.log(`\nBuilding binary for ${platform}...`);
8+
9+
execSync(
10+
`pkg ./bin/react-stdio -t ${platform} -o ./build/${tag}/${platform}/react-stdio`,
11+
{ stdio: "inherit" }
12+
);
13+
});

scripts/release.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

yarn.lock

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,8 +2286,8 @@ randomatic@^1.1.3:
22862286
kind-of "^4.0.0"
22872287

22882288
rc@^1.1.7:
2289-
version "1.2.4"
2290-
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.4.tgz#a0f606caae2a3b862bbd0ef85482c0125b315fa3"
2289+
version "1.2.5"
2290+
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.5.tgz#275cd687f6e3b36cc756baa26dfee80a790301fd"
22912291
dependencies:
22922292
deep-extend "~0.4.0"
22932293
ini "~1.3.0"
@@ -2339,10 +2339,6 @@ readable-stream@^2.0.1, readable-stream@^2.0.5, readable-stream@^2.0.6, readable
23392339
string_decoder "~1.0.3"
23402340
util-deprecate "~1.0.1"
23412341

2342-
readline-sync@^1.4.1:
2343-
version "1.4.7"
2344-
resolved "https://registry.yarnpkg.com/readline-sync/-/readline-sync-1.4.7.tgz#001bfdd4c06110c3c084c63bf7c6a56022213f30"
2345-
23462342
realpath-native@^1.0.0:
23472343
version "1.0.0"
23482344
resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.0.0.tgz#7885721a83b43bd5327609f0ddecb2482305fdf0"

0 commit comments

Comments
 (0)