Skip to content

Commit 53fd60d

Browse files
authored
Merge pull request #4 from bbuckland/next
Next
2 parents e4270bd + a6a6cfc commit 53fd60d

File tree

89 files changed

+1950
-1118
lines changed

Some content is hidden

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

89 files changed

+1950
-1118
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cache:
99
directories:
1010
- .npm
1111
before_install:
12-
- curl -o- -L https://yarnpkg.com/install.sh | bash
12+
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --nightly
1313
- export PATH="$HOME/.yarn/bin:$PATH"
1414
install: true
1515
script:
@@ -28,5 +28,8 @@ env:
2828
- TEST_SUITE=behavior
2929
matrix:
3030
include:
31+
- os: osx
32+
node_js: 8
33+
env: TEST_SUITE=behavior
3134
- node_js: 4
3235
env: TEST_SUITE=old-node

CHANGELOG.md

Lines changed: 625 additions & 575 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ Builds the app for production to the `build` folder.<br>
117117
It correctly bundles React in production mode and optimizes the build for the best performance.
118118

119119
The build is minified and the filenames include the hashes.<br>
120-
By default, it also [includes a service worker](https://github.com/facebook/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.
121120

122121
Your app is ready to be deployed.
123122

@@ -189,7 +188,7 @@ Your environment will have everything you need to build a modern single-page Rea
189188
* A fast interactive unit test runner with built-in support for coverage reporting.
190189
* A live development server that warns about common mistakes.
191190
* A build script to bundle JS, CSS, and images for production, with hashes and sourcemaps.
192-
* 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/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app) criteria.
191+
* 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/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app) criteria. (*Note: Using the service worker is opt-in as of `react-scripts@2.0.0` and higher*)
193192
* Hassle-free updates for the above tools with a single dependency.
194193

195194
Check out [this guide](https://github.com/nitishdayal/cra_closer_look) for an overview of how these tools fit together.

appveyor.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ image: Visual Studio 2017
22

33
environment:
44
APPVEYOR_SAVE_CACHE_ON_ERROR: true
5+
APPVEYOR_BUILD_WORKER_CLOUD: 'GCE'
56
matrix:
67
- nodejs_version: 10
78
test_suite: 'simple'
@@ -36,7 +37,7 @@ platform:
3637
install:
3738
- ps: Install-Product node $env:nodejs_version $env:platform
3839
- ps: |
39-
(New-Object Net.WebClient).DownloadFile("https://yarnpkg.com/latest.msi", "$env:temp\yarn.msi")
40+
(New-Object Net.WebClient).DownloadFile("https://nightly.yarnpkg.com/latest.msi", "$env:temp\yarn.msi")
4041
cmd /c start /wait msiexec.exe /i $env:temp\yarn.msi /quiet /qn /norestart
4142
4243
build: off

fixtures/output/webpack-message-formatting/__snapshots__/index.test.js.snap

Lines changed: 89 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`webpack message formatting formats aliased unknown export 1`] = `
4+
Object {
5+
"stderr": "Creating an optimized production build...
6+
Failed to compile.
7+
8+
./src/App.js
9+
Attempted import error: 'bar' is not exported from './AppUnknownExport' (imported as 'bar2').
10+
11+
12+
",
13+
"stdout": "",
14+
}
15+
`;
16+
317
exports[`webpack message formatting formats babel syntax error 1`] = `
418
Object {
519
"stderr": "Creating an optimized production build...
620
Failed to compile.
721
822
./src/App.js
9-
Syntax error: Unterminated JSX contents (8:12)
23+
Syntax error: Unterminated JSX contents (8:13)
1024
1125
6 | <div>
1226
7 | <span>
@@ -25,16 +39,16 @@ Syntax error: Unterminated JSX contents (8:12)
2539
exports[`webpack message formatting formats css syntax error 1`] = `
2640
Object {
2741
"stderr": "Creating an optimized production build...
28-
Failed to compile.
29-

30-
./src/AppCss.css
31-
Syntax Error: (3:2) Unexpected }
42+
Failed to compile.
3243
33-
 1 | .App {
34-
 2 |  color: red;
35-
> 3 | }}
36-
 |  ^
37-
 4 | 
44+
./src/AppCss.css
45+
Syntax error: Unexpected } (3:2)
46+
47+
1 | .App {
48+
2 | color: red;
49+
> 3 | }}
50+
| ^
51+
4 |
3852
3953
4054
",
@@ -74,12 +88,58 @@ To ignore, add // eslint-disable-next-line to the line before.
7488
}
7589
`;
7690
91+
exports[`webpack message formatting formats file not found error 1`] = `
92+
Object {
93+
"stderr": "Creating an optimized production build...
94+
Failed to compile.
95+
96+
./src/App.js
97+
Cannot find file './ThisFileSouldNotExist' in './src'.
98+
99+
100+
",
101+
"stdout": "",
102+
}
103+
`;
104+
77105
exports[`webpack message formatting formats missing package 1`] = `
78106
Object {
79107
"stderr": "Creating an optimized production build...
80-
Failed to compile.
81-

82-
Module not found: Error: Can't resolve 'unknown-package' in '/private/var/folders/c3/vytj6_h56b77f_g72smntm3m0000gn/T/bf26e1d3700ad14275f6eefb5e4417c1/src'
108+
Failed to compile.
109+
110+
./src/App.js
111+
Cannot find module: 'unknown-package'. Make sure this package is installed.
112+
113+
You can install this package by running: yarn add unknown-package.
114+
115+
116+
",
117+
"stdout": "",
118+
}
119+
`;
120+
121+
exports[`webpack message formatting formats no default export 1`] = `
122+
Object {
123+
"stderr": "Creating an optimized production build...
124+
Failed to compile.
125+
126+
./src/App.js
127+
Attempted import error: './ExportNoDefault' does not contain a default export (imported as 'myImport').
128+
129+
130+
",
131+
"stdout": "",
132+
}
133+
`;
134+
135+
exports[`webpack message formatting formats out of scope error 1`] = `
136+
Object {
137+
"stderr": "Creating an optimized production build...
138+
Failed to compile.
139+
140+
./src/App.js
141+
You attempted to import ../OutOfScopeImport which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
142+
You can either move it inside src/, or add a symlink to it from project's node_modules/.
83143
84144
85145
",
@@ -93,7 +153,22 @@ Object {
93153
Failed to compile.
94154
95155
./src/App.js
96-
1:1677-1680 './AppUnknownExport' does not contain an export named 'bar'.
156+
Attempted import error: 'bar' is not exported from './AppUnknownExport'.
157+
158+
159+
",
160+
"stdout": "",
161+
}
162+
`;
163+
164+
exports[`webpack message formatting helps when users tries to use sass 1`] = `
165+
Object {
166+
"stderr": "Creating an optimized production build...
167+
Failed to compile.
168+
169+
./src/AppSass.scss
170+
To import Sass files, you first need to install node-sass.
171+
Run \`npm install node-sass\` or \`yarn add node-sass\` inside your workspace.
97172
98173
99174
",

fixtures/output/webpack-message-formatting/index.test.js

Lines changed: 76 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
const { bootstrap, getOutputProduction } = require('../../utils');
1+
const {
2+
bootstrap,
3+
getOutputDevelopment,
4+
getOutputProduction,
5+
} = require('../../utils');
26
const fs = require('fs-extra');
37
const path = require('path');
48
const Semaphore = require('async-sema');
@@ -29,8 +33,7 @@ describe('webpack message formatting', () => {
2933
expect(response).toMatchSnapshot();
3034
});
3135

32-
xit('formats css syntax error', async () => {
33-
// TODO: fix me!
36+
it('formats css syntax error', async () => {
3437
fs.copySync(
3538
path.join(__dirname, 'src', 'AppCss.js'),
3639
path.join(testDirectory, 'src', 'App.js')
@@ -40,8 +43,7 @@ describe('webpack message formatting', () => {
4043
expect(response).toMatchSnapshot();
4144
});
4245

43-
xit('formats unknown export', async () => {
44-
// TODO: fix me!
46+
it('formats unknown export', async () => {
4547
fs.copySync(
4648
path.join(__dirname, 'src', 'AppUnknownExport.js'),
4749
path.join(testDirectory, 'src', 'App.js')
@@ -51,8 +53,27 @@ describe('webpack message formatting', () => {
5153
expect(response).toMatchSnapshot();
5254
});
5355

54-
xit('formats missing package', async () => {
55-
// TODO: fix me!
56+
it('formats aliased unknown export', async () => {
57+
fs.copySync(
58+
path.join(__dirname, 'src', 'AppAliasUnknownExport.js'),
59+
path.join(testDirectory, 'src', 'App.js')
60+
);
61+
62+
const response = await getOutputProduction({ directory: testDirectory });
63+
expect(response).toMatchSnapshot();
64+
});
65+
66+
it('formats no default export', async () => {
67+
fs.copySync(
68+
path.join(__dirname, 'src', 'AppNoDefault.js'),
69+
path.join(testDirectory, 'src', 'App.js')
70+
);
71+
72+
const response = await getOutputProduction({ directory: testDirectory });
73+
expect(response).toMatchSnapshot();
74+
});
75+
76+
it('formats missing package', async () => {
5677
fs.copySync(
5778
path.join(__dirname, 'src', 'AppMissingPackage.js'),
5879
path.join(testDirectory, 'src', 'App.js')
@@ -85,4 +106,52 @@ describe('webpack message formatting', () => {
85106
const response = await getOutputProduction({ directory: testDirectory });
86107
expect(response).toMatchSnapshot();
87108
});
109+
110+
it('helps when users tries to use sass', async () => {
111+
fs.copySync(
112+
path.join(__dirname, 'src', 'AppSass.js'),
113+
path.join(testDirectory, 'src', 'App.js')
114+
);
115+
116+
const response = await getOutputProduction({ directory: testDirectory });
117+
expect(response).toMatchSnapshot();
118+
});
119+
120+
it('formats file not found error', async () => {
121+
fs.copySync(
122+
path.join(__dirname, 'src', 'AppUnknownFile.js'),
123+
path.join(testDirectory, 'src', 'App.js')
124+
);
125+
126+
const response = await getOutputProduction({ directory: testDirectory });
127+
expect(response).toMatchSnapshot();
128+
});
129+
130+
it('formats case sensitive path error', async () => {
131+
fs.copySync(
132+
path.join(__dirname, 'src', 'AppIncorrectCase.js'),
133+
path.join(testDirectory, 'src', 'App.js')
134+
);
135+
136+
const response = await getOutputDevelopment({ directory: testDirectory });
137+
if (process.platform === 'darwin') {
138+
expect(response.stderr).toMatch(
139+
`Cannot find file: 'export5.js' does not match the corresponding name on disk: './src/Export5.js'.`
140+
);
141+
} else {
142+
expect(response.stderr).not.toEqual(''); // TODO: figure out how we can test this on Linux/Windows
143+
// I believe getting this working requires we tap into enhanced-resolve
144+
// pipeline, which is debt we don't want to take on right now.
145+
}
146+
});
147+
148+
it('formats out of scope error', async () => {
149+
fs.copySync(
150+
path.join(__dirname, 'src', 'AppOutOfScopeImport.js'),
151+
path.join(testDirectory, 'src', 'App.js')
152+
);
153+
154+
const response = await getOutputProduction({ directory: testDirectory });
155+
expect(response).toMatchSnapshot();
156+
});
88157
});

fixtures/output/webpack-message-formatting/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
22
"dependencies": {
3-
"node-sass": "4.x",
43
"react": "latest",
5-
"react-dom": "latest",
6-
"react-scripts": "latest"
4+
"react-dom": "latest"
75
},
86
"browserslist": [
97
">0.2%"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React, { Component } from 'react';
2+
import { bar as bar2 } from './AppUnknownExport';
3+
4+
class App extends Component {
5+
componentDidMount() {
6+
bar2();
7+
}
8+
render() {
9+
return <div />;
10+
}
11+
}
12+
13+
export default App;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React, { Component } from 'react';
2+
import five from './export5';
3+
4+
class App extends Component {
5+
render() {
6+
return <div className="App">{five}</div>;
7+
}
8+
}
9+
10+
export default App;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React, { Component } from 'react';
2+
import myImport from './ExportNoDefault';
3+
4+
class App extends Component {
5+
render() {
6+
return <div className="App">{myImport}</div>;
7+
}
8+
}
9+
10+
export default App;

0 commit comments

Comments
 (0)