diff --git a/cli.js b/cli.js deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/global-cli/index.js b/global-cli/index.js index 94e9721972bc754de0328bd600c7516e33670261..f76d7adeaf046287cab66dcdcc190e1a16b5441a 100644 --- a/global-cli/index.js +++ b/global-cli/index.js @@ -37,7 +37,6 @@ var fs = require('fs'); var path = require('path'); -var exec = require('child_process').exec; var spawn = require('child_process').spawn; var chalk = require('chalk'); var semver = require('semver'); diff --git a/init.js b/init.js index 77fd8fac9b2c24f47da0ff46969bca452da378d7..5dd1aa8b6e094755ef59f0ed358a7b9dcc4177f8 100644 --- a/init.js +++ b/init.js @@ -1,3 +1,24 @@ -module.exports = function(root, appName) { - console.log('Creating the app', appName, 'at', root); +module.exports = function(hostPath, appName) { + var selfPath = hostPath + '/node_modules/create-react-app-scripts'; + + var hostPackage = require(hostPath + '/package.json'); + var selfPackage = require(selfPath + '/package.json'); + + // Copy over devDependencies + for (var key in selfPackage.devDependencies) { + hostPackage.dependencies[key] = selfPackage.devDependencies[key]; + } + + // Setup the script rules + hostPackage.scripts = {}; + ['start', 'build', 'publish-gh-pages'].forEach(function(command) { + hostPackage.scripts[command] = 'node node_modules/create-react-app-scripts/' + command + '.js'; + }); + + fs.writeFileSync(hostPath + '/package.json', JSON.stringify(hostPackage, null, 2)); + + // Move the src folder + fs.renameSync(selfPackage + '/src', hostPackage + '/src'); + + console.log('Creating the app', appName, 'at', hostPath); }; diff --git a/package.json b/package.json index b2f7e31b955acf40b7839004bb47b42bd0327f63..ba969cfa16cd72a2421a45f3db5901f2a1954bb4 100644 --- a/package.json +++ b/package.json @@ -27,12 +27,14 @@ "html-webpack-plugin": "^2.22.0", "json-loader": "^0.5.4", "postcss-loader": "^0.9.1", - "react": "^15.2.1", - "react-dom": "^15.2.1", "rimraf": "^2.5.3", "style-loader": "^0.13.1", "url-loader": "^0.5.7", "webpack": "^1.13.1", "webpack-dev-server": "^1.14.1" + }, + "devDependencies": { + "react": "^15.2.1", + "react-dom": "^15.2.1" } }