0

I forked this repo here, pretty straightforward. Now I point my project's package.json to use my fork. After I npm install everything looks good except the lib/dist folder is missing. I know npm run build needs to be run to generate those files and could just do that manually, but the Wix version somehow runs the build step on installation of the package. The only difference from the original is that I changed some iOS code. Do official npm packages (meaning ones you can install by name) get the benefit of some extra love after installation? What am I missing?

There's not much code to show, but I'll show the scripts section of the package.json file...

"scripts": {
    "build": "rm -rf ./lib/dist && tsc",
    "prestart": "npm run build",
    "pretest-js": "npm run build",
    "pretest-unit-ios": "npm run build",
    "pretest-unit-android": "npm run build",
    "test": "node scripts/test",
    "start": "node ./scripts/start",
    "pretest-e2e-ios-release": "npm run build",
    "clean": "node ./scripts/clean",
    "test-e2e-ios": "node ./scripts/test-e2e --ios",
    "test-e2e-ios-release": "node ./scripts/test-e2e --ios --release",
    "test-unit-ios": "node ./scripts/test-unit --ios",
    "test-unit-android": "node ./scripts/test-unit --android",
    "test-js": "node ./scripts/test-js",
    "xcode": "open example/ios/NotificationsExampleApp.xcodeproj",
    "androidStudio": "open -a /Applications/Android\\ Studio.app ./example/android",
    "prerelease": "npm run build",
    "release": "node ./scripts/release",
    "generate-changelog": "gren changelog",
    "docusaurus": "npm start --prefix website"
},

UPDATE: I added a prepare entry to my fork's package.json the dist files were created. I'm still curious as to why that is done automatically for the original repo.

rob5408
  • 2,972
  • 2
  • 40
  • 53

1 Answers1

0

This question has a lot in common with mine, maybe even a dupe. This answer took me a couple reads, but it led me to read the node documentation (gasp!). I inferred that package authors build and publish to npm (which is obvious), but that npm install doesn't actually go to git to grab the files, instead they have a tar from the publishing process. That was the missing part for me. Anyway, if you want to have your own personal package built on install, use prepare.

rob5408
  • 2,972
  • 2
  • 40
  • 53