create-rx-app
Advanced tools
Comparing version 0.2.1-beta.3 to 0.2.1-rc.0
@@ -39,2 +39,3 @@ "use strict"; | ||
sourceType: options.javascript ? 'javascript' : 'typescript', | ||
skipInstall: !!options.skipInstall, | ||
yarn: !!options.yarn, | ||
@@ -48,2 +49,3 @@ }).run(); | ||
.option('-Y, --yarn', 'use yarn as package manager') | ||
.option('-S, --skip-install', 'do not automatically install dependencies') | ||
.allowUnknownOption() | ||
@@ -55,4 +57,5 @@ .parse(process.argv); | ||
createRXApp(program.args.shift(), { | ||
skipInstall: program.skipInstall, | ||
javascript: program.javascript, | ||
yarn: program.yarn, | ||
}); |
@@ -30,2 +30,5 @@ "use strict"; | ||
var IOS_FOLDER = 'ios'; | ||
var NPM_INSTALL = 'npm i'; | ||
var NPM_RUN = 'npm run'; | ||
var YARN = 'yarn'; | ||
var chdir = process.chdir; | ||
@@ -42,3 +45,3 @@ var Generator = /** @class */ (function () { | ||
}; | ||
this.runCommand = yarn ? 'yarn' : 'npm run'; | ||
this.runCommand = yarn ? YARN : NPM_RUN; | ||
this.options = options; | ||
@@ -62,3 +65,3 @@ } | ||
var paths = [COMMON_FOLDER, sourceType].map(function (folderName) { return path_1.default.join(templatePath, folderName); }); | ||
var pathPatterns = __assign({}, this.projectPatterns, { '_babelrc': '.babelrc', '_eslintrc': '.eslintrc', '_gitignore': '.gitignore', '_tsconfig.json': 'tsconfig.json', '_tslint.json': 'tslint.json' }); | ||
var pathPatterns = __assign({}, this.projectPatterns, { '_babel.config.js': 'babel.config.js', '_eslintrc': '.eslintrc', '_gitignore': '.gitignore', '_tsconfig.json': 'tsconfig.json', '_tslint.json': 'tslint.json' }); | ||
paths.forEach(function (srcPath) { return (_this.walk(srcPath, ignorePaths).forEach(function (absolutePath) { return (_this.copy(absolutePath, _this.buildDestPath(absolutePath, srcPath, pathPatterns), _this.projectPatterns)); })); }); | ||
@@ -114,12 +117,17 @@ }; | ||
Generator.prototype.generatePackageJson = function () { | ||
var _a = this.options, projectPath = _a.projectPath, projectName = _a.projectName, yarn = _a.yarn; | ||
var _a = this.options, projectPath = _a.projectPath, projectName = _a.projectName, skipInstall = _a.skipInstall, yarn = _a.yarn; | ||
var paramsPrefix = yarn ? ' ' : ' -- '; | ||
var packageJson = JSON.stringify(__assign({ name: projectName.toLowerCase() }, lodash_1.omit(this.packageJson, ['devDependencies', 'peerDependencies', 'dependencies'])), null, 2); | ||
var packageJson = JSON.stringify(__assign({ name: projectName.toLowerCase() }, lodash_1.omit(this.packageJson, skipInstall ? [] : ['devDependencies', 'dependencies'])), null, 2); | ||
fs_extra_1.default.writeFileSync(path_1.default.resolve(projectPath, 'package.json'), mustache_1.default.render(packageJson, { runCommand: this.runCommand, paramsPrefix: paramsPrefix })); | ||
}; | ||
Generator.prototype.printInstructions = function () { | ||
var _a = this.options, projectName = _a.projectName, projectPath = _a.projectPath; | ||
var _a = this.options, projectName = _a.projectName, projectPath = _a.projectPath, skipInstall = _a.skipInstall, yarn = _a.yarn; | ||
var xcodeProjectPath = path_1.default.resolve(projectPath, IOS_FOLDER, projectName) + ".xcodeproj"; | ||
var windowsProjectPath = path_1.default.resolve(projectPath, WINDOWS_FOLDER, projectName) + ".sln"; | ||
console.log(chalk_1.default.green.bold('%s was successfully created. \n'), projectName); | ||
if (skipInstall) { | ||
console.log(chalk_1.default.green.bold('To install dependencies:')); | ||
console.log(' cd %s', projectPath); | ||
console.log(chalk_1.default.white.bold(' %s \n'), yarn ? YARN : NPM_INSTALL); | ||
} | ||
console.log(chalk_1.default.green.bold('To run your app on Web:')); | ||
@@ -152,3 +160,6 @@ console.log(' cd %s', projectPath); | ||
Generator.prototype.installDependencies = function () { | ||
var _a = this.packageJson, devDependencies = _a.devDependencies, peerDependencies = _a.peerDependencies, dependencies = _a.dependencies; | ||
if (this.options.skipInstall) { | ||
return; | ||
} | ||
var _a = this.packageJson, devDependencies = _a.devDependencies, dependencies = _a.dependencies; | ||
var _b = this.options, projectPath = _b.projectPath, yarn = _b.yarn; | ||
@@ -158,3 +169,3 @@ var packageManager = new package_manager_1.PackageManager(yarn); | ||
packageManager.install(devDependencies, 'dev dependencies', true); | ||
packageManager.install(__assign({}, dependencies, peerDependencies), 'dependencies'); | ||
packageManager.install(dependencies, 'dependencies'); | ||
}; | ||
@@ -161,0 +172,0 @@ Generator.prototype.setPackageJson = function () { |
@@ -22,3 +22,3 @@ "use strict"; | ||
chalk_1.default.blue.bold(['[', this.yarn ? 'yarn' : 'npm', ']'].join('')), | ||
chalk_1.default.white.bold([this.yarn ? 'Adding' : 'Installing', (description || '') + "..."].join(' ')), | ||
chalk_1.default.white.bold([this.yarn ? 'adding' : 'installing', (description || '') + "..."].join(' ')), | ||
].join(' '); | ||
@@ -25,0 +25,0 @@ }; |
{ | ||
"name": "create-rx-app", | ||
"version": "0.2.1-beta.3", | ||
"version": "0.2.1-rc.0", | ||
"description": "ReactXP Project Generator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,6 +20,6 @@ # Create-RX-App | ||
Options: | ||
-J, --javascript generate project in JavaScript | ||
-Y, --yarn use yarn as package manager | ||
-h, --help output usage information | ||
-J, --javascript generate project in JavaScript | ||
-Y, --yarn use yarn as package manager | ||
-S --skip-install do not automatically install dependencies | ||
-h, --help output usage information | ||
``` | ||
@@ -41,3 +41,3 @@ | ||
- `npm run start:windows` - runs the Windows version of the app | ||
- `npm start` - runs react native (RN) development server | ||
- `npm run start:rn-dev-server` - runs react native (RN) development server | ||
@@ -44,0 +44,0 @@ ## License and Copyright |
@@ -41,2 +41,3 @@ import commander from 'commander'; | ||
sourceType: options.javascript ? 'javascript' : 'typescript', | ||
skipInstall: !!options.skipInstall, | ||
yarn: !!options.yarn, | ||
@@ -51,2 +52,3 @@ }).run(); | ||
.option('-Y, --yarn', 'use yarn as package manager') | ||
.option('-S, --skip-install', 'do not automatically install dependencies') | ||
.allowUnknownOption() | ||
@@ -60,4 +62,5 @@ .parse(process.argv); | ||
createRXApp(program.args.shift(), { | ||
skipInstall: program.skipInstall, | ||
javascript: program.javascript, | ||
yarn: program.yarn, | ||
}); |
@@ -17,2 +17,3 @@ import template from 'mustache'; | ||
projectPath: string; | ||
skipInstall: boolean; | ||
sourceType: SourceType; | ||
@@ -25,2 +26,5 @@ yarn: boolean; | ||
const IOS_FOLDER = 'ios'; | ||
const NPM_INSTALL = 'npm i'; | ||
const NPM_RUN = 'npm run'; | ||
const YARN = 'yarn'; | ||
@@ -44,3 +48,3 @@ const { chdir } = process; | ||
this.runCommand = yarn ? 'yarn' : 'npm run'; | ||
this.runCommand = yarn ? YARN : NPM_RUN; | ||
this.options = options; | ||
@@ -70,3 +74,3 @@ } | ||
...this.projectPatterns, | ||
'_babelrc': '.babelrc', | ||
'_babel.config.js': 'babel.config.js', | ||
'_eslintrc': '.eslintrc', | ||
@@ -151,6 +155,6 @@ '_gitignore': '.gitignore', | ||
private generatePackageJson(): void { | ||
const { projectPath, projectName, yarn } = this.options; | ||
const { projectPath, projectName, skipInstall, yarn } = this.options; | ||
const paramsPrefix = yarn ? ' ' : ' -- '; | ||
const packageJson = JSON.stringify({ | ||
name: projectName.toLowerCase(), ...omit(this.packageJson, ['devDependencies', 'peerDependencies', 'dependencies']), | ||
name: projectName.toLowerCase(), ...omit(this.packageJson, skipInstall ? [] : ['devDependencies', 'dependencies']), | ||
}, null, 2); | ||
@@ -165,3 +169,3 @@ | ||
private printInstructions(): void { | ||
const { projectName, projectPath } = this.options; | ||
const { projectName, projectPath, skipInstall, yarn } = this.options; | ||
const xcodeProjectPath = `${ path.resolve(projectPath, IOS_FOLDER, projectName) }.xcodeproj`; | ||
@@ -171,2 +175,9 @@ const windowsProjectPath = `${ path.resolve(projectPath, WINDOWS_FOLDER, projectName) }.sln`; | ||
console.log(chalk.green.bold('%s was successfully created. \n'), projectName); | ||
if (skipInstall) { | ||
console.log(chalk.green.bold('To install dependencies:')); | ||
console.log(' cd %s', projectPath); | ||
console.log(chalk.white.bold(' %s \n'), yarn ? YARN : NPM_INSTALL); | ||
} | ||
console.log(chalk.green.bold('To run your app on Web:')); | ||
@@ -204,3 +215,7 @@ console.log(' cd %s', projectPath); | ||
private installDependencies(): void { | ||
const { devDependencies, peerDependencies, dependencies } = this.packageJson; | ||
if (this.options.skipInstall) { | ||
return; | ||
} | ||
const { devDependencies, dependencies } = this.packageJson; | ||
const { projectPath, yarn } = this.options; | ||
@@ -211,3 +226,3 @@ const packageManager = new PackageManager(yarn); | ||
packageManager.install(devDependencies, 'dev dependencies', true); | ||
packageManager.install({ ...dependencies, ...peerDependencies }, 'dependencies'); | ||
packageManager.install(dependencies, 'dependencies'); | ||
} | ||
@@ -214,0 +229,0 @@ |
@@ -23,3 +23,3 @@ import chalk from 'chalk'; | ||
chalk.blue.bold(['[', this.yarn ? 'yarn' : 'npm', ']'].join('')), | ||
chalk.white.bold([this.yarn ? 'Adding' : 'Installing', `${ description || ''}...`].join(' ')), | ||
chalk.white.bold([this.yarn ? 'adding' : 'installing', `${ description || ''}...`].join(' ')), | ||
].join(' '); | ||
@@ -26,0 +26,0 @@ } |
@@ -6,7 +6,5 @@ { | ||
"dependencies": { | ||
"reactxp": "1.4.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "16.6.0-alpha.8af6728", | ||
"react-dom": "16.6.0-alpha.8af6728", | ||
"reactxp": "1.4.0", | ||
"react": "16.6.0", | ||
"react-dom": "16.6.0", | ||
"react-native": "0.57.3", | ||
@@ -20,2 +18,3 @@ "react-native-windows": "0.57.0-rc.0" | ||
"babel-loader": "8.0.4", | ||
"cross-env": "5.2.0", | ||
"html-webpack-plugin": "3.2.0", | ||
@@ -26,3 +25,3 @@ "metro-react-native-babel-preset": "0.48.1", | ||
"webpack-cli": "3.1.2", | ||
"webpack-dev-server": "3.1.9", | ||
"webpack-dev-server": "3.1.10", | ||
"webpack-merge": "4.1.4" | ||
@@ -35,6 +34,6 @@ }, | ||
"start:ios": "{{ runCommand }} rn-cli{{ paramsPrefix }}run-ios", | ||
"start:web": "webpack-dev-server --config=web/webpack/dev.js --progress --colors --mode=development", | ||
"start": "{{ runCommand }} rn-cli{{ paramsPrefix }}start --reset-cache", | ||
"build:web": "webpack --config=web/webpack/prod.js --progress --colors --mode=production" | ||
"start:web": "cross-env platform=web webpack-dev-server --config=web/webpack/dev.js --progress --colors --mode=development", | ||
"start:rn-dev-server": "{{ runCommand }} rn-cli{{ paramsPrefix }}start --reset-cache", | ||
"build:web": "cross-env platform=web webpack --config=web/webpack/prod.js --progress --colors --mode=production" | ||
} | ||
} |
@@ -9,3 +9,3 @@ { | ||
"devDependencies": { | ||
"fork-ts-checker-webpack-plugin": "0.4.10", | ||
"fork-ts-checker-webpack-plugin": "0.4.11", | ||
"tslint": "5.11.0", | ||
@@ -12,0 +12,0 @@ "tslint-react": "3.6.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
327164
958