Last active
February 3, 2024 02:32
-
-
Save micimize/cebad5e0a7443374722b92cfed92f5a4 to your computer and use it in GitHub Desktop.
Scripts to streamline/enforce the copy and publish subdir method (https://stackoverflow.com/a/39946795/2234013). idk if copying package.json is necessary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"prepublishOnly": "if [[ ! $PWD =~ dist$ ]]; then npm run _dist:nopublish; fi", | |
"_dist:nopublish": "echo 'Use `npm run dist` instead of `npm publish`!' && exit 1", | |
"_dist:prep": "yarn build && cp package.json dist && cp README.md dist", | |
"_dist:post": "rm -f dist/package.json && rm -f dist/README.md", | |
"dist": "npm run _dist:prep && npm publish dist && npm run _dist:post" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same for me here - @sandrina-p 's fix did the trick for me.
And, after that, you just need to
npm publish <tar>
, wheretar
is the tar ball generated fromnpm pack ./dist