Skip to content

Commit

Permalink
Remove custom prepare-publish from dist folder
Browse files Browse the repository at this point in the history
The reason it existed is that when the esm `exports` field was
introduced, a lot of editors didn't support this mapping for
non-package-index imports (so importing other file paths from
within the package).

Since editors do support it now, we don't need this custom
logic anymore.
  • Loading branch information
ThaNarie committed Dec 11, 2023
1 parent 68f19b6 commit 5726ed4
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 104 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/bump-version-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ jobs:

- name: Publish to NPM
run: |
npm run prepare-publish
cd ./dist
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish
env:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/publish-dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ jobs:

- name: Publish
run: |
npm run prepare-publish
cd ./dist
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish --tag next
env:
Expand Down
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,7 @@ automatically on every push to the `main` branch (e.g. when a PR is merged).

#### Manual

Since we're publishing from the `dist` folder (see `./scripts/preparePublish.ts` for more
information), we need to run `npm run build` before publishing.

After that, we can run `prepare-publish` to copy files` over to the
`dist` folder, and run `npm publish` from within the `dist`folder.

```sh
npm run build
npm run prepare-publish
cd dist
npm publish
```

> **Note** that we're publishing from the `dist` folder, not the root of the project, so the
> paths might be a bit confusing.
The `./scripts/preparePublish.ts` script is executed before publishing, and it will copy additional
files to the `dist` folder, such as the `package.json`, `README.md` and `LICENSE` files.
55 changes: 1 addition & 54 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"fix": "npm run lint -- --fix",
"format": "prettier \"**/*.{mjs,cjs,js,jsx,ts,tsx,json,md,mdx,css,scss,html}\" --write --loglevel warn",
"typecheck": "tsc --project tsconfig.json --noEmit --noUnusedLocals",
"prepare-publish": "tsx ./scripts/preparePublish.ts",
"postinstall": "husky install"
},
"prettier": "@mediamonks/prettier-config",
Expand Down Expand Up @@ -74,13 +73,11 @@
"@mediamonks/eslint-config": "^2.2.0",
"@mediamonks/eslint-config-typescript": "^1.2.0",
"@mediamonks/prettier-config": "^1.0.1",
"@types/shelljs": "^0.8.12",
"eslint": "^8.41.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"shelljs": "^0.8.5",
"shx": "^0.3.4",
"tsx": "^4.6.2",
"typescript": "^5.0.4",
Expand Down
29 changes: 0 additions & 29 deletions scripts/preparePublish.ts

This file was deleted.

0 comments on commit 5726ed4

Please sign in to comment.