Skip to content
This repository has been archived by the owner on Mar 1, 2020. It is now read-only.

cdnjs-importer 2.0.0 #13

Merged
merged 8 commits into from
Oct 5, 2015
Merged

cdnjs-importer 2.0.0 #13

merged 8 commits into from
Oct 5, 2015

Conversation

IonicaBizau
Copy link
Contributor

$ cdnjs-importer -h
Usage: cdnjs-importer [options]

Options:
  -g, --git-url <git-url>  Your library git url.                   
  -p, --path <path>        The path to your cdnjs local repository.
  -h, --help               Displays this help.                     
  -v, --version            Displays version information.           

Examples:
  cdnjs-importer -g git@github.com:IonicaBizau/gh.js.git # adds gh.js to cdnjs
  cdnjs-importer -g ... -p path/to/cdnjs

The default cdnjs repository location is in ~/cdnjs

Documentation can be found at https://github.com/IonicaBizau/cdnjs-importer

@IonicaBizau
Copy link
Contributor Author

@PeterDaveHello Could you please test it out? 😄

@PeterDaveHello
Copy link
Contributor

hmmmmmm ... I am afraid that I can not do it soon, but will do it after 2 weeks if you don't mind, currently working on some very important works, sorry.

@IonicaBizau
Copy link
Contributor Author

but will do it after 2 weeks if you don't mind

@PeterDaveHello So, could you test it out and give me feedback? 😄 I know time passes quickly. ⌛

@PeterDaveHello
Copy link
Contributor

oooooooops, 3 more days please ... btw, would you like to move this project to cdnjs organization?

@IonicaBizau
Copy link
Contributor Author

😄

btw, would you like to move this project to cdnjs organization?

@PeterDaveHello Sure! Maybe, can I get a little shiny donation? 😀

@PeterDaveHello
Copy link
Contributor

@IonicaBizau What does the donation actually mean here bro?

@IonicaBizau
Copy link
Contributor Author

@PeterDaveHello Some money on PayPal is always welcome! 😸

@PeterDaveHello
Copy link
Contributor

Ha, I really hope so I can do, but actually, I don't even get any money from this project yet.
@thomasdavis, will our income from ads export to my account soon?

@PeterDaveHello
Copy link
Contributor

cdnjs-importer/bin/cdnjs-importer -g git://github.com/ocombe/ocLazyLoad.git
Will not pass the test

@PeterDaveHello
Copy link
Contributor

Can not handle(even let the user know) conflicts, would you like to fix it in this version or not?

@IonicaBizau
Copy link
Contributor Author

cdnjs-importer/bin/cdnjs-importer -g git://github.com/ocombe/ocLazyLoad.git
Will not pass the test

I will check it out.

Can not handle(even let the user know) conflicts, would you like to fix it in this version or not?

It's better to fix it now since this is major release.

@IonicaBizau
Copy link
Contributor Author

@PeterDaveHello Why doesn't the above package pass the test?

@PeterDaveHello
Copy link
Contributor

Which one? Do you have its dump?

@IonicaBizau
Copy link
Contributor Author

@PeterDaveHello cdnjs-importer/bin/cdnjs-importer -g git://github.com/ocombe/ocLazyLoad.git -- don't have time to test it out, but having the error I can think where to fix it. 😄

@PeterDaveHello
Copy link
Contributor

I can not help without the dump, in fact, all the rules are in cdnjs's repo, you can check it out.

@IonicaBizau
Copy link
Contributor Author

The test error says:

Remove the first 2 spaces of each line and include blank line at end if you copy and paste this example

@PeterDaveHello I don't really understand why this appears -- I added the blank line at the end and removed the 2 spaces on each line, still, it appears. Why?

@PeterDaveHello
Copy link
Contributor

How about give me the raw/bump to debug!

@IonicaBizau
Copy link
Contributor Author

Okokok:

