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 v3 Project Testing #4554

Closed
14 of 21 tasks
thedavidprice opened this issue Feb 22, 2022 · 8 comments
Closed
14 of 21 tasks

Yarn v3 Project Testing #4554

thedavidprice opened this issue Feb 22, 2022 · 8 comments
Assignees

Comments

@thedavidprice
Copy link
Contributor

thedavidprice commented Feb 22, 2022

cc @jtoar and @dac09

related to PR #4444

Project Testing: Setup and Upgrade

  1. npx create-redwood-app@experimental

Checks

  • create-redwood-app
  • dev
    • currently starts with Prisma error but runs successfully
  • info
  • build
    • cannot find "script named prisma"
  • prerender
  • lint
  • generate page
  • destroy page
  • prisma migrate dev
  • prisma generate
  • g scaffold
  • test (including web and api)
  • type-check
  • check
  • storybook
    • noticeably faster!
  • generate script
  • exec
  • dataMigrate up
  • setup deploy netlify
  • setup ui tailwindcss
  • rwfw
@thedavidprice
Copy link
Contributor Author

thedavidprice commented Feb 22, 2022

__Update: here's the problem. create-... installs at latest published version. So going to need to manually upgrade. I could change the publishing process to set everything to the upcoming experimental version... TBD`

Fail on initial Create

Here's what I get when I run npx create-redwood-app@experimental <directory>

npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
  ✔ Creating Redwood app
    ✔ Checking node and yarn compatibility
    ✔ Creating directory '/Users/price/Repos/x-yarn-3'
  ✔ Installing packages
    ✔ Running 'yarn install'... (This could take a while)
  ✖ Convert TypeScript files to JavaScript
    → $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
    Generating types

