Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yarn 2 does not run prepare/prepublishOnly script #2305

Closed
polRk opened this issue Feb 17, 2020 · 1 comment
Closed

Yarn 2 does not run prepare/prepublishOnly script #2305

polRk opened this issue Feb 17, 2020 · 1 comment
Labels
working as intended The current behavior is intended.

Comments

@polRk
Copy link

polRk commented Feb 17, 2020

package.json

  "scripts": {
    "build": "tsc --build",
    "lint": "eslint src/**/*.ts --fix",
    "format": "prettier src/**/*.ts --write",
    "generate": "docker run --rm -v $PWD/codegen.yml:/codegen/codegen.yml -v $PWD/src:/codegen/src polrk/graphql-codegen",
    "prepublishOnly": "yarn generate && yarn format && yarn lint && yarn build"
  }

Command

yarn npm publish

What is the expected behavior?
Run prepublishOnly script before

➜ git:(master) ✗ npm publish

@0.0.0 prepublishOnly .
yarn generate && yarn format && yarn lint && yarn build

What is the current behavior?
➜ git:(master) ✗ yarn npm publish
➤ YN0000: codegen.yml
➤ YN0000: lib/index.d.ts
➤ YN0000: lib/index.js
➤ YN0000: lib/index.js.map
➤ YN0000: lib/sdk.d.ts
➤ YN0000: lib/sdk.js
➤ YN0000: lib/sdk.js.map
➤ YN0000: package.json
➤ YN0000: tsconfig.json

Steps to Reproduce

  1. npm publish
  2. yarn npm publish

Environment

  • Node Version: 12
  • Yarn V2
  • OS and version: Mac OS
@paul-soporan paul-soporan changed the title Yarn 2 do not run prepare/prepublishOnly script Yarn 2 does not run prepare/prepublishOnly script Jan 2, 2021
@paul-soporan paul-soporan transferred this issue from yarnpkg/yarn Jan 2, 2021
@paul-soporan
Copy link
Member

That's intended, Yarn 2+ doesn't support prepare / prepublishOnly anymore. Use prepack for transpiling the sources and prepublish when you don't want side-effects.

You can find a list of supported lifecycle scripts here: https://yarnpkg.com/advanced/lifecycle-scripts.

@paul-soporan paul-soporan added the working as intended The current behavior is intended. label Jan 2, 2021
dguo added a commit to dguo/coinbase-js that referenced this issue Mar 26, 2023
prepublishOnly isn't supported in Yarn v2+. See:
yarnpkg/berry#2305 (comment)
mifi added a commit to transloadit/uppy that referenced this issue Sep 15, 2023
mifi added a commit to transloadit/uppy that referenced this issue Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
working as intended The current behavior is intended.
Projects
None yet
Development

No branches or pull requests

2 participants