·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
···············································································································································································································✗·····················································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
·····································································································································································································································································
······················································································································································································································································               


    oclazyload                                                                                                                                                                                                                                                       
      ✗ oclazyload: format check                                                                                                                                                                                                                                     
        » oclazyload: package.json wrong format, correct one should be like this.                                                                                                                                                                                    
  (Remove the first 2 spaces of each line and include blank line at end if you copy and paste this example)                                                                                                                                                          
  {                                                                                                                                                                                                                                                                  
    "name": "oclazyload",                                                                                                                                                                                                                                            
    "version": "1.0.2",                                                                                                                                                                                                                                              
    "description": "Load modules on demand (lazy load) with angularJS",                                                                                                                                                                                              
    "main": "dist/ocLazyLoad.js",                                                                                                                                                                                                                                    
    "author": "Olivier Combe <olivier.combe@gmail.com>",                                                                                                                                                                                                             
    "license": "MIT",                                                                                                                                                                                                                                                
    "homepage": "https://github.com/ocombe/ocLazyLoad",                                                                                                                                                                                                              
    "directories": {                                                                                                                                                                                                                                                 
      "example": "examples"                                                                                                                                                                                                                                          
    },                                                                                                                                                                                                                                                               
    "repository": {                                                                                                                                                                                                                                                  
      "type": "git",                                                                                                                                                                                                                                                 
      "url": "git://github.com/ocombe/ocLazyLoad.git"                                                                                                                                                                                                                
    },                                                                                                                                                                                                                                                               
    "keywords": [                                                                                                                                                                                                                                                    
      "lazy load",                                                                                                                                                                                                                                                   
      "lazy-load",                                                                                                                                                                                                                                                   
      "load on demand",                                                                                                                                                                                                                                              
      "module",                                                                                                                                                                                                                                                      
      "angular",                                                                                                                                                                                                                                                     
      "angularJS"                                                                                                                                                                                                                                                    
    ],                                                                                                                                                                                                                                                               
    "bugs": {                                                                                                                                                                                                                                                        
      "url": "https://github.com/ocombe/ocLazyLoad/issues"                                                                                                                                                                                                           
    },                                                                                                                                                                                                                                                               
    "npmName": "oclazyload",                                                                                                                                                                                                                                         
    "npmFileMap": [                                                                                                                                                                                                                                                  
      {                                                                                                                                                                                                                                                              
        "basePath": "/dist",                                                                                                                                                                                                                                         
        "files": [                                                                                                                                                                                                                                                   
          "*/"                                                                                                                                                                                                                                                       
        ]                                                                                                                                                                                                                                                            
      }                                                                                                                                                                                                                                                              
    ],                                                                                                                                                                                                                                                               
    "filename": "modules"                                                                                                                                                                                                                                            
  }                                                                                                                                                                                                                                                                  

   // valid-packages-test.js:158                                                                                                                                                                                                                                     
  ✗ Broken » 14077 honored ∙ 1 broken (26.116s)                                                                                                                                                                                                                      
  npm ERR! Test failed.  See above for more details.                                                                                                                                                                                                                 
npm ERR! not ok code 0                              

@PeterDaveHello
Copy link
Contributor

Could you give the dump of package.json?

@IonicaBizau
Copy link
Contributor Author

