Skip to content

Commit 2726f1d

Browse files
committed
Tweak wording and make package.json scripts less obnoxious
1 parent 54c3b06 commit 2726f1d

File tree

6 files changed

+29
-5
lines changed

6 files changed

+29
-5
lines changed

bin/build-react-app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env node
2+
require('../scripts/build');

bin/graduate-react-app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env node
2+
require('../scripts/graduate');

bin/start-react-app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env node
2+
require('../scripts/start');

global-cli/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ function createApp(name, verbose, version) {
7777
var appName = path.basename(root);
7878

7979
console.log(
80-
'This will walk you through creating a new React app in',
81-
root
80+
'Creating a new React app in ' + root + '.'
8281
);
82+
console.log();
8383

8484
fs.mkdirSync(root);
8585

@@ -92,6 +92,8 @@ function createApp(name, verbose, version) {
9292
process.chdir(root);
9393

9494
console.log('Installing create-react-app-scripts package from npm...');
95+
console.log('This might take a while! ⌛');
96+
console.log();
9597

9698
run(root, appName, version, verbose);
9799
}

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
"build": "node scripts/build.js local",
77
"create-react-app": "node global-cli/index.js --scripts-version \"$PWD/`npm pack`\""
88
},
9+
"bin": {
10+
"start-react-app": "./bin/start-react-app.js",
11+
"build-react-app": "./bin/build-react-app.js",
12+
"graduate-react-app": "./bin/graduate-react-app.js"
13+
},
914
"dependencies": {
1015
"autoprefixer": "^6.3.7",
1116
"babel-core": "^6.10.4",

scripts/init.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ module.exports = function(hostPath, appName) {
2323

2424
// Setup the script rules
2525
hostPackage.scripts = {};
26-
['start', 'build'].forEach(function(command) {
26+
['start', 'build', 'graduate'].forEach(function(command) {
2727
hostPackage.scripts[command] =
28-
'node node_modules/create-react-app-scripts/scripts/' + command + '.js';
28+
command + '-react-app';
2929
});
3030

3131
fs.writeFileSync(hostPath + '/package.json', JSON.stringify(hostPackage, null, 2));
@@ -35,5 +35,16 @@ module.exports = function(hostPath, appName) {
3535
// Move the src folder
3636
fs.renameSync(selfPath + '/src', hostPath + '/src');
3737

38-
console.log('Creating the app', appName, 'at', hostPath);
38+
console.log('Success! Created ' + appName + ' at ' + hostPath + '.');
39+
console.log();
40+
console.log('Inside that directory, you can run several commands:');
41+
console.log(' * npm start: Starts the development server.');
42+
console.log(' * npm run build: Builds the app for production.');
43+
console.log(' * npm run graduate: Removes this tool. If you do this, you can’t go back!');
44+
console.log();
45+
console.log('We suggest that you begin by typing:');
46+
console.log(' cd', appName);
47+
console.log(' npm start');
48+
console.log();
49+
console.log('Happy hacking!');
3950
};

0 commit comments

Comments
 (0)