@clevercloud/random-labels
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "@clevercloud/random-labels", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Randomize a list of labels and display them in a suspenseful way", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -5,2 +5,3 @@ #!/usr/bin/env node | ||
import clipboardy from 'clipboardy'; | ||
import { spawn } from 'child_process'; | ||
@@ -11,6 +12,6 @@ const CLIPBOARD_OPTION = "--clipboard"; | ||
const args = process.argv.slice(2); | ||
const shouldCopyToClipboard = args.includes(CLIPBOARD_OPTION); | ||
const labels = args.filter((arg)=>arg !== CLIPBOARD_OPTION ); | ||
const labels = args.filter((arg) => arg !== CLIPBOARD_OPTION); | ||
const isWayland = process.env.XDG_SESSION_TYPE === 'wayland'; | ||
@@ -43,5 +44,18 @@ function run () { | ||
const randomLabelsMarkdown = randomLabels | ||
.map((name) => `* ${name}`) | ||
.join('\n'); | ||
clipboardy.writeSync(randomLabelsMarkdown); | ||
.map((name) => `* ${name}`) | ||
.join('\n'); | ||
clipboardy.write(randomLabelsMarkdown) | ||
.catch((error) => { | ||
if (!error.message.includes("Couldn't find the `xsel` binary and fallback didn't work.") || !isWayland) { | ||
console.error(error); | ||
} | ||
}); | ||
// workaround because `clipboardy` does not support Wayland (https://github.com/sindresorhus/clipboardy/issues/38) | ||
// we silence errors because gnome users may not need/have wl-copy even on wayland, gnome makes xclip / xsel work anyway | ||
if (isWayland) { | ||
spawn('wl-copy', [randomLabelsMarkdown], { stdio: 'ignore' }) | ||
.on('error', () => {}); | ||
} | ||
} | ||
@@ -48,0 +62,0 @@ |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
14054
49
2
1