@typescript-tools/find-package
Advanced tools
Comparing version 1.1.3 to 1.1.4-beta.1
@@ -33,8 +33,10 @@ "use strict"; | ||
const lerna_packages_1 = require("@typescript-tools/lerna-packages"); | ||
const err = function_1.identity; | ||
const findPackageByPath = (packages) => (packagePath) => function_1.pipe(packages, | ||
const findPackageByPath = (packages) => (packagePath) => (0, function_1.pipe)(packages, | ||
// FIXME: only works with relative paths | ||
A.filter(({ location }) => location === path.resolve(process.cwd(), packagePath)), A.head); | ||
const findPackageByName = (packages) => (packageName) => function_1.pipe(packages, A.filter(({ name }) => name === packageName), A.head); | ||
const findPackageIn = (packages) => (packagePathOrName) => function_1.pipe(findPackageByPath(packages)(packagePathOrName), O.alt(() => findPackageByName(packages)(packagePathOrName)), O.fold(() => TE.left(err({ type: 'unable to find package in monorepo', package: packagePathOrName })), TE.right)); | ||
const findPackageByName = (packages) => (packageName) => (0, function_1.pipe)(packages, A.filter(({ name }) => name === packageName), A.head); | ||
const findPackageIn = (packages) => (packagePathOrName) => (0, function_1.pipe)(findPackageByPath(packages)(packagePathOrName), O.alt(() => findPackageByName(packages)(packagePathOrName)), O.fold(() => TE.left({ | ||
type: 'unable to find package in monorepo', | ||
package: packagePathOrName, | ||
}), TE.right)); | ||
exports.findPackageIn = findPackageIn; | ||
@@ -44,4 +46,4 @@ /** | ||
*/ | ||
const findPackage = (pathInsideMonorepo, packagePathOrName) => function_1.pipe(lerna_packages_1.lernaPackages(pathInsideMonorepo), TE.chain(packages => exports.findPackageIn(packages)(packagePathOrName))); | ||
const findPackage = (pathInsideMonorepo, packagePathOrName) => (0, function_1.pipe)((0, lerna_packages_1.lernaPackages)(pathInsideMonorepo), TE.chain((packages) => (0, exports.findPackageIn)(packages)(packagePathOrName))); | ||
exports.findPackage = findPackage; | ||
//# sourceMappingURL=index.js.map |
185
package.json
{ | ||
"name": "@typescript-tools/find-package", | ||
"version": "1.1.3", | ||
"description": "Find lerna package by path or name", | ||
"homepage": "https://github.com/typescript-tools/typescript-tools", | ||
"bugs": { | ||
"url": "https://github.com/typescript-tools/typescript-tools/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/typescript-tools/typescript-tools.git" | ||
}, | ||
"license": "ISC", | ||
"author": "Eric Crosson <eric.s.crosson@utexas.edu> (https://github.com/EricCrosson)", | ||
"main": "dist/src/index.js", | ||
"types": "dist/src/index.d.ts", | ||
"name": "@typescript-tools/find-package", | ||
"version": "1.1.4-beta.1", | ||
"description": "Find lerna package by path or name", | ||
"homepage": "https://github.com/typescript-tools/typescript-tools", | ||
"bugs": { | ||
"url": "https://github.com/typescript-tools/typescript-tools/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/typescript-tools/typescript-tools.git" | ||
}, | ||
"license": "ISC", | ||
"author": "Eric Crosson <eric.s.crosson@utexas.edu> (https://github.com/EricCrosson)", | ||
"main": "dist/src/index.js", | ||
"types": "dist/src/index.d.ts", | ||
"files": [ | ||
"dist/src/" | ||
], | ||
"scripts": { | ||
"prepublishOnly": "npm run clean && npm run build", | ||
"ava": "echo 'No tests defined'", | ||
"clean": "rimraf --no-glob dist", | ||
"build": "tsc --build --incremental .", | ||
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", | ||
"docs": "docs-ts", | ||
"lint": "eslint --ext ts .", | ||
"lint:fix": "eslint --ext ts --fix . package.json", | ||
"lint-staged": "lint-staged", | ||
"test": "echo 'No tests defined'", | ||
"prettier": "prettier --list-different .", | ||
"prettier:fix": "prettier --write ." | ||
}, | ||
"pre-commit": "lint-staged", | ||
"lint-staged": { | ||
"*.ts": [ | ||
"eslint --fix", | ||
"prettier --write" | ||
] | ||
}, | ||
"dependencies": { | ||
"@typescript-tools/io-ts": "2.2.0", | ||
"@typescript-tools/lerna-packages": "2.2.2", | ||
"fp-ts": "^2.9.3" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^14.14.6", | ||
"@typescript-eslint/eslint-plugin": "^4.6.1", | ||
"@typescript-eslint/parser": "^4.6.1", | ||
"ava": "^3.13.0", | ||
"ava-fast-check": "^3.0.0", | ||
"codecov": "^3.8.1", | ||
"docs-ts": "^0.5.3", | ||
"eslint": "^7.12.1", | ||
"fast-check": "^2.6.0", | ||
"lint-staged": "^10.5.1", | ||
"nyc": "^15.1.0", | ||
"pre-commit": "^1.2.2", | ||
"prettier": "2.1.2", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^9.0.0", | ||
"typescript": "^4.4.4" | ||
}, | ||
"ava": { | ||
"extensions": [ | ||
"ts" | ||
], | ||
"files": [ | ||
"dist/src/" | ||
"!dist/**/*.d.ts", | ||
"test/**/test-*.ts" | ||
], | ||
"scripts": { | ||
"prepublishOnly": "npm run compile", | ||
"ava": "echo 'No tests defined'", | ||
"clean": "rimraf --no-glob dist", | ||
"compile": "tsc --build --incremental .", | ||
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", | ||
"docs": "docs-ts", | ||
"lint": "eslint --ext ts .", | ||
"lint:fix": "eslint --ext ts --fix .", | ||
"lint-staged": "lint-staged", | ||
"prettier:check": "prettier --list-different src/**/*.ts", | ||
"prettier:write": "prettier --write src/**/*.ts", | ||
"test": "echo 'No tests defined'", | ||
"watch:ava": "nodemon -e 'ts json' -x 'npm run ava -- -s -v --fail-fast || true'", | ||
"watch:compile": "nodemon -e 'ts json' -x 'npm run compile || true'", | ||
"watch:lint": "nodemon -e 'ts js json' -x 'npm run lint || true'", | ||
"watch:test": "nodemon -e 'ts json' -x 'npm test || true'" | ||
}, | ||
"pre-commit": "lint-staged", | ||
"lint-staged": { | ||
"*.ts": [ | ||
"eslint --fix", | ||
"prettier --write" | ||
] | ||
}, | ||
"dependencies": { | ||
"@typescript-tools/io-ts": "^2.2.0", | ||
"@typescript-tools/lerna-packages": "^2.2.2", | ||
"fp-ts": "^2.9.3" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^14.14.6", | ||
"@typescript-eslint/eslint-plugin": "^4.6.1", | ||
"@typescript-eslint/parser": "^4.6.1", | ||
"ava": "^3.13.0", | ||
"ava-fast-check": "^3.0.0", | ||
"codecov": "^3.8.1", | ||
"docs-ts": "^0.5.3", | ||
"eslint": "^7.12.1", | ||
"fast-check": "^2.6.0", | ||
"lint-staged": "^10.5.1", | ||
"nyc": "^15.1.0", | ||
"pre-commit": "^1.2.2", | ||
"prettier": "2.1.2", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^9.0.0", | ||
"typescript": "^4.0.5" | ||
}, | ||
"ava": { | ||
"extensions": [ | ||
"ts" | ||
], | ||
"files": [ | ||
"!dist/**/*.d.ts", | ||
"test/**/test-*.ts" | ||
], | ||
"require": [ | ||
"ts-node/register" | ||
] | ||
}, | ||
"nyc": { | ||
"extension": [ | ||
".ts" | ||
], | ||
"include": [ | ||
"src/*.ts" | ||
], | ||
"require": [ | ||
"ts-node/register" | ||
] | ||
}, | ||
"keywords": [ | ||
"find", | ||
"lerna", | ||
"package" | ||
"require": [ | ||
"ts-node/register" | ||
] | ||
}, | ||
"nyc": { | ||
"extension": [ | ||
".ts" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "7939e6eb8ed5b05f49529f9e16cd5242f80c5d58" | ||
"include": [ | ||
"src/*.ts" | ||
], | ||
"require": [ | ||
"ts-node/register" | ||
] | ||
}, | ||
"keywords": [ | ||
"find", | ||
"lerna", | ||
"package" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
# find-package | ||
[![License][]](https://opensource.org/licenses/ISC) | ||
@@ -7,6 +8,6 @@ [![NPM Package][]](https://npmjs.org/package/@typescript-tools/find-package) | ||
[License]: https://img.shields.io/badge/License-ISC-blue.svg | ||
[NPM Package]: https://img.shields.io/npm/v/@typescript-tools/find-package.svg | ||
[Build status]: https://travis-ci.org/typescript-tools/find-package.svg?branch=master | ||
[Code Coverage]: https://codecov.io/gh/typescript-tools/find-package/branch/master/graph/badge.svg | ||
[license]: https://img.shields.io/badge/License-ISC-blue.svg | ||
[npm package]: https://img.shields.io/npm/v/@typescript-tools/find-package.svg | ||
[build status]: https://travis-ci.org/typescript-tools/find-package.svg?branch=master | ||
[code coverage]: https://codecov.io/gh/typescript-tools/find-package/branch/master/graph/badge.svg | ||
@@ -17,3 +18,3 @@ > Find lerna package by path or name | ||
``` shell | ||
```shell | ||
npm install @typescript-tools/find-package | ||
@@ -24,3 +25,3 @@ ``` | ||
``` typescript | ||
```typescript | ||
import { findPackage } from '@typescript-tools/find-package' | ||
@@ -27,0 +28,0 @@ // TODO: describe usage |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62
35
8998
7
2