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

internal(rwfw) Add bins as scripts #8754

Merged
merged 12 commits into from Jun 28, 2023

Conversation

Tobbe
Copy link
Member

@Tobbe Tobbe commented Jun 27, 2023

New bins that you create (executable node files listed under "bin" in package.json) don't work with yarn rwfw project:sync or project:copy. Sometimes updating existing bins also doesn't work.

What happens is yarn will just say it can't find the bin. It'll look like this
image

I've found a way to work around that by adding all bins as scripts to the rw app's root package.json

  "scripts": {
    "redwood": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/web/dist/bins/redwood.js",
    "rw": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/web/dist/bins/redwood.js",
    "rwfw": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/web/dist/bins/rwfw.js",
    "tsc": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/web/dist/bins/tsc.js",
    "rw-api-server-watch": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/core/dist/bins/rw-api-server-watch.js",
    "rw-log-formatter": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/core/dist/bins/rw-log-formatter.js",
    "rw-server": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/api-server/dist/index.js",
    "cross-env": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/web/dist/bins/cross-env.js",
    "eslint": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/core/dist/bins/eslint.js",
    "jest": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/core/dist/bins/jest.js",
    "nodemon": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/core/dist/bins/nodemon.js",
    "rimraf": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/core/dist/bins/rimraf.js",
    "rw-gen": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/internal/dist/generate/generate.js",
    "rw-gen-watch": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/internal/dist/generate/watch.js",
    "rw-vite-build": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/vite/bins/rw-vite-build.mjs",
    "rw-vite-dev": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/vite/bins/rw-vite-dev.mjs",
    "rw-tobbe": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/vite/bins/rw-tobbe.mjs",
    "vite": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/vite/bins/vite.mjs",
    "msw": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/web/dist/bins/msw.js",
    "storybook": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/web/dist/bins/storybook.js",
    "webpack": "node /Users/tobbe/tmp/rw-svg/node_modules/@redwoodjs/web/dist/bins/webpack.js"
  }

@Tobbe Tobbe added the release:chore This PR is a chore (means nothing for users) label Jun 27, 2023
Copy link
Collaborator

@Josh-Walker-GM Josh-Walker-GM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tobbe I made a small change to only for the file IO once if that's okay?

@Tobbe
Copy link
Member Author

Tobbe commented Jun 27, 2023

Was getting this error in CI
image

Doesn't seem like we're using our own rimraf bin anywhere, so I removed it.

The actual issue with rimraf is that rimraf doesn't have a "package.json" entry in it's "exports" field in its package.json file. (Yes, a field that points to itself pretty much)

Here's another package that had the same problem for other people uuidjs/uuid#444

@Tobbe Tobbe enabled auto-merge (squash) June 27, 2023 22:44
@Tobbe Tobbe merged commit 0fae3fb into redwoodjs:main Jun 28, 2023
28 checks passed
@redwoodjs-bot redwoodjs-bot bot added this to the next-release milestone Jun 28, 2023
@Tobbe Tobbe deleted the tobbe-rwfw-project-sync-bins branch June 28, 2023 11:37
@jtoar jtoar modified the milestones: next-release, v6.0.0 Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:chore This PR is a chore (means nothing for users)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants