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

Replace npm with yarn #11332

Merged
merged 9 commits into from
Sep 20, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: node_js
sudo: required # See http://docs.travis-ci.com/user/trusty-ci-environment/
dist: trusty
node_js:
- "4.7"
- "4.8"
python:
- "2.7"
notifications:
Expand All @@ -15,7 +15,7 @@ before_install:
- sh -e /etc/init.d/xvfb start
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome*.deb
- npm install -g npm@'^5.0.0'
- yarn -v
before_script:
- pip install --user protobuf
- gem install percy-capybara phantomjs poltergeist
Expand Down Expand Up @@ -56,9 +56,3 @@ matrix:
username: "amphtml"
jwt:
secure: "Wze0F0vGL0UcxryOx1n/vcuD5LIMGyR+69Nc6IWLoRvZBbbIpFwVFhDE6rE9ranIXiA2Hc684N4sV8ASfNDF8RRSB+jyLov159qwgji2rBxIfQ/4kuDV2vYoAJvYMz8m42kwx5FV2VV9awqMMt8mwU3wYIrKIaVCxB34uV86KIlDlbrHxt17Bm5EIiUmwi9r1AAnW/63vVRUN264D77oB4j9UQ759PfD6BDwEt54O87KurNIaLseNCr1IvzfL8veEsZ3uTbLC1GtgHfR4IGgkS2YyN2QIk06VZWeRDEOalS3RcY0nDkbCmBywxIGObnrpEMzOpjBiOb2fxLoLvvpjlla5W84zJGfWE6q4T9IvkyHuDJE+sft5B+arjMIeA6PIeUhKdV27+6qqDEf7fILZ/U/Ekn9ds4zSV8hekAZPUyyPncOeyWppCIJ8sOeCrsebkRjH1BoX/d+FE+nP0bN/XkBpIi/nManx5FyS/kqjQWGKmvsFQfEWlSUaZi7XtEQEjvBizRkzvpJanSDaoiTDS2Keulmwii3XRId51FuGtnfDZFeggLaMTKGfBX9DlPkccwYAZe6vPNfYk1pNgEj6AtnifEhYVEO+aAuWhEnJ86od+1wDOL/h+a2XY6h8/gFBywsD95p7sXPfdVDCKgwagiBo+Hw5MNjztVF7lszg1A="
cache:
directories:
- node_modules
- .gem
pip: true
bundler: true
5 changes: 3 additions & 2 deletions build-system/SERVING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ limitations under the License.

