Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Meta
create-react-app
Commits
f8b47260
Commit
f8b47260
authored
8 years ago
by
Dan Abramov
Browse files
Options
Download
Email Patches
Plain Diff
Add missing file check to npm run build too
parent
4a0f39ae
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
scripts/build.js
+3
-0
scripts/build.js
scripts/eject.js
+1
-0
scripts/eject.js
scripts/start.js
+1
-15
scripts/start.js
scripts/utils/checkRequiredFiles.js
+33
-0
scripts/utils/checkRequiredFiles.js
with
38 additions
and
15 deletions
+38
-15
scripts/build.js
+
3
-
0
View file @
f8b47260
...
...
@@ -21,9 +21,12 @@ var rimrafSync = require('rimraf').sync;
var
webpack
=
require
(
'
webpack
'
);
var
config
=
require
(
'
../config/webpack.config.prod
'
);
var
paths
=
require
(
'
../config/paths
'
);
var
checkRequiredFiles
=
require
(
'
./utils/checkRequiredFiles
'
);
var
recursive
=
require
(
'
recursive-readdir
'
);
var
stripAnsi
=
require
(
'
strip-ansi
'
);
checkRequiredFiles
();
// Input: /User/dan/app/build/static/js/main.82be8.js
// Output: /static/js/main.js
function
removeFileNameHash
(
fileName
)
{
...
...
This diff is collapsed.
Click to expand it.
scripts/eject.js
+
1
-
0
View file @
f8b47260
...
...
@@ -44,6 +44,7 @@ prompt(
path
.
join
(
'
config
'
,
'
jest
'
,
'
transform.js
'
),
path
.
join
(
'
scripts
'
,
'
build.js
'
),
path
.
join
(
'
scripts
'
,
'
start.js
'
),
path
.
join
(
'
scripts
'
,
'
utils
'
,
'
checkRequiredFiles.js
'
),
path
.
join
(
'
scripts
'
,
'
utils
'
,
'
chrome.applescript
'
),
path
.
join
(
'
scripts
'
,
'
utils
'
,
'
prompt.js
'
),
path
.
join
(
'
scripts
'
,
'
utils
'
,
'
WatchMissingNodeModulesPlugin.js
'
)
...
...
This diff is collapsed.
Click to expand it.
scripts/start.js
+
1
-
15
View file @
f8b47260
...
...
@@ -11,7 +11,6 @@
process
.
env
.
NODE_ENV
=
'
development
'
;
var
fs
=
require
(
'
fs
'
);
var
path
=
require
(
'
path
'
);
var
chalk
=
require
(
'
chalk
'
);
var
webpack
=
require
(
'
webpack
'
);
...
...
@@ -21,6 +20,7 @@ var httpProxyMiddleware = require('http-proxy-middleware');
var
execSync
=
require
(
'
child_process
'
).
execSync
;
var
opn
=
require
(
'
opn
'
);
var
detect
=
require
(
'
detect-port
'
);
var
checkRequiredFiles
=
require
(
'
./utils/checkRequiredFiles
'
);
var
prompt
=
require
(
'
./utils/prompt
'
);
var
config
=
require
(
'
../config/webpack.config.dev
'
);
var
paths
=
require
(
'
../config/paths
'
);
...
...
@@ -171,20 +171,6 @@ function openBrowser(port, protocol) {
opn
(
protocol
+
'
://localhost:
'
+
port
+
'
/
'
);
}
function
checkRequiredFiles
()
{
var
filesPathToCheck
=
[
paths
.
appHtml
,
paths
.
appIndexJs
];
filesPathToCheck
.
forEach
(
function
(
filePath
)
{
try
{
fs
.
accessSync
(
filePath
,
fs
.
F_OK
);
}
catch
(
err
)
{
var
fileName
=
path
.
basename
(
filePath
);
console
.
log
(
chalk
.
red
(
`Cannot find
${
fileName
}
in
${
filePath
}
directory`
)
);
process
.
exit
(
1
);
}
});
}
// We need to provide a custom onError function for httpProxyMiddleware.
// It allows us to log custom error messages on the console.
function
onProxyError
(
proxy
)
{
...
...
This diff is collapsed.
Click to expand it.
scripts/utils/checkRequiredFiles.js
0 → 100644
+
33
-
0
View file @
f8b47260
// @remove-on-eject-begin
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
// @remove-on-eject-end
const
fs
=
require
(
'
fs
'
);
const
path
=
require
(
'
path
'
);
const
chalk
=
require
(
'
chalk
'
);
const
paths
=
require
(
'
../../config/paths
'
);
function
checkRequiredFiles
()
{
const
filesPathToCheck
=
[
paths
.
appHtml
,
paths
.
appIndexJs
];
filesPathToCheck
.
forEach
(
filePath
=>
{
try
{
fs
.
accessSync
(
filePath
,
fs
.
F_OK
);
}
catch
(
err
)
{
const
dirName
=
path
.
dirname
(
filePath
);
const
fileName
=
path
.
basename
(
filePath
);
console
.
log
(
chalk
.
red
(
'
Could not find a required file.
'
));
console
.
log
(
chalk
.
red
(
'
Name:
'
)
+
chalk
.
cyan
(
fileName
));
console
.
log
(
chalk
.
red
(
'
Searched in:
'
)
+
chalk
.
cyan
(
dirName
));
process
.
exit
(
1
);
}
});
}
module
.
exports
=
checkRequiredFiles
;
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets