Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

auto-dist-tag

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-dist-tag - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

.github/workflows/ci.yml

21

package.json
{
"name": "auto-dist-tag",
"version": "1.0.0",
"version": "2.0.0",
"description": "Automatically rewrites the publishConfig.tag setting in your package.json file for you",

@@ -20,17 +20,20 @@ "homepage": "https://github.com/Turbo87/auto-dist-tag#readme",

"scripts": {
"release": "release-it",
"test": "jest"
},
"dependencies": {
"debug": "^3.1.0",
"fs-extra": "^6.0.1",
"meow": "^5.0.0",
"package-json": "^5.0.0",
"pkg-up": "^2.0.0",
"semver": "^5.3.0"
"debug": "^4.3.1",
"fs-extra": "^9.0.0",
"meow": "^8.0.0",
"package-json": "^6.0.0",
"pkg-up": "^3.0.0",
"semver": "^7.0.0"
},
"devDependencies": {
"jest": "^22.4.3"
"jest": "26.6.3",
"release-it": "14.2.2",
"release-it-lerna-changelog": "3.1.0"
},
"engines": {
"node": ">=6"
"node": ">=10"
},

@@ -37,0 +40,0 @@ "jest": {

@@ -8,32 +8,21 @@ 'use strict';

module.exports = function autoDistTag(cwd, options) {
let pkgPath, pkg, tags, tag;
module.exports = async function autoDistTag(cwd, options) {
let pkgPath = await pkgUp(cwd);
let pkg = await fs.readJson(pkgPath);
let tags = await getDistTags(pkg.name);
let tag = await calcDistTag(pkg.version, tags);
return pkgUp(cwd)
.then(_pkgPath => (pkgPath = _pkgPath))
.then(() => fs.readJson(pkgPath))
.then(_pkg => (pkg = _pkg))
.then(() => getDistTags(pkg.name))
.then(_tags => (tags = _tags))
.then(() => calcDistTag(pkg.version, tags))
.then(_tag => (tag = _tag))
.then(() => {
if (options && options.write) {
// skip writing to `package.json if an explicit publishConfig.tag is set
if ('publishConfig' in pkg && 'tag' in pkg.publishConfig) {
return;
}
if (
options && options.write &&
// skip writing to `package.json if an explicit publishConfig.tag is set
!('publishConfig' in pkg && 'tag' in pkg.publishConfig) &&
// skip writing to `package.json if the calculated tag is "latest" because it's the default anyway
tag !== 'latest'
) {
pkg.publishConfig = pkg.publishConfig || {};
pkg.publishConfig.tag = tag;
fs.writeJson(pkgPath, pkg, {spaces: 2});
}
// skip writing to `package.json if the calculated tag is "latest" because it's the default anyway
if (tag === 'latest') {
return;
}
pkg.publishConfig = pkg.publishConfig || {};
pkg.publishConfig.tag = tag;
return fs.writeJson(pkgPath, pkg, { spaces: 2 });
}
})
.then(() => tag);
return tag;
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc