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

add yarn.lock file for deterministic builds #7041

Merged
merged 6 commits into from
Jan 25, 2017

Conversation

erwinmombay
Copy link
Member

@erwinmombay erwinmombay commented Jan 14, 2017

/to @dknecht as well for review

need to use yarn instead of npm install in deployment systems

@@ -56,7 +56,6 @@
"gulp-git": "1.7.2",
"gulp-help": "1.6.1",
"gulp-if": "2.0.0",
"gulp-image-diff": "0.3.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

had to remove this since it had compatibility issues. i dont think we use it right now anyways

@dknecht
Copy link
Contributor

dknecht commented Jan 14, 2017

Thanks. I assume this would have prevented #7039

cc / @ipostelnik

@aghassemi
Copy link
Contributor

@erwinmombay I assume yarn.lock is not picked up by npm and migrating from npm to yarn requires some work (e.g. updating CONTRIBUTING.md, SERVING.md, travis config and few scripts in package.json that still use npm.

Maybe we can start by a public INTENT TO IMPLEMENT: Switching from npm to yarn issue and take it from there?

@erwinmombay
Copy link
Member Author

@aghassemi yeah we will have to update docs for sure. I'll create an issue

@aghassemi
Copy link
Contributor

@erwinmombay I am more worried about the work involved in migrating travis config, few scripts in package.json and our internal release scripts to yarn than just the docs. Would be nice to do all that in a single PR after which everyone should switch to yarn.

@erwinmombay
Copy link
Member Author

the work on travis is pretty minimal the only tricky part is installing "yarn"

@erwinmombay erwinmombay force-pushed the add-yarn-lock branch 2 times, most recently from 93cfd99 to b3ceb33 Compare January 17, 2017 20:33
@@ -37,6 +37,7 @@ env:
- NPM_CONFIG_PROGRESS="false"

cache:
yarn: true
Copy link
Member Author

Choose a reason for hiding this comment

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

@aghassemi switched to yarn

Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

@erwinmombay erwinmombay force-pushed the add-yarn-lock branch 3 times, most recently from 0fb8c04 to 732e98e Compare January 18, 2017 06:52
@erwinmombay erwinmombay force-pushed the add-yarn-lock branch 2 times, most recently from d33fb6c to 1a23f67 Compare January 18, 2017 08:53
@ampprojectbot
Copy link
Member

Here is a list of owners that can approve this PR:

/to @cramforce

Owners can approve through the "APPROVED" label. If the author of the PR is an owner of the files or directory, the PR will be approved right away.

@cramforce
Copy link
Member

@ampprojectbot You will need a more optimistic profile image for me to approve this change!

@@ -207,6 +207,12 @@ function main(argv) {
return 0;
}

if (!(files.some(x => x === 'package.json') &&
Copy link
Contributor

Choose a reason for hiding this comment

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

The logic here fails if PR does not include either of them. We want logical XOR here. Maybe do:

if( files.includes('package.json') ? files.includes('yarn.lock') : !files.includes('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.

good catch. will fix

Copy link
Member Author

Choose a reason for hiding this comment

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

can you check my logic again. changed it to:

files.includes('package.json') ? !files.includes('yarn.lock') : false

we should be OK if yarn.lock is updated but package.json is not in instances where we re-pin nested deps. unlikely but i see it happen when running yarn update dep

@@ -207,6 +207,12 @@ function main(argv) {
return 0;
}

if (!(files.some(x => x === 'package.json') &&
files.some(x => x === 'yarn.lock'))) {
console.error(`\npr-check.js - please update through yarn.\n`);
Copy link
Contributor

Choose a reason for hiding this comment

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

pr-check.js - any update to package.json or yarn.lock must include the other file. Please update through yarn.

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.

@@ -24,7 +24,7 @@ require('./csvify-size');
require('./dep-check');
require('./get-zindex');
require('./lint');
require('./make-golden');
//require('./make-golden');
Copy link
Contributor

Choose a reason for hiding this comment

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

remove instead of commenting out?

Copy link
Member Author

Choose a reason for hiding this comment

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

will do

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.

@ampprojectbot
Copy link
Member

Here is a list of owners that can approve this PR:

/to @cramforce

Owners can approve through the "APPROVED" label. If the author of the PR is an owner of the files or directory, the PR will be approved right away.

@erwinmombay
Copy link
Member Author

bot logic was wrong. fixing here https://github.com/google/github-owners-bot/pull/7/files

@@ -207,6 +207,12 @@ function main(argv) {
return 0;
}

if (files.includes('package.json') ? !files.includes('yarn.lock') : false) {
Copy link
Contributor

@aghassemi aghassemi Jan 18, 2017

Choose a reason for hiding this comment

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

I think what I suggested previously was correct:

if has package.json => must also have yarn.lock, otherwise must NOT have 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.

will do

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.

@erwinmombay erwinmombay merged commit e9fd8e2 into ampproject:master Jan 25, 2017
jridgewell pushed a commit to jridgewell/amphtml that referenced this pull request Jan 31, 2017
* add yarn.lock file for deterministic builds

* switch travis to use yarn

* fix logic for package.json an yarn.lock check

* make sure that it also errors if only yarn.lock exists

* add back yarn.lock file

* update serving/building docs
mrjoro pushed a commit to mrjoro/amphtml that referenced this pull request Apr 28, 2017
* add yarn.lock file for deterministic builds

* switch travis to use yarn

* fix logic for package.json an yarn.lock check

* make sure that it also errors if only yarn.lock exists

* add back yarn.lock file

* update serving/building docs
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

Successfully merging this pull request may close these issues.

None yet

5 participants