Giter Club home page Giter Club logo

libgrabber's Introduction

This project is no longer used.

The new jsDelivr backend automatically keeps all projects updated by pulling files directly from npm and github.

libgrabber's People

Contributors

aleksandara avatar bzmw avatar jangie avatar jimaek avatar mar10 avatar martinkolarik avatar megawac avatar thekondrashov avatar tombyrer avatar unboundev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libgrabber's Issues

Does libgrabber verify if files are new?

I found a project that seemed to fail to upload the new files after bumping a new release. 2 clues:

  • file dates are 2 weeks old after the new 0.3.1
  • top-line comment still reads the old 0.3.0 version.

I'd think it would be nice to at least warn of old files, so our admins won't push a non-update update when they're multitasking.

test scenario: upload fixes without SemVer update?

I noticed that project.js looks at SemVer to flag updates, which is great.

Should it be in scope to have a new update be pushed without a SemVer increase? Sometimes a dev might forget a minor change, then add it & push out an update with out feeling they need to increase the SemVer.

Support major.minor versions

Many smaller projects, particularly those of CSS and JavaScript such as hosted on jsDelivr, utilize a major.minor structure. Despite not being SemVer compliant per-se, libgrabber should probably support them.

The way I would do this is to detect the versions with only one dot separating two integers early on, and appending a second minor version to fix the detection of new versions, but use the original for the folder names in the projects.

Example

1.2 => 1.2.0
1.4.3 => 1.4.3

