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
cd8bae0d
Commit
cd8bae0d
authored
8 years ago
by
Dan Abramov
Browse files
Options
Download
Email Patches
Plain Diff
Further tweak the build output
parent
670e382c
1 merge request
!353
Add check-filename-webpack-plugin to warn on JSX file extension
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/build.js
+17
-10
scripts/build.js
with
17 additions
and
10 deletions
+17
-10
scripts/build.js
+
17
-
10
View file @
cd8bae0d
...
@@ -118,7 +118,11 @@ function build(previousSizeMap) {
...
@@ -118,7 +118,11 @@ function build(previousSizeMap) {
var
publicPath
=
config
.
output
.
publicPath
;
var
publicPath
=
config
.
output
.
publicPath
;
if
(
homepagePath
&&
homepagePath
.
indexOf
(
'
.github.io/
'
)
!==
-
1
)
{
if
(
homepagePath
&&
homepagePath
.
indexOf
(
'
.github.io/
'
)
!==
-
1
)
{
// "homepage": "http://user.github.io/project"
// "homepage": "http://user.github.io/project"
console
.
log
(
'
You can now deploy them to
'
+
chalk
.
green
(
homepagePath
)
+
'
:
'
);
console
.
log
(
'
The project was built assuming it is hosted at
'
+
chalk
.
green
(
publicPath
)
+
'
.
'
);
console
.
log
(
'
You can control this with the
'
+
chalk
.
green
(
'
homepage
'
)
+
'
field in your
'
+
chalk
.
cyan
(
'
package.json
'
)
+
'
.
'
);
console
.
log
();
console
.
log
(
'
The
'
+
chalk
.
cyan
(
'
build
'
)
+
'
folder is ready to be deployed.
'
);
console
.
log
(
'
To publish it at
'
+
chalk
.
green
(
homepagePath
)
+
'
, run:
'
);
console
.
log
();
console
.
log
();
console
.
log
(
'
'
+
chalk
.
blue
(
'
git
'
)
+
chalk
.
cyan
(
'
commit -am
'
)
+
chalk
.
yellow
(
'
"Save local changes"
'
));
console
.
log
(
'
'
+
chalk
.
blue
(
'
git
'
)
+
chalk
.
cyan
(
'
commit -am
'
)
+
chalk
.
yellow
(
'
"Save local changes"
'
));
console
.
log
(
'
'
+
chalk
.
blue
(
'
git
'
)
+
chalk
.
cyan
(
'
checkout -B gh-pages
'
));
console
.
log
(
'
'
+
chalk
.
blue
(
'
git
'
)
+
chalk
.
cyan
(
'
checkout -B gh-pages
'
));
...
@@ -128,32 +132,35 @@ function build(previousSizeMap) {
...
@@ -128,32 +132,35 @@ function build(previousSizeMap) {
console
.
log
(
'
'
+
chalk
.
blue
(
'
git
'
)
+
chalk
.
cyan
(
'
push -f origin gh-pages
'
));
console
.
log
(
'
'
+
chalk
.
blue
(
'
git
'
)
+
chalk
.
cyan
(
'
push -f origin gh-pages
'
));
console
.
log
(
'
'
+
chalk
.
blue
(
'
git
'
)
+
chalk
.
cyan
(
'
checkout -
'
));
console
.
log
(
'
'
+
chalk
.
blue
(
'
git
'
)
+
chalk
.
cyan
(
'
checkout -
'
));
console
.
log
();
console
.
log
();
console
.
log
(
'
The project was built assuming it is hosted at
'
+
chalk
.
green
(
publicPath
)
+
'
.
'
);
console
.
log
(
'
You can control this with the
'
+
chalk
.
green
(
'
homepage
'
)
+
'
field in your
'
+
chalk
.
cyan
(
'
package.json
'
)
+
'
.
'
);
}
else
if
(
publicPath
!==
'
/
'
)
{
}
else
if
(
publicPath
!==
'
/
'
)
{
// "homepage": "http://mywebsite.com/project"
// "homepage": "http://mywebsite.com/project"
console
.
log
(
'
The project was built assuming it is hosted at
'
+
chalk
.
green
(
publicPath
)
+
'
.
'
);
console
.
log
(
'
The project was built assuming it is hosted at
'
+
chalk
.
green
(
publicPath
)
+
'
.
'
);
console
.
log
(
'
You can control this with the
'
+
chalk
.
green
(
'
homepage
'
)
+
'
field in your
'
+
chalk
.
cyan
(
'
package.json
'
)
+
'
.
'
);
console
.
log
(
'
You can control this with the
'
+
chalk
.
green
(
'
homepage
'
)
+
'
field in your
'
+
chalk
.
cyan
(
'
package.json
'
)
+
'
.
'
);
}
else
{
// no homepage or "homepage": "http://mywebsite.com"
console
.
log
(
'
You can now deploy them or serve them with a static server:
'
);
console
.
log
();
console
.
log
();
console
.
log
(
'
'
+
chalk
.
blue
(
'
npm
'
)
+
chalk
.
cyan
(
'
install -g pushstate-server
'
));
console
.
log
(
'
The
'
+
chalk
.
cyan
(
'
build
'
)
+
'
folder is ready to be deployed.
'
);
console
.
log
(
'
'
+
chalk
.
blue
(
'
pushstate-server
'
)
+
chalk
.
cyan
(
'
build
'
));
console
.
log
(
'
'
+
chalk
.
blue
(
openCommand
)
+
chalk
.
cyan
(
'
http://localhost:9000
'
));
console
.
log
();
console
.
log
();
}
else
{
// no homepage or "homepage": "http://mywebsite.com"
console
.
log
(
'
The project was built assuming it is hosted at the server root.
'
);
console
.
log
(
'
The project was built assuming it is hosted at the server root.
'
);
if
(
homepagePath
)
{
if
(
homepagePath
)
{
// "homepage": "http://mywebsite.com"
// "homepage": "http://mywebsite.com"
console
.
log
(
'
You can control this with the
'
+
chalk
.
green
(
'
homepage
'
)
+
'
field in your
'
+
chalk
.
cyan
(
'
package.json
'
)
+
'
.
'
);
console
.
log
(
'
You can control this with the
'
+
chalk
.
green
(
'
homepage
'
)
+
'
field in your
'
+
chalk
.
cyan
(
'
package.json
'
)
+
'
.
'
);
console
.
log
();
}
else
{
}
else
{
// no homepage
// no homepage
console
.
log
(
'
To override this, specify the
'
+
chalk
.
green
(
'
homepage
'
)
+
'
in your
'
+
chalk
.
cyan
(
'
package.json
'
)
+
'
.
'
);
console
.
log
(
'
To override this, specify the
'
+
chalk
.
green
(
'
homepage
'
)
+
'
in your
'
+
chalk
.
cyan
(
'
package.json
'
)
+
'
.
'
);
console
.
log
(
'
For example, add this to build it for GitHub Pages:
'
)
console
.
log
(
'
For example, add this to build it for GitHub Pages:
'
)
console
.
log
();
console
.
log
();
console
.
log
(
'
'
+
chalk
.
green
(
'
"homepage"
'
)
+
chalk
.
cyan
(
'
:
'
)
+
chalk
.
green
(
'
"http://myname.github.io/myapp"
'
)
+
chalk
.
cyan
(
'
,
'
));
console
.
log
(
'
'
+
chalk
.
green
(
'
"homepage"
'
)
+
chalk
.
cyan
(
'
:
'
)
+
chalk
.
green
(
'
"http://myname.github.io/myapp"
'
)
+
chalk
.
cyan
(
'
,
'
));
console
.
log
();
}
}
console
.
log
(
'
The
'
+
chalk
.
cyan
(
'
build
'
)
+
'
folder is ready to be deployed.
'
);
console
.
log
(
'
You may also serve it locally with a static server:
'
)
console
.
log
();
console
.
log
(
'
'
+
chalk
.
blue
(
'
npm
'
)
+
chalk
.
cyan
(
'
install -g pushstate-server
'
));
console
.
log
(
'
'
+
chalk
.
blue
(
'
pushstate-server
'
)
+
chalk
.
cyan
(
'
build
'
));
console
.
log
(
'
'
+
chalk
.
blue
(
openCommand
)
+
chalk
.
cyan
(
'
http://localhost:9000
'
));
console
.
log
();
}
}
console
.
log
();
});
});
}
}
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