Skip to content

Commit

Permalink
Add an experimental helper script to expose the component locally whe…
Browse files Browse the repository at this point in the history
…n debugging

See facebook/create-react-app#7993 (comment) for
how this is used.
  • Loading branch information
ankon committed Aug 28, 2020
1 parent db1b182 commit 7796baf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ storybook-static/

# development workflows
.node_modules/
exposed/

*.orig
*.rej
Expand Down
19 changes: 19 additions & 0 deletions dev-link.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

exposed_directory=${PWD}/exposed

# Clean out the exposed directory and recreate it
rm -rf "${exposed_directory}" && mkdir -p "${exposed_directory}"

# Link the various pieces we need to make it look like our package
for f in src $(node -p '(require("./package.json").files || []).join("\n")'); do
ln -s "../${f}" "${exposed_directory}/${f}"
done
# Hardlink files such as package.json to prevent smart tools trying to bork things.
for f in package.json; do
ln "${f}" "${exposed_directory}/${f}"
done
(cd "${exposed_directory}" && NODE_ENV=production npm link)

npm install
npm run build -- --watch

0 comments on commit 7796baf

Please sign in to comment.