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

clean-publish

Package Overview
Dependencies
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clean-publish - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

8

clean-publish.js

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

' --before-script Run script on the to-release dir before npm\n' +
' publish'
' publish\n' +
' --temp-dir Create temporary directory with given name'

@@ -83,2 +84,5 @@ async function handleOptions () {

i += 1
} else if (process.argv[i] === '--temp-dir') {
options.tempDir = process.argv[i + 1]
i += 1
} else {

@@ -99,3 +103,3 @@ options._ = process.argv[i]

const tempDirectoryName = await createTempDirectory()
const tempDirectoryName = await createTempDirectory(options.tempDir)

@@ -102,0 +106,0 @@ const files = await readSrcDirectory()

@@ -88,4 +88,16 @@ import { promises as fs } from "fs"

export function createTempDirectory () {
return mkdtemp('tmp')
export async function createTempDirectory (name) {
if (name) {
try {
await fs.mkdir(name)
} catch (err) {
if (err.code === 'EEXIST') {
throw new Error(`Temporary directory "${name}" already exists.`)
}
}
return name
}
return await mkdtemp('tmp')
}

@@ -92,0 +104,0 @@

@@ -24,3 +24,6 @@ /**

'The `exports` in the `"clean-publish"` section ' +
'of package.json must be `an array of strings`'
'of package.json must be `an array of strings`',
tempDirNotString:
'The `temp-dir` in the `"clean-publish"` section ' +
'of package.json must be `an string`'
}

@@ -36,3 +39,5 @@ const FILE_ERRORS = {

exportsNotStrings:
'The `exports` in Clean Publish config ' + 'must be `an array of strings`'
'The `exports` in Clean Publish config ' + 'must be `an array of strings`',
tempDirNotString:
'The `temp-dir` in Clean Publish config ' + 'must be `an string`'
}

@@ -53,5 +58,9 @@

function isString(value) {
return typeof value === 'string' && value
}
function isStrings (value) {
if (!Array.isArray(value)) return false
return value.every(i => typeof i === 'string')
return value.every(isString)
}

@@ -61,5 +70,9 @@

if (!Array.isArray(value)) return false
return value.every(i => typeof i === 'string' || i instanceof RegExp)
return value.every(i => isString(i) || i instanceof RegExp)
}
function isStringOrUndefined (value) {
return typeof value === 'undefined' || isString(value)
}
function isStringsOrUndefined (value) {

@@ -93,2 +106,5 @@ return typeof value === 'undefined' || isStrings(value)

}
if (!isStringOrUndefined(config.tempDir)) {
return 'tempDirNotString'
}
return false

@@ -95,0 +111,0 @@ }

{
"name": "clean-publish",
"version": "3.3.0",
"version": "3.4.0",
"description": "Clean your package before publish",

@@ -5,0 +5,0 @@ "keywords": [

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