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

build: switch from npm to yarn #19328

Closed
wants to merge 2 commits into from
Closed

Conversation

ocombe
Copy link
Contributor

@ocombe ocombe commented Sep 22, 2017

PR Type

What kind of change does this PR introduce?

[x] Build related changes
[x] CI related changes

What is the current behavior?

We use npm to install and lock our dependencies (with shrinkwrap)

What is the new behavior?

We use yarn instead of npm

Does this PR introduce a breaking change?

[x] No

@ocombe ocombe added area: build & ci Related the build and CI infrastructure of the project state: WIP PR target: TBD labels Sep 22, 2017
@ocombe ocombe force-pushed the build-yarn branch 2 times, most recently from 4a493a5 to 2ffe9d9 Compare September 22, 2017 09:35
@angular angular deleted a comment from mary-poppins Sep 22, 2017
@angular angular deleted a comment from mary-poppins Sep 22, 2017
@mary-poppins
Copy link

You can preview c706fc2 at https://pr19328-c706fc2.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 53f4f45 at https://pr19328-53f4f45.ngbuilds.io/.

@4kochi
Copy link

4kochi commented Sep 22, 2017

Just out of curiosity. Why not just use npm v5? It should be almost as fast as yarn. Or is there another reason besides speed improvements?

@ocombe
Copy link
Contributor Author

ocombe commented Sep 22, 2017

We still need to support old versions of node for some tests, which I believe that the new npm doesn't.
Also we will try to use yarn workspaces after this to share the node folder across all packages.

And yarn is still faster for now, see https://medium.com/@nikjohn/npm-5-yarn-killer-ba69737b24d0

@4kochi
Copy link

4kochi commented Sep 22, 2017

Ok, thanks for the clarification.

@mary-poppins
Copy link

You can preview 9c1a8d5 at https://pr19328-9c1a8d5.ngbuilds.io/.

@@ -56,7 +58,7 @@ Next, install the JavaScript modules needed to build and test Angular:

```shell
# Install Angular project dependencies (package.json)
npm install
yarn install
```

**Optional**: In this document, we make use of project local `npm` package scripts and binaries
Copy link
Contributor

Choose a reason for hiding this comment

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

can you also remove Options 1, 2 and 3? they all refer to installing global dependencies, using npm with yarn projects, and using sudo which are all anti-patterns and shouldn't be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

package.json Outdated
@@ -17,7 +17,8 @@
"url": "https://github.com/angular/angular.git"
},
"scripts": {
"postinstall": "node tools/npm/copy-npm-shrinkwrap && webdriver-manager update",
"preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('Please use Yarn instead of NPM to install dependencies. See: https://yarnpkg.com/lang/en/docs/install/')\"",
"postinstall": "webdriver-manager update",
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add the --gecko false flag here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure if it would fail something with this here, I'll add it

* If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
* date, some browsers (e.g. IE 9) will throw an invalid Date error
* If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the
* timeoffset is applied Note: ISO months are 0 for January, 1 for February, ...
Copy link
Contributor

Choose a reason for hiding this comment

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

bad line join

or `yarn upgrade <packagename> --dev` to update to the latest version that matches version constraint
in `package.json`

To Remove an existing dependency do the following: run `yarn remove <packagename>@<version|latest>`
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you need to specify the version in this case

@@ -37,7 +37,7 @@ fi
setEnvVar NODE_VERSION 6.9.5
setEnvVar NPM_VERSION 3.10.7 # do not upgrade to >3.10.8 unless https://github.com/npm/npm/issues/14042 is resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this line

@ocombe ocombe added action: review The PR is still awaiting reviews from at least one requested reviewer and removed state: WIP labels Sep 22, 2017
@mary-poppins
Copy link

You can preview 4976e0b at https://pr19328-4976e0b.ngbuilds.io/.

@IgorMinar IgorMinar added action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release and removed action: review The PR is still awaiting reviews from at least one requested reviewer PR target: TBD labels Sep 22, 2017
@alexeagle
Copy link
Contributor

fyi on error-reporting: I had node 4 and the yarn install fails with

yarn install v1.0.2
$ node -e "if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('Please use Yarn instead of NPM to install dependencies. See: https://yarnpkg.com/lang/en/docs/install/')"
error Couldn't find the binary node -e "if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('Please use Yarn instead of NPM to install dependencies. See: https://yarnpkg.com/lang/en/docs/install/')"

not sure if it's worth fixing (by checking node version first I suppose)

@ocombe
Copy link
Contributor Author

ocombe commented Sep 22, 2017

The node engine in package.json is "node": ">=6.9.5 <7.0.0",, so we probably don't need to support node 4?

@alexeagle
Copy link
Contributor

Right, not asking for support, I'm just pointing out the error isn't very nice.
Igor is making fun of me for running node 4 at all; I don't care if you change anything for that case.

IgorMinar pushed a commit that referenced this pull request Sep 22, 2017
@IgorMinar IgorMinar closed this in f48b343 Sep 22, 2017
@@ -8,6 +8,6 @@ echo "#################################"
echo "Running platform-server end to end tests"
echo "#################################"

npm install
yarn install

npm run test
Copy link
Member

Choose a reason for hiding this comment

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

Not yarn test? 😞 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, it'll be in my follow up PR, thanks

jmleoni pushed a commit to jmleoni/angular that referenced this pull request Oct 6, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: build & ci Related the build and CI infrastructure of the project cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants