[英]Post-install build step not happening on forked npm package
I forked this repo here , pretty straightforward.我在这里分叉了这个repo,非常简单。 Now I point my project's
package.json
to use my fork.现在我指出我的项目的
package.json
使用我的叉子。 After I npm install
everything looks good except the lib/dist
folder is missing.在我
npm install
之后,除了缺少lib/dist
文件夹外,一切看起来都很好。 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.我知道
npm run build
需要运行以生成这些文件,并且可以手动执行此操作,但是 Wix 版本以某种方式在安装 package 时运行构建步骤。 The only difference from the original is that I changed some iOS code.与原版的唯一区别是我更改了一些 iOS 代码。 Do official npm packages (meaning ones you can install by name) get the benefit of some extra love after installation?
官方 npm 软件包(即您可以按名称安装的软件包)在安装后是否会获得额外的爱? What am I missing?
我错过了什么?
There's not much code to show, but I'll show the scripts section of the package.json file...没有太多代码要显示,但我将显示 package.json 文件的脚本部分...
"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.更新:我在我的 fork 的
package.json
中添加了一个prepare
条目,创建了 dist 文件。 I'm still curious as to why that is done automatically for the original repo.我仍然很好奇为什么原始回购会自动完成。
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.
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抓取文件。 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
.那对我来说是缺少的部分,无论如何,如果您想在安装时拥有自己的个人 package,请使用
prepare
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.