$ cat ajax/libs/oclazyload/package.json                                                                                                                                                                                                   
{                                                                                                                                                                                                                                                                    
  "name": "oclazyload",                                                                                                                                                                                                                                              
  "version": "1.0.2",                                                                                                                                                                                                                                                
  "description": "Load modules on demand (lazy load) with angularJS",                                                                                                                                                                                                
  "main": "dist/ocLazyLoad.js",                                                                                                                                                                                                                                      
  "author": "Olivier Combe <olivier.combe@gmail.com>",                                                                                                                                                                                                               
  "license": "MIT",                                                                                                                                                                                                                                                  
  "homepage": "https://github.com/ocombe/ocLazyLoad",                                                                                                                                                                                                                
  "directories": {                                                                                                                                                                                                                                                   
    "example": "examples"                                                                                                                                                                                                                                            
  },                                                                                                                                                                                                                                                                 
  "repository": {                                                                                                                                                                                                                                                    
    "type": "git",                                                                                                                                                                                                                                                   
    "url": "git://github.com/ocombe/ocLazyLoad.git"                                                                                                                                                                                                                  
  },                                                                                                                                                                                                                                                                 
  "keywords": [                                                                                                                                                                                                                                                      
    "lazy load",                                                                                                                                                                                                                                                     
    "lazy-load",                                                                                                                                                                                                                                                     
    "load on demand",                                                                                                                                                                                                                                                
    "module",                                                                                                                                                                                                                                                        
    "angular",                                                                                                                                                                                                                                                       
    "angularJS"                                                                                                                                                                                                                                                      
  ],                                                                                                                                                                                                                                                                 
  "bugs": {                                                                                                                                                                                                                                                          
    "url": "https://github.com/ocombe/ocLazyLoad/issues"                                                                                                                                                                                                             
  },                                                                                                                                                                                                                                                                 
  "npmName": "oclazyload",                                                                                                                                                                                                                                           
  "npmFileMap": [                                                                                                                                                                                                                                                    
    {                                                                                                                                                                                                                                                                
      "basePath": "/dist",                                                                                                                                                                                                                                           
      "files": [                                                                                                                                                                                                                                                     
        "**/*"                                                                                                                                                                                                                                                       
      ]                                                                                                                                                                                                                                                              
    }                                                                                                                                                                                                                                                                
  ],                                                                                                                                                                                                                                                                 
  "filename": "modules"                                                                                                                                                                                                                                              
}                                                                                                                                                                                                                                                                    

@PeterDaveHello
Copy link
Contributor

What's its md5 hash? c158f5f8b6375f1599ea86a86e0a158f? 59b6e9b10e03bef47986b9cf1df18adf?

@IonicaBizau
Copy link
Contributor Author

@PeterDaveHello Hmm, how to calculate that hash?

$ md5sum ~/cdnjs/ajax/libs/oclazyload/package.json
3acaff315b09a6d75e6a340f466670dd  /home/ionicabizau/cdnjs/ajax/libs/oclazyload/package.json

@PeterDaveHello
Copy link
Contributor

Looks different, so I think you should better upload it to google drive or dropbox or somewhere else to let me download and test it, thanks!

@IonicaBizau
Copy link
Contributor Author

Isn't this enough?

$ cat ~/cdnjs/ajax/libs/oclazyload/package.json                                                                                                   
{
  "name": "oclazyload",
  "version": "1.0.2",
  "description": "Load modules on demand (lazy load) with angularJS",
  "main": "dist/ocLazyLoad.js",
  "author": "Olivier Combe <olivier.combe@gmail.com>",
  "license": "MIT",
  "homepage": "https://github.com/ocombe/ocLazyLoad",
  "directories": {
    "example": "examples"
  },
  "repository": {
    "type": "git",
    "url": "git://github.com/ocombe/ocLazyLoad.git"
  },
  "keywords": [
    "lazy load",
    "lazy-load",
    "load on demand",
    "module",
    "angular",
    "angularJS"
  ],
  "bugs": {
    "url": "https://github.com/ocombe/ocLazyLoad/issues"
  },
  "npmName": "oclazyload",
  "npmFileMap": [
    {
      "basePath": "/dist",
      "files": [
        "**/*"
      ]
    }
  ],
  "filename": "modules"
}

@PeterDaveHello
Copy link
Contributor

No is not. You can try to copy and paste, I can't get the same md5.

@IonicaBizau
Copy link
Contributor Author

@PeterDaveHello There you go! ⚡

@PeterDaveHello
Copy link
Contributor

hmmmm ... should remove the last blank line.

@IonicaBizau
Copy link
Contributor Author