Error: Command failed with exit code 1: yarn rw ts-to-js
Usage Error: Couldn't find a script named "rw".

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
    at makeError (/Users/price/.npm/_npx/071fc70ce4e320d9/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/Users/price/.npm/_npx/071fc70ce4e320d9/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  shortMessage: 'Command failed with exit code 1: yarn rw ts-to-js',
  command: 'yarn rw ts-to-js',
  escapedCommand: '"yarn rw ts-to-js"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: `\x1B[31m\x1B[1mUsage Error\x1B[22m\x1B[39m: Couldn't find a script named "rw".\n` +
    '\n' +
    '\x1B[1m$ \x1B[22myarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...',
  stderr: '',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false,
  context: [Object: null prototype] {}
}

Warning: Directory '/Users/price/Repos/x-yarn-3' was created. However, the installation could not complete due to an error.

Update

I re-published and included the experimental semver in the packages. Create worked seemlessly.

@thedavidprice
Copy link
Contributor Author

thedavidprice commented Feb 23, 2022

Prisma Error first run of yarn rw dev

First I ran rw build which threw because:

Command failed with exit code 1: yarn prisma generate --schema="/Users/price/Repos/x-yarn-3/api/db/schema.prisma"
Usage Error: Couldn't find a script named "prisma".

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...

Then I tried yarn rw dev, which threw the same error but then proceeded to run correctly:

➜  x-yarn-3 yarn rw dev
  ✖ Generating the Prisma client...
    → $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
Command failed with exit code 1: yarn prisma generate --schema="/Users/price/Repos/x-yarn-3/api/db/schema.prisma"
Usage Error: Couldn't find a script named "prisma".

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
api | [nodemon] 2.0.15
api | [nodemon] to restart at any time, enter `rs`
api | [nodemon] watching path(s): redwood.toml
api | [nodemon] watching extensions: js,mjs,json
api | [nodemon] starting `yarn rw-api-server-watch | rw-log-formatter`
gen
... // etc

Subsequent runs of yarn rw dev ran clean.

@thedavidprice
Copy link
Contributor Author

thedavidprice commented Feb 23, 2022

Current Errors

Dev

➜  x-yarn3 yarn rw dev
  ✖ Generating the Prisma client...
    → $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
Command failed with exit code 1: yarn prisma generate --schema="/Users/price/Repos/x-yarn3/api/db/schema.prisma"
Usage Error: Couldn't find a script named "prisma".

...

api | Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.

...

Build

note: fails for both build api and build web. Following is output for build

➜  x-yarn3 yarn rw build
  ✖ Generating Prisma Client...
    → $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
    Verifying graphql schema...
    Building API...
    Cleaning Web...
    Building Web...
    Prerendering Web...
Command failed with exit code 1: yarn prisma generate --schema="/Users/price/Repos/x-yarn3/api/db/schema.prisma"
Usage Error: Couldn't find a script named "prisma".

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...

Test

➜  x-yarn3 yarn rw test 
node:internal/validators:120
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:120:11)
    at Module.require (node:internal/modules/cjs/loader:998:3)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/price/Repos/x-yarn3/node_modules/@redwoodjs/core/dist/bins/jest.js:7:1)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  code: 'ERR_INVALID_ARG_TYPE'
}

type-check

➜  x-yarn3 yarn rw type-check
  ✖ Generating the Prisma client...
    → $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
Command failed with exit code 1: yarn prisma generate --schema="/Users/price/Repos/x-yarn3/api/db/schema.prisma"
Usage Error: Couldn't find a script named "prisma".

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
  ✔ Generating types
Unknown Syntax Error: Command not found; did you mean one of:

setup ui tailwindcss

➜  x-yarn3 yarn rw setup ui tailwindcss
  ✔ Installing packages...
  ✔ Configuring PostCSS...
  ✖ Initializing Tailwind CSS...
    → $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
    Adding import to index.css...
Command failed with exit code 1: yarn tailwindcss init /Users/price/Repos/x-yarn3/web/config/tailwind.config.js
Usage Error: Couldn't find a script named "tailwindcss".

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...

rwfw

➜  x-yarn3 yarn rwfw 
Redwood Framework Tools Path: /Users/price/Repos/redwoodjs-redwood (​/Users/price/Repos/redwoodjs-redwood​)
➤ YN0000: Done in 0s

➜  x-yarn3 yarn rwfw project:sync
Redwood Framework Tools Path: /Users/price/Repos/redwoodjs-redwood (​/Users/price/Repos/redwoodjs-redwood​)
Usage Error: Couldn't find a script named "project:sync".

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...

@thedavidprice thedavidprice moved this to Todo in Release Feb 23, 2022
@thedavidprice thedavidprice moved this from Todo to In progress in Release Feb 23, 2022
@jtoar
Copy link
Contributor

jtoar commented Feb 23, 2022

@thedavidprice I think I know why most of those commands are breaking:

dom@evaM1 ~/p/r/_/y/exp (main)> yarn why @redwoodjs/cli
└─ @redwoodjs/core@npm:0.46.1-experimental.53
   └─ @redwoodjs/cli@npm:0.46.1 (via npm:^0.46.1-experimental.53)

It looks like npx create-redwood-app@experimental isn't installing the experimental version of the cli for some reason. The generatePrismaClient helper is still that of v0.46.1, which is why it can't find the prisma binary (this is from node_modules/@redwoodjs/cli/dist/...):

const generatePrismaCommand = schema => {
  if (skipTask(schema)) {
    return {};
  }

  return {
    cmd: 'yarn prisma', // this wont' work anymore; it's updated it in my PR
    args: ['generate', schema && `--schema="${schema}"`]
  };
};

@jtoar
Copy link
Contributor

jtoar commented Feb 23, 2022

I had a look at core's package.json (node_modules/@redwoodjs/core/package.json) and the right versions are listed. Maybe the semver caret is causing the mixup:

"@redwoodjs/cli": "^0.46.1-experimental.53",
"@redwoodjs/eslint-config": "^0.46.1-experimental.53",
"@redwoodjs/internal": "^0.46.1-experimental.53",
"@redwoodjs/testing": "^0.46.1-experimental.53",

@jtoar
Copy link
Contributor

jtoar commented Feb 23, 2022

Here's the updated CLI check list after setting this resolution in the root workspace's package.json:

"resolutions": {
  "@redwoodjs/cli": "0.46.1-experimental.53"
}
  • dev
  • build
  • prerender
  • test (including web and api)
  • type-check
  • setup ui tailwindcss
  • rwfw

@cloudcompute
Copy link

@thedavidprice

Based on my own experiences, I'll strongly recommend to use 'pnpm' instead of 'yarn 3'.
Kindly go through this link

@thedavidprice
Copy link
Contributor Author

Thanks again, @Ramandhingra! My reply here

@jtoar jtoar moved this from In progress to Backlog in Release Apr 15, 2022
@jtoar jtoar closed this as completed Apr 15, 2022
@jtoar jtoar moved this from Backlog to Done in Release Apr 15, 2022
@jtoar jtoar moved this from Done to Archived in Release Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Archived
Development

No branches or pull requests

3 participants