推送到本地工件存储库时修改了 NPM 版本
NPM version is modified when pushing to local artifactory repository
自从我们升级到 Artifactory 版本 6.12.1 后,发布我们的 node.js 包时出现了一个新行为。下面是我们的package.json主要的样子(为了保密修改了一些信息):
{
"name": "@org/module-test",
"version": "1.0.0-12345",
"description": "Module's description",
"scripts": {
<scripts>
},
"repository": {
"type": "git",
"url": "<git repo url>"
},
"license": "UNLICENSED",
"devDependencies": {
"husky": "^1.3.1"
},
"publishConfig": {
"registry": "https://<artifactory_url>/api/npm/npm-local/",
"_auth": "<API token>"
},
"files": [
"<app-folder>"
],
"husky": {
"hooks": {
<several hooks>
}
}
}
这里重要的部分是版本参数。如果我在该配置中执行 npm publish
,一切正常,并且 json 和 tgz 文件具有相同的名称。但是,当版本如下所示时:
"version": "1.0.0-123abc"
tgz 文件的名称是这样的,但是 npm 信息 选项卡中的版本和相应的 json 文件是这样写的:
module-test-1.0.0-123-abc.json
每当版本中包含该格式的数字和字母时,都会添加破折号 (-),这会影响我们自动化使用这些包的管道的能力。这是有问题的,因为我们输入了我们的 git 提交哈希作为版本号,所以只要哈希以 digits 开头并跟随字母,就会出现问题。
我们之前的6.1.0版本没有出现这个问题。需要注意的是,与 npm 存储库相关的先前配置和实际配置之间没有重大差异。有问题的版本号,这是 event.log
文件中显示的内容:
1569867062896|create|npm-local/@org/module-test/-/@org/module-test-1.0.0-123abc.tgz
1569867062896|props|npm-local/@org/module-test/-/@org/module-test-1.0.0-123abc.tgz
1569867062896|create|npm-local/.npm/@org/module-test/@org/module-test-1.0.0-123-abc.json
1569867062896|props|npm-local/@org/module-test/-/@org/module-test-1.0.0-123abc.tgz
1569867063055|props|npm-local/@org/module-test/-/@org/module-test-1.0.0-12abc.tgz
正如我们所见,只有json文件的名称被修改了。
如果我们在主版本和子版本之间插入一串字符,问题就消失了,像这样:
"version":"1.0.0-string-123abc"
这应该是一个艰难的临时解决方法,因为按照我们的标准,它不构成 "clean" 版本 ID。
不确定这是否相关,但这是 npm-local 存储库使用的 npm-default 存储库布局:
<repoLayout>
<name>npm-default</name>
<artifactPathPattern>[orgPath]/[module]/[module]-[baseRev](-[fileItegRev]).tgz</artifactPathPattern>
<distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
<folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
</repoLayout>
可以找到 repoLayout 的文档here
我们希望 json 文件、tgz 存档和版本 ID 保持不变,无论版本号是多少。为什么添加这个破折号,我们不知道,但我们需要它消失。这是我们不知道的新配置还是错误?
这是最近版本中引入的问题。我们计划在即将发布的版本之一中修复它。您可以关注https://www.jfrog.com/jira/browse/RTFACT-20247了解更多详情。
自从我们升级到 Artifactory 版本 6.12.1 后,发布我们的 node.js 包时出现了一个新行为。下面是我们的package.json主要的样子(为了保密修改了一些信息):
{
"name": "@org/module-test",
"version": "1.0.0-12345",
"description": "Module's description",
"scripts": {
<scripts>
},
"repository": {
"type": "git",
"url": "<git repo url>"
},
"license": "UNLICENSED",
"devDependencies": {
"husky": "^1.3.1"
},
"publishConfig": {
"registry": "https://<artifactory_url>/api/npm/npm-local/",
"_auth": "<API token>"
},
"files": [
"<app-folder>"
],
"husky": {
"hooks": {
<several hooks>
}
}
}
这里重要的部分是版本参数。如果我在该配置中执行 npm publish
,一切正常,并且 json 和 tgz 文件具有相同的名称。但是,当版本如下所示时:
"version": "1.0.0-123abc"
tgz 文件的名称是这样的,但是 npm 信息 选项卡中的版本和相应的 json 文件是这样写的:
module-test-1.0.0-123-abc.json
每当版本中包含该格式的数字和字母时,都会添加破折号 (-),这会影响我们自动化使用这些包的管道的能力。这是有问题的,因为我们输入了我们的 git 提交哈希作为版本号,所以只要哈希以 digits 开头并跟随字母,就会出现问题。
我们之前的6.1.0版本没有出现这个问题。需要注意的是,与 npm 存储库相关的先前配置和实际配置之间没有重大差异。有问题的版本号,这是 event.log
文件中显示的内容:
1569867062896|create|npm-local/@org/module-test/-/@org/module-test-1.0.0-123abc.tgz
1569867062896|props|npm-local/@org/module-test/-/@org/module-test-1.0.0-123abc.tgz
1569867062896|create|npm-local/.npm/@org/module-test/@org/module-test-1.0.0-123-abc.json
1569867062896|props|npm-local/@org/module-test/-/@org/module-test-1.0.0-123abc.tgz
1569867063055|props|npm-local/@org/module-test/-/@org/module-test-1.0.0-12abc.tgz
正如我们所见,只有json文件的名称被修改了。
如果我们在主版本和子版本之间插入一串字符,问题就消失了,像这样:
"version":"1.0.0-string-123abc"
这应该是一个艰难的临时解决方法,因为按照我们的标准,它不构成 "clean" 版本 ID。
不确定这是否相关,但这是 npm-local 存储库使用的 npm-default 存储库布局:
<repoLayout>
<name>npm-default</name>
<artifactPathPattern>[orgPath]/[module]/[module]-[baseRev](-[fileItegRev]).tgz</artifactPathPattern>
<distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
<folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
</repoLayout>
可以找到 repoLayout 的文档here
我们希望 json 文件、tgz 存档和版本 ID 保持不变,无论版本号是多少。为什么添加这个破折号,我们不知道,但我们需要它消失。这是我们不知道的新配置还是错误?
这是最近版本中引入的问题。我们计划在即将发布的版本之一中修复它。您可以关注https://www.jfrog.com/jira/browse/RTFACT-20247了解更多详情。