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

Issue #365 - Added option to override package manager. #427

Closed
wants to merge 12 commits into from

Conversation

RobinTo
Copy link

@RobinTo RobinTo commented Dec 14, 2017

Implemented parameter for create-razzle-app to override package manager, could resolve #365 if useable.

create-razzle-app my-project -p npm

Command Info Valid values
-p --packageManager Override package manager, default to yarn. npm, yarn

Tested this on mac using

  • npx ./razzle/packages/create-razzle-app/bin/create-razzle-app test-razzle-project -p npm
  • cd test-razzle-project
  • npm start

If the option is not supplied it defaults to old behaviour, otherwise checks that it is one of yarn or npm, and defaults to old behaviour if not. Could remove check for yarn or npm if you want to enable any value to be used.

I want to be able to keep supporting projects that use yarn, while favoring npm for new projects.

Due to the sentence above I was unsure wether to set the default to npm, but currently it default to yarn as previously done. Could be changed if desired.

I hope you find this useful, even though the issue was marked as low priority.

Some yarn lockfiles unrelated to my modifications appear to have many changes. I'm not very familiar with the inner workings of yarn, but I suspect it might be due to newer yarn version when I ran the initial yarn setup?

@jariz
Copy link
Collaborator

jariz commented Dec 22, 2017

I'm slowly seeing the JS hemisphere moving back to npm, but correct me if I'm wrong.
Eitherway, yarn was the previous default so probably best to keep it that way.

@jariz
Copy link
Collaborator

jariz commented Dec 22, 2017

@RobinTo Can you update all readme's? There are more than 2.
I know this is kind of annoying but it's something that's being worked on (#409)

@RobinTo
Copy link
Author

RobinTo commented Dec 27, 2017

Of course, all the relevant readme files should now be updated.

Copy link
Owner

@jaredpalmer jaredpalmer left a comment

Choose a reason for hiding this comment

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

Not sure why lockfiles are in this commit. May need to open a new PR

@@ -22,6 +22,10 @@ exports.exampleHelp = function() {
)}`;
};

exports.packageManagerHelp = function() {
return `Wich package manager (npm or yarn) to utilize for setup.`;
Copy link
Owner

Choose a reason for hiding this comment

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

Which***

@jaredpalmer
Copy link
Owner

Is there a way to automatically tell based on whether user has called this with npx or yarn create?

@RobinTo
Copy link
Author

RobinTo commented Jan 2, 2018

I fixed the spelling error. Let me know if you want me to open a new pull request where I reset the lockfiles to the versions present on current master.

As far as I could see with some light searching, there is no way to detect if it was done through yarn create or directly, since according to https://yarnpkg.com/lang/en/docs/cli/create/ yarn create is equal to

$ yarn global add create-react-app
$ create-react-app my-app

where the end result is the same as if you had installed create-react-app globally with any packagemanager and ran the command directly. If you have any suggestions where to look for making it work, please let me know though and I'd be happy to look into it further.

@jariz
Copy link
Collaborator

jariz commented Jan 2, 2018

I've done a little research by running yarn create and sadly process.argv returns the same as it would when directly running the script.
On top of that process.ppid is set to undefined, so no way to get information about who started the script either.

So, short answer to @jaredpalmer's question: Nope.

@jariz
Copy link
Collaborator

jariz commented Jan 2, 2018

Scratch that, ppid only exists in 9.2+ and it does appear to return the yarn pid, but then again, that version has only been out for 2 months.
So, I think this is kind of out of scope for now, unless we're willing to do all sorts of crazy platform specific hacks.

jaredpalmer and others added 7 commits March 21, 2018 15:45
Fix incorrect link to chunk scripts caused by string concatenation instead of incrementing the port number value.

`process.env.*` values are strings, so in the example file port value was `'30001'` instead of `3001`.
Mirroring the patch for react-dev-utils that causes dev utils to break in IE11. strip-ansi package arrow function is causing this issue. See react-dev-utils patch PR that was accepted to fix this issue: facebook/create-react-app#2692
@jariz jariz changed the base branch from master to next April 16, 2018 12:09
Copy link
Owner

@jaredpalmer jaredpalmer left a comment

Choose a reason for hiding this comment

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

Nice

@stale
Copy link

stale bot commented Aug 15, 2018

Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.

@stale stale bot added the stale label Aug 15, 2018
@stale
Copy link

stale bot commented Aug 22, 2018

ProBot automatically closed this due to inactivity. Holler if this is a mistake, and we'll re-open it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants