Skip to content

Commit fa38856

Browse files
francocorreasosamjackson
authored andcommitted
Add binary support. (#14)
1 parent 370bc03 commit fa38856

File tree

4 files changed

+216
-16
lines changed

4 files changed

+216
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
dist

package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
"type": "git",
1111
"url": "https://github.com/ReactTraining/react-stdio"
1212
},
13-
"files": [
14-
"bin",
15-
"server.js"
16-
],
13+
"files": ["bin", "server.js"],
1714
"scripts": {
1815
"release": "node ./scripts/release.js",
19-
"test": "jest"
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"
2019
},
2120
"dependencies": {
2221
"JSONStream": "^1.0.7",
@@ -27,12 +26,10 @@
2726
},
2827
"devDependencies": {
2928
"jest": "^22.1.4",
29+
"pkg": "^4.3.0",
3030
"readline-sync": "^1.4.1"
3131
},
3232
"jest": {
33-
"testPathIgnorePatterns": [
34-
"/node_modules/",
35-
"__tests__/mocks"
36-
]
33+
"testPathIgnorePatterns": ["/node_modules/", "__tests__/mocks"]
3734
}
3835
}

scripts/release.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ const getPackageVersion = () =>
1111
JSON.parse(fs.readFileSync(path.resolve(__dirname, "../package.json")))
1212
.version;
1313

14+
const binaryPlatforms = [
15+
"win-x64",
16+
"win-x86",
17+
"linux-x64",
18+
"linux-x86",
19+
"macos"
20+
];
21+
1422
// Get the next version, which may be specified as a semver
1523
// version number or anything `npm version` recognizes. This
1624
// is a "pre-release" if nextVersion is premajor, preminor,
@@ -29,9 +37,17 @@ exec("npm test");
2937
// 4) Create a v* tag that points to that commit
3038
exec(`npm version ${nextVersion} -m "Version %s"`);
3139

32-
// 5) Publish to npm. Use the "next" tag for pre-releases,
40+
// 5) Build a binary version for universal support
41+
exec(`npm config set react-stdio:version ${nextVersion}`);
42+
43+
binaryPlatforms.forEach(platform => {
44+
exec(`npm config set react-stdio:platform ${platform}`);
45+
exec(`npm run dist:binary`);
46+
});
47+
48+
// 6) Publish to npm. Use the "next" tag for pre-releases,
3349
// "latest" for all others
3450
exec(`npm publish --tag ${isPrerelease ? "next" : "latest"}`);
3551

36-
// 6) Push the v* tag to GitHub
52+
// 7) Push the v* tag to GitHub
3753
exec(`git push -f origin v${getPackageVersion()}`);

0 commit comments

Comments
 (0)