{"id":19475459,"url":"https://github.com/artdecocode/fpj","last_synced_at":"2026-06-12T04:31:12.578Z","repository":{"id":57241229,"uuid":"169765559","full_name":"artdecocode/fpj","owner":"artdecocode","description":"Resolves The Location Of The Package.Json File By Traversing The File System Up Starting From Given Path.","archived":false,"fork":false,"pushed_at":"2020-02-23T00:13:33.000Z","size":63,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-31T01:36:21.688Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.artd.eco","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artdecocode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-08T16:36:19.000Z","updated_at":"2020-02-23T00:14:30.000Z","dependencies_parsed_at":"2022-09-07T23:13:00.328Z","dependency_job_id":null,"html_url":"https://github.com/artdecocode/fpj","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/artdecocode/fpj","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdecocode%2Ffpj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdecocode%2Ffpj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdecocode%2Ffpj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdecocode%2Ffpj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artdecocode","download_url":"https://codeload.github.com/artdecocode/fpj/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdecocode%2Ffpj/sbom","scorecard":{"id":208888,"data":{"date":"2025-08-11","repo":{"name":"github.com/artdecocode/fpj","commit":"c0dd1a9074fae02b8923e6eed4ab8275b4a2a9a6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T00:21:09.304Z","repository_id":57241229,"created_at":"2025-08-17T00:21:09.304Z","updated_at":"2025-08-17T00:21:09.304Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34229624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T19:32:56.767Z","updated_at":"2026-06-12T04:31:12.549Z","avatar_url":"https://github.com/artdecocode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fpj: **Find Package Json**\n\n[![npm version](https://badge.fury.io/js/fpj.svg)](https://www.npmjs.com/package/fpj)\n\n`fpj` Resolves The Location Of The Package.Json File For The Given Dependency By Traversing The File System Up Starting From Given Path.\n\n```sh\nyarn add -E fpj\n```\n\n## Table Of Contents\n\n- [Table Of Contents](#table-of-contents)\n- [API](#api)\n- [`async fpj(dirname: string, packageName: string, opts?: FPJConfig): FPJReturn`](#async-fpjdirname-stringpackagename-stringopts-fpjconfig-fpjreturn)\n  * [`_fpj.Config`](#type-_fpjconfig)\n  * [`_fpj.Return`](#type-_fpjreturn)\n- [Fields](#fields)\n- [Soft Mode](#soft-mode)\n- [Copyright](#copyright)\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/0.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n## API\n\nThe package is available by importing its default function:\n\n```js\nimport fpj from 'fpj'\n```\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/1.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n## \u003ccode\u003easync \u003cins\u003efpj\u003c/ins\u003e(\u003c/code\u003e\u003csub\u003e\u003cbr/\u003e\u0026nbsp;\u0026nbsp;`dirname: string,`\u003cbr/\u003e\u0026nbsp;\u0026nbsp;`packageName: string,`\u003cbr/\u003e\u0026nbsp;\u0026nbsp;`opts?: FPJConfig,`\u003cbr/\u003e\u003c/sub\u003e\u003ccode\u003e): \u003ci\u003eFPJReturn\u003c/i\u003e\u003c/code\u003e\n\nReturns the resolved entry point to the package. It will start checking for the presence of packages using Node's algorithm by resolving the `node_modules` folder first inside of the given _dirname_, then if not found, traverse up and repeat, until root of the OS is reached.\n\nThe preference of the `entry` output will be given to the `module` field specified in the _package.json_. If the `main` is found instead, it will be indicated with `hasMain` property on the returned object.\n\n\u003cstrong\u003e\u003ca name=\"type-_fpjconfig\"\u003e`_fpj.Config`\u003c/a\u003e\u003c/strong\u003e: The options for `fpj`.\n\n|  Name  |             Type              |                                                                       Description                                                                       | Default |\n| ------ | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |\n| fields | \u003cem\u003e!Array\u0026lt;string\u0026gt;\u003c/em\u003e | Any additional fields from `package.json` file to return.                                                                                               | -       |\n| soft   | \u003cem\u003eboolean\u003c/em\u003e              | If the entry export (main or module) does not exist, `soft` mode will not throw an error, but add the `hasEntry` property to the output set to _false_. | `false` |\n\n_For example, the `package.json` files and meta information for 2 packages can be fetched using the following example:_\n\n```js\n/* yarn example/ */\nimport fpj from 'fpj'\nimport { dirname } from 'path'\n\n(async () =\u003e {\n  const zoroaster = await fpj(\n    dirname('example/example.js'),\n    'zoroaster'\n  )\n  console.log(zoroaster)\n  const read = await fpj(\n    dirname('example/example.js'),\n    '@wrote/read'\n  )\n  console.log(read)\n})()\n```\n\n_FPJ gives preference to the `module` field and will report it as the entry if it exists. Otherwise, the `main` is used with the `hasMain` property set to true:_\n\n```js\n{\n  entry: 'node_modules\\\\zoroaster\\\\depack\\\\index.js',\n  packageJson: 'node_modules\\\\zoroaster\\\\package.json',\n  version: '4.3.0',\n  packageName: 'zoroaster',\n  hasMain: true\n}\n{\n  entry: 'node_modules\\\\@wrote\\\\read\\\\src\\\\index.js',\n  packageJson: 'node_modules\\\\@wrote\\\\read\\\\package.json',\n  version: '1.0.4',\n  packageName: '@wrote/read'\n}\n```\n\n\u003cstrong\u003e\u003ca name=\"type-_fpjreturn\"\u003e`_fpj.Return`\u003c/a\u003e\u003c/strong\u003e: The return type of the program.\n\n|       Name       |       Type       |                                       Description                                        |\n| ---------------- | ---------------- | ---------------------------------------------------------------------------------------- |\n| __entry*__       | \u003cem\u003estring\u003c/em\u003e  | The location of the package's entry file. The preference is given to the `module` field. |\n| __packageJson*__ | \u003cem\u003estring\u003c/em\u003e  | The path to the package.json file itself.                                                |\n| __packageName*__ | \u003cem\u003estring\u003c/em\u003e  | The name of the resolved package.                                                        |\n| version          | \u003cem\u003estring\u003c/em\u003e  | The version of the package.                                                              |\n| hasMain          | \u003cem\u003eboolean\u003c/em\u003e | Whether the entry is the `main` rather than `module`.                                    |\n| entryExists      | \u003cem\u003eboolean\u003c/em\u003e | In soft mode, will be set to `false` if the entry file does not exist.                   |\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/2.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n## Fields\n\nAny additional fields from `package.json` that need to be present in the output can be specified in the `fields` property.\n\n```js\n/* yarn example/ */\nimport fpj from 'fpj'\nimport { dirname } from 'path'\n\n(async () =\u003e {\n  const zoroaster = await fpj(\n    dirname('example/example.js'),\n    'zoroaster',\n    { fields: ['license', 'bin'] },\n  )\n  console.log(zoroaster)\n})()\n```\n```js\n{\n  entry: 'node_modules\\\\zoroaster\\\\depack\\\\index.js',\n  packageJson: 'node_modules\\\\zoroaster\\\\package.json',\n  version: '4.3.0',\n  packageName: 'zoroaster',\n  hasMain: true,\n  license: 'AGPL-3.0',\n  bin: {\n    zoroaster: 'depack/bin/zoroaster.js',\n    'zoroaster-dev': 'src/bin/index.js'\n  }\n}\n```\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/3.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n## Soft Mode\n\nWhen a package exports either a main or a module fields, `fpj` will check for their existence to resolve the path to the entry. When the entry does not exist, by default an error will be thrown. To disable the error, and add the `entryExists: false` to the output, the _Soft Mode_ can be activated.\n\n```js\n/* yarn example/ */\nimport fpj from 'fpj'\nimport { dirname } from 'path'\n\n(async () =\u003e {\n  const zoroaster = await fpj(\n    dirname('example/example.js'),\n    'myPackage',\n    { soft: true },\n  )\n  console.log(zoroaster)\n})()\n```\n```js\n{\n  entry: 'example\\\\node_modules\\\\myPackage\\\\index.js',\n  packageJson: 'example\\\\node_modules\\\\myPackage\\\\package.json',\n  version: '1.0.0',\n  packageName: 'myPackage',\n  hasMain: true,\n  entryExists: false\n}\n```\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/4.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n\n## Copyright\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003e\n      \u003ca href=\"https://www.artd.eco\"\u003e\n        \u003cimg width=\"100\" src=\"https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png\"\n          alt=\"Art Deco\"\u003e\n      \u003c/a\u003e\n    \u003c/th\u003e\n    \u003cth\u003e© \u003ca href=\"https://www.artd.eco\"\u003eArt Deco™\u003c/a\u003e   2020\u003c/th\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/-1.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartdecocode%2Ffpj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartdecocode%2Ffpj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartdecocode%2Ffpj/lists"}