draft: refactor project so it sits on top of a standalone app
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
const findUp = require('find-up');
|
||||
|
||||
module.exports = cwd => findUp('package.json', {cwd});
|
||||
module.exports.sync = cwd => findUp.sync('package.json', {cwd});
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"_from": "pkg-up@^2.0.0",
|
||||
"_id": "pkg-up@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=",
|
||||
"_location": "/pkg-up",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "pkg-up@^2.0.0",
|
||||
"name": "pkg-up",
|
||||
"escapedName": "pkg-up",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/browserslist"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz",
|
||||
"_shasum": "c819ac728059a461cab1c3889a2be3c49a004d7f",
|
||||
"_spec": "pkg-up@^2.0.0",
|
||||
"_where": "O:\\zero\\zero.Web\\node_modules\\browserslist",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/pkg-up/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"find-up": "^2.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Find the closest package.json file",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/pkg-up#readme",
|
||||
"keywords": [
|
||||
"pkg",
|
||||
"package",
|
||||
"file",
|
||||
"find",
|
||||
"up",
|
||||
"find-up",
|
||||
"findup",
|
||||
"look-up",
|
||||
"look",
|
||||
"search",
|
||||
"match",
|
||||
"resolve",
|
||||
"parent",
|
||||
"parents",
|
||||
"folder",
|
||||
"directory",
|
||||
"dir",
|
||||
"walk",
|
||||
"walking",
|
||||
"path"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "pkg-up",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/pkg-up.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "2.0.0"
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
# pkg-up [](https://travis-ci.org/sindresorhus/pkg-up)
|
||||
|
||||
> Find the closest package.json file
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save pkg-up
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/
|
||||
└── Users
|
||||
└── sindresorhus
|
||||
└── foo
|
||||
├── package.json
|
||||
└── bar
|
||||
├── baz
|
||||
└── example.js
|
||||
```
|
||||
|
||||
```js
|
||||
// example.js
|
||||
const pkgUp = require('pkg-up');
|
||||
|
||||
pkgUp().then(filepath => {
|
||||
console.log(filepath);
|
||||
//=> '/Users/sindresorhus/foo/package.json'
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pkgUp([cwd])
|
||||
|
||||
Returns a `Promise` for either the filepath or `null` if it could be found.
|
||||
|
||||
### pkgUp.sync([cwd])
|
||||
|
||||
Returns the filepath or `null`.
|
||||
|
||||
#### cwd
|
||||
|
||||
Type: `string`
|
||||
Default: `process.cwd()`
|
||||
|
||||
Directory to start from.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [read-pkg-up](https://github.com/sindresorhus/read-pkg-up) - Read the closest package.json file
|
||||
- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
|
||||
- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Reference in New Issue
Block a user