From bf3b95deee92423517a2c21237cabaf51e91cf34 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Thu, 21 May 2015 00:34:44 +0800 Subject: [PATCH 01/36] if exist minified file, point to it --- lib/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/index.js b/lib/index.js index d204613..45705a5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -205,6 +205,13 @@ CdnJsImporter.prototype.add = function (lib, callback) { // Append the filename field used by cdnjs package.filename = files[0].replace(Path.join(repo.cwd, package.npmFileMap[0].basePath) + "/", ""); + temp = package.filename.split("."); + ext = temp.pop(); + temp.push("min"); + temp.push(ext); + if (IsThere.sync(Path.join(repo.cwd, package.npmFileMap[0].basePath) + "/" + temp.toString().replace(/\,/g, "."))) { + package.filename = temp.toString().replace(/\,/g, "."); + } // Create the package.json file in the cdnjs repository Logger.log("Writing the package.json file in " + libPath, "info"); FsExtra.writeJson(Path.join(libPath, PATH_PACK), package, function (err) { From 80414026b1cea31380a3b491e96e9c3318142dc3 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Thu, 21 May 2015 00:40:18 +0800 Subject: [PATCH 02/36] small refactor to make it easier to read in the part to handle filename field --- lib/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 45705a5..7c4864b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -169,6 +169,9 @@ CdnJsImporter.prototype.add = function (lib, callback) { var libPath = Path.join(self.root, package.name) , vPath = Path.join(libPath, package.version) + , pwd = Path.join(repo.cwd, package.npmFileMap[0].basePath) + "/"; + , temp + , ext ; // Create the version directory @@ -203,13 +206,13 @@ CdnJsImporter.prototype.add = function (lib, callback) { } // Append the filename field used by cdnjs - package.filename = files[0].replace(Path.join(repo.cwd, package.npmFileMap[0].basePath) + "/", ""); + package.filename = files[0].replace(pwd, ""); temp = package.filename.split("."); ext = temp.pop(); temp.push("min"); temp.push(ext); - if (IsThere.sync(Path.join(repo.cwd, package.npmFileMap[0].basePath) + "/" + temp.toString().replace(/\,/g, "."))) { + if (IsThere.sync(pwd + temp.toString().replace(/\,/g, "."))) { package.filename = temp.toString().replace(/\,/g, "."); } // Create the package.json file in the cdnjs repository From 05454c253cac56909de959d128d58720847c8320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Tue, 16 Jun 2015 21:30:54 +0300 Subject: [PATCH 03/36] Relicense --- LICENSE | 37 ++++++++++++++++++++----------------- package.json | 2 +- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/LICENSE b/LICENSE index ad4ac1b..ddd6036 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,24 @@ -The MIT License (MIT) +The KINDLY License +Copyright (c) 2015 Ionică Bizău -Copyright (c) 2015 Ionică Bizău +You have the permission to use this software, read its source code, modify and +redistribute it under the following terms: -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: + - if you want to use this software or include parts of its code in a + closed-source or commercial project you should kindly ask the + author (via a private message or email) and get a positive answer + - this license should be included in the modified versions of this software + - in case of redistributing modified copies, you are encouraged to clearly + indicate that the copies are based on this work + - if you think that your redistributed copy is awesome, you are encouraged to + show the author of this software what you did and how you helped the others -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +You are free to install and use this software on as many machines as you want, +free of charge, making sure you met the terms above. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +You are encouraged to kindly support the software and its author by: + + - sharing his/her work + - reporting issues/bugs and asking for feature requests + - donating money or any other things that can help the author + - contribute on the software code by fixing bugs and adding features diff --git a/package.json b/package.json index f807828..03ca810 100644 --- a/package.json +++ b/package.json @@ -43,4 +43,4 @@ "ul": "^2.1.0" }, "devDependencies": {} -} \ No newline at end of file +} From a4eab9472870653b82f6d6206d92ea3aab4cbb6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Tue, 16 Jun 2015 21:32:08 +0300 Subject: [PATCH 04/36] Updated dependencies --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 03ca810..1ccdf1a 100644 --- a/package.json +++ b/package.json @@ -30,17 +30,17 @@ "test": "test" }, "dependencies": { - "bug-killer": "^1.0.0", - "fs-extra": "^0.16.5", - "fs-plus": "2.7.0", + "bug-killer": "^3.0.0", + "fs-extra": "^0.19.0", + "fs-plus": "^2.8.1", "glob": "^5.0.3", "gry": "^2.1.0", - "is-there": "^1.1.0", + "is-there": "^4.0.0", "minimist": "^1.1.1", - "oargv": "^1.2.0", "mkdirp": "^0.5.0", - "tmp": "^0.0.25", - "ul": "^2.1.0" + "oargv": "^1.2.0", + "tmp": "0.0.26", + "ul": "^5.0.0" }, "devDependencies": {} } From 9088e4033ba502d11af98d6c967d82e723431a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 13:23:25 +0300 Subject: [PATCH 05/36] Use one-by-one to avoid the callback hell. --- lib/index.js | 282 +++++++++++++++++++++++++-------------------------- 1 file changed, 136 insertions(+), 146 deletions(-) diff --git a/lib/index.js b/lib/index.js index d204613..de81599 100644 --- a/lib/index.js +++ b/lib/index.js @@ -8,6 +8,12 @@ var Gry = require("gry") , Path = require("path") , Glob = require("glob") , Logger = require("bug-killer") + , OneByOne = require("one-by-one") + , Mkdirp = require("mkdirp") + , ReadJson = require("r-json") + , WriteJson = require("w-json") + , SameTime = require("same-time") + , Ncp = require("ncp") ; // Constants @@ -16,9 +22,6 @@ const PATH_LIBS = "/ajax/libs/" , PATH_PACK = "package.json" ; -// Configurations -Logger.config.displayDate = true; - /** * CdnJsImporter * Creates a new instance of `CdnJsImporter`. @@ -102,7 +105,14 @@ function CdnJsImporter (options, callback) { * @return {CdnJsImporter} The `CdnJsImporter` instance. */ CdnJsImporter.prototype.add = function (lib, callback) { - var self = this; + var self = this + , pack = {} + , i = 0 + , srcDir = "" + , cDir = null + , libPath = "" + , vPath = "" + ; // Handle strings if (typeof lib === "string") { @@ -115,30 +125,27 @@ CdnJsImporter.prototype.add = function (lib, callback) { dir: null }); - // Create a temp directory - Tmp.dir(function (err, path, cleanupCallback) { - - if (err) { - Logger.log("Failed to create temp directory: " + err.toString(), "error"); - return callback(err); + OneByOne([ + // Create tmp directory + Tmp.dir.bind(Tmp) + // Clone the library repo + , function (cb, path) { + Logger.log("Cloning " + lib.git + " into " + path, "info"); + self.repo = new Gry(path); + self.repo_path = path; + repo.exec(OArgv({ + _: [lib.git, "."] + }, "clone"), function (err) { + if (err) { return cb("Failed to clone the repository: " + err.toString()); } + cb(); + }); } - - // Clone the repository - Logger.log("Cloning " + lib.git + " into " + path, "info"); - var repo = new Gry(path); - repo.exec(OArgv({ _: [lib.git, "."]}, "clone"), function (err) { - - if (err) { - Logger.log("Failed to clone the repository: " + err.toString(), "error"); - return callback(err); - } + // Read the package.json file + , function (cb) { // Use the package.json - var pack = Path.join(path, PATH_PACK) - , i = 0 - , srcDir = path - , cDir = null - ; + pack = Path.join(self.repo_path, PATH_PACK); + srcDir = path; // Check if the package.json file exists // TODO Import from NPM @@ -158,135 +165,118 @@ CdnJsImporter.prototype.add = function (lib, callback) { } } - // Read the package.json file Logger.log("Set the source path: " + lib.dir, "info"); - FsExtra.readJson(pack, function (err, package) { - - if (err) { - Logger.log("Failed to read the package.json file: " + err.toString(), "error"); - return callback(err); + ReadJson(pack, function (err, package) { + if (err) { return callback(new Error("Failed to read the package.json file: " + err.toString())); } + cb(); + }); + } + // Create the version directory + , function (cb) { + libPath = Path.join(self.root, package.name); + vPath = Path.join(libPath, package.version); + + // Create the version directory + Logger.log("Creating the version directory: " + vPath, "info"); + + // Append the auto-update fields + package.npmName = package.name; + package.npmFileMap = lib.map || [ + { + basePath: lib.dir + , files: ["**/*"] } + ]; - var libPath = Path.join(self.root, package.name) - , vPath = Path.join(libPath, package.version) - ; - - // Create the version directory - Logger.log("Creating the version directory: " + vPath, "info"); - FsExtra.mkdirp(vPath, function (err) { - - if (err) { - Logger.log("Failed to create the version directory: " + err.toString(), "error"); - return callback(err); - } - - // Append the auto-update fields - package.npmName = package.name; - package.npmFileMap = lib.map || [ - { - basePath: lib.dir - , files: ["**/*"] - } - ]; - - - // Get the library files - Logger.log("Getting the library files.", "info"); - - // TODO Handle the whole array - var basePath = Path.join(path, package.npmFileMap[0].basePath, package.npmFileMap[0].files[0]); - Glob(basePath, function (err, files) { - - if (err) { - Logger.log("Failed to get the library files: " + err.toString(), "error"); - return callback(err); - } - - // Append the filename field used by cdnjs - package.filename = files[0].replace(Path.join(repo.cwd, package.npmFileMap[0].basePath) + "/", ""); - - // Create the package.json file in the cdnjs repository - Logger.log("Writing the package.json file in " + libPath, "info"); - FsExtra.writeJson(Path.join(libPath, PATH_PACK), package, function (err) { - - if (err) { - Logger.log("Failed to create the package.json file: " + err.toString(), "error"); - return callback(err); - } - - /*! - * copyDone - * This function is called when the copying of the files is done. - * - * @name copyDone - * @function - * @param {Error|null} err The error value. - * @return {undefined} - */ - function copyDone(err) { - - if (err) { - Logger.log("Failed to copy the library files: " + err.toString(), "error"); - return callback(err); - } - - // Add the files - Logger.log("Adding the new library files in the git repository.", "info"); - self.git.exec("add . -A", function (err) { - - if (err) { - Logger.log("Failed to add the files: " + err.toString(), "error"); - return callback(err); - } - - // Commit the changes - Logger.log("Committing the changes", "info"); - var message = "Added " + package.name + "@" + package.version; - self.git.commit(message, function (err) { - - if (err) { - Logger.log("Failed to commit the changes: " + err.toString(), "error"); - return callback(err); - } + Mkdirp(vPath, cb); + } + // Fetch the needed files + , function (cb) { + // Get the library files + Logger.log("Getting the library files.", "info"); - // Done - Logger.log(message, "info"); - callback(); - }); - }); - } + // TODO Handle the whole array + var basePath = Path.join(path, package.npmFileMap[0].basePath, package.npmFileMap[0].files[0]); - /*! - * copySeq - * Copies the provided file into the cdnjs repository. - * - * @name copySeq - * @function - * @param {Number|undefined} c The current index of the file. - * @return {undefined} - */ - function copySeq(c) { - c = c || 0; - var cPath = files[c]; - if (!cPath) { - return copyDone(); - } + Glob(basePath, function (err, files) { + if (err) { return cb(new Error("Failed to get the library files: " + err.toString())); } - FsExtra.copy(cPath, Path.join(vPath, cPath.split("/").pop()), function (err) { - if (err) { return copyDone(err); } - copySeq(c + 1); - }); - } + // Append the filename field used by cdnjs + package.filename = files[0].replace(Path.join(repo.cwd, package.npmFileMap[0].basePath) + "/", ""); + cb(); + }); + } + // Write the package.json file + , function (cb) { + // Create the package.json file in the cdnjs repository + Logger.log("Writing the package.json file in " + libPath, "info"); + + WriteJson(Path.join(libPath, PATH_PACK), package, function (err) { + if (err) { return cb(new Error("Failed to create the package.json file: " + err.toString())); } + cb(); + }); + } + // Copy the library files + , function (cb) { + Logger.log("Copying the library files", "info"); + SameTime(files.map(function (cPath) { + return Ncp.bind(this, cPath, Path.join(vPath, cPath.split("/").pop())); + }), function (err) { + if (err) { + Logger.log("Failed to copy the library files: " + err.toString(), "error"); + return cb(err); + } + cb(); + }); + } + // Checkout the master branch + , function (cb) { + Logger.log("Checking out the master branch.", "info"); + cb(); + } + , self.git.exec.bind(self.git, "git checkout master") + // Pull from github/cdnjs/cdnjs + , function (cb) { + Logger.log("Pulling from origin.", "info"); + cb(); + } + , self.git.exec.bind(self.git, "git pull origin master") + // Create the new branch + , function (cb) { + Logger.log("Creating a new branch for your library.", "info"); + cb(); + } + , self.git.exec.bind(self.git, OArgv({ + _: "importer-" + pack.name + , b: true + }, "git checkout")) + // Add files + , function (cb) { + Logger.log("Adding the new library files in the git repository.", "info"); + self.git.exec("add . -A", function (err) { + if (err) { + Logger.log("Failed to add the files: " + err.toString(), "error"); + return cb(err); + } + cb(); + }); + } + // Commit the changes + , function (cb) { + Logger.log("Committing the changes", "info"); + var message = "Added " + package.name + "@" + package.version; + self.git.commit(message, function (err) { + if (err) { + Logger.log("Failed to commit the changes: " + err.toString(), "error"); + return cb(err); + } - // Copy the files - Logger.log("Copying the library files", "info"); - copySeq(); - }); - }); - }); + // Done + Logger.log(message, "info"); + cb(); }); - }) - }); + } + ], callback); }; module.exports = CdnJsImporter; From 7c32b8a630f51ec33aedfc51006ea196da860120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 13:41:17 +0300 Subject: [PATCH 06/36] Fixed #9. Use the CLP parser --- bin/cdnjs-importer | 66 ++++++++++++++++++++++++++-------------------- lib/index.js | 2 +- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/bin/cdnjs-importer b/bin/cdnjs-importer index 677042f..66f7ae8 100755 --- a/bin/cdnjs-importer +++ b/bin/cdnjs-importer @@ -2,50 +2,60 @@ // Dependencies var CdnJsImporter = require("../lib") - , Minimist = require("minimist") , Ul = require("ul") , Path = require("path") , Logger = require("bug-killer") , IsThere = require("is-there") - , Fs = require("fs-plus") + , Clp = require("clp") + , Package = require("../package") ; -// Parse arguments -var argv = Minimist(process.argv.slice(2)); +// Parse the command line arguments +var gitUrlOpt = new CLP.Option(["g", "git-url"], "Your library git url.", "git-url") + , pathOpt = new CLP.Option(["p", "path"], "The path to your cdnjs local repository.", "path", Path.join(Ul.home(), "cdnjs")) + , parser = new CLP({ + name: "CDNJS Importer" + , version: Package.version + , exe: Package.name + , examples: [ + "cdnjs-importer -i git@github.com:IonicaBizau/gh.js.git # adds gh.js to cdnjs" + , "cdnjs-importer -i ... -p path/to/cdnjs" + ] + , docs_url: Package.homepage + , notes: "The default cdnjs repository location is in ~/cdnjs" + , process: true + }, [ + gitUrlOpt + , pathOpt + ]) + ; -// Constants -const CDNJS_ROOT = argv.c ? argv.c : Path.join(Ul.USER_DIR, "cdnjs"); +// Invalid git url +if (!gitUrlOpt.value) { + return console.log(parser.displayHelp()); +} + +// Resolve the path to the cdnjs repo +if (pathOpt.is_provided) { + pathOpt.value = Path.resolve(pathOpt.value.replace("~", Ul.home())); +} // Check if the repository exists and display friendly messages -if (!IsThere.sync(CDNJS_ROOT)) { - Logger.config.displayDate = false; - Logger.config.logLevel = 4; +if (!IsThere(pathOpt.value)) { Logger.log("Couldn't find the CDNJS repository in this path: " + CDNJS_ROOT, "error"); Logger.log("Use `git clone git@github.com:cdnjs/cdnjs.git ~/cdnjs` to clone it.", "info"); - Logger.log("If you already cloned it in another location, please provide the path to that location using `cdnjs-importer -c path/to/cdnjs`", "info"); + Logger.log("If you already cloned it in another location, please provide the path to that location using `cdnjs-importer -p path/to/cdnjs`", "info"); return; } // Import the repositories var importer = CdnJsImporter({ - cdnjs: Fs.normalize(CDNJS_ROOT) + cdnjs: pathOpt.value , debug: true - , libs: [] + , libs: [ + gitUrlOpt.value + ] }, function (err) { - console.log(err); + if (err) { return Logger.log(err); } + Logger.log("Successfully done. Now you have to push your changes on GitHub and raise a pull request."); }); - -function seq(i) { - i = i || 0; - - var cLib = argv._[i]; - if (!cLib) { - return Logger.log("Done.", "info"); - } - - importer.add(cLib, function (err) { - seq(i + 1); - }); -} - -seq(); diff --git a/lib/index.js b/lib/index.js index de81599..23b39f2 100644 --- a/lib/index.js +++ b/lib/index.js @@ -51,7 +51,7 @@ function CdnJsImporter (options, callback) { callback = callback || function (err) {}; // Debug mode - Logger.config.logLevel = options.debug === true + Logger.config.level = options.debug === true ? 4 : (typeof options.debug === "number" ? options.debug : 0) From ce21118cb4117ce29875a8dbbb17dec547c12669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 13:47:13 +0300 Subject: [PATCH 07/36] Fixed the variable name --- bin/cdnjs-importer | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/cdnjs-importer b/bin/cdnjs-importer index 66f7ae8..37ea3b3 100755 --- a/bin/cdnjs-importer +++ b/bin/cdnjs-importer @@ -11,9 +11,9 @@ var CdnJsImporter = require("../lib") ; // Parse the command line arguments -var gitUrlOpt = new CLP.Option(["g", "git-url"], "Your library git url.", "git-url") - , pathOpt = new CLP.Option(["p", "path"], "The path to your cdnjs local repository.", "path", Path.join(Ul.home(), "cdnjs")) - , parser = new CLP({ +var gitUrlOpt = new Clp.Option(["g", "git-url"], "Your library git url.", "git-url") + , pathOpt = new Clp.Option(["p", "path"], "The path to your cdnjs local repository.", "path", Path.join(Ul.home(), "cdnjs")) + , parser = new Clp({ name: "CDNJS Importer" , version: Package.version , exe: Package.name From 7fcc71c047cdb8f3719807dabbac0b906dc9aca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 13:47:22 +0300 Subject: [PATCH 08/36] Removed fs-extra --- lib/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 23b39f2..25efc9c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -4,7 +4,6 @@ var Gry = require("gry") , Ul = require("ul") , Tmp = require("tmp") , OArgv = require("oargv") - , FsExtra = require("fs-extra") , Path = require("path") , Glob = require("glob") , Logger = require("bug-killer") From 6dca088aaee684d30b81aa592e04e95a8797ee75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 13:47:47 +0300 Subject: [PATCH 09/36] Updated dependencies --- package.json | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 1ccdf1a..7db9a8c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cdnjs-importer", - "version": "1.4.1", + "version": "2.0.0", "description": "Easy way to import a library into CDNJS.", "main": "lib/index.js", "bin": { @@ -29,18 +29,22 @@ "directories": { "test": "test" }, + "devDependencies": {}, "dependencies": { "bug-killer": "^3.0.0", - "fs-extra": "^0.19.0", - "fs-plus": "^2.8.1", - "glob": "^5.0.3", - "gry": "^2.1.0", + "clp": "^3.0.0", + "glob": "^5.0.10", + "gry": "^4.0.0", "is-there": "^4.0.0", "minimist": "^1.1.1", - "mkdirp": "^0.5.0", - "oargv": "^1.2.0", - "tmp": "0.0.26", - "ul": "^5.0.0" - }, - "devDependencies": {} + "mkdirp": "^0.5.1", + "ncp": "^2.0.0", + "oargv": "^2.0.0", + "one-by-one": "^2.0.0", + "r-json": "^1.0.0", + "same-time": "^2.0.0", + "tmp": "^0.0.26", + "ul": "^5.0.0", + "w-json": "^1.0.0" + } } From 15b468f34357e7d8454aee042a3483736de466a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 13:49:20 +0300 Subject: [PATCH 10/36] Updated is-there api --- lib/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/index.js b/lib/index.js index 25efc9c..6ec2647 100644 --- a/lib/index.js +++ b/lib/index.js @@ -60,7 +60,7 @@ function CdnJsImporter (options, callback) { // Check if the cdnjs exists self.root = options.cdnjs + PATH_LIBS; - if (!IsThere.sync(self.root)) { + if (!IsThere(self.root)) { return callback(new Error("The cdnjs library directory doesn't exist.")); } @@ -148,7 +148,7 @@ CdnJsImporter.prototype.add = function (lib, callback) { // Check if the package.json file exists // TODO Import from NPM - if (!IsThere.sync(pack)) { + if (!IsThere(pack)) { return callback(new Error("package.json is required.")); } @@ -156,7 +156,7 @@ CdnJsImporter.prototype.add = function (lib, callback) { if (!lib.dir) { for (; i < PATH_DIST.length; ++i) { cDir = path + PATH_DIST[i]; - if (IsThere.sync(cDir)) { + if (IsThere(cDir)) { srcDir = cDir; lib.dir = PATH_DIST[i] break; From 39c4d9ccdce61c069dd9ecb85126c3aa2ae43c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 13:51:45 +0300 Subject: [PATCH 11/36] Use same time when handling the libs --- lib/index.js | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/lib/index.js b/lib/index.js index 6ec2647..1470034 100644 --- a/lib/index.js +++ b/lib/index.js @@ -67,27 +67,11 @@ function CdnJsImporter (options, callback) { // Create a gry instance in the cdnjs repository self.git = new Gry(self.root); - var res = { - err: [] - , data: [] - } - , c = 0 - , handler = function (lib, i) { - self.add(lib, function (err, data) { - res.err[i] = err; - res.data[i] = data; - if (++c === options.libs.length) { - if (res.err.length) { - callback(res); - } - } - }); - } - ; - - options.libs.forEach(function (cLib, i) { - handler(cLib, i); - }); + if (options.libs.length) { + SameTime(options.libs.map(function (cLib) { + return self.add.bind(self, cLib); + }, callback); + } } /** From 9c5055c1fd98aad2bbebf288af7ac4949a02374c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 13:52:05 +0300 Subject: [PATCH 12/36] Fixed syntax --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 1470034..6a07a3b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -70,7 +70,7 @@ function CdnJsImporter (options, callback) { if (options.libs.length) { SameTime(options.libs.map(function (cLib) { return self.add.bind(self, cLib); - }, callback); + }), callback); } } From a18c46116d31f848ec3f9ea971f92ffed28d59d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 13:52:44 +0300 Subject: [PATCH 13/36] Fixed the repo reference --- lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 6a07a3b..a36c183 100644 --- a/lib/index.js +++ b/lib/index.js @@ -116,7 +116,7 @@ CdnJsImporter.prototype.add = function (lib, callback) { Logger.log("Cloning " + lib.git + " into " + path, "info"); self.repo = new Gry(path); self.repo_path = path; - repo.exec(OArgv({ + self.repo.exec(OArgv({ _: [lib.git, "."] }, "clone"), function (err) { if (err) { return cb("Failed to clone the repository: " + err.toString()); } @@ -185,7 +185,7 @@ CdnJsImporter.prototype.add = function (lib, callback) { if (err) { return cb(new Error("Failed to get the library files: " + err.toString())); } // Append the filename field used by cdnjs - package.filename = files[0].replace(Path.join(repo.cwd, package.npmFileMap[0].basePath) + "/", ""); + package.filename = files[0].replace(Path.join(self.repo.cwd, package.npmFileMap[0].basePath) + "/", ""); cb(); }); } From ebeaeaeef4d705f0d13d6bcb107770c887f2ad74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 14:07:10 +0300 Subject: [PATCH 14/36] Fixed branch name --- lib/index.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/index.js b/lib/index.js index a36c183..d229060 100644 --- a/lib/index.js +++ b/lib/index.js @@ -95,6 +95,9 @@ CdnJsImporter.prototype.add = function (lib, callback) { , cDir = null , libPath = "" , vPath = "" + , package = {} + , path = "" + , files = [] ; // Handle strings @@ -112,7 +115,8 @@ CdnJsImporter.prototype.add = function (lib, callback) { // Create tmp directory Tmp.dir.bind(Tmp) // Clone the library repo - , function (cb, path) { + , function (cb, tmpPath) { + path = tmpPath; Logger.log("Cloning " + lib.git + " into " + path, "info"); self.repo = new Gry(path); self.repo_path = path; @@ -149,8 +153,9 @@ CdnJsImporter.prototype.add = function (lib, callback) { } Logger.log("Set the source path: " + lib.dir, "info"); - ReadJson(pack, function (err, package) { + ReadJson(pack, function (err, pack) { if (err) { return callback(new Error("Failed to read the package.json file: " + err.toString())); } + package = pack; cb(); }); } @@ -181,8 +186,9 @@ CdnJsImporter.prototype.add = function (lib, callback) { // TODO Handle the whole array var basePath = Path.join(path, package.npmFileMap[0].basePath, package.npmFileMap[0].files[0]); - Glob(basePath, function (err, files) { + Glob(basePath, function (err, libFiles) { if (err) { return cb(new Error("Failed to get the library files: " + err.toString())); } + files = libFiles; // Append the filename field used by cdnjs package.filename = files[0].replace(Path.join(self.repo.cwd, package.npmFileMap[0].basePath) + "/", ""); @@ -217,22 +223,21 @@ CdnJsImporter.prototype.add = function (lib, callback) { Logger.log("Checking out the master branch.", "info"); cb(); } - , self.git.exec.bind(self.git, "git checkout master") + , self.git.exec.bind(self.git, "checkout master") // Pull from github/cdnjs/cdnjs , function (cb) { Logger.log("Pulling from origin.", "info"); cb(); } - , self.git.exec.bind(self.git, "git pull origin master") + , self.git.exec.bind(self.git, "pull origin master") // Create the new branch , function (cb) { Logger.log("Creating a new branch for your library.", "info"); - cb(); + self.git.exec(OArgv({ + _: "importer-" + package.name + , b: true + }, "checkout"), cb) } - , self.git.exec.bind(self.git, OArgv({ - _: "importer-" + pack.name - , b: true - }, "git checkout")) // Add files , function (cb) { Logger.log("Adding the new library files in the git repository.", "info"); From ea69a9b090a30f583e4bf9e2d92ddfe87b70cdca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 14:07:32 +0300 Subject: [PATCH 15/36] Include the version name as well --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index d229060..ffd7706 100644 --- a/lib/index.js +++ b/lib/index.js @@ -234,7 +234,7 @@ CdnJsImporter.prototype.add = function (lib, callback) { , function (cb) { Logger.log("Creating a new branch for your library.", "info"); self.git.exec(OArgv({ - _: "importer-" + package.name + _: "importer-" + package.name + "@" + package.version , b: true }, "checkout"), cb) } From 5eb1b53c36814783575f77158da2834510ffd15d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 14:07:46 +0300 Subject: [PATCH 16/36] Use minus instead of @ --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index ffd7706..be55924 100644 --- a/lib/index.js +++ b/lib/index.js @@ -234,7 +234,7 @@ CdnJsImporter.prototype.add = function (lib, callback) { , function (cb) { Logger.log("Creating a new branch for your library.", "info"); self.git.exec(OArgv({ - _: "importer-" + package.name + "@" + package.version + _: "importer-" + package.name + "-" + package.version , b: true }, "checkout"), cb) } From cd8fa25116da4199082d19711fab4155c1ccfa80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 14:11:38 +0300 Subject: [PATCH 17/36] Error message --- bin/cdnjs-importer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdnjs-importer b/bin/cdnjs-importer index 37ea3b3..8ecd013 100755 --- a/bin/cdnjs-importer +++ b/bin/cdnjs-importer @@ -56,6 +56,6 @@ var importer = CdnJsImporter({ gitUrlOpt.value ] }, function (err) { - if (err) { return Logger.log(err); } + if (err) { return Logger.log(err, "error"); } Logger.log("Successfully done. Now you have to push your changes on GitHub and raise a pull request."); }); From 8a960c566005a7cef89acb791e9592a6375e9149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 14:18:28 +0300 Subject: [PATCH 18/36] Check for autoupdate --- lib/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/index.js b/lib/index.js index be55924..9ee3148 100644 --- a/lib/index.js +++ b/lib/index.js @@ -195,6 +195,16 @@ CdnJsImporter.prototype.add = function (lib, callback) { cb(); }); } + // Remove duplicate autoupdate + , function (cb) { + Logger.log("Checking if autoupdate config exists."); + if (package.autoupdate) { + Logger.log("Found autoupdate in package.json. Removing npmName and npmFileMap.", "warn"); + delete package.npmName; + delete package.npmFileMap; + } + cb(); + } // Write the package.json file , function (cb) { // Create the package.json file in the cdnjs repository From cb5c0b86fc9cd4fb102c74782947484b6e57346d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 16:27:40 +0300 Subject: [PATCH 19/36] Minor fixes --- lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 6550427..0352885 100644 --- a/lib/index.js +++ b/lib/index.js @@ -185,7 +185,7 @@ CdnJsImporter.prototype.add = function (lib, callback) { // TODO Handle the whole array var basePath = Path.join(path, package.npmFileMap[0].basePath, package.npmFileMap[0].files[0]) - , pwd = Path.join(repo.cwd, package.npmFileMap[0].basePath) + "/" + , pwd = Path.join(self.repo.cwd, package.npmFileMap[0].basePath) + "/" , tmp = null , ext = null ; @@ -202,7 +202,7 @@ CdnJsImporter.prototype.add = function (lib, callback) { temp.push("min"); temp.push(ext); - if (IsThere.sync(pwd + temp.join("."))) { + if (IsThere(pwd + temp.join("."))) { package.filename = temp.join("."); } From 850c5b3bb43ef5cbaf0cb92bca80bdb6aa8d4a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 16:39:31 +0300 Subject: [PATCH 20/36] Removed minimist as dependency --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 7db9a8c..a9aebe3 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "glob": "^5.0.10", "gry": "^4.0.0", "is-there": "^4.0.0", - "minimist": "^1.1.1", "mkdirp": "^0.5.1", "ncp": "^2.0.0", "oargv": "^2.0.0", From 3db1c57d19b75c1520e65ffc59c255e593c66c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 16:42:37 +0300 Subject: [PATCH 21/36] Docs --- .blah/README.ejs | 112 +++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 2 +- CONTRIBUTING.md | 60 +++++++++++++++++++++++++ README.md | 78 +++++++++++++++------------------ package.json | 3 ++ 5 files changed, 211 insertions(+), 44 deletions(-) create mode 100644 .blah/README.ejs create mode 100644 CONTRIBUTING.md diff --git a/.blah/README.ejs b/.blah/README.ejs new file mode 100644 index 0000000..c970e91 --- /dev/null +++ b/.blah/README.ejs @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + +<% // Dependencies %> +<% var IsThere = require("is-there"); %> +<% var Fs = require("fs"); %> +<% var Path = require("path"); %> +<% var Ul = require("ul"); %> + +<% // Compute the directory paths %> +<% var binPath = Path.join(_.path, "bin"); %> +<% var examplesPath = Path.join(_.path, "examples"); %> +<% var examplePath = Path.join(_.path, "example"); %> +<% var example = IsThere(examplePath) ? examplePath : IsThere(examplesPath) ? examplesPath : null; %> +<% var isCli = IsThere(binPath); %> + +<% if (_.pack.blah.h_img) { %> +![<%- _.pack.name %>](<%- _.pack.blah.h_img %>) +<% } %> + +<% // Create the name and description %> +<% if (isCli) { %> +# `$ <%- _.pack.name %>` [![Donate now][donate-now]][paypal-donations] +<% } else { %> +# <%- _.pack.name %> [![Donate now][donate-now]][paypal-donations] +<% } %> +<%- _.pack.description %> + +<% if (_.pack.blah.ex_img) { %> +![<%- _.pack.name %>](<%-_.pack.blah.ex_img %>) +<% } %> + +<% // Cli usage %> +<% if (isCli) { %> +### CLI Usage +You can install the package globally and use it as command line tool: + +```sh +$ npm i -g <%- _.pack.name %> +``` + +Then, run `<%- _.pack.name %> --help` and see what the cli tool can do. + +For example, to add [`gh.js`]() in CDNJS, do: + +```sh +$ cdnjs-importer -g git@github.com:IonicaBizau/gh.js.git +``` + +<% } %> + +<% // Show the example if there is one %> +<% if (example) { %> +<% var exStrPath = Path.join(example, "index.js"); %> +<% if (!IsThere(exStrPath)) { %> +<% example = null; %> +<% } %> +<% if (example) { %> +## Example + +<% if (isCli) { %> +Here is an example how to use this package as library. +<% } %> + +<% var exStr = Fs.readFileSync(exStrPath, "utf-8"); %> +<% exStr = exStr.replace("../lib", _.pack.name) %> + +```js +<%- exStr %> +``` +<% } %> +<% } %> + +<% // Documentation %> +## Documentation + +<% if (isCli) { %> +For full API reference, see the [DOCUMENTATION.md][docs] file. +<% } else { %> +<% docs = docs.split("\n").slice(3).join("\n"); %> +<%- docs %> +<% } %> + +<% // How to contribute %> +## How to contribute +Have an idea? Found a bug? See [how to contribute][contributing]. + +<% // License information %> +## License +[KINDLY][license] © [Ionică Bizău][website]–The [LICENSE](/LICENSE) file contains +a copy of the license. + +<% // Links %> +[license]: http://ionicabizau.github.io/kindly-license/?author=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica@gmail.com%3E&year=2015 +[contributing]: /CONTRIBUTING.md +[website]: http://ionicabizau.net +[docs]: /DOCUMENTATION.md +[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MG98D7NPFZ3MG +[donate-now]: http://i.imgur.com/jioicaN.png diff --git a/.gitignore b/.gitignore index a931981..61f2900 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ *.swo *~ *.log -node_modules \ No newline at end of file +node_modules diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..961dbf7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,60 @@ +# :eight_spoked_asterisk: :stars: :sparkles: :dizzy: :star2: :star2: :sparkles: :dizzy: :star2: :star2: Contributing :star: :star2: :dizzy: :sparkles: :star: :star2: :dizzy: :sparkles: :stars: :eight_spoked_asterisk: + +So, you want to contribute to this project! That's awesome. However, before +doing so, please read the following simple steps how to contribute. This will +make the life easier and will avoid wasting time on things which are not +requested. :sparkles: + +## Discuss the changes before doing them + - First of all, open an issue in the repository, using the [bug tracker][1], + describing the contribution you'd like to make, the bug you found or any + other ideas you have. This will help us to get you started on the right + foot. + + - If it makes sense, add the platform and software information (e.g. operating + system, Node.JS version etc), screenshots (so we can see what you're seeing). + + - It's recommended to wait for feedback before continuing to next steps. However, + if the issue is clear (e.g. a typo) and the fix is simple, you can continue + and fix it. + +## Fixing issues + - Fork the project in your account and create a branch with your fix: + `some-great-feature` or `some-issue-fix`. + + - Commit your changes in that branch, writing the code following the + [code style][2]. If the project contains tests (generally, the `test` + directory), you are encouraged to add a test as well. :memo: + + - If the project contains a `package.json` file add yourself in the + `contributors` array (if it doesn't exist, create it): + + ```json + { + "contributors": [ + "Your Name (http://your.website) + ] + } + ``` + +## Creating a pull request + + - Open a pull request, and reference the initial issue in the pull request + message (e.g. *fixes # + + + + + + + + + + + + + + +![cdnjs-importer](http://i.imgur.com/OLwedYJ.png) + +# `$ cdnjs-importer` [![Donate now][donate-now]][paypal-donations] -# CDNJS Importer Easy way to import a library into CDNJS. -## Installation +### CLI Usage +You can install the package globally and use it as command line tool: ```sh -$ npm install -g cdnjs-importer +$ npm i -g cdnjs-importer ``` -## Usage +Then, run `cdnjs-importer --help` and see what the cli tool can do. -Use the `-c` option to specify the path to the CDNJS repository. Default location is `~/cdnjs`. +For example, to add [`gh.js`]() in CDNJS, do: ```sh -$ cdnjs-importer -c path/to/cdnjs git@github.com:someone/project.git git@github.com:someone/another-project.git +$ cdnjs-importer -g git@github.com:IonicaBizau/gh.js.git ``` ## Documentation -Using as module is also possible. -### `CdnJsImporter(options, callback)` -Creates a new instance of `CdnJsImporter`. - -#### Params -- **Object** `options`: An object containing the following fields: - - `libs` (Array): An array of `Lib` items (see the `add` method what they should contain). They will be downloaded in parallel (default: `[]`). - - `debug` (Boolean|Number): A boolean or number value indicating the log level (default: `false`). - - `cdnjs` (String): The absolute path to the local cdnjs repository. - -- **Function** `callback`: The callback function. - -#### Return -- **CdnJsImporter** The `CdnJsImporter` instance. - -### `add(lib, callback)` -Adds a new library in the local cdnjs repository. - -#### Params -- **Object|String** `lib`: The git url as string or an object containing: - - `git` (String): The `git` url. - - `dir` (String): The directory containing the files which should be imported (default: `"/dist"` or `"/build"` or `"/src"` or `"/"`). - - `map` (Array): The file map used by cdnjs in autoupdate process (default: `[{ basePath: lib.dir , files: ["**/*"] }]`). -- **Function** `callback`: The callback function called with `error` and `data`. - -#### Return -- **CdnJsImporter** The `CdnJsImporter` instance. +For full API reference, see the [DOCUMENTATION.md][docs] file. ## How to contribute -1. File an issue in the repository, using the bug tracker, describing the - contribution you'd like to make. This will help us to get you started on the - right foot. -2. Fork the project in your account and create a new branch: - `your-great-feature`. -3. Commit your changes in that branch. -4. Open a pull request, and reference the initial issue in the pull request - message. +Have an idea? Found a bug? See [how to contribute][contributing]. ## License -See the [LICENSE](./LICENSE) file. +[KINDLY][license] © [Ionică Bizău][website]–The [LICENSE](/LICENSE) file contains +a copy of the license. + +[license]: http://ionicabizau.github.io/kindly-license/?author=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica@gmail.com%3E&year=2015 +[contributing]: /CONTRIBUTING.md +[website]: http://ionicabizau.net +[docs]: /DOCUMENTATION.md +[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MG98D7NPFZ3MG +[donate-now]: http://i.imgur.com/jioicaN.png \ No newline at end of file diff --git a/package.json b/package.json index a9aebe3..b1c5005 100644 --- a/package.json +++ b/package.json @@ -45,5 +45,8 @@ "tmp": "^0.0.26", "ul": "^5.0.0", "w-json": "^1.0.0" + }, + "blah": { + "h_img": "http://i.imgur.com/OLwedYJ.png" } } From 4921762c42bac70fa7417be40757d6df6d41a67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 18 Jun 2015 16:56:07 +0300 Subject: [PATCH 22/36] Updated examples --- bin/cdnjs-importer | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cdnjs-importer b/bin/cdnjs-importer index 8ecd013..add2442 100755 --- a/bin/cdnjs-importer +++ b/bin/cdnjs-importer @@ -18,8 +18,8 @@ var gitUrlOpt = new Clp.Option(["g", "git-url"], "Your library git url.", "git-u , version: Package.version , exe: Package.name , examples: [ - "cdnjs-importer -i git@github.com:IonicaBizau/gh.js.git # adds gh.js to cdnjs" - , "cdnjs-importer -i ... -p path/to/cdnjs" + "cdnjs-importer -g git@github.com:IonicaBizau/gh.js.git # adds gh.js to cdnjs" + , "cdnjs-importer -g ... -p path/to/cdnjs" ] , docs_url: Package.homepage , notes: "The default cdnjs repository location is in ~/cdnjs" From 005ee48c4c3f4de3d66cf80c181f1457129e02c3 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Thu, 9 Jul 2015 17:49:24 +0800 Subject: [PATCH 23/36] Remove useless fields in package.json --- lib/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/index.js b/lib/index.js index 0352885..3158ef6 100644 --- a/lib/index.js +++ b/lib/index.js @@ -194,6 +194,9 @@ CdnJsImporter.prototype.add = function (lib, callback) { if (err) { return cb(new Error("Failed to get the library files: " + err.toString())); } files = libFiles; + // Delete useless fields + delete package.scripts; + delete package.devDependencies; // Append the filename field used by cdnjs package.filename = files[0].replace(pwd, ""); From 52e9ea29abf6bc467ec925e08f3dec4451923888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 16 Jul 2015 12:55:56 +0300 Subject: [PATCH 24/36] :memo: Added docs --- DOCUMENTATION.md | 16 ++++++++++++++++ lib/index.js | 7 +++++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 DOCUMENTATION.md diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md new file mode 100644 index 0000000..0a9ae01 --- /dev/null +++ b/DOCUMENTATION.md @@ -0,0 +1,16 @@ +## Documentation +You can see below the API reference of this module. + +### `CdnJsImporter(options, callback)` +Creates a new instance of `CdnJsImporter`. + +#### Params +- **Object** `options`: An object containing the following fields: + - `libs` (Array): An array of `Lib` items (see the `add` method what they should contain). They will be downloaded in parallel (default: `[]`). + - `debug` (Boolean|Number): A boolean or number value indicating the log level (default: `false`). + - `cdnjs` (String): The absolute path to the local cdnjs repository. +- **Function** `callback`: The callback function. + +#### Return +- **CdnJsImporter** The `CdnJsImporter` instance. + diff --git a/lib/index.js b/lib/index.js index 3158ef6..e6e21ce 100644 --- a/lib/index.js +++ b/lib/index.js @@ -81,13 +81,16 @@ function CdnJsImporter (options, callback) { * @name add * @function * @param {Object|String} lib The git url as string or an object containing: + * * - `git` (String): The `git` url. - * - `dir` (String): The directory containing the files which should be imported (default: `"/dist"` or `"/build"` or `"/src"` or `"/"`). - * - `map` (Array): The file map used by cdnjs in autoupdate process (default: `[{ basePath: lib.dir , files: ["**\/*"] }]`). + * - `dir` (String): The directory containing the files which should be imported. + * - `map` (Array): The file map used by cdnjs in autoupdate process. + * * @param {Function} callback The callback function called with `error` and `data`. * @return {CdnJsImporter} The `CdnJsImporter` instance. */ CdnJsImporter.prototype.add = function (lib, callback) { + var self = this , pack = {} , i = 0 From 1a236d498dee4b14be71a557f9f419561143b5f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Sun, 9 Aug 2015 09:22:24 +0300 Subject: [PATCH 25/36] Pull first and then do the changes --- lib/index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/index.js b/lib/index.js index 3158ef6..348d9a7 100644 --- a/lib/index.js +++ b/lib/index.js @@ -112,8 +112,14 @@ CdnJsImporter.prototype.add = function (lib, callback) { }); OneByOne([ + // Pull from github/cdnjs/cdnjs + function (cb) { + Logger.log("Pulling from origin.", "info"); + cb(); + } + , self.git.exec.bind(self.git, "pull https://github.com/cdnjs/cdnjs.git") // Create tmp directory - Tmp.dir.bind(Tmp) + , Tmp.dir.bind(Tmp) // Clone the library repo , function (cb, tmpPath) { path = tmpPath; @@ -251,12 +257,6 @@ CdnJsImporter.prototype.add = function (lib, callback) { cb(); } , self.git.exec.bind(self.git, "checkout master") - // Pull from github/cdnjs/cdnjs - , function (cb) { - Logger.log("Pulling from origin.", "info"); - cb(); - } - , self.git.exec.bind(self.git, "pull origin master") // Create the new branch , function (cb) { Logger.log("Creating a new branch for your library.", "info"); From 8a6404e5d9e3963811783c643526b17554b58a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Sun, 9 Aug 2015 15:14:29 +0300 Subject: [PATCH 26/36] :arrow_up: w-json@1.1.0 --- lib/index.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 348d9a7..5aef5f6 100644 --- a/lib/index.js +++ b/lib/index.js @@ -233,7 +233,7 @@ CdnJsImporter.prototype.add = function (lib, callback) { // Create the package.json file in the cdnjs repository Logger.log("Writing the package.json file in " + libPath, "info"); - WriteJson(Path.join(libPath, PATH_PACK), package, function (err) { + WriteJson(Path.join(libPath, PATH_PACK), package, true, function (err) { if (err) { return cb(new Error("Failed to create the package.json file: " + err.toString())); } cb(); }); diff --git a/package.json b/package.json index b1c5005..acd4641 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "same-time": "^2.0.0", "tmp": "^0.0.26", "ul": "^5.0.0", - "w-json": "^1.0.0" + "w-json": "^1.1.0" }, "blah": { "h_img": "http://i.imgur.com/OLwedYJ.png" From 1a837079133cadc0dffddf2e2dfd7712c09eaf4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Mon, 10 Aug 2015 11:05:02 +0300 Subject: [PATCH 27/36] Updated the repository url --- CONTRIBUTING.md | 5 +++-- package.json | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 961dbf7..8a1a1c7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ make the life easier and will avoid wasting time on things which are not requested. :sparkles: ## Discuss the changes before doing them - - First of all, open an issue in the repository, using the [bug tracker][1], + - First of all, open an issue in the repository, using the [bug tracker][1] describing the contribution you'd like to make, the bug you found or any other ideas you have. This will help us to get you started on the right foot. @@ -56,5 +56,6 @@ Finally, your contributions will be merged, and everyone will be happy! :smile: Thanks! :sweat_smile: -[1]: https://github.com/IonicaBizau/cdnjs-importer/issues +[1]: https://github.com/cdnjs/cdnjs-importer/issues + [2]: https://github.com/IonicaBizau/code-style \ No newline at end of file diff --git a/package.json b/package.json index acd4641..e0516d2 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "repository": { "type": "git", - "url": "git@github.com:IonicaBizau/cdnjs-importer.git" + "url": "git@github.com:cdnjs/cdnjs-importer.git" }, "keywords": [ "cdnjs", @@ -23,9 +23,9 @@ ], "license": "MIT", "bugs": { - "url": "https://github.com/IonicaBizau/cdnjs-importer/issues" + "url": "https://github.com/cdnjs/cdnjs-importer/issues" }, - "homepage": "https://github.com/IonicaBizau/cdnjs-importer", + "homepage": "https://github.com/cdnjs/cdnjs-importer", "directories": { "test": "test" }, From e6758cc62b4c0430df508120daa8048aecb89a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Wed, 12 Aug 2015 11:41:57 +0300 Subject: [PATCH 28/36] Declared the CDNJS_ROOT constant --- bin/cdnjs-importer | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/cdnjs-importer b/bin/cdnjs-importer index add2442..e9c49bd 100755 --- a/bin/cdnjs-importer +++ b/bin/cdnjs-importer @@ -8,11 +8,15 @@ var CdnJsImporter = require("../lib") , IsThere = require("is-there") , Clp = require("clp") , Package = require("../package") + , Abs = require("abs") ; +// Constants +const CDNJS_ROOT = Abs("~/cdnjs"); + // Parse the command line arguments var gitUrlOpt = new Clp.Option(["g", "git-url"], "Your library git url.", "git-url") - , pathOpt = new Clp.Option(["p", "path"], "The path to your cdnjs local repository.", "path", Path.join(Ul.home(), "cdnjs")) + , pathOpt = new Clp.Option(["p", "path"], "The path to your cdnjs local repository.", "path", CDNJS_ROOT) , parser = new Clp({ name: "CDNJS Importer" , version: Package.version From b1b45fb195a792116413d4bcff231c6539e0e1f0 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Sun, 20 Sep 2015 16:00:44 +0800 Subject: [PATCH 29/36] move test -> example (same as #19) according to https://github.com/cdnjs/cdnjs-importer/issues/16#issuecomment-141755240, the origin `test` is just an example, not the "test" work. --- {test => example}/index.js | 0 package.json | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) rename {test => example}/index.js (100%) diff --git a/test/index.js b/example/index.js similarity index 100% rename from test/index.js rename to example/index.js diff --git a/package.json b/package.json index e0516d2..30de6f7 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "cdnjs-importer": "./bin/cdnjs-importer" }, "scripts": { - "test": "node test" + "test": "echo \"Error: no test specified\" && exit 1", + "example": "node example" }, "repository": { "type": "git", From 9b1b5b0d60225b299cd422a933ceab7c537a351b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 1 Oct 2015 17:37:03 +0300 Subject: [PATCH 30/36] :memo: --- CONTRIBUTING.md | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8a1a1c7..e0084f0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,17 +6,18 @@ make the life easier and will avoid wasting time on things which are not requested. :sparkles: ## Discuss the changes before doing them - - First of all, open an issue in the repository, using the [bug tracker][1] - describing the contribution you'd like to make, the bug you found or any + - First of all, open an issue in the repository, using the [bug tracker][1], + describing the contribution you would like to make, the bug you found or any other ideas you have. This will help us to get you started on the right foot. - If it makes sense, add the platform and software information (e.g. operating - system, Node.JS version etc), screenshots (so we can see what you're seeing). + system, Node.JS version etc.), screenshots (so we can see what you are + seeing). - - It's recommended to wait for feedback before continuing to next steps. However, - if the issue is clear (e.g. a typo) and the fix is simple, you can continue - and fix it. + - It is recommended to wait for feedback before continuing to next steps. + However, if the issue is clear (e.g. a typo) and the fix is simple, you can + continue and fix it. ## Fixing issues - Fork the project in your account and create a branch with your fix: @@ -26,13 +27,14 @@ requested. :sparkles: [code style][2]. If the project contains tests (generally, the `test` directory), you are encouraged to add a test as well. :memo: - - If the project contains a `package.json` file add yourself in the - `contributors` array (if it doesn't exist, create it): + - If the project contains a `package.json` or a `bower.json` file add yourself + in the `contributors` array (or `authors` in the case of `bower.json`; + if the array does not exist, create it): ```json { "contributors": [ - "Your Name (http://your.website) + "Your Name (http://your.website)" ] } ``` @@ -40,11 +42,11 @@ requested. :sparkles: ## Creating a pull request - Open a pull request, and reference the initial issue in the pull request - message (e.g. *fixes #*). Write a good description and title, so everybody will know what is fixed/improved. - - If it makes sense, add screenshots, gifs etc, so it's easier to see what's - going on. + - If it makes sense, add screenshots, gifs etc., so it is easier to see what + is going on. ## Wait for feedback Before accepting your contributions, we will review them. You may get feedback @@ -53,6 +55,7 @@ in your branch and the pull request will be updated automatically. ## Everyone is happy! Finally, your contributions will be merged, and everyone will be happy! :smile: +Contributions are more than welcome! Thanks! :sweat_smile: From 6c7bc99c2f7227814181e27ce78e0264713d0aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 1 Oct 2015 17:37:50 +0300 Subject: [PATCH 31/36] Updated the image --- .blah/README.ejs | 2 +- README.md | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.blah/README.ejs b/.blah/README.ejs index c970e91..56fac50 100644 --- a/.blah/README.ejs +++ b/.blah/README.ejs @@ -109,4 +109,4 @@ a copy of the license. [website]: http://ionicabizau.net [docs]: /DOCUMENTATION.md [paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MG98D7NPFZ3MG -[donate-now]: http://i.imgur.com/jioicaN.png +[donate-now]: http://i.imgur.com/6cMbHOC.png diff --git a/README.md b/README.md index 8605e6e..489b774 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,29 @@ For example, to add [`gh.js`]() in CDNJS, do: $ cdnjs-importer -g git@github.com:IonicaBizau/gh.js.git ``` +## Example + +Here is an example how to use this package as library. + +```js +// Dependencies +var CdnJsImporter = require("cdnjs-importer") + , Path = require("path") + ; + +// Test adding CaiuSS +CdnJsImporter({ + cdnjs: Path.resolve(__dirname, "../../cdnjs") + , debug: true + , libs: [ + "git@github.com:IonicaBizau/CaiuSS.git" + ] +}, function (res) { + console.log(res); +}); + +``` + ## Documentation For full API reference, see the [DOCUMENTATION.md][docs] file. @@ -50,4 +73,4 @@ a copy of the license. [website]: http://ionicabizau.net [docs]: /DOCUMENTATION.md [paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MG98D7NPFZ3MG -[donate-now]: http://i.imgur.com/jioicaN.png \ No newline at end of file +[donate-now]: http://i.imgur.com/6cMbHOC.png \ No newline at end of file From 3f9eaf7261d9589567b068896bd2ff6d4069e4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 1 Oct 2015 17:51:59 +0300 Subject: [PATCH 32/36] Upgraded dependencies --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 30de6f7..eadb5db 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ }, "devDependencies": {}, "dependencies": { - "bug-killer": "^3.0.0", + "bug-killer": "^4.0.0", "clp": "^3.0.0", "glob": "^5.0.10", "gry": "^4.0.0", @@ -43,9 +43,10 @@ "one-by-one": "^2.0.0", "r-json": "^1.0.0", "same-time": "^2.0.0", - "tmp": "^0.0.26", + "tmp": "0.0.28", "ul": "^5.0.0", - "w-json": "^1.1.0" + "w-json": "^1.1.0", + "abs": "^1.0.0" }, "blah": { "h_img": "http://i.imgur.com/OLwedYJ.png" From 9142ddb7e7d747a17270c73be71d5510f0bfe185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 1 Oct 2015 18:35:22 +0300 Subject: [PATCH 33/36] Use abs to normalize the path. Display the computed path value --- bin/cdnjs-importer | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cdnjs-importer b/bin/cdnjs-importer index e9c49bd..6beae28 100755 --- a/bin/cdnjs-importer +++ b/bin/cdnjs-importer @@ -41,12 +41,12 @@ if (!gitUrlOpt.value) { // Resolve the path to the cdnjs repo if (pathOpt.is_provided) { - pathOpt.value = Path.resolve(pathOpt.value.replace("~", Ul.home())); + pathOpt.value = Abs(pathOpt.value); } // Check if the repository exists and display friendly messages if (!IsThere(pathOpt.value)) { - Logger.log("Couldn't find the CDNJS repository in this path: " + CDNJS_ROOT, "error"); + Logger.log("Couldn't find the CDNJS repository in this path: " + pathOpt.value, "error"); Logger.log("Use `git clone git@github.com:cdnjs/cdnjs.git ~/cdnjs` to clone it.", "info"); Logger.log("If you already cloned it in another location, please provide the path to that location using `cdnjs-importer -p path/to/cdnjs`", "info"); return; From f12a35fd00fb6a6aa47c9abb148b7cef8f8e7039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 1 Oct 2015 18:36:10 +0300 Subject: [PATCH 34/36] Fixed the pwd value. Fixed #10. --- lib/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 036ca36..b355959 100644 --- a/lib/index.js +++ b/lib/index.js @@ -194,7 +194,7 @@ CdnJsImporter.prototype.add = function (lib, callback) { // TODO Handle the whole array var basePath = Path.join(path, package.npmFileMap[0].basePath, package.npmFileMap[0].files[0]) - , pwd = Path.join(self.repo.cwd, package.npmFileMap[0].basePath) + "/" + , pwd = Path.join(self.repo.cwd, package.npmFileMap[0].basePath) , tmp = null , ext = null ; @@ -206,6 +206,7 @@ CdnJsImporter.prototype.add = function (lib, callback) { // Delete useless fields delete package.scripts; delete package.devDependencies; + // Append the filename field used by cdnjs package.filename = files[0].replace(pwd, ""); @@ -214,7 +215,7 @@ CdnJsImporter.prototype.add = function (lib, callback) { temp.push("min"); temp.push(ext); - if (IsThere(pwd + temp.join("."))) { + if (IsThere(Path.join(pwd, temp.join(".")))) { package.filename = temp.join("."); } From c276ea3be6451033a0878211613a335185b97fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Mon, 5 Oct 2015 07:18:17 +0300 Subject: [PATCH 35/36] Fixed the email address --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index ddd6036..44f5049 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ The KINDLY License -Copyright (c) 2015 Ionică Bizău +Copyright (c) 2015 Ionică Bizău You have the permission to use this software, read its source code, modify and redistribute it under the following terms: From 453007e332d99fc7c7fbde94f659dc481fc9ccf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Mon, 5 Oct 2015 07:18:30 +0300 Subject: [PATCH 36/36] Generated the docs --- .blah/README.ejs | 112 ----------------------------------------------- README.md | 37 ++++++++++++---- package.json | 2 +- 3 files changed, 30 insertions(+), 121 deletions(-) delete mode 100644 .blah/README.ejs diff --git a/.blah/README.ejs b/.blah/README.ejs deleted file mode 100644 index 56fac50..0000000 --- a/.blah/README.ejs +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - -<% // Dependencies %> -<% var IsThere = require("is-there"); %> -<% var Fs = require("fs"); %> -<% var Path = require("path"); %> -<% var Ul = require("ul"); %> - -<% // Compute the directory paths %> -<% var binPath = Path.join(_.path, "bin"); %> -<% var examplesPath = Path.join(_.path, "examples"); %> -<% var examplePath = Path.join(_.path, "example"); %> -<% var example = IsThere(examplePath) ? examplePath : IsThere(examplesPath) ? examplesPath : null; %> -<% var isCli = IsThere(binPath); %> - -<% if (_.pack.blah.h_img) { %> -![<%- _.pack.name %>](<%- _.pack.blah.h_img %>) -<% } %> - -<% // Create the name and description %> -<% if (isCli) { %> -# `$ <%- _.pack.name %>` [![Donate now][donate-now]][paypal-donations] -<% } else { %> -# <%- _.pack.name %> [![Donate now][donate-now]][paypal-donations] -<% } %> -<%- _.pack.description %> - -<% if (_.pack.blah.ex_img) { %> -![<%- _.pack.name %>](<%-_.pack.blah.ex_img %>) -<% } %> - -<% // Cli usage %> -<% if (isCli) { %> -### CLI Usage -You can install the package globally and use it as command line tool: - -```sh -$ npm i -g <%- _.pack.name %> -``` - -Then, run `<%- _.pack.name %> --help` and see what the cli tool can do. - -For example, to add [`gh.js`]() in CDNJS, do: - -```sh -$ cdnjs-importer -g git@github.com:IonicaBizau/gh.js.git -``` - -<% } %> - -<% // Show the example if there is one %> -<% if (example) { %> -<% var exStrPath = Path.join(example, "index.js"); %> -<% if (!IsThere(exStrPath)) { %> -<% example = null; %> -<% } %> -<% if (example) { %> -## Example - -<% if (isCli) { %> -Here is an example how to use this package as library. -<% } %> - -<% var exStr = Fs.readFileSync(exStrPath, "utf-8"); %> -<% exStr = exStr.replace("../lib", _.pack.name) %> - -```js -<%- exStr %> -``` -<% } %> -<% } %> - -<% // Documentation %> -## Documentation - -<% if (isCli) { %> -For full API reference, see the [DOCUMENTATION.md][docs] file. -<% } else { %> -<% docs = docs.split("\n").slice(3).join("\n"); %> -<%- docs %> -<% } %> - -<% // How to contribute %> -## How to contribute -Have an idea? Found a bug? See [how to contribute][contributing]. - -<% // License information %> -## License -[KINDLY][license] © [Ionică Bizău][website]–The [LICENSE](/LICENSE) file contains -a copy of the license. - -<% // Links %> -[license]: http://ionicabizau.github.io/kindly-license/?author=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica@gmail.com%3E&year=2015 -[contributing]: /CONTRIBUTING.md -[website]: http://ionicabizau.net -[docs]: /DOCUMENTATION.md -[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MG98D7NPFZ3MG -[donate-now]: http://i.imgur.com/6cMbHOC.png diff --git a/README.md b/README.md index 489b774..ef5ec7a 100644 --- a/README.md +++ b/README.md @@ -19,24 +19,42 @@ Easy way to import a library into CDNJS. -### CLI Usage +## Installation + You can install the package globally and use it as command line tool: ```sh -$ npm i -g cdnjs-importer +$ npm i -g cdnjs-importer@2.0.0-beta ``` -Then, run `cdnjs-importer --help` and see what the cli tool can do. - -For example, to add [`gh.js`]() in CDNJS, do: +Then, run `cdnjs-importer --help` and see what the CLI tool can do. ```sh -$ cdnjs-importer -g git@github.com:IonicaBizau/gh.js.git +$ cdnjs-importer --help +Usage: cdnjs-importer [options] + +Options: + -g, --git-url Your library git url. + -p, --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/cdnjs/cdnjs-importer ``` ## Example -Here is an example how to use this package as library. +Here is an example how to use this package as library. To install it locally, as library, you can do that using `npm`: + +```sh +$ npm i cdnjs-importer +``` ```js // Dependencies @@ -64,6 +82,9 @@ For full API reference, see the [DOCUMENTATION.md][docs] file. ## How to contribute Have an idea? Found a bug? See [how to contribute][contributing]. +## Press Highlights +None yet. If you wrote or found an article about this project, [add it][contributing] in this section. :memo: + ## License [KINDLY][license] © [Ionică Bizău][website]–The [LICENSE](/LICENSE) file contains a copy of the license. @@ -73,4 +94,4 @@ a copy of the license. [website]: http://ionicabizau.net [docs]: /DOCUMENTATION.md [paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MG98D7NPFZ3MG -[donate-now]: http://i.imgur.com/6cMbHOC.png \ No newline at end of file +[donate-now]: http://i.imgur.com/6cMbHOC.png diff --git a/package.json b/package.json index eadb5db..8255ec9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cdnjs-importer", - "version": "2.0.0", + "version": "2.0.0-beta", "description": "Easy way to import a library into CDNJS.", "main": "lib/index.js", "bin": {