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
Switches to local shared-libs #5684
Conversation
afc5b4b
to
f95b9d0
Compare
Gruntfile.js
Outdated
@@ -815,7 +815,7 @@ module.exports = function(grunt) { | |||
// Build tasks | |||
grunt.registerTask('install-dependencies', 'Update and patch dependencies', [ | |||
'exec:undo-patches', | |||
'exec:npm-ci-shared-libs', | |||
'exec:npm-ci-shared-libs:production', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this to not pack
shared-libs dev dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this command is only ever called from here, so I think we should just hardcode --production
into the command above.
@@ -50,6 +50,7 @@ | |||
"grunt-sass": "^3.0.2", | |||
"grunt-text-replace": "^0.4.0", | |||
"grunt-xmlmin": "^0.1.8", | |||
"jasmine-spec-reporter": "^4.2.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes e2e jasmine spec reporting look pretty:
https://travis-ci.org/medic/medic/jobs/535893166#L3633 - successfull build
https://travis-ci.org/medic/medic/jobs/535888193#L3682 - deliberately failed build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
const PouchDB = require('pouchdb').defaults({ db: memdown }); | ||
const PouchDB = require('pouchdb-core'); | ||
PouchDB.plugin(require('pouchdb-adapter-memory')); | ||
PouchDB.plugin(require('pouchdb-mapreduce')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Runs integration tests with memory adapter instead of leveldown, so we don't need to build leveldown every time we install or test this dependency. Shaves ~3 minutes off the Travis build job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. Awesome!
@@ -238,7 +238,7 @@ const finalize = ({ change, results }, callback) => { | |||
// todo: how to handle a failed save? for now just | |||
// waiting until next change and try again. | |||
if (err) { | |||
logger.error(`error saving changes on doc ${change.id} seq ${change.seq}: ${JSON.stringify(err)}`); | |||
logger.error(`error saving changes on doc ${change.id} seq ${change.seq}: %o`, err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log(JSON.stringify(new Error('you would expect something else, right?')));
=> {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh.
e9be545
to
c595ec2
Compare
@@ -962,7 +962,6 @@ module.exports = function(grunt) { | |||
'static-analysis', | |||
'build', | |||
'build-admin', | |||
'install-dependencies', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find a good reason to install dependencies the second time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally. Must've been a bug...
@garethbowen could you please have a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. So many improvements in a single PR! I've made a few minor comments inline.
I'm a little concerned about destabilising 3.5.0 so near the finish line. Do you think it's worth holding off merging until 3.6.0?
I think we should have an issue created to track this. I think it could use a little AT to make sure the release works as expected. What do you think?
Gruntfile.js
Outdated
return getSharedLibDirs() | ||
.map( | ||
lib => | ||
`echo Installing shared library: ${lib} && | ||
(cd shared-libs/${lib} && npm ci)` | ||
(cd shared-libs/${lib} && npm ci ${production && '--production' || ''})` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a ternary would be clearer, eg: ${production ? '--production' : ''}
@@ -962,7 +962,6 @@ module.exports = function(grunt) { | |||
'static-analysis', | |||
'build', | |||
'build-admin', | |||
'install-dependencies', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally. Must've been a bug...
Gruntfile.js
Outdated
@@ -815,7 +815,7 @@ module.exports = function(grunt) { | |||
// Build tasks | |||
grunt.registerTask('install-dependencies', 'Update and patch dependencies', [ | |||
'exec:undo-patches', | |||
'exec:npm-ci-shared-libs', | |||
'exec:npm-ci-shared-libs:production', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this command is only ever called from here, so I think we should just hardcode --production
into the command above.
api/package.json
Outdated
"async": "^2.6.1", | ||
"bikram-sambat": "^1.5.0", | ||
"bikram-sambat": "1.5.0", | ||
"bikram-sambat-bootstrap": "1.4.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These versions should have a ^
, right?
@@ -50,6 +50,7 @@ | |||
"grunt-sass": "^3.0.2", | |||
"grunt-text-replace": "^0.4.0", | |||
"grunt-xmlmin": "^0.1.8", | |||
"jasmine-spec-reporter": "^4.2.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
const PouchDB = require('pouchdb').defaults({ db: memdown }); | ||
const PouchDB = require('pouchdb-core'); | ||
PouchDB.plugin(require('pouchdb-adapter-memory')); | ||
PouchDB.plugin(require('pouchdb-mapreduce')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. Awesome!
"object-path": "^0.11.4" | ||
}, | ||
"dependencies": { | ||
"object-path": "^0.11.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has moved most of the libs from devDependencies to dependencies - were they previously in the wrong place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Because I'm installing them with --production
, I needed them in the proper place (they're not dev dependencies).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome.
@@ -238,7 +238,7 @@ const finalize = ({ change, results }, callback) => { | |||
// todo: how to handle a failed save? for now just | |||
// waiting until next change and try again. | |||
if (err) { | |||
logger.error(`error saving changes on doc ${change.id} seq ${change.seq}: ${JSON.stringify(err)}`); | |||
logger.error(`error saving changes on doc ${change.id} seq ${change.seq}: %o`, err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh.
jasmineNodeOpts: { | ||
// makes default jasmine reporter not display dots for every spec | ||
print: () => {} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't like the dots?
Occasionally it's useful to know that the tests are still running.
Can we print the name of the test that's being executed instead of a dot? Potentially we could only print the name if in debug mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the dots, the dots along with the names look stange - the default reporter displays a .
for a successful test and an F
for a failure.
Together they look like this:
I do like the names, and I'd like to see them in my Travis builds.
This new reporter offers plenty of customization. Would you rather the name of the test be displayed at start and then a separate message upon success/failure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No that's perfect, without the dots! It's fairly easy to work out which test is running if you can see which test has just completed so leave it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff!
The code is good to go. Please raise a new issue covering your changes and schedule it for 3.6.0 (in AT) and it can be merged once 3.5.0 is out the door.
@garethbowen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The duration looks great. Good work!
fd31cb7
to
bceef58
Compare
Description
Changes transitions error reporting to not stringify errors.
Changes lineage lib to not require
pouchdb
and run integration tests with memory adapter, to avoid building leveldown every time we install or test the library.Changes packages for all apps so shared-libs are local again.
Adds jasmine reporter to improve e2e tests outputs.
#5694
Code review items
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.