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
410a6a95
Commit
410a6a95
authored
8 years ago
by
Dan Abramov
Committed by
GitHub
8 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Clean up e2e script (#867)
* Clean up e2e script * Link to local packages after ejecting
parent
90ce8abf
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tasks/cra.sh
+8
-0
tasks/cra.sh
tasks/e2e.sh
+16
-36
tasks/e2e.sh
with
24 additions
and
36 deletions
+24
-36
tasks/cra.sh
+
8
-
0
View file @
410a6a95
...
...
@@ -56,6 +56,9 @@ $root_path/node_modules/.bin/lerna bootstrap
cd
packages/react-scripts
# Save package.json because we're going to touch it
cp
package.json package.json.orig
# Like bundle-deps, this script modifies packages/react-scripts/package.json,
# copying own dependencies (those in the `packages` dir) to bundledDependencies
node
$root_path
/tasks/bundle-own-deps.js
...
...
@@ -63,6 +66,11 @@ node $root_path/tasks/bundle-own-deps.js
# Finally, pack react-scripts
scripts_path
=
$root_path
/packages/react-scripts/
`
npm pack
`
# Restore package.json
rm
package.json
mv
package.json.orig package.json
# ******************************************************************************
# Now that we have packed them, call the global CLI.
# ******************************************************************************
...
...
This diff is collapsed.
Click to expand it.
tasks/e2e.sh
+
16
-
36
View file @
410a6a95
...
...
@@ -19,7 +19,7 @@ function cleanup {
cd
$root_path
# Uncomment when snapshot testing is enabled by default:
# rm ./packages/react-scripts/template/src/__snapshots__/App.test.js.snap
rm
-rf
$temp_cli_path
$temp_app_path
$clean_path
rm
-rf
$temp_cli_path
$temp_app_path
}
# Error messages are redirected to stderr
...
...
@@ -53,7 +53,9 @@ set -x
cd
..
root_path
=
$PWD
# Lint
npm
install
# Lint own code
./node_modules/.bin/eslint
--ignore-path
.gitignore ./
# ******************************************************************************
...
...
@@ -61,8 +63,6 @@ root_path=$PWD
# This does not affect our users but makes sure we can develop it.
# ******************************************************************************
npm
install
# Test local build command
npm run build
# Check for expected output
...
...
@@ -84,45 +84,19 @@ npm start -- --smoke-test
# Next, pack react-scripts and create-react-app so we can verify they work.
# ******************************************************************************
# Pack CLI
(it doesn't need cleaning)
# Pack CLI
cd
$root_path
/packages/create-react-app
cli_path
=
$PWD
/
`
npm pack
`
# Packing react-scripts takes more work because we want to clean it up first.
# Create a temporary clean folder that contains production only code.
# Do not overwrite any files in the current folder.
clean_path
=
`
mktemp
-d
2>/dev/null
||
mktemp
-d
-t
'clean_path'
`
# Copy some of the react-scripts project files to the temporary folder.
# Exclude folders that definitely won’t be part of the package from processing.
# We will strip the dev-only code there, `npm pack`, and copy the package back.
cd
$root_path
rsync
-av
--exclude
=
'.git'
--exclude
=
$clean_path
\
--exclude
=
'node_modules'
--exclude
=
'build'
\
'./'
$clean_path
>
/dev/null
# Open the clean folder
cd
$clean_path
/packages/react-scripts
# Now remove all the code relevant to development of Create React App.
files
=
"
$(
find
-L
.
-name
"*.js"
-type
f
)
"
for
file
in
$files
;
do
sed
-i
.bak
'/\/\/ @remove-on-publish-begin/,/\/\/ @remove-on-publish-end/d'
$file
rm
$file
.bak
done
# Install all our packages
cd
$clean_path
$root_path
/node_modules/.bin/lerna bootstrap
cd
$clean_path
/packages/react-scripts
# Go to react-scripts
cd
$root_path
/packages/react-scripts
# Like bundle-deps, this script modifies packages/react-scripts/package.json,
# copying own dependencies (those in the `packages` dir) to bundledDependencies
node
$
clean
_path
/tasks/bundle-own-deps.js
node
$
root
_path
/tasks/bundle-own-deps.js
# Finally, pack react-scripts
scripts_path
=
$
clean
_path
/packages/react-scripts/
`
npm pack
`
scripts_path
=
$
root
_path
/packages/react-scripts/
`
npm pack
`
# ******************************************************************************
# Now that we have packed them, create a clean app folder and install them.
...
...
@@ -168,9 +142,15 @@ npm start -- --smoke-test
# Finally, let's check that everything still works after ejecting.
# ******************************************************************************
# Eject
# Eject
...
echo yes
| npm run eject
# ...but still link to the local packages
npm
link
$root_path
/packages/babel-preset-react-app
npm
link
$root_path
/packages/eslint-config-react-app
npm
link
$root_path
/packages/react-dev-utils
npm
link
$root_path
/packages/react-scripts
# Test the build
npm run build
# Check for expected output
...
...
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