Skip to content

Commit 0b457c2

Browse files
authored
Merge pull request #1 from jwbennet/cra-sb
Cra sb
2 parents a1b56cf + 4dea24f commit 0b457c2

File tree

162 files changed

+92187
-3372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+92187
-3372
lines changed

Diff for: .eslintrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"rules": {
1313
"no-console": "off",
14-
"strict": ["error", "global"]
14+
"strict": ["error", "global"],
15+
"curly": "warn"
1516
}
1617
}

Diff for: .travis.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
language: node_js
33
node_js:
4-
- 4
54
- 6
65
- 7
76
cache:
@@ -25,5 +24,7 @@ matrix:
2524
include:
2625
- node_js: 0.10
2726
env: TEST_SUITE=simple
28-
- node_js: 6
29-
env: USE_YARN=yes TEST_SUITE=simple
27+
# There's a weird Yarn/Lerna bug related to prerelease versions.
28+
# TODO: reenable after we ship 1.0.
29+
# - node_js: 6
30+
# env: USE_YARN=yes TEST_SUITE=simple

Diff for: CHANGELOG-0.x.md

+1,374
Large diffs are not rendered by default.

Diff for: CHANGELOG.md

+453-1,147
Large diffs are not rendered by default.

Diff for: CONTRIBUTING.md

+4
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ All functionality must be retained (and configuration given to the user) if they
7777

7878
2. Run `npm install` in the root `create-react-app` folder.
7979

