Skip to content

Commit 7796baf

Browse files
committed
Add an experimental helper script to expose the component locally when debugging
See facebook/create-react-app#7993 (comment) for how this is used.
1 parent db1b182 commit 7796baf

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ storybook-static/
1515

1616
# development workflows
1717
.node_modules/
18+
exposed/
1819

1920
*.orig
2021
*.rej

dev-link.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
exposed_directory=${PWD}/exposed
4+
5+
# Clean out the exposed directory and recreate it
6+
rm -rf "${exposed_directory}" && mkdir -p "${exposed_directory}"
7+
8+
# Link the various pieces we need to make it look like our package
9+
for f in src $(node -p '(require("./package.json").files || []).join("\n")'); do
10+
ln -s "../${f}" "${exposed_directory}/${f}"
11+
done
12+
# Hardlink files such as package.json to prevent smart tools trying to bork things.
13+
for f in package.json; do
14+
ln "${f}" "${exposed_directory}/${f}"
15+
done
16+
(cd "${exposed_directory}" && NODE_ENV=production npm link)
17+
18+
npm install
19+
npm run build -- --watch

0 commit comments

Comments
 (0)