@PeterDaveHello Pushed a fix to pull first from github/cdnjs/cdnjs and then to add the files. Do you have any idea how to save the file without adding that new line at the end?

It's just a JSON.stringify. On the other side, why is it so important not to have that new line at the end of the file (in cdnjs)?

@IonicaBizau
Copy link
Contributor Author

Actually, it should end with a new line character. Why?

@PeterDaveHello
Copy link
Contributor

We use JSON.stringify too, I think JSON.stringify didn't bite, see:

https://github.com/cdnjs/cdnjs/blob/master/auto-update.js#L185

        if (stable.is(version) && semver.gt(version, pkg.version)) {
          pkg.version = version;

          fs.writeFileSync(libPatha, JSON.stringify(pkg, null, 2) + '\n', 'utf8');
        }

https://github.com/cdnjs/autoupdate/blob/master/updaters/git.js#L60

            if(allFiles.length !==0 && stable.is(tag) && semver.gt(tag, package.version)){
              console.log('Updated package.json to version'.green, tag);
              var packagePath = path.normalize(path.join(__dirname, '../../cdnjs', 'ajax', 'libs', package.name, 'package.json')),
                packageJSON = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
              packageJSON.version = tag;
              fs.writeFileSync(packagePath, JSON.stringify(packageJSON, undefined, 2)  + '\n');
            } 

We don't have to have a empty new line at the end of file, that doesn't make sense, some coding style even disallow it, and most of the libs don't do that, for examples:
https://github.com/jquery/jquery/blob/master/package.json
https://github.com/uikit/uikit/blob/master/package.json
https://github.com/angular/angular.js/blob/master/package.json
https://github.com/emberjs/ember.js/blob/master/package.json

@IonicaBizau
Copy link
Contributor Author

fs.writeFileSync(libPatha, JSON.stringify(pkg, null, 2) + '\n', 'utf8');

Exactly! So I need to handle that little \n in w-json. Will push a fix soon.

@IonicaBizau
Copy link
Contributor Author

@PeterDaveHello Now it should work. The tests are passing. 😄

@PeterDaveHello
Copy link
Contributor

👍

@IonicaBizau
Copy link
Contributor Author

@PeterDaveHello If you like, we can move it in @cdnjs. 🎉 Got stable!

@PeterDaveHello
Copy link
Contributor

@IonicaBizau Let's do it. We can discuss the detail on gitter 👍

@IonicaBizau
Copy link
Contributor Author

Hey @PeterDaveHello @Piicksarn @maruilian11! ✨

Could you please test these changes and give me feedback? I'm going to release the new version this week. 🎉

@PeterDaveHello
Copy link
Contributor

hmmmm ... I need more time, working on other important issue right now.
I think we can release v2.0.0-betas right now.

@IonicaBizau IonicaBizau merged commit 453007e into master Oct 5, 2015
@IonicaBizau IonicaBizau deleted the new-version branch October 5, 2015 04:25
@IonicaBizau
Copy link
Contributor Author

@PeterDaveHello Good idea! cdnjs-importer@2.0.0-beta is out. 🎉

@PeterDaveHello
Copy link
Contributor

Nice 👍

@ryankirkman: @IonicaBizau wanna post the info about the new version of importer on twitter, would you please help him? I have no permission on it~

@IonicaBizau
Copy link
Contributor Author

@ryankirkman Yeah, an update would be welcome! 😄

@ryankirkman
Copy link
Member

Certainly gentlemen, here it is: https://twitter.com/cdnjs/status/650938062713688065

Thank you @IonicaBizau !

@PeterDaveHello
Copy link
Contributor

@ryankirkman thanks

@IonicaBizau
Copy link
Contributor Author

@ryankirkman @PeterDaveHello Thanks, guys! ✨

Sorry it took so long to release the new version.

@PeterDaveHello
Copy link
Contributor

@IonicaBizau no problem!

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.

3 participants