sub-subfolders listing

  • dist/*.js - copies javascript files from dist dir. Directory structure will not be retained (e.g. dist dir will be stripped when copied). To retain directory structure prepend glob with ./ e.g. ./dist/*.js

What happens if all files for consumption are inside dist, but they have a dist/vendors folder, & they want only the /vendors folder to be a directory in jsDelivr?

Follow redirects

For example this fails

{
  "packageManager": "github",
  "name": "matreshka",
  "repo": "finom/matreshka",
  "files": {
    "include": ["matreshka.min.js", "matreshka.js", "matreshka.min.map"]
  }
}

because finom/matreshka is now matreshkajs/matreshka

The bot should be able to follow the redirects and use the new repo names.

Are all files read for SemVer?

Eg: for "include": [ "thing.css", "thing..min.css", "thing.js", "thing.min.js"], if jquery.thing.js's SemVer is changed, then all files are uploaded to a new version on jsDelivr, even if the other files' versions aren't bumped? How about if a non-mainfile version is bumped like a CSS?

Could be a race condition if a PR is accepted before the min files are updated.

Git workflow

I'm interested in hearing your opinions about how libgrabber should approach with pushing project updates to git. My idea is that libgrabber doesn't work directly with jsdelivr/jsdelivr repo, but uses its own fork (with a separate github account). For example, let say that librabber found a new version in one of the projects, then it does following things:

  1. Creates local branch <project name>/<version>
  2. Adds project files to this branch
  3. Commits to branch
  4. Pushes branch to origin
  5. Removes local branch
  6. Creates pull request to merge remote branch <project name>/<version> into jsdelivr/jsdelivr

Every time libgrabber get scheduled to run, it merges changes from upstream (jsdelivr/jsdelivr). On the next execution it will not update same version again because the pull request is accepted by @jimaek and new version is found in the file system.

If the pull request is still not accepted, then libgrabber checks if there is a remote branch (<project name>/<version>) in its own fork and skips updating project again. This works rather well in cases when there is an error in update.json or a bug in libgrabber. You could just fix update.json and delete remote branch directly from github, libgrabber will then try to update the project again.

This is implemented as of now, with the exception of doing pull requests. There are couple of branches created in test jsdelivr fork https://github.com/aleksandarabot/jsdelivr/branches.

Please tell me your suggestions and improvements to this workflow.

Include folders

https://github.com/wavded/humane-js
How do we include the themes folder?

{
  "packageManager": "github",
  "name": "humane.js",
  "repo": "wavded/humane-js",
  "files": {
    "basePath": "/",
    "include": ["humane.min.js", "humane.js", "themes"]
  }
}

Doesnt work.

Updating using metadata/home/jsdelivr/files/humane.js/update.json
 Read metadata
 { metadata:
 { packageManager: 'github',
 name: 'humane.js',
 repo: 'wavded/humane-js',
 files:
 { basePath: '/',
 include:
 [ 'humane.min.js',
 'humane.js',
 'themes' ] },
 path: '/home/jsdelivr/files/humane.js' },
 versions:
 { localVersions: [ '3.0.6', '3.1.0' ],
 remoteVersions:
 [ '1.1.0',
 '1.2.0',
 '1.2.1',
 '1.3.0',
 '1.4.0',
 '2.0.0',
 '2.1.0',
 '2.1.1',
 '2.2.0',
 '2.2.5',
 '2.2.6',
 '2.2.7',
 '2.2.8',
 '2.5.0',
 '2.6.0',
 '2.7.0',
 '2.7.1',
 '2.7.2',
 '2.8.0',
 '2.8.1',
 '3.0.0',
 '3.0.1',
 '3.0.2',
 '3.0.3',
 '3.0.4',
 '3.0.5',
 '3.0.6',
 '3.1.0',
 '3.2.0' ],
 branchVersions: [] } }
Updating humane.js to 3.2.0
Copied 3 files
{ name: 'humane.js',
version: '3.2.0',
files:
[ '/home/jsdelivr/files/humane.js/3.2.0/humane.min.js',
'/home/jsdelivr/files/humane.js/3.2.0/humane.js',
'/home/jsdelivr/files/humane.js/3.2.0/themes' ] } 

And themes/* would simply add the contents of the folder.

Deprications and warnings

npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"4.4.3","npm":"2.15.1"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"4.4.3","npm":"2.15.1"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"4.4.3","npm":"2.15.1"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"4.4.3","npm":"2.15.1"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"4.4.3","npm":"2.15.1"})

Version aliasing doesn't point to the latest version

Hi there,
We've recently pushed the latest version of our javascript client: v2.6.6 and we'd like to make it available to our users through jsdelivr to always provide them our latest version, so they won't have to worry about minor updates.
We just discovered that aliases point to different versions, and not to the last one.

Latest version: 2.6.6 (added 13 days ago)
http://cdn.jsdelivr.net/algoliasearch/latest/algoliasearch.min.js -> 2.6.2
http://cdn.jsdelivr.net/algoliasearch/2/algoliasearch.min.js -> 2.6.5

Sounds like a caching issue. Could you please have a look into it.
Otherwise, can you tell me how often does the libgrabber bot crawle github repos?

Thanks,

auto-update repos' README?

Idea source

Likely a v2 thing, but could work something like this:

  1. Repo managers adds the Update.json
  2. When libbrabber hits their repo, it also grabs the README.*
  3. Looks for "CDN" or "jsDelivr" keywords
  4. If doesn't exist, then a PR is prepped to add instructions on how to use jsDelivr. Best as a subsection under "Usage" or "Download" if any. If not, before the "License" at the end.
  5. PR is pushed after the repo is active on the CDN.

Unfortunately, badges can't be used anymore for notifications.

Update.json file schema

When libgrabber checks if project is updated, it reads metadata from update.json. Metadata contains information like name of package, type of package manager (npm or bower), repository url (if project is not using package manager) and a list of files to be included or excluded.

For example, for a project that uses npm or bower:

{
  "packageManager": "npm" // "bower"
  "name": "lodash",
  "files": {
    "basePath": "dist/",
    "include": ["*.js"],
    "exclude": ["lodash.underscore.js", "lodash.underscore.min.js"]
  }
}

If the project is not using package manager, then the repository value identifies project location. For example:

{
  "repository": "https://github.com/lodash/lodash"
  "files": {
    "basePath": "dist/",
    "include": ["*.js"],
    "exclude": ["lodash.underscore.js", "lodash.underscore.min.js"]
  }
}

packageManager - type of package manager (npm or bower)
name - package name
repository - required if packageManager or name are not defined, refers to the project's git repository
files.basePath (optional) - base path to use when looking for resources
files.include (optional, multiple) - files or paths to include
files.exclude (optional, multiple) - files or paths to exclude

Includes/excludes might be specified using glob (see https://github.com/isaacs/node-glob).

Use NMM & bower instead of GitHub "Release"?

Besides getting project updates from github, libgrabber supports popular package managers npm and bower.

I assume now that this means NPM or Bower may be used only to flag new releases, instead of Releases?
And the files are still uploaded directly from GitHub?

name field is jsDelvr's folder?

name (required) - refers to package name on npm or Bower, or repo name when GitHub is used

Seems that name really reflects jsDelvr's folder name if you look at this example? If true, then I'll update.

Rename files

Is there any way to make the bot rename some files before pushing them?
This way we can make sure that all projects will follow our structure.

Discussion jsdelivr/jsdelivr#915

Create README

We need a detailed readme for this project describing how to install and use the tool for people that want to contribute code and for the authors how to keep their projects auto-updated.

Send an email when an update fails

For example chartist changed their structure and libgrabber stopped updating it.
The only way to see the problem is to read the logs

info: Updating chartist.js to v0.4.3
info: Copied 0 files name=chartist.js, version=v0.4.3, files=[]
warn: Something might be wrong with update.json name=chartist.js, version=v0.4.3

an other example

error: Error in reading metadata file /home/jsdelivr/files/underscore.string/update.json
warn: Failed to read metadata metadataPath=/home/jsdelivr/files/underscore.string/update.json,
error: Failed to update project /home/jsdelivr/files/underscore.string/update.json
error: Failed to update project

There needs to be a way to automatically notify the admin via email about a library that fails to update

Update projects with no local versions

If a project doesn't have any local versions then libgrabber should simply download the latest available.
Example:

files/jquery.cookie/
info.ini
update.json

This is going to be awesome as it doesnt require the author to fork jsDelivr and add an initial version. He can simply use Web GUI to add update.json and libgrabber will take care of the rest.

Faster updates with Webhooks

Lots of big projects want instant updates on our CDN.
Any ideas how to use Github's webhooks functionality to ping libgrabber every-time there is a new release and quickly update that project?

Check if remote project has tags

We accidentally added an update.json to a project that doesnt have any tagged releases. So libgrabber crashed. Can we catch this kind of errors and simply skip these projects?

Allow the bot to merge own PRs

If its possible it would help a lot to add a parameter to update.json.
Something like "auto-merge": true.
It can be enabled per project and if the bot sees it then it will automatically merge the PR for that project without waiting for a mod.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.