Comments (10)
@Mister-Hope 是不是这些依赖应该都放在 devDep 里面?https://github.com/walinejs/waline/blob/main/packages/client/package.json#L84-L92
@Mister-Hope Should all these dependencies be placed in devDep? https://github.com/walinejs/waline/blob/main/packages/client/package.json#L84-L92
from waline.
Nope,.the slim bundle is the default entry on node, so perhaps your workflow are still problematic.
from waline.
@Mister-Hope 有两种解决办法,一种是将 @waline/api
打包进去,这样能保持 @waline/api
是跟随仓库最新的;还有一种方案是构建前修改 package.json
将其指向到 npm 最新的版本号上。你选一个我再改吧。
@Mister-Hope There are two solutions. One is to package @waline/api
, so as to keep @waline/api
up to date with the warehouse; the other is to modify package.json before building
Point it to the latest npm version number. You choose one and I'll change it.
from waline.
原则上使用workspace:* 对于pnpm发布是没问题的。只是ci有问题而已
In principle, there is no problem using workspace:* for pnpm publishing. It’s just a problem with ci
from waline.
@Mister-Hope CI和发布都没有问题,现在是package.json中依赖写的还是workspace,所以导致了在其他项目里安装出错了。这种monorepo项目的依赖内部引用一般对外的产物都是bundle后文件,所以前端引用bundle后的产物是没有问题的,所以我才提了第一个问题是否是放在devDep的。如果要提供未bundle的版本给node使用的话,要么就是把workspace的依赖bundle进去,要么就是workspace的依赖发包改成非workspace依赖,对应着我说的两个方案。
@Mister-Hope There are no problems with CI and release. Now the dependencies in package.json are written in workspace, which causes installation errors in other projects. This kind of monorepo project relies on internal references. Generally, the external products are bundled files, so there is no problem in the front end referencing the bundled products, so I asked the first question whether it is placed in devDep. If you want to provide an unbundled version for node to use, you must either add the workspace dependency into the bundle, or change the workspace dependency outsourcing to a non-workspace dependency, which corresponds to the two solutions I mentioned.
from waline.
大哥别犟,我之前特意开了issue。如果你使用 pnpm publish命令发布任何含有workspace 协议的任何包,那么他们会在发布时基于workspace相关依赖的版本自动转换到对应的版本号范围。本质上就是你 CI 发布有问题。
换言之,无论是 dep peerDep 还是 devDep 的依赖,workspace protocal都是没问题,对于本地是 1.0.0 的版本,workspace:* workspace:~ workspace:^ 会自动通过 pnpm 发布的时候转换为 "1.0.0" "~1.0.0" 和 "^1.0.0"。
我不是很了解 npm 对于只能在特定 CI/CD 环境的限制具体有什么,但是一个最起码的解决办法是改一下workflow 自己手动检测当前版本是否已发布并手动 pnpm publish(如需要)
Brother, don't be stubborn, I specially opened an issue before. If you use the pnpm publish command to publish any package containing the workspace protocol, they will automatically be converted to the corresponding version number range based on the version of the workspace-related dependencies when publishing. Essentially, there is a problem with your CI release.
In other words, whether it is a dependency on dep peerDep or devDep, the workspace protocol is no problem. For the local version 1.0.0, workspace:* workspace:~ workspace:^ will automatically be converted to "1.0.0" when published through pnpm "~1.0.0" and "^1.0.0".
I don't know much about npm's specific restrictions on specific CI/CD environments, but a minimum solution is to change the workflow to manually detect whether the current version has been published and manually pnpm publish (if necessary)
from waline.
@Mister-Hope 我觉得你可能没听明白我说的话的意思。那就按照你的理解来吧,CI 发布有问题,有两个解决方案,你选择一种,我来修改。
@Mister-Hope I think you may not understand what I mean. Then follow your understanding. There is a problem with CI release. There are two solutions. You choose one and I will modify it.
from waline.
我觉得我充分理解了你要表达的意思,但我不觉得你的观点是对的。
握有大量包含monorepo的项目都在用 pnpm,比如 vuepress/core vuepress/ecosystem vuepress-theme-hope/vuepress-theme-hope mdit-plugins/mdit-plugins 之类的。
-
包管理器使用要一致,而且像corepack这种东西已经很成熟了,比如
corepack use npm
就直接能把当前的项目从任意包管理器换成 npm。我不能理解 pnpm 的项目用 npm publish 的方式来发包,就是这里的workspace的问题。npm不支持 workspace,也自然不需要再 publish 的时候对这种特殊版本做处理。 -
这种monorepo项目的依赖内部引用一般对外的产物都是bundle后文件。
我不能理解这种错误结论是从哪得出来的,所有针对 node 的 monorepo 发包的时候都不会 bundle,做一个需要 CDN 通过浏览器来使用的包在前端才是特例。我上面举的所有例子都没有打包 monorepo 内其他包的行为。就拿这个项目本身的依赖来说,@typescript-eslint @commitlint 等包也不是你所说的这么干。
(仅技术性讨论)
I think I fully understand what you're trying to say, but I don't think your point is correct.
A large number of projects containing monorepo are using pnpm, such as vuepress/core vuepress/ecosystem vuepress-theme-hope/vuepress-theme-hope mdit-plugins/mdit-plugins and the like.
-
Package managers must be used consistently, and things like corepack are already very mature. For example,
corepack use npm
can directly change the current project from any package manager to npm. I can't understand that pnpm projects use npm publish to deliver packages. It's a problem with the workspace here. npm does not support workspace, so there is no need to handle this special version when publishing. -
The dependencies of this monorepo project are internally referenced and generally the external products are bundle files.
I can't understand where this wrong conclusion comes from. All monorepo packages for node will not be bundled. Making a package that requires CDN to be used through the browser is a special case on the front end. All the examples I gave above do not include the behavior of packaging other packages within the monorepo. Take the dependencies of the project itself as an example. Packages such as @typescript-eslint @commitlint do not do what you said.
(Technical discussion only)
from waline.
- 包管理器要使用一致,这个是有待商榷的结论,先不说它是不是完全正确的吧。我没有按照你的思路选择
pnpm publish
的原因是,市面上暂时没有比较好的集成pnpm publish
的 GitHub Action。而现有的 https://github.com/JS-DevTools/npm-publish 工具比较好的点是能够识别版本号再做发布相关的逻辑,能比较好的根据不同 case 返回发布的状态。综合换工具和适配的成本,我选择了后者适配。 - 首先,我说的是“一般”,其次,这也不是错误的结论。就你举例的两个案例我都去看了,typescript-eslint 的 workspace 依赖是在 workspaceRoot 的,不存在需要发布的场景。而 commitlint 我没找到它有 workspace 依赖的行为,或者它使用 yarn 的 workspace 的依赖书写规则和 pnpm 不太一样,我没有看到同类的场景可以参考。
按照你说的 pnpm 的行为,我认为你会选择提到的方案二,那我就不多说了按照二来处理吧。
- Package managers should be used consistently. This is a debatable conclusion, let’s not say whether it is completely correct. The reason why I didn't choose
pnpm publish
according to your idea is that there is currently no better GitHub Action integratingpnpm publish
on the market. The existing https://github.com/JS-DevTools/npm-publish tool is better in that it can identify the version number and then perform release-related logic, and it can better return the release status according to different cases. Considering the cost of tool replacement and adaptation, I chose the latter adaptation. - First of all, I said "generally", and secondly, this is not a wrong conclusion. I have looked at the two cases you gave. The workspace dependency of typescript-eslint is in the workspaceRoot, and there is no scenario where it needs to be released. As for commitlint, I didn't find that it has workspace dependency behavior, or that the dependency writing rules of yarn's workspace are different from pnpm. I haven't seen similar scenarios for reference.
According to the behavior of pnpm you mentioned, I think you will choose the second option mentioned, so I won’t go into details and just handle it according to the second option.
from waline.
fixed with #2333 please update to @waline/[email protected]
from waline.
Related Issues (20)
- [Bug]: 你们的后端接口写的很乱啊 || [Bug]: Your backend interface is very messy. HOT 2
- [Bug]: Comment sorting and disabling image upload settings in client don't seem to work. HOT 2
- [Bug]: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client HOT 2
- [Bug]: ArticleReaction.vue:99 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'reaction0') HOT 3
- [Bug]: Error when accessing UI management,TypeError: ww is not a function (admin:9118:162) HOT 2
- [Bug]: Got SyntaxError & ReferenceError when Importing waline.js v3 by CDN | 通过CDN导入waline.js v3时得到语法错误与引用错误 HOT 7
- [Feature]: GRAVATAR_STR SHA256 支持 || [Feature]: GRAVATAR_STR SHA256 support HOT 1
- [Bug]: Fail to deploy on Vercel - dist folder missing? HOT 6
- [Bug]: QQ邮件登陆后后台出现乱码,且发件退件 || [Bug]: After logging in to QQ mail, garbled characters appear in the background and the mail is returned. HOT 3
- [Bug] [独立部署 直接运行] [SQLite数据库] : 未配置LeanCloud相关的环境变量时, 程序运行报错 || [Bug] [Independent deployment, direct operation] [SQLite database]: When the environment variables related to LeanCloud are not configured, the program will report an error when running. HOT 4
- [Bug]: 评论未填邮件地址时,会报错 || [Bug]: When commenting without filling in the email address, an error will be reported HOT 1
- [Bug]: 发件人和收件人同一个邮箱? || [Bug]: The sender and recipient have the same email address? HOT 3
- [Feature]: 能支持从环境变量指定端口吗 || [Feature]: Can the port be specified from the environment variable? HOT 5
- [Bug]: WALINE将URL 中不带反斜杠/ 结尾和带反斜杠/ 结尾的地址会认为是两个页面 || [Bug]: WALINE will consider the URL without backslash/ at the end and the address with backslash/ at the end as two pages. HOT 2
- [Bug]: Cannot read properties of undefined (reading 'nick') HOT 9
- [Bug]: Prior submitted comment isn't clearing from comment form HOT 4
- [Feature]: RSS feeds for comments HOT 1
- [Bug]: 使用 zeabur 部署后评论/登录后台会提示:Not initialized HOT 7
- [Bug]: 最新版本评论数获取失败 || [Bug]: Failed to obtain the number of comments for the latest version HOT 17
- [Bug]: api return unexpected result to client HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from waline.