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

Remove dependencies on yarn #11279

Merged
merged 11 commits into from Sep 13, 2017
Merged

Remove dependencies on yarn #11279

merged 11 commits into from Sep 13, 2017

Conversation

danielrozenberg
Copy link
Member

Fixes #11278

Copy link

@dreamofabear dreamofabear left a comment

Choose a reason for hiding this comment

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

Let's also add the equivalent package-lock.json file with the same versions in the current yarn.lock.

@dreamofabear
Copy link

Related: #2771

@ampprojectbot ampprojectbot added this to the Pending Triage milestone Sep 12, 2017
@@ -380,21 +380,6 @@ function main(argv) {
process.exit(1);
}

// Make sure changes to package.json also update yarn.lock.
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of removing this check, maybe repurpose it to make sure that package.json and package-lock.json are updated in lock step? (Heh!)

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair enough, PTAL


```
yarn global add gulp
sudo npm install -g gulp
Copy link
Contributor

Choose a reason for hiding this comment

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

Is sudo required on all platforms? If not, don't include it here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed sudo from the command and added a comment below to clarify

@@ -48,7 +48,7 @@ This Quick Start guide is the TL;DR version of the longer [end-to-end guide](get
* Go to the branch: `git checkout <branch name>`

# Build AMP & run a local server
* Make sure you have the latest packages (after you pull): `yarn`
* Make sure you have the latest packages (after you pull): `npm install`
Copy link
Contributor

Choose a reason for hiding this comment

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

Another useful command is to run npm prune to make sure unnecessary dependencies are removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added it below in the "Create commits to contain your changes" section


* Install Gulp by running `yarn global add gulp`
* Install Gulp by running `sudo npm install -g gulp`
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment re: sudo. Many of our developers are on Mac OS and probably don't need to use it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Same

* Install [yarn](https://yarnpkg.com/en/docs/install)
* Install [npm](https://www.npmjs.com/get-npm)

* In your local repository directory (e.g. `~/src/ampproject/amphtml`), install the packages that AMP uses by running `npm install`
Copy link
Contributor

Choose a reason for hiding this comment

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

Make this consistent with what's below re: sudo. Also, for commands that will likely be copy-pasted by new developers, let's put them on a separate line, like it previously was.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -62,6 +62,7 @@ This Quick Start guide is the TL;DR version of the longer [end-to-end guide](get
# Create commits to contain your changes

* Edit files in your favorite editor
* If you edited `package.json` run `npm prune && npm install` to generated an updated `package-lock.json` file
Copy link
Member

Choose a reason for hiding this comment

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

to generate*

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


* Install Gulp by running `yarn global add gulp`
* Install Gulp by running `npm install -g gulp` (on some platforms this command might required elevated privileges using `sudo`)
Copy link
Member

Choose a reason for hiding this comment

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

might require*

Copy link
Member Author

Choose a reason for hiding this comment

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

Damn these fingers and their muscle memory 😝

Copy link
Contributor

@rsimha rsimha left a comment

Choose a reason for hiding this comment

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

LGTM after the typos pointed out by Erwin are fixed.

@dreamofabear
Copy link

Per the group chat, let's also bump our min node version in package.json to 4.7 and document somewhere that NPM >= 5 is required (perhaps as part of the warning in pr-check.js).

@rsimha
Copy link
Contributor

rsimha commented Sep 13, 2017

If you look at the Travis raw logs from your PR checks, you'll see:

$ node --version
v4.8.4
$ npm --version
2.15.11
$ nvm --version
0.33.4

This can be updated via the mechanism described in travis-ci/travis-ci#4653

@rsimha
Copy link
Contributor

rsimha commented Sep 13, 2017

With the latest changes in commit 4dd5998, I still see an old version of npm being used. https://travis-ci.org/ampproject/amphtml/jobs/275099764

I don't think adding an npm version to engines in .travis.yml is meant to work. I was referring to the workaround in travis-ci/travis-ci#4653 (comment).

I'll let @choumx comment on whether that will address the versioning concern he raised.

Copy link

@dreamofabear dreamofabear left a comment

Choose a reason for hiding this comment

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

I haven't checked that the versions in the new package-lock.json are the same as the versions in the deleted yarn.lock, but I assume this is ok. Right, @erwinmombay? 😄

package.json Outdated
@@ -5,7 +5,8 @@
"description": "Fastish HTML",
"main": "index.js",
"engines": {
"node": "^4.0.0"
"node": "^4.7.0",
"npm": "^5"

Choose a reason for hiding this comment

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

Nit: 5.0.0 to be consistent with semantic versioning.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


* Install [npm](https://www.npmjs.com/get-npm)
* Install [npm](https://www.npmjs.com/get-npm) version >= 5

Choose a reason for hiding this comment

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

Nit: Since installing node also installs npm, this should probably be "upgrade npm to version >= 5".

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, PTAL

@dreamofabear
Copy link

The last thing per our conversation with Raghu is to compare build timings for npm 5 vs yarn on Travis. Hopefully it's a negligible delta (or faster!).

Copy link
Member Author

@danielrozenberg danielrozenberg left a comment

Choose a reason for hiding this comment

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

Doesn't seem to have an effect on the running time of Travis


* Install [npm](https://www.npmjs.com/get-npm)
* Install [npm](https://www.npmjs.com/get-npm) version >= 5
Copy link
Member Author

Choose a reason for hiding this comment

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

Done, PTAL

package.json Outdated
@@ -5,7 +5,8 @@
"description": "Fastish HTML",
"main": "index.js",
"engines": {
"node": "^4.0.0"
"node": "^4.7.0",
"npm": "^5"
Copy link
Member Author

Choose a reason for hiding this comment

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

Done


* Install [yarn](https://yarnpkg.com/en/docs/install)
* If the version of [npm](https://www.npmjs.com/)` that was installed with NodeJS is lower than version 5, upgrade it by running `npm install -g npm@latest` (on some platforms this command might require elevated privileges using `sudo`)
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is badly formatted due to a stray backtick. (You can click the "view" button above this file in the "files changed" view to see what it will actually look like.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


* Install [yarn](https://yarnpkg.com/en/docs/install)
* If the version of [npm](https://www.npmjs.com/)` that was installed with NodeJS is lower than version 5, upgrade it by running `npm install -g npm@latest` (on some platforms this command might require elevated privileges using `sudo`)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Add a comma after "on some platforms"

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed the voice of this sentence:

  • on some platforms this command might require elevated privileges using sudo
  • this command might require elevated privileges using sudo on some platforms

@@ -62,6 +62,7 @@ This Quick Start guide is the TL;DR version of the longer [end-to-end guide](get
# Create commits to contain your changes

* Edit files in your favorite editor
* If you edited `package.json` run `npm prune && npm install` to generate an updated `package-lock.json` file
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Add a comma after "If you edited package.json"

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@rsimha
Copy link
Contributor

rsimha commented Sep 13, 2017

Re: build times, yarn used to take ~8 s, while npm install took ~16 s on the Travis run for this PR. This shouldn't be of huge concern, besides I'm sure it'll get faster in later runs with caching.

screenshot from 2017-09-13 13 13 16
screenshot from 2017-09-13 13 13 48

@dreamofabear
Copy link

👍 I was about to post that it's about 17 seconds slower including npm upgrade.

Travis had yarn caching, let's investigate separately how to do that for npm.

@rsimha
Copy link
Contributor

rsimha commented Sep 13, 2017

@choumx, we already cache node_modules. However, https://stackoverflow.com/questions/42521884/should-i-have-travis-cache-node-modules-or-home-npm recommends caching $HOME/.npm instead of node_modules.

@danielrozenberg, this can go in as a separate PR if you'd like :)

@danielrozenberg
Copy link
Member Author

Re: yarn vs npm caching - the Travis documentation you linked to says that the caching only applies if you set node version > 6, so the difference in timing might be unrelated. The node_modules is cached in .travis.yml, not sure how much it affects future PRs

@rsimha rsimha merged commit 2ebe918 into ampproject:master Sep 13, 2017
@danielrozenberg danielrozenberg deleted the un-yarn branch September 13, 2017 18:48
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.

None yet

6 participants