summaryrefslogtreecommitdiffstats
path: root/node_modules/in-publish
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/in-publish')
-rw-r--r--node_modules/in-publish/LICENSE14
-rw-r--r--node_modules/in-publish/README.md52
-rwxr-xr-xnode_modules/in-publish/in-install.js4
-rwxr-xr-xnode_modules/in-publish/in-publish.js4
-rw-r--r--node_modules/in-publish/index.js32
-rwxr-xr-xnode_modules/in-publish/not-in-install.js4
-rwxr-xr-xnode_modules/in-publish/not-in-publish.js4
-rw-r--r--node_modules/in-publish/package.json50
-rw-r--r--node_modules/in-publish/test/package.json10
9 files changed, 174 insertions, 0 deletions
diff --git a/node_modules/in-publish/LICENSE b/node_modules/in-publish/LICENSE
new file mode 100644
index 0000000..f4be44d
--- /dev/null
+++ b/node_modules/in-publish/LICENSE
@@ -0,0 +1,14 @@
+Copyright (c) 2015, Rebecca Turner <me@re-becca.org>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
diff --git a/node_modules/in-publish/README.md b/node_modules/in-publish/README.md
new file mode 100644
index 0000000..de0b2a7
--- /dev/null
+++ b/node_modules/in-publish/README.md
@@ -0,0 +1,52 @@
+in-publish
+==========
+
+> For background, see [npm#10074](https://github.com/npm/npm/issues/10074).
+
+Detect if we were run as a result of `npm publish`. This is intended to allow you to
+easily have prepublish lifecycle scripts that don't run when you run `npm install`.
+
+```
+$ npm install --save-dev in-publish
+in-publish@1.0.0 node_modules/in-publish
+```
+
+Then edit your package.json to have:
+
+```json
+ "scripts": {
+ "prepublish": "in-publish && thing-I-dont-want-on-dev-install || not-in-publish"
+ }
+```
+
+Now when you run:
+
+```
+$ npm install
+```
+Then `thing-I-dont-want-on-dev-install` won't be run, but...
+
+```
+$ npm publish
+```
+And `thing-I-dont-want-on-dev-install` will be run.
+
+It's worth noting that the `prepublish` lifecycle is _ALSO_ called when you build a tarball, so:
+
+```
+$ npm pack
+```
+
+Will call your `prepublish` lifecycle, but with the example above,
+`thing-I-dont-want-on-dev-install` won't be run.
+
+If you want this, you can use another helper included here:
+
+```json
+ "scripts": {
+ "prepublish": "not-in-install && thing-I-dont-want-on-dev-install || in-install"
+ }
+```
+
+The above will run your `thing-I-dont-want-on-dev-install` on `publish` and
+on `pack` but not on `install`.
diff --git a/node_modules/in-publish/in-install.js b/node_modules/in-publish/in-install.js
new file mode 100755
index 0000000..98a955e
--- /dev/null
+++ b/node_modules/in-publish/in-install.js
@@ -0,0 +1,4 @@
+#!/usr/bin/env node
+'use strict'
+var inInstall = require('./index.js').inInstall
+process.exit(inInstall() ? 0 : 1)
diff --git a/node_modules/in-publish/in-publish.js b/node_modules/in-publish/in-publish.js
new file mode 100755
index 0000000..79823fd
--- /dev/null
+++ b/node_modules/in-publish/in-publish.js
@@ -0,0 +1,4 @@
+#!/usr/bin/env node
+'use strict'
+var inPublish = require('./index.js').inPublish
+process.exit(inPublish() ? 0 : 1)
diff --git a/node_modules/in-publish/index.js b/node_modules/in-publish/index.js
new file mode 100644
index 0000000..8cfc92f
--- /dev/null
+++ b/node_modules/in-publish/index.js
@@ -0,0 +1,32 @@
+'use strict'
+function inCommand (cmd, cmdStr) {
+ if (process.env.npm_command) {
+ return process.env.npm_command === cmdStr
+ }
+
+ try {
+ var npm_config_argv = JSON.parse(process.env['npm_config_argv'])
+ } catch (e) {
+ return false
+ }
+
+ if (typeof npm_config_argv !== 'object') process.exit(1)
+ if (!npm_config_argv.cooked) process.exit(1)
+ if (!npm_config_argv.cooked instanceof Array) process.exit(1)
+
+ var V
+ while ((V = npm_config_argv.cooked.shift()) !== undefined) {
+ if (/^-/.test(V)) continue
+ if (cmd.test(V)) return true
+ return false
+ }
+ return false
+}
+
+exports.inPublish = function () {
+ return inCommand(/^pu(b(l(i(sh?)?)?)?)?$/, 'publish')
+}
+
+exports.inInstall = function () {
+ return inCommand(/^i(n(s(t(a(ll?)?)?)?)?)?$/, 'install')
+}
diff --git a/node_modules/in-publish/not-in-install.js b/node_modules/in-publish/not-in-install.js
new file mode 100755
index 0000000..b0d5dae
--- /dev/null
+++ b/node_modules/in-publish/not-in-install.js
@@ -0,0 +1,4 @@
+#!/usr/bin/env node
+'use strict'
+var inInstall = require('./index.js').inInstall
+process.exit(inInstall() ? 1 : 0)
diff --git a/node_modules/in-publish/not-in-publish.js b/node_modules/in-publish/not-in-publish.js
new file mode 100755
index 0000000..9528f5c
--- /dev/null
+++ b/node_modules/in-publish/not-in-publish.js
@@ -0,0 +1,4 @@
+#!/usr/bin/env node
+'use strict'
+var inPublish = require('./index.js').inPublish
+process.exit(inPublish() ? 1 : 0)
diff --git a/node_modules/in-publish/package.json b/node_modules/in-publish/package.json
new file mode 100644
index 0000000..0104b74
--- /dev/null
+++ b/node_modules/in-publish/package.json
@@ -0,0 +1,50 @@
+{
+ "_from": "in-publish@^2.0.0",
+ "_id": "in-publish@2.0.1",
+ "_inBundle": false,
+ "_integrity": "sha512-oDM0kUSNFC31ShNxHKUyfZKy8ZeXZBWMjMdZHKLOk13uvT27VTL/QzRGfRUcevJhpkZAvlhPYuXkF7eNWrtyxQ==",
+ "_location": "/in-publish",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "in-publish@^2.0.0",
+ "name": "in-publish",
+ "escapedName": "in-publish",
+ "rawSpec": "^2.0.0",
+ "saveSpec": null,
+ "fetchSpec": "^2.0.0"
+ },
+ "_requiredBy": [
+ "/node-sass"
+ ],
+ "_resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.1.tgz",
+ "_shasum": "948b1a535c8030561cea522f73f78f4be357e00c",
+ "_spec": "in-publish@^2.0.0",
+ "_where": "/home/pruss/Dev/3-minute-website/node_modules/node-sass",
+ "author": {
+ "name": "Rebecca Turner",
+ "email": "me@re-becca.org"
+ },
+ "bin": {
+ "in-publish": "in-publish.js",
+ "in-install": "in-install.js",
+ "not-in-publish": "not-in-publish.js",
+ "not-in-install": "not-in-install.js"
+ },
+ "bugs": {
+ "url": "https://github.com/iarna/in-publish/issues"
+ },
+ "bundleDependencies": false,
+ "deprecated": false,
+ "description": "Detect if we were run as a result of `npm publish`",
+ "homepage": "https://github.com/iarna/in-publish",
+ "license": "ISC",
+ "main": "index.js",
+ "name": "in-publish",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/iarna/in-publish.git"
+ },
+ "version": "2.0.1"
+}
diff --git a/node_modules/in-publish/test/package.json b/node_modules/in-publish/test/package.json
new file mode 100644
index 0000000..541061a
--- /dev/null
+++ b/node_modules/in-publish/test/package.json
@@ -0,0 +1,10 @@
+{
+ "name": "test",
+ "version": "1.0.0",
+ "devDependencies": {
+ "in-publish": "file:///Users/rebecca/code/in-publish"
+ },
+ "scripts": {
+ "prepublish": "in-publish && exit 1 || not-in-publish"
+ }
+}