mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-12-16 01:52:35 +08:00
working
This commit is contained in:
63
react-native-pushy-cli/cli.js
vendored
Executable file
63
react-native-pushy-cli/cli.js
vendored
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Created by tdzl2003 on 2/13/16.
|
||||
*/
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
|
||||
var CLI_MODULE_PATH = function() {
|
||||
return path.resolve(
|
||||
process.cwd(),
|
||||
'node_modules',
|
||||
'react-native-pushy',
|
||||
'local-cli'
|
||||
);
|
||||
};
|
||||
|
||||
var PACKAGE_JSON_PATH = function() {
|
||||
return path.resolve(
|
||||
process.cwd(),
|
||||
'node_modules',
|
||||
'react-native-pushy',
|
||||
'package.json'
|
||||
);
|
||||
};
|
||||
|
||||
checkForVersionCommand();
|
||||
|
||||
require('babel-register')({
|
||||
'plugins': [
|
||||
'transform-async-to-generator',
|
||||
'transform-strict-mode',
|
||||
'transform-object-rest-spread',
|
||||
'transform-es2015-parameters',
|
||||
'transform-es2015-destructuring',
|
||||
],
|
||||
});
|
||||
|
||||
var cli;
|
||||
var cliPath = CLI_MODULE_PATH();
|
||||
if (fs.existsSync(cliPath)) {
|
||||
cli = require(cliPath);
|
||||
}
|
||||
|
||||
if (cli) {
|
||||
cli.run();
|
||||
} else {
|
||||
console.error('`pushy install` is under development, please run `npm install react-native-pushy` to install pushy manually.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function checkForVersionCommand() {
|
||||
if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
|
||||
console.log('react-native-pushy-cli: ' + require('./package.json').version);
|
||||
try {
|
||||
console.log('react-native-pushy: ' + require(PACKAGE_JSON_PATH()).version);
|
||||
} catch (e) {
|
||||
console.log('react-native-pushy: n/a - not inside a React Native project directory')
|
||||
}
|
||||
process.exit();
|
||||
}
|
||||
}
|
||||
31
react-native-pushy-cli/package.json
Normal file
31
react-native-pushy-cli/package.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "react-native-pushy-cli",
|
||||
"version": "0.1.0",
|
||||
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
"pushy": "cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/reactnativecn/react-native-pushy.git"
|
||||
},
|
||||
"keywords": [
|
||||
"react-native",
|
||||
"ios",
|
||||
"android",
|
||||
"update"
|
||||
],
|
||||
"author": "reactnativecn",
|
||||
"license": "BSD-3-Clause",
|
||||
"bugs": {
|
||||
"url": "https://github.com/reactnativecn/react-native-pushy/issues"
|
||||
},
|
||||
"homepage": "https://github.com/reactnativecn/react-native-pushy/tree/master/react-native-pushy-cli",
|
||||
"dependencies": {
|
||||
"babel-register": "^6.5.2"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user