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

Bug: Yeoman runs npm or yarn multiple times. #644

Closed
brandones opened this issue Apr 9, 2020 · 1 comment
Closed

Bug: Yeoman runs npm or yarn multiple times. #644

brandones opened this issue Apr 9, 2020 · 1 comment

Comments

@brandones
Copy link

The docs state

Yeoman will ensure the npm install command is only run once even if it is called multiple times by multiple generators.

However, Yeoman appears to be running Yarn multiple times in my project:

screenshot


My environment

  • OS version/details: Ubuntu 19.10
  • Node version: 12.16.1
  • npm version: 6.14.1
  • Version of yo : 3.1.1

Expected behavior

Yeoman should run Yarn exactly once.

Current behavior

Yeoman runs yarn twice.

Steps to reproduce the behavior

See https://github.com/single-spa/create-single-spa/blob/9f80def0e3df929ba22dd4c06912505feafc4019/packages/generator-single-spa/src/react/generator-single-spa-react.js#L156-L167 .

Check out https://github.com/single-spa/create-single-spa/tree/9f80def0e3df929ba22dd4c06912505feafc4019 .

~/C/p/m/create-single-spa $ cd ..
~/C/p/mf $ mkdir gen-test
~/C/p/mf $ cd gen-test
~/C/p/m/gen-test $ ../create-single-spa/packages/create-single-spa/bin/create-single-spa.js

? Select type to generate single-spa application / parcel
? Which framework do you want to use? react
? Which package manager do you want to use? yarn
? Will this project use Typescript? Yes
? Organization name (use lowercase and dashes) op
? Project name (use lowercase and dashes) fe

Command line output

See pastebin. The important part is the end:

Done in 4.20s.
Project setup complete!
Steps to test your React single-spa application:
1. Run 'yarn start --https --port 8500'
2. Go to https://single-spa-playground.org/playground/instant-test?name=@op/fe&url=8500 to see it working!
yarn install v1.21.1
warning package.json: No license field
warning No license field
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.43s.

Where that first "Done" is from the first yarn run.

@JoshuaKGoldberg
Copy link

The npmInstall and yarnInstall commands have since been deprecated: see yeoman/generator#1294 -> yeoman/generator#1283.

Also, looking at the code in generate-single-spa-react.js:

if (this.typescript) {
  // ...
  if (this.packageManager === "npm") {
    this.npmInstall(typescriptDevDeps, { "save-dev": true });
    this.npmInstall(typeDeps, { save: true });
  } else {
    this.yarnInstall(typescriptDevDeps, { dev: true });
    this.yarnInstall(typeDeps);
  }
}
this.installDependencies({
  npm: this.packageManager === "npm",
  yarn: this.packageManager === "yarn",
  bower: false,
});

That's two sets of installation commands. So it should be running two installs.

Closing out as I think this is working as intended. But if I'm wrong, someone please yell at me and post why. Cheers! 🎩

@JoshuaKGoldberg JoshuaKGoldberg closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants