{"id":20519435,"url":"https://github.com/wonkooklee/next-pathmap","last_synced_at":"2025-10-13T05:35:22.409Z","repository":{"id":160988940,"uuid":"635778039","full_name":"wonkooklee/next-pathmap","owner":"wonkooklee","description":"Pathmap Generator for Next.js Pages","archived":false,"fork":false,"pushed_at":"2023-05-14T11:34:17.000Z","size":79,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-07T05:28:37.662Z","etag":null,"topics":["metadata-management","next","next-pathmap","nextjs","path","pathmap","pathmapping","route"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/next-pathmap?activeTab=readme","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wonkooklee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-03T12:41:29.000Z","updated_at":"2024-01-21T09:31:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"dce176bd-19cb-4ed8-9ec6-5530d3548578","html_url":"https://github.com/wonkooklee/next-pathmap","commit_stats":null,"previous_names":["wonkooklee/demo-npm-cli-tool"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/wonkooklee/next-pathmap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonkooklee%2Fnext-pathmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonkooklee%2Fnext-pathmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonkooklee%2Fnext-pathmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonkooklee%2Fnext-pathmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wonkooklee","download_url":"https://codeload.github.com/wonkooklee/next-pathmap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonkooklee%2Fnext-pathmap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006841,"owners_count":26084204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"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":["metadata-management","next","next-pathmap","nextjs","path","pathmap","pathmapping","route"],"created_at":"2024-11-15T22:13:40.841Z","updated_at":"2025-10-13T05:35:22.395Z","avatar_url":"https://github.com/wonkooklee.png","language":"JavaScript","readme":"\u003cbr /\u003e\n\u003cbr /\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003cfigure\u003e\u003cimg src=\"https://user-images.githubusercontent.com/61101022/236479507-48e8efe0-55b8-4357-b24b-b552393286b7.png\" alt=\"logo\" width=\"160\"\u003e\u003c/figure\u003e\n\n\u003ch1\u003e \u003cb\u003enext-pathmap\u003c/b\u003e\n\u003c/h1\u003e\n\n\u003cp\u003e Pathmap Generator for 'Pages' directory of Next.js \u003c/p\u003e\n\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n`next-pathmap` is a tool that automatically extracts paths from the pages folder of the **next.js** project and converts them into `JSON` path-maps.  \nIt was created to manage all the metadata for each page in one file or to use as a hashmap.\n\n\u003cbr /\u003e\n\n## Requirements\n\n- node.js \u003e= 14.0.0\n\n\u003cbr /\u003e\n\n## Core dependencies\n\n- [globby](https://github.com/sindresorhus/globby)\n- [inquirer](https://github.com/SBoudrias/Inquirer.js)\n- [json-format](https://github.com/luizstacio/json-format)\n\n\u003cbr /\u003e\n\n## Installations\n\nYou can run the binary without installation via the npx command. Or you can use it by installing it as a dependency.\n\n```sh\n$ npx next-pathmap\n```\nor\n```sh\n$ npm install -D next-pathmap\n```\nYou can also enter the command directly through the global installation.\n```sh\n$ npm install -g next-path\n$ next-path\n```\n\n\u003cbr /\u003e\n\n## Configurations\n\nTo configure required properties you should define either use `pathmap.config.json` or configure via command-line input.  \nIf `pathmap.config.json` file is detected at the root of your project, script will use automatically as a configuration.\n\n\u003cbr /\u003e\n\n### 1. `pathmap.config.js` (Recommended)\n\n```js\n/** @type {import('next-pathmap/config').PathmapConfig} */\nconst PathmapConfig = {\n  pathToPages: \"src/pages\",\n  pathToSave: \"src/pathmap/pathmap.json\",\n  includes: [\"**/*.page.{ts,tsx}\"],\n  excludes: [\"!**/_*.{ts,tsx}\", \"!**/[A-Z]*.{ts,tsx}\", \"!api\"],\n  schema: {\n    /* properties you want */\n  },\n  categories: [\n    {\n      /* first matching segment map of the path */\n      key: value,\n    },\n    {\n      /* second matching segment map of the path */\n      key: value,\n    },\n    // and so on...\n  ],\n};\n\nmodule.exports = PathmapConfig;\n```\n\n\u003cbr /\u003e\n\n### 2. Configure with command-line interface\n\nYou can configure with command-line interface unless you don't have configuration file.  \nYou can select only basic options compared to setting via config file.\n\n```\n? Enter the path to the '/pages' directory. src/pages\n? Enter the destination to save jsonized pathmap file. pathmap/pathmap.json\n? includes: **/*.page.{ts,tsx}\n? excludes: **/[!_]*.{ts,tsx}, **/[!A-Z]*.page.{ts,tsx}, !api\n.\n.\n```\n\n\u003cbr /\u003e\n\n## Result\n\nAll paths in the project are mapped to a JSON object as shown below. Use it as meta information on the page by importing it or refer to it as an alias in the path.\n\n### Artifact\n\n```json\n{\n  \"/services/insurance\": {\n    \"alias\": \"serv-insurance-page-viewed\",\n    \"trackPageView\": true,\n    \"categories\": [\"customer-service\", \"insurance/main\"],\n    \"query\": []\n  },\n  \"/services/loan\": {\n    \"alias\": \"serv-loan-page-viewed\",\n    \"trackPageView\": true,\n    \"categories\": [\"customer-service\", \"loan/main\"],\n    \"query\": []\n  },\n  \"/services/products/[id]\": {\n    \"alias\": \"serv-prod-id-page-viewed\",\n    \"trackPageView\": true,\n    \"categories\": [\"customer-service\", \"product/detail\"],\n    \"query\": [\"id\"]\n  }\n}\n```\n\n### Example\n```js\nimport pathmap from '@/pathmap/pathmap.json';\n\nexport default function InsurancePage() {\n\n  const pathInfo = pathmap['/services/insurance'];\n  const pageAlias = pathInfo.alias;\n\n  trackPageView({ pageName: pathInfo.categories.join('/') })\n// ...\n\n\n```\n\n\n\n\u003cbr /\u003e\n\n© WONKOOK LEE\n\n- Powered by Bash in iPad\n\u003cbr /\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwonkooklee%2Fnext-pathmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwonkooklee%2Fnext-pathmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwonkooklee%2Fnext-pathmap/lists"}