Skip to content

Instantly share code, notes, and snippets.

@tk3
Last active October 31, 2020 11:18
Show Gist options
  • Save tk3/dcfd6e159f4fad048c10f5537949985d to your computer and use it in GitHub Desktop.
Save tk3/dcfd6e159f4fad048c10f5537949985d to your computer and use it in GitHub Desktop.
npx script from gist

npx script sample

#!/usr/bin/env node
const fs = require('fs');
const { spawnSync } = require('child_process');
console.log("Hello world");
spawnSync('ls', ['-l'], { stdio: 'inherit' });
const readmeText = `# title
## sub title
content
`;
fs.writeFileSync('README.md', readmeText);
{
"name": "npx-script-from-gist",
"version": "1.0.0",
"bin": "./index.js"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment