{"id":16617290,"url":"https://github.com/masterodin/publisher","last_synced_at":"2026-05-10T05:03:20.195Z","repository":{"id":38360998,"uuid":"196429504","full_name":"MasterOdin/publisher","owner":"MasterOdin","description":"Utility for publishing cleaner packages","archived":false,"fork":false,"pushed_at":"2023-03-17T11:01:25.000Z","size":656,"stargazers_count":0,"open_issues_count":9,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-24T02:39:46.489Z","etag":null,"topics":["babel","npm","package-json","package-management","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/MasterOdin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-07-11T16:25:53.000Z","updated_at":"2021-10-08T03:53:13.000Z","dependencies_parsed_at":"2024-06-21T14:15:27.506Z","dependency_job_id":"3786b0a5-df94-44bf-8659-31855b39811b","html_url":"https://github.com/MasterOdin/publisher","commit_stats":{"total_commits":278,"total_committers":4,"mean_commits":69.5,"dds":"0.28776978417266186","last_synced_commit":"4a3cff723db74d99f9aeed747be1df914f7ca48b"},"previous_names":["masterodin/typescript-publish"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasterOdin%2Fpublisher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasterOdin%2Fpublisher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasterOdin%2Fpublisher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MasterOdin%2Fpublisher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MasterOdin","download_url":"https://codeload.github.com/MasterOdin/publisher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242968476,"owners_count":20214470,"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","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":["babel","npm","package-json","package-management","typescript"],"created_at":"2024-10-12T02:16:06.935Z","updated_at":"2026-05-10T05:03:20.139Z","avatar_url":"https://github.com/MasterOdin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @masterodin/publisher\n\n[![Test](https://github.com/MasterOdin/publisher/workflows/Test/badge.svg?branch=master)](https://github.com/MasterOdin/publisher/actions?query=workflow%3ATest+branch%3Amaster)\n[![codecov](https://codecov.io/gh/MasterOdin/publisher/branch/master/graph/badge.svg)](https://codecov.io/gh/MasterOdin/publisher)\n[![npm (scoped)](https://img.shields.io/npm/v/@masterodin/publisher)](https://npmjs.com/package/@masterodin/publisher)\n\nUtility package to handle publishing built packages.\n\nThis utility helps to ensure that various steps are run before publishing as well to aim to create a minimal\ndistributed package, which only contains the compiled code, README, LICENSE, and other necessary files in a\nflat structure. This allows one to specify a build directory separate from\nthe source code (keeping the working repo nice and clean), and that the end-user will see a flat structure for\neasier importing.\n\nThis package currently only supports TypeScript with tsconfig.json files, but aims to add support\nto babel.\n\nFor example, assume you have the following directory structure:\n\n```text\ndist/\n  foo.js\n  foo.d.ts\n  index.js\n  index.d.ts\nsrc/\n  src_files\npackage.json\nREADME.md\ntsconfig.json\n```\n\nThe \"normal\" way of doing this is to build your typescript files in `src/` to `dist/` and then specify just `dist/`\nin the files directive in `package.json` and that the main should point at `dist/index.js`. While this works fine if\neverything the user would want to import is exposed in `./dist/index.js`, this can be very cumbersome and lead to\nbloated files. Additionally, if the user wants to import something from `foo.js`, they will have to do something like\n`import {bar} from 'your-package/dist/foo'` which is cumbersome at best. This package helps to alleviate these pain\npoints such that running it will produce the following directory structure:\n\n```text\ndist/\n  foo.js\n  foo.d.ts\n  index.js\n  index.d.ts\n  README.md\n  package.json\n```\n\nwhere `tsc` handles publishing to your `outDir` and `publisher` handles copying all of the other metadata files, using\nthe `.npmignore` file if it exists, else just copying in `package.json` and `README`, `LICEN[CS]E`, and `CHANGELOG`.\n\nFrom there, it publishes directly within the `dist/` directory, meaning you can minimize the amount of\nimports in `index.js` and that consumers can more cleanly import other sources doing\n`import {bar} from 'your-package/foo`.\n\nAdditionally, publisher will help ensure that all steps of the build/publish lifecycle are hit to help ensure\nthat no steps are missed. By default, it will run:\n\n* lint\n* build\n* test\n\nand if any of those fail, the publish is cancelled.\n\n## Installation\n\n```bash\nnpm install --save-dev @masterodin/publisher\n```\n\n## Usage\n\n```text\n$ publisher --help\nUsage: publisher [options]\n\nOptions:\n  -V, --version        output the version number\n  --init               Initialize publisher for repository\n  --dryrun, --dry-run  Do a dry-run of publisher without publishing\n  --no-checks          Will not run lint or test steps\n  -h, --help           display help for command\n```\n\n## Configuration\n\nOut of the box, publisher will try and figure out the right thing to do, making it capable to a\na handful of build systems. If it cannot determine things automatically, you can specify the following\nwithin a `.publisherrc.json` file:\n\n```javascript\n{\n  \"steps\": [],     // list of steps to run, defaults to lint, run, build\n  \"outDir\": \"\",    // directory to publish, it omitted publisher will try to infere this\n  \"publish\": true  // whether to run npm publish or not at end\n  \"clean\": true    // whether to delete outDir before running, defaults to true\n}\n```\n\nYou may alternatively specify these fields under `publisherrc` key in the `package.json`. Publisher will\nfirst look for its own file, and then look under `package.json`. You cannot combine the CLI option\n`--no-checks` with the files.\n\n_NOTE_: We use `publisherrc` instead of `publisher` as the latter is used by VSCode extensions, and\nVSCode will show an error if the field is not defined proper for extensions.\n\n## package.json\n\nIt's recommended to add `\"prepublishOnly\": \"echo \\\"Run publisher instead!\\\" \u0026\u0026 exit 1\"` to the\n`scripts` object in the `package.json` to prevent any accidental `npm publish` usage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasterodin%2Fpublisher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasterodin%2Fpublisher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasterodin%2Fpublisher/lists"}