Skip to content
This repository was archived by the owner on Sep 7, 2020. It is now read-only.

Shorter load time & updated git to 2.13.5 - #13

Closed
marcelobern wants to merge 2 commits into
pimterry:masterfrom
marcelobern:master
Closed

marcelobern wants to merge 2 commits into
pimterry:masterfrom
marcelobern:master

Conversation

@marcelobern

@marcelobern marcelobern commented Nov 14, 2018 •

Copy link
Copy Markdown

Implemented

  • Resolved Reduced load time #12 (reduced load time) using bin-minify & lambda-bin.
  • Added stageGit.js to untar git and satge it with bin-minify.
  • Added config.js to ensure path consistency between stageGit.js and index.js while preventing API breaks and keeping run-time footprint as small as possible.
  • Updated git from 2.4.3 to 2.13.5 - now source controlling binaries minPack directly as well

Testing

  • Added eslint config file with rules from existing code, and fixed current code to adhere to this configuration.
  • Added mocah/chai testing.
  • Added coveralls.
  • Updated bats testing file - test case 3 not passing in Nodejs 10 & 11

CI

  • Updated Travis CI config file to add new Nodejs versions, drop old Nodejs versions, and include coveralls.
  • Added files section to package.json to avoid publishing the git tar file (and reduce module size).
  • Added prepublishOnly script to package.json to automate the staging of git binaries prior to npm publish.

Documentation

  • Created HOWTO.md with details for maintainers on how to update to new git versions and changing the code files.
  • Added CHANGELOG.md.
  • Edited README.md to format sample code and add NPM, Travis CI, and Coveralls badges.

- Updated git from 2.4.3 to 2.13.5
@marcelobern marcelobern mentioned this pull request Nov 14, 2018

@pimterry pimterry left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Awesome work! A few things I'd like to look at to simplify this first. I haven't dug into the finer details of this yet, I will try to find some details this week, but these are the main points that jumped out at me, which it'd be good to start with.

Comment thread index.js Outdated
}
}, error => {
reject(new Error(`lambda-git failed to load: ${error}`));
});

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

We shouldn't need to wrap a promise to manually call resolve/reject when we've already got a promise coming back from lambdaBinRuntime.applyMinPack. I think you can change this to something like:

function installGit(options) {
  options = options || {}; // (skip the new Promise)
  ...
  return lambdaBinRuntime.applyMinPack(targetDirectory).then(() => {
    ...
    // Now normal returns work fine, no resolve():
    return {
      binPath: binPath
      ...
    };
  });
  // no error => reject() needed - promise errors propagate automatically

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Will push this change once I hear back from you on the other items.

Comment thread gulpfile.js Outdated

const GIT_FILENAME = 'git-2.13.5.tar';

gulp.task('default', async (done) => {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why do we need gulp here? Could we make this a simple node script instead? Seems a little like overkill.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We could migrate it to its own script. That might require some work around error handling, which gulp is handling for us now.

As this is being invoked by npm (see package.json -> scripts -> prepublishOnly) error handling would need to work nicely there as well, so npm publish does not happen when prepublishOnly fails.

I am willing to give it a try or we could leave it as a future enhancement and release the current version sooner rather than later. Thoughts?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I do think it would be better to do this as a standalone script, and drop all those deps. If it's a lot of work it's ok, but it would be better if you've got time.

I'd be surprised if gulp is actually giving you much error handling here, and it shouldn't be necessary anyway - any stream that fires an error event without a specific handler will already crash the node process with a failing exit code immediately, and that should be sufficient to block publishing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done, stageGit.js worked from within npm run prepublishOnly

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

And now I remember why I was using gulp...

It was to bypass issues around filecompare running on Node 6 & 7...

I do not know what gulp is doing that fixes it but without it Travis CI Node 6 & 7 tests fail with error:

/home/node/app/node_modules/filecompare/lib/index.js:3
const fsread = require('util').promisify(fs.read);
                                ^
 
TypeError: require(...).promisify is not a function

I am open to suggestions here but if we do not find a quick fix I vote for keeping gulp and moving on...

Comment thread gulpfile.js Resolved
Comment thread gulpfile.js Resolved
Comment thread gulpfile.js Outdated

const GIT_FILENAME = 'git-2.13.5.tar';

gulp.task('default', async (done) => {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I do think it would be better to do this as a standalone script, and drop all those deps. If it's a lot of work it's ok, but it would be better if you've got time.

I'd be surprised if gulp is actually giving you much error handling here, and it shouldn't be necessary anyway - any stream that fires an error event without a specific handler will already crash the node process with a failing exit code immediately, and that should be sufficient to block publishing.

Comment thread package.json Resolved
- cleanup unnecessary Promise
- removed ./bin from git
- replaced gulp with stageGit.js
@marcelobern

Copy link
Copy Markdown
Author

@pimterry could you please let me know if you are ok with using gulp due to the issue with filecompare I shared a few weeks back?

I would like to close this PR and cross this off my to do list ;-)

@marcelobern

Copy link
Copy Markdown
Author

Closing this PR as it is no longer needed with the release of git-lambda-layer

@pimterry

Copy link
Copy Markdown
Owner

Sorry for the delay @marcelobern, I've been away. Totally agree that layers are a nicer more general solution to this, great to see that! I'll update the readme to link there, and deprecate this package.

pimterry added a commit that referenced this pull request Dec 19, 2018
Now that lambda layers are available, they provide a more general solution to this problem. See #13 for some context.
@ryanblock ryanblock reopened this Feb 14, 2019
@rarkins

rarkins commented May 9, 2019

Copy link
Copy Markdown

Any plans to continue this PR?

@ryanblock

Copy link
Copy Markdown
Collaborator

@rarkins seems like not, but it needs a reboot anyway. I'm well overdue to take a look at this, especially with Node 10 hitting Lambda this week (which breaks this package).

Gonna close.

@ryanblock ryanblock closed this May 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduced load time

4 participants