## Requirements
- git
- node + npm
- node 4.8+
- gulp (installed globally)
- java 8
- yarn 1.0.2+ (see https://yarnpkg.com/)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Move this up the list, just below node, to reflect the order in which they are likely to be installed.

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


## Steps
```bash
git clone https://github.com/ampproject/amphtml.git
cd amphtml
# Checkout a tag
git checkout 123456789
npm install
yarn
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be yarn install? Or is yarn sufficient if there's a yarn.lock?

Copy link
Member Author

Choose a reason for hiding this comment

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

"yarn" == "yarn install", regardless of yarn.lock or not

https://yarnpkg.com/lang/en/docs/cli/install/

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool, thanks for checking!

gulp clean
# We only need to build the css files, no need to generate `max` files
gulp build --css-only
Expand Down
12 changes: 6 additions & 6 deletions build-system/pr-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,17 +381,17 @@ function main(argv) {
process.exit(1);
}

// Make sure changes to package.json also update package-lock.json.
if (files.indexOf('package.json') != -1 && files.indexOf('package-lock.json') == -1) {
// Make sure changes to package.json also update yarn.lock.
if (files.indexOf('package.json') != -1 && files.indexOf('yarn.lock') == -1) {
console.error(fileLogPrefix, util.colors.red('ERROR:'),
'Updates to', util.colors.cyan('package.json'),
'must be accompanied by a corresponding update to',
util.colors.cyan('package-lock.json'));
util.colors.cyan('yarn.lock'));
console.error(fileLogPrefix, util.colors.yellow('NOTE:'),
'To update', util.colors.cyan('package-lock.json'), 'after changing',
'To update', util.colors.cyan('yarn.lock'), 'after changing',
util.colors.cyan('package.json') + ',', 'run',
'"' + util.colors.cyan('npm purge && npm install') + '"',
'and include the change to', util.colors.cyan('package-lock.json'),
'"' + util.colors.cyan('yarn install') + '"',
'and include the change to', util.colors.cyan('yarn.lock'),
'in your PR.');
process.exit(1);
}
Expand Down
2 changes: 1 addition & 1 deletion contributing/DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Before you start developing in AMP, check out these resources:

For most developers the instructions in the [Getting Started Quick Start Guide](getting-started-quick.md) will be sufficient for building/running/testing during development. This section provides a more detailed reference.

The Quick Start Guide's [One-time setup](getting-started-quick.md#one-time-setup) has instructions for installing Node.js, npm, and Gulp which you'll need before running these commands.
The Quick Start Guide's [One-time setup](getting-started-quick.md#one-time-setup) has instructions for installing Node.js, yarn, and Gulp which you'll need before running these commands.

| Command | Description |
| ----------------------------------------------------------------------- | --------------------------------------------------------------------- |
Expand Down
16 changes: 8 additions & 8 deletions contributing/getting-started-e2e.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,20 @@ Now run `git remote -v` again and notice that you have set up your upstream alia

Now that you have all of the files copied locally you can actually build the code and run a local server to try things out.

amphtml uses Node.js, the npm package manager and the Gulp build system to build amphtml and start up a local server that lets you try out your changes. Installing these and getting amphtml built is straightforward:
amphtml uses Node.js, the Yarn package manager and the Gulp build system to build amphtml and start up a local server that lets you try out your changes. Installing these and getting amphtml built is straightforward:

* Install [NodeJS](https://nodejs.org/) version >= 4.7 (which includes npm)
* Install [NodeJS](https://nodejs.org/) version >= 4.8 (which includes npm)

* If the version of [npm](https://www.npmjs.com/) that was installed along with NodeJS is lower than 5 (check with `npm -v`), upgrade it by running
* Install [Yarn](https://yarnpkg.com/) version >= 1.0.2, follow the instructions on the website or install it with npm:
```
npm install -g npm@latest
npm install -g yarn@latest
```

The preceding command might require elevated privileges using `sudo` on some platforms.

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

Choose a reason for hiding this comment

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

Same question here, re: yarn vs. yarn install.

Copy link
Member Author

Choose a reason for hiding this comment

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

ACK

```

You should see a progress indicator and some messages scrolling by. You may see some warnings about optional dependencies that are generally safe to ignore.
Expand All @@ -177,10 +177,10 @@ amphtml uses Node.js, the npm package manager and the Gulp build system to build

* The AMP Project uses Gulp as our build system. Gulp uses a configuration file ([gulpfile.js](https://github.com/ampproject/amphtml/blob/master/gulpfile.js)) to build amphtml (including the amphtml javascript) and to start up the Node.js server with the proper settings. You don't really have to understand exactly what it is doing at this point--you just have to install it and use it.

You can install Gulp using npm:
You can install Gulp using Yarn:

```
npm install -g gulp
yarn global add gulp
```

The preceding command might require elevated privileges using `sudo` on some platforms.
Expand Down Expand Up @@ -278,7 +278,7 @@ The common workflow for making changes to files in Git is:

* edit some files using your favorite editor

* if you edited `package.json`, run `npm prune && npm install` to generate an updated `package-lock.json` file
* if you edited `package.json`, run `yarn install` to generate an updated `yarn.lock` file

* tell Git that you care about these changes by _staging_ them using the `git add` command

Expand Down
10 changes: 5 additions & 5 deletions contributing/getting-started-quick.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ This Quick Start guide is the TL;DR version of the longer [end-to-end guide](get

* [Install and set up Git](https://help.github.com/articles/set-up-git/); in the "Authenticating" step of that page use SSH instead of HTTPS

* Install [NodeJS](https://nodejs.org/) version >= 4.7
* Install [NodeJS](https://nodejs.org/) version >= 4.8

* 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` (this command might require elevated privileges using `sudo` on some platforms)
* Install [Yarn](https://yarnpkg.com/) version >= 1.0.2, follow the instructions on the website or install it with npm: `npm install -g yarn@latest` (this command might require elevated privileges using `sudo` on some platforms)

* Install Gulp by running `npm install -g gulp` (as before, this command might require `sudo`)
* Install Gulp by running `yarn global add gulp` (as before, this command might require `sudo`)

* Add this line to your hosts file (`/etc/hosts` on Mac or Linux, `%SystemRoot%\System32\drivers\etc\hosts` on Windows):

Expand All @@ -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): `npm install`
* Make sure you have the latest packages (after you pull): `yarn`
* Start the server: `gulp`
* Access your server at [http://localhost:8000](http://localhost:8000)
* Access your sample pages at [http://localhost:8000/examples](http://localhost:8000/examples)
Expand All @@ -62,7 +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
* If you edited `package.json`, run `yarn install` to generate an updated `yarn.lock` file
* Add each file you change: `git add <file>`
* Create a commit: `git commit -m "<your commit message>"`
* Instead of `add`ing each file individually you can use the `-a` flag on the commit instead
Expand Down
Loading