80+
3. *(Only for macOS Sierra)*: Until [0.10.0](https://github.com/facebookincubator/create-react-app/milestone/23) is released, you may need to install [Watchman](https://facebook.github.io/watchman/docs/install.html) (e.g. `brew install watchman`).
81+
8082
Once it is done, you can modify any file locally and run `npm start`, `npm test` or `npm run build` just like in a generated project.
8183

8284
If you want to try out the end-to-end flow with the global CLI, you can do this too:
@@ -88,6 +90,8 @@ cd my-app
8890

8991
and then run `npm start` or `npm run build`.
9092

93+
*Note: if you are using yarn, we suggest that you use `yarn install --no-lockfile` instead of the bare `yarn` or `yarn install` because we [intentionally](https://github.com/facebookincubator/create-react-app/pull/2014#issuecomment-300811661) do not ignore or add yarn.lock to our repo.*
94+
9195
## Cutting a Release
9296

9397
1. Tag all merged pull requests that go into the release with the relevant milestone. Each merged PR should also be labeled with one of the [labels](https://github.com/facebookincubator/create-react-app/labels) named `tag: ...` to indicate what kind of change it is.

Diff for: README.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ Install it once globally:
4040
npm install -g create-react-app
4141
```
4242

43-
**You’ll need to have Node >= 4 on your machine**.
44-
45-
**We strongly recommend to use Node >= 6 and npm >= 3 for faster installation speed and better disk usage.** You can use [nvm](https://github.com/creationix/nvm#usage) to easily switch Node versions between different projects.
43+
**You’ll need to have Node >= 6 on your machine**. You can use [nvm](https://github.com/creationix/nvm#usage) to easily switch Node versions between different projects.
4644

4745
**This tool doesn’t assume a Node backend**. The Node installation is only required for Create React App itself.
4846

@@ -67,13 +65,15 @@ my-app/
6765
public/
6866
favicon.ico
6967
index.html
68+
manifest.json
7069
src/
7170
App.css
7271
App.js
7372
App.test.js
7473
index.css
7574
index.js
7675
logo.svg
76+
registerServiceWorker.js
7777
```
7878

7979
No configuration or complicated folder structures, just the files you need to build your app.<br>
@@ -92,7 +92,7 @@ You will see the build errors and lint warnings in the console.
9292
### `npm test` or `yarn test`
9393

9494
Runs the test watcher in an interactive mode.<br>
95-
By default, runs tests related to files changes since the last commit.
95+
By default, runs tests related to files changed since the last commit.
9696

9797
[Read more about testing.](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#running-tests)
9898

@@ -102,7 +102,9 @@ Builds the app for production to the `build` folder.<br>
102102
It correctly bundles React in production mode and optimizes the build for the best performance.
103103

104104
The build is minified and the filenames include the hashes.<br>
105-
Your app is ready to be deployed!
105+
By default, it also [includes a service worker](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app) so that your app loads from local cache on future visits.
106+
107+
Your app is ready to be deployed.
106108

107109
## User Guide
108110

@@ -118,6 +120,7 @@ The [User Guide](https://github.com/facebookincubator/create-react-app/blob/mast
118120
- [Changing the Page `<title>`](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#changing-the-page-title)
119121
- [Installing a Dependency](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#installing-a-dependency)
120122
- [Importing a Component](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#importing-a-component)
123+
- [Code Splitting](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#code-splitting)
121124
- [Adding a Stylesheet](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-a-stylesheet)
122125
- [Post-Processing CSS](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#post-processing-css)
123126
- [Adding a CSS Preprocessor (Sass, Less etc.)](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-a-css-preprocessor-sass-less-etc)
@@ -134,7 +137,6 @@ The [User Guide](https://github.com/facebookincubator/create-react-app/blob/mast
134137
- [Generating Dynamic `<meta>` Tags on the Server](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#generating-dynamic-meta-tags-on-the-server)
135138
- [Pre-Rendering into Static HTML Files](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#pre-rendering-into-static-html-files)
136139
- [Running Tests](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#running-tests)
137-
- [Developing Components in Isolation](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#developing-components-in-isolation)
138140
- [Making a Progressive Web App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app)
139141
- [Deployment](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#deployment)
140142
- [Advanced Configuration](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#advanced-configuration)
@@ -164,6 +166,7 @@ Please refer to the [User Guide](https://github.com/facebookincubator/create-rea
164166
* Import CSS and image files directly from JavaScript.
165167
* Autoprefixed CSS, so you don’t need `-webkit` or other prefixes.
166168
* A `build` script to bundle JS, CSS, and images for production, with sourcemaps.
169+
* An offline-first [service worker](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers) and a [web app manifest](https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/), meeting all the [Progressive Web App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app) criteria.
167170

168171
**The feature set is intentionally limited**. It doesn’t support advanced features such as server rendering or CSS modules. The tool is also **non-configurable** because it is hard to provide a cohesive experience and easy updates across a set of tools when the user can tweak anything.
169172

@@ -243,7 +246,6 @@ Notable alternatives also include:
243246
* [aik](https://github.com/d4rkr00t/aik)
244247
* [react-app](https://github.com/kriasoft/react-app)
245248
* [dev-toolkit](https://github.com/stoikerty/dev-toolkit)
246-
* [tarec](https://github.com/geowarin/tarec)
247249
* [sku](https://github.com/seek-oss/sku)
248250

249251
You can also use module bundlers like [webpack](http://webpack.github.io) and [Browserify](http://browserify.org/) directly.<br>

Diff for: appveyor.yml

-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ environment:
1414
test_suite: "installs"
1515
- nodejs_version: 6
1616
test_suite: "kitchensink"
17-
- nodejs_version: 4
18-
test_suite: "simple"
19-
- nodejs_version: 4
20-
test_suite: "installs"
21-
- nodejs_version: 4
22-
test_suite: "kitchensink"
2317

2418
cache:
2519
- node_modules -> appveyor.cleanup-cache.txt

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
"changelog": "lerna-changelog",
66
"create-react-app": "tasks/cra.sh",
77
"e2e": "tasks/e2e-simple.sh",
8-
"postinstall": "lerna bootstrap",
8+
"postinstall": "lerna bootstrap && cd packages/react-error-overlay/ && npm run build:prod",
99
"publish": "tasks/release.sh",
1010
"start": "node packages/react-scripts/scripts/start.js",
1111
"test": "node packages/react-scripts/scripts/test.js --env=jsdom",
1212
"format": "prettier --trailing-comma es5 --single-quote --write 'packages/*/*.js' 'packages/*/!(node_modules)/**/*.js'",
1313
"precommit": "lint-staged"
1414
},
1515
"devDependencies": {
16-
"eslint": "3.16.1",
16+
"eslint": "3.19.0",
1717
"husky": "^0.13.2",
1818
"lerna": "2.0.0-beta.38",
1919
"lerna-changelog": "^0.2.3",

Diff for: packages/babel-preset-react-app/index.js

-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
*/
99
'use strict';
1010

11-
var path = require('path');
12-
1311
const plugins = [
1412
// class { handleClick = () => { } }
1513
require.resolve('babel-plugin-transform-class-properties'),
@@ -36,8 +34,6 @@ const plugins = [
3634
helpers: false,
3735
polyfill: false,
3836
regenerator: true,
39-
// Resolve the Babel runtime relative to the config.
40-
moduleName: path.dirname(require.resolve('babel-runtime/package')),
4137
},
4238
],
4339
];

Diff for: packages/babel-preset-react-app/package.json

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "babel-preset-react-app",
3-
"version": "2.1.1",
3+
"version": "3.0.0",
44
"description": "Babel preset used by Create React App",
55
"repository": "facebookincubator/create-react-app",
66
"license": "BSD-3-Clause",
@@ -11,18 +11,20 @@
1111
"index.js"
1212
],
1313
"dependencies": {
14-
"babel-plugin-dynamic-import-node": "1.0.0",
14+
"babel-plugin-dynamic-import-node": "1.0.2",
1515
"babel-plugin-syntax-dynamic-import": "6.18.0",
16-
"babel-plugin-transform-class-properties": "6.23.0",
16+
"babel-plugin-transform-class-properties": "6.24.1",
1717
"babel-plugin-transform-object-rest-spread": "6.23.0",
1818
"babel-plugin-transform-react-constant-elements": "6.23.0",
19-
"babel-plugin-transform-react-jsx": "6.23.0",
19+
"babel-plugin-transform-react-jsx": "6.24.1",
2020
"babel-plugin-transform-react-jsx-self": "6.22.0",
2121
"babel-plugin-transform-react-jsx-source": "6.22.0",
22-
"babel-plugin-transform-regenerator": "6.22.0",
22+
"babel-plugin-transform-regenerator": "6.24.1",
2323
"babel-plugin-transform-runtime": "6.23.0",
24-
"babel-preset-env": "1.2.1",
25-
"babel-preset-react": "6.23.0",
26-
"babel-runtime": "6.23.0"
24+
"babel-preset-env": "1.4.0",
25+
"babel-preset-react": "6.24.1"
26+
},
27+
"peerDependencies": {
28+
"babel-runtime": "^6.23.0"
2729
}
2830
}

Diff for: packages/create-react-app/createReactApp.js

+67-25
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
// tell people to update their global version of create-react-app.
2929
//
3030
// Also be careful with new language features.
31-
// This file must work on Node 4+.
31+
// This file must work on Node 6+.
3232
//
3333
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3434
// /!\ DO NOT MODIFY THIS FILE /!\
@@ -160,7 +160,34 @@ function createApp(name, verbose, version, template) {
160160
const originalDirectory = process.cwd();
161161
process.chdir(root);
162162

163-
run(root, appName, version, verbose, originalDirectory, template);
163+
if (!semver.satisfies(process.version, '>=6.0.0')) {
164+
console.log(
165+
chalk.yellow(
166+
`You are using Node ${process.version} so the project will be boostrapped with an old unsupported version of tools.\n\n` +
167+
`Please update to Node 6 or higher for a better, fully supported experience.\n`
168+
)
169+
);
170+
// Fall back to latest supported react-scripts on Node 4
171+
version = '[email protected]';
172+
}
173+
174+
const useYarn = shouldUseYarn();
175+
if (!useYarn) {
176+
const npmInfo = checkNpmVersion();
177+
if (!npmInfo.hasMinNpm) {
178+
if (npmInfo.npmVersion) {
179+
console.log(
180+
chalk.yellow(
181+
`You are using npm ${npmInfo.npmVersion} so the project will be boostrapped with an old unsupported version of tools.\n\n` +
182+
`Please update to npm 3 or higher for a better, fully supported experience.\n`
183+
)
184+
);
185+
}
186+
// Fall back to latest supported react-scripts for npm 3
187+
version = '[email protected]';
188+
}
189+
}
190+
run(root, appName, version, verbose, originalDirectory, template, useYarn);
164191
}
165192

166193
function shouldUseYarn() {
@@ -190,7 +217,6 @@ function install(useYarn, dependencies, verbose, isOnline) {
190217
console.log();
191218
}
192219
} else {
193-
checkNpmVersion();
194220
command = 'npm';
195221
args = ['install', '--save', '--save-exact'].concat(dependencies);
196222
}
@@ -212,13 +238,19 @@ function install(useYarn, dependencies, verbose, isOnline) {
212238
});
213239
}
214240

215-
function run(root, appName, version, verbose, originalDirectory, template) {
241+
function run(
242+
root,
243+
appName,
244+
version,
245+
verbose,
246+
originalDirectory,
247+
template,
248+
useYarn
249+
) {
216250
const packageToInstall = getInstallPackage(version);
217251
const allDependencies = ['react', 'react-dom', packageToInstall];
218252

219253
console.log('Installing packages. This might take a couple minutes.');
220-
221-
const useYarn = shouldUseYarn();
222254
getPackageName(packageToInstall)
223255
.then(packageName => checkIfOnline(useYarn).then(isOnline => ({
224256
isOnline: isOnline,
@@ -253,6 +285,15 @@ function run(root, appName, version, verbose, originalDirectory, template) {
253285
);
254286
const init = require(scriptsPath);
255287
init(root, appName, verbose, originalDirectory, template);
288+
289+
if (version === '[email protected]') {
290+
console.log(
291+
chalk.yellow(
292+
`\nNote: the project was boostrapped with an old unsupported version of tools.\n` +
293+
`Please update to Node >=6 and npm >=3 to get supported tools in new projects.\n`
294+
)
295+
);
296+
}
256297
})
257298
.catch(reason => {
258299
console.log();
@@ -302,7 +343,7 @@ function run(root, appName, version, verbose, originalDirectory, template) {
302343
}
303344

304345
function getInstallPackage(version) {
305-
let packageToInstall = 'react-scripts';
346+
let packageToInstall = '@jwbennet/spring-boot-react-scripts';
306347
const validSemver = semver.valid(version);
307348
if (validSemver) {
308349
packageToInstall += `@${validSemver}`;
@@ -398,24 +439,18 @@ function getPackageName(installPackage) {
398439
}
399440

400441
function checkNpmVersion() {
401-
let isNpm2 = false;
442+
let hasMinNpm = false;
443+
let npmVersion = null;
402444
try {
403-
const npmVersion = execSync('npm --version').toString();
404-
isNpm2 = semver.lt(npmVersion, '3.0.0');
445+
npmVersion = execSync('npm --version').toString().trim();
446+
hasMinNpm = semver.gte(npmVersion, '3.0.0');
405447
} catch (err) {
406-
return;
448+
// ignore
407449
}
408-
if (!isNpm2) {
409-
return;
410-
}
411-
console.log(chalk.yellow('It looks like you are using npm 2.'));
412-
console.log(
413-
chalk.yellow(
414-
'We suggest using npm 3 or Yarn for faster install times ' +
415-
'and less disk space usage.'
416-
)
417-
);
418-
console.log();
450+
return {
451+
hasMinNpm: hasMinNpm,
452+
npmVersion: npmVersion,
453+
};
419454
}
420455

421456
function checkNodeVersion(packageName) {
@@ -457,7 +492,7 @@ function checkAppName(appName) {
457492

458493
// TODO: there should be a single place that holds the dependencies
459494
const dependencies = ['react', 'react-dom'];
460-
const devDependencies = ['react-scripts'];
495+
const devDependencies = ['@jwbennet/spring-boot-react-scripts'];
461496
const allDependencies = dependencies.concat(devDependencies).sort();
462497
if (allDependencies.indexOf(appName) >= 0) {
463498
console.error(
@@ -530,12 +565,19 @@ function isSafeToCreateProjectIn(root) {
530565
'.idea',
531566
'README.md',
532567
'LICENSE',
533-
'web.iml',
534568
'.hg',
535569
'.hgignore',
536570
'.hgcheck',
571+
'.mvn',
572+
'mvnw',
573+
'mvnw.cmd',
574+
'pom.xml',
575+
'src',
537576
];
538-
return fs.readdirSync(root).every(file => validFiles.indexOf(file) >= 0);
577+
return fs
578+
.readdirSync(root)
579+
.filter(file => !file.endsWith('.iml'))
580+
.every(file => validFiles.indexOf(file) >= 0);
539581
}
540582

541583
function checkIfOnline(useYarn) {

Diff for: packages/create-react-app/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@
4141
var chalk = require('chalk');
4242

4343
var currentNodeVersion = process.versions.node;
44-
if (currentNodeVersion.split('.')[0] < 4) {
44+
var semver = currentNodeVersion.split('.');
45+
var major = semver[0];
46+
47+
if (major < 4) {
4548
console.error(
4649
chalk.red(
4750
'You are running Node ' +

0 commit comments

Comments
 (0)