Clean up the oopsie. Rebuild the blank exercises.

This commit is contained in:
Michael Frank
2021-05-09 00:39:21 +12:00
parent b984cb4c6f
commit d28d80c46f
1565 changed files with 27186 additions and 199003 deletions
+12 -9
View File
@@ -1,14 +1,17 @@
'use strict';
var path = require('path');
var findUp = require('find-up');
const path = require('path');
const findUp = require('find-up');
module.exports = function (cwd) {
return findUp('package.json', {cwd: cwd}).then(function (fp) {
return fp ? path.dirname(fp) : null;
});
const pkgDir = async cwd => {
const filePath = await findUp('package.json', {cwd});
return filePath && path.dirname(filePath);
};
module.exports.sync = function (cwd) {
var fp = findUp.sync('package.json', {cwd: cwd});
return fp ? path.dirname(fp) : null;
module.exports = pkgDir;
// TODO: Remove this for the next major release
module.exports.default = pkgDir;
module.exports.sync = cwd => {
const filePath = findUp.sync('package.json', {cwd});
return filePath && path.dirname(filePath);
};
+4 -16
View File
@@ -1,21 +1,9 @@
The MIT License (MIT)
MIT License
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:
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 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.
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.
+22 -20
View File
@@ -1,27 +1,27 @@
{
"_from": "pkg-dir@^1.0.0",
"_id": "pkg-dir@1.0.0",
"_from": "pkg-dir@^4.2.0",
"_id": "pkg-dir@4.2.0",
"_inBundle": false,
"_integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=",
"_integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==",
"_location": "/pkg-dir",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "pkg-dir@^1.0.0",
"raw": "pkg-dir@^4.2.0",
"name": "pkg-dir",
"escapedName": "pkg-dir",
"rawSpec": "^1.0.0",
"rawSpec": "^4.2.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
"fetchSpec": "^4.2.0"
},
"_requiredBy": [
"/eslint-module-utils"
"/import-local"
],
"_resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz",
"_shasum": "7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4",
"_spec": "pkg-dir@^1.0.0",
"_where": "/Users/cloyd/coderrr/odin/javascript-exercises/node_modules/eslint-module-utils",
"_resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz",
"_shasum": "f099133df7ede422e81d1d8448270eeb3e4261f3",
"_spec": "pkg-dir@^4.2.0",
"_where": "/home/michael/projects/javascript-exercises/node_modules/import-local",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@@ -32,19 +32,22 @@
},
"bundleDependencies": false,
"dependencies": {
"find-up": "^1.0.0"
"find-up": "^4.0.0"
},
"deprecated": false,
"description": "Find the root directory of a npm package",
"description": "Find the root directory of a Node.js project or npm package",
"devDependencies": {
"ava": "*",
"xo": "*"
"ava": "^1.4.1",
"tempy": "^0.3.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"engines": {
"node": ">=0.10.0"
"node": ">=8"
},
"files": [
"index.js"
"index.js",
"index.d.ts"
],
"homepage": "https://github.com/sindresorhus/pkg-dir#readme",
"keywords": [
@@ -62,7 +65,6 @@
"file",
"search",
"match",
"package",
"resolve",
"parent",
"parents",
@@ -80,7 +82,7 @@
"url": "git+https://github.com/sindresorhus/pkg-dir.git"
},
"scripts": {
"test": "xo && ava"
"test": "xo && ava && tsd"
},
"version": "1.0.0"
"version": "4.2.0"
}
+13 -10
View File
@@ -1,12 +1,12 @@
# pkg-dir [![Build Status](https://travis-ci.org/sindresorhus/pkg-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/pkg-dir)
> Find the root directory of a npm package
> Find the root directory of a Node.js project or npm package
## Install
```
$ npm install --save pkg-dir
$ npm install pkg-dir
```
@@ -25,12 +25,14 @@ $ npm install --save pkg-dir
```js
// example.js
var pkgDir = require('pkg-dir');
const pkgDir = require('pkg-dir');
pkgDir(__dirname).then(function (rootPath) {
console.log(rootPath);
(async () => {
const rootDir = await pkgDir(__dirname);
console.log(rootDir);
//=> '/Users/sindresorhus/foo'
});
})();
```
@@ -38,15 +40,15 @@ pkgDir(__dirname).then(function (rootPath) {
### pkgDir([cwd])
Returns a promise that resolves to the package root path or `null`.
Returns a `Promise` for either the project root path or `undefined` if it couldn't be found.
### pkgDir.sync([cwd])
Returns the package root path or `null`.
Returns the project root path or `undefined` if it couldn't be found.
#### cwd
Type: `string`
Type: `string`<br>
Default: `process.cwd()`
Directory to start from.
@@ -55,9 +57,10 @@ Directory to start from.
## Related
- [pkg-dir-cli](https://github.com/sindresorhus/pkg-dir-cli) - CLI for this module
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)