update .gitignore
This commit is contained in:
1
node_modules/module-details-from-path/.npmignore
generated
vendored
Normal file
1
node_modules/module-details-from-path/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
7
node_modules/module-details-from-path/.travis.yml
generated
vendored
Normal file
7
node_modules/module-details-from-path/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '6'
|
||||
- '5'
|
||||
- '4'
|
||||
- '0.12'
|
||||
- '0.10'
|
||||
21
node_modules/module-details-from-path/LICENSE
generated
vendored
Normal file
21
node_modules/module-details-from-path/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Thomas Watson Steen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
34
node_modules/module-details-from-path/README.md
generated
vendored
Normal file
34
node_modules/module-details-from-path/README.md
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
# module-details-from-path
|
||||
|
||||
Extract the Node.js module details like name and base path given an
|
||||
absolute path to a file inside the module.
|
||||
|
||||
[](https://travis-ci.org/watson/module-details-from-path)
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install module-details-from-path --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var assert = require('assert')
|
||||
var parse = require('module-details-from-path')
|
||||
|
||||
var path = '/Users/watson/code/node_modules/blackjack/node_modules/picture-tube/bin/tube.js'
|
||||
|
||||
assert.deepStrictEqual(parse(path), {
|
||||
name: 'picture-tube',
|
||||
basedir: '/Users/watson/code/node_modules/blackjack/node_modules/picture-tube',
|
||||
path: 'bin/tube.js'
|
||||
})
|
||||
```
|
||||
|
||||
Returns `undefined` if module details cannot be found.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
18
node_modules/module-details-from-path/index.js
generated
vendored
Normal file
18
node_modules/module-details-from-path/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict'
|
||||
|
||||
var path = require('path')
|
||||
|
||||
module.exports = function (file) {
|
||||
var segments = file.split(path.sep)
|
||||
var index = segments.lastIndexOf('node_modules')
|
||||
if (index === -1) return
|
||||
if (!segments[index + 1]) return
|
||||
var scoped = segments[index + 1][0] === '@'
|
||||
var name = scoped ? segments[index + 1] + '/' + segments[index + 2] : segments[index + 1]
|
||||
var offset = scoped ? 3 : 2
|
||||
return {
|
||||
name: name,
|
||||
basedir: segments.slice(0, index + offset).join(path.sep),
|
||||
path: segments.slice(index + offset).join(path.sep)
|
||||
}
|
||||
}
|
||||
41
node_modules/module-details-from-path/package.json
generated
vendored
Normal file
41
node_modules/module-details-from-path/package.json
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "module-details-from-path",
|
||||
"version": "1.0.3",
|
||||
"description": "Extract the Node.js module details like name and base path given an abosulte path to a file inside the module",
|
||||
"main": "index.js",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"standard": "^7.1.2",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/watson/module-details-from-path.git"
|
||||
},
|
||||
"keywords": [
|
||||
"node",
|
||||
"nodejs",
|
||||
"npm",
|
||||
"module",
|
||||
"extract",
|
||||
"parse",
|
||||
"name",
|
||||
"basedir",
|
||||
"directory",
|
||||
"path",
|
||||
"relative"
|
||||
],
|
||||
"author": "Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/watson/module-details-from-path/issues"
|
||||
},
|
||||
"homepage": "https://github.com/watson/module-details-from-path#readme",
|
||||
"coordinates": [
|
||||
55.666507,
|
||||
12.5798711
|
||||
]
|
||||
}
|
||||
22
node_modules/module-details-from-path/test.js
generated
vendored
Normal file
22
node_modules/module-details-from-path/test.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
|
||||
var test = require('tape')
|
||||
var parse = require('./')
|
||||
|
||||
var paths = {
|
||||
'/path/to/node_modules/@scope/name/index.js': { name: '@scope/name', basedir: '/path/to/node_modules/@scope/name', path: 'index.js' },
|
||||
'/path/to/node_modules/name/index.js': { name: 'name', basedir: '/path/to/node_modules/name', path: 'index.js' },
|
||||
'/path/to/node_modules/name/sub/index.js': { name: 'name', basedir: '/path/to/node_modules/name', path: 'sub/index.js' },
|
||||
'/path/to/node_modules/invalid/node_modules/name/index.js': { name: 'name', basedir: '/path/to/node_modules/invalid/node_modules/name', path: 'index.js' },
|
||||
'/path/to/node_modules': undefined,
|
||||
'/path/to/no/module': undefined,
|
||||
'': undefined
|
||||
}
|
||||
|
||||
Object.keys(paths).forEach(function (path) {
|
||||
var result = paths[path]
|
||||
test(function (t) {
|
||||
t.deepEqual(parse(path), result)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user