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

can-npm-publish

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

can-npm-publish - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4

2

bin/cmd.js

@@ -39,3 +39,3 @@ #!/usr/bin/env node

})
.catch(error => {
.catch((error) => {
if (cli.flags.verbose) {

@@ -42,0 +42,0 @@ console.error(error.message);

// MIT © 2018 azu
"use strict";
const path = require("path");
const spawn = require("cross-spawn");

@@ -7,2 +8,17 @@ const readPkg = require("read-pkg");

/**
* @param {string} [filePathOrDirPath]
* @returns {Promise<readPkg.NormalizedPackageJson>}
*/
const readPkgWithPath = (filePathOrDirPath) => {
if (filePathOrDirPath) {
const isJSON = path.extname(filePathOrDirPath) === ".json";
if (isJSON) {
return Promise.resolve(require(filePathOrDirPath));
}
return readPkg({ cwd: filePathOrDirPath });
} else {
return readPkg();
}
};
/**
* Return rejected promise if the package name is invalid

@@ -14,3 +30,3 @@ * @param {string} packagePath

const checkPkgName = (packagePath, options) => {
return readPkg(packagePath).then(pkg => {
return readPkgWithPath(packagePath).then((pkg) => {
const name = pkg["name"];

@@ -39,4 +55,4 @@ const result = validatePkgName(name);

*/
const checkPrivateField = packagePath => {
return readPkg(packagePath).then(pkg => {
const checkPrivateField = (packagePath) => {
return readPkgWithPath(packagePath).then((pkg) => {
if (pkg["private"] === true) {

@@ -62,11 +78,14 @@ return Promise.reject(new Error("This package is private."));

view.stdout.on("data", data => {
view.stdout.on("data", (data) => {
result += data.toString();
});
view.stderr.on("data", err => {
view.stderr.on("data", (err) => {
errorResult += err.toString();
});
view.on("close", code => {
view.on("close", (code) => {
if (code !== 0) {
return reject(new Error(errorResult));
}
const resultJSON = JSON.parse(result);

@@ -82,3 +101,3 @@ if (resultJSON && resultJSON.error) {

}
resolve(JSON.parse(result));
resolve(resultJSON);
});

@@ -88,4 +107,4 @@ });

const checkAlreadyPublish = packagePath => {
return readPkg(packagePath).then(pkg => {
const checkAlreadyPublish = (packagePath) => {
return readPkgWithPath(packagePath).then((pkg) => {
const name = pkg["name"];

@@ -101,3 +120,3 @@ const version = pkg["version"];

}
return viewPackage(name, registry).then(versions => {
return viewPackage(name, registry).then((versions) => {
if (versions.includes(version)) {

@@ -104,0 +123,0 @@ return Promise.reject(new Error(`${name}@${version} is already published`));

{
"name": "can-npm-publish",
"version": "1.3.3",
"version": "1.3.4",
"description": "A command line tool that check to see if `npm publish` is possible.",

@@ -35,17 +35,17 @@ "keywords": [

"test": "mocha test",
"prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"",
"precommit": "lint-staged",
"postcommit": "git reset"
"postcommit": "git reset",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"",
"prepare": "git config --local core.hooksPath .githooks"
},
"dependencies": {
"cross-spawn": "^6.0.5",
"meow": "^4.0.0",
"read-pkg": "^3.0.0",
"cross-spawn": "^7.0.3",
"meow": "^9.0.0",
"read-pkg": "^5.0.0",
"validate-npm-package-name": "^3.0.0"
},
"devDependencies": {
"husky": "^0.14.3",
"lint-staged": "^6.0.1",
"mocha": "^5.0.0",
"prettier": "^1.10.2"
"lint-staged": "^11.0.0",
"mocha": "^9.0.0",
"prettier": "^2.3.1"
},

@@ -55,10 +55,10 @@ "prettier": {

"printWidth": 120,
"tabWidth": 4
"tabWidth": 4,
"trailingComma": "none"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,css}": [
"prettier --write",
"git add"
"prettier --write"
]
}
}

@@ -1,2 +0,2 @@

# can-npm-publish [![Build Status](https://travis-ci.org/azu/can-npm-publish.svg?branch=master)](https://travis-ci.org/azu/can-npm-publish)
# can-npm-publish [![Actions Status: test](https://github.com/azu/can-npm-publish/workflows/test/badge.svg)](https://github.com/azu/can-npm-publish/actions?query=workflow%3A"test")

@@ -3,0 +3,0 @@ A command line tool that check to see if `npm publish` is possible.

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