diff --git a/link/link.js b/link/link.js new file mode 100644 index 0000000..6f757ac --- /dev/null +++ b/link/link.js @@ -0,0 +1,11 @@ +#!/usr/bin/env node + +try { + // eslint-disable-next-line import/no-unassigned-import + require('../dist/now.js') +} catch (err) { + if (err.code === 'ENOENT' && err.syscall === 'uv_cwd') { + console.error(`Current path doesn't exist!`) + process.exit(1) + } +} diff --git a/link/package.json b/link/package.json new file mode 100644 index 0000000..3f4e96c --- /dev/null +++ b/link/package.json @@ -0,0 +1,9 @@ +{ + "name": "now", + "license": "MIT", + "description": "The command line interface for Now", + "repository": "zeit/now", + "bin": { + "now": "link.js" + } +} diff --git a/package.json b/package.json index 60ab621..bfb5b8b 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "postinstall": "node download/install.js", "prepublish": "in-install || (npm run prepare && cp /dev/null download/dist/now)", "pack": "pkg dist/now.js -c package.json -o packed/now", - "prepare": "webpack --context download --config download/webpack.config.js" + "prepare": "webpack --context download --config download/webpack.config.js", + "link": "cd link && yarn link" }, "lint-staged": { "*.js": [