-
-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Support compiling on Windows Converts bash script to node script. No longer requires gulp to be installed globally. Fixes: #925 @JeromeDeLeon Can you test if this works? * replace directory with cmd * clean up
- Loading branch information
Showing
3 changed files
with
56 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const pkg = require('./package.json'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { execSync } = require('child_process'); | ||
|
||
const rmDir = function(dirPath) { | ||
if(fs.existsSync(dirPath)) { | ||
const files = fs.readdirSync(dirPath); | ||
files.forEach(function(file) { | ||
const curPath = path.join(dirPath, file); | ||
if(fs.lstatSync(curPath).isDirectory()) { | ||
rmDir(curPath); | ||
} else { | ||
fs.unlinkSync(curPath); | ||
} | ||
}); | ||
fs.rmdirSync(dirPath); | ||
} | ||
}; | ||
|
||
const exec = function(cmd) { | ||
execSync(cmd, { stdio: 'inherit' }); | ||
}; | ||
|
||
console.log(`Building JavaScript SDK v${pkg.version}...\n`) | ||
|
||
console.log('Cleaning up old builds...\n'); | ||
|
||
rmDir(path.join(__dirname, 'dist')); | ||
rmDir(path.join(__dirname, 'lib')); | ||
|
||
const crossEnv = 'npm run cross-env'; | ||
const gulp = 'npm run gulp'; | ||
|
||
console.log('Browser Release:'); | ||
exec(`${crossEnv} PARSE_BUILD=browser ${gulp} compile`); | ||
|
||
console.log('Weapp Release:'); | ||
exec(`${crossEnv} PARSE_BUILD=weapp ${gulp} compile`); | ||
|
||
console.log('Node.js Release:'); | ||
exec(`${crossEnv} PARSE_BUILD=node ${gulp} compile`); | ||
|
||
console.log('React Native Release:'); | ||
exec(`${crossEnv} PARSE_BUILD=react-native ${gulp} compile`); | ||
|
||
console.log('Bundling and minifying for CDN distribution:'); | ||
exec(`${gulp} browserify`); | ||
exec(`${gulp} browserify-weapp`); | ||
exec(`${gulp} minify`); | ||
exec(`${gulp} minify-weapp`); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters