-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modularise scripts #1433
Merged
Merged
Modularise scripts #1433
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6bd6381
Refactor start script into modules
djgrant 073cb55
Move dev server config into config file
djgrant d606bcc
Replace eject file whitelist with a "remove-file-on-eject" flag
djgrant 1a3fa31
Move utils into scripts folder (for inclusion in ejection)
djgrant 38bc01c
Add missed changes
Timer 0f9b5df
Pass showInstructions as an argument
Timer 3ba6dfe
Fix eject bug
Timer 61e99ee
Don't eject babelTransform
Timer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// @remove-file-on-eject | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
var config = require('./webpack.config.dev'); | ||
var paths = require('./paths'); | ||
|
||
var protocol = process.env.HTTPS === 'true' ? 'https' : 'http'; | ||
var host = process.env.HOST || 'localhost'; | ||
|
||
module.exports = { | ||
// Enable gzip compression of generated files. | ||
compress: true, | ||
// Silence WebpackDevServer's own logs since they're generally not useful. | ||
// It will still show compile warnings and errors with this setting. | ||
clientLogLevel: 'none', | ||
// By default WebpackDevServer serves physical files from current directory | ||
// in addition to all the virtual build products that it serves from memory. | ||
// This is confusing because those files won’t automatically be available in | ||
// production build folder unless we copy them. However, copying the whole | ||
// project directory is dangerous because we may expose sensitive files. | ||
// Instead, we establish a convention that only files in `public` directory | ||
// get served. Our build script will copy `public` into the `build` folder. | ||
// In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%: | ||
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> | ||
// In JavaScript code, you can access it with `process.env.PUBLIC_URL`. | ||
// Note that we only recommend to use `public` folder as an escape hatch | ||
// for files like `favicon.ico`, `manifest.json`, and libraries that are | ||
// for some reason broken when imported through Webpack. If you just want to | ||
// use an image, put it in `src` and `import` it from JavaScript instead. | ||
contentBase: paths.appPublic, | ||
// By default files from `contentBase` will not trigger a page reload. | ||
watchContentBase: true, | ||
// Enable hot reloading server. It will provide /sockjs-node/ endpoint | ||
// for the WebpackDevServer client so it can learn when the files were | ||
// updated. The WebpackDevServer client is included as an entry point | ||
// in the Webpack development configuration. Note that only changes | ||
// to CSS are currently hot reloaded. JS changes will refresh the browser. | ||
hot: true, | ||
// It is important to tell WebpackDevServer to use the same "root" path | ||
// as we specified in the config. In development, we always serve from /. | ||
publicPath: config.output.publicPath, | ||
// WebpackDevServer is noisy by default so we emit custom message instead | ||
// by listening to the compiler events with `compiler.plugin` calls above. | ||
quiet: true, | ||
// Reportedly, this avoids CPU overload on some systems. | ||
// https://github.com/facebookincubator/create-react-app/issues/293 | ||
watchOptions: { | ||
ignored: /node_modules/ | ||
}, | ||
// Enable HTTPS if the HTTPS environment variable is set to 'true' | ||
https: protocol === 'https', | ||
host: host, | ||
overlay: false, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// @remove-file-on-eject | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Timer btw. Is there is any code convention (besides of eslint)? Use normal function or arrow?
Right now there are both normal and arrow are using. For example -
eject.js
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to have a lower node requirement than Node 4, iirc. I'm not sure on an official preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arrows are fine. If it runs on Node 4 then it's good. But only in
react-scripts
.Global CLI should stay parseable by Node 0.12 so that we can show a nice error message instead of crashing. (We could also split modern code into a lazy require.)