|
1 | | - |
| 1 | +<!----------------------------------------------------------------------------> |
| 2 | +<!-- STOP, LOOK & LISTEN! --> |
| 3 | +<!-- ==================== --> |
| 4 | +<!-- Do NOT edit this file directly since it's generated from a template --> |
| 5 | +<!-- file, using https://github.com/IonicaBizau/node-blah --> |
| 6 | +<!-- --> |
| 7 | +<!-- If you found a typo in documentation, fix it in the source files --> |
| 8 | +<!-- (`lib/*.js`) and make a pull request. --> |
| 9 | +<!-- --> |
| 10 | +<!-- If you have any other ideas, open an issue. --> |
| 11 | +<!-- --> |
| 12 | +<!-- Please consider reading the contribution steps (CONTRIBUTING.md). --> |
| 13 | +<!-- * * * Thanks! * * * --> |
| 14 | +<!----------------------------------------------------------------------------> |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +# `$ cdnjs-importer` [![Donate now][donate-now]][paypal-donations] |
2 | 19 |
|
3 | | -# CDNJS Importer |
4 | 20 | Easy way to import a library into CDNJS. |
5 | 21 |
|
6 | 22 | ## Installation |
7 | 23 |
|
| 24 | +You can install the package globally and use it as command line tool: |
| 25 | + |
8 | 26 | ```sh |
9 | | -$ npm install -g cdnjs-importer |
| 27 | +$ npm i -g cdnjs-importer@2.0.0-beta |
10 | 28 | ``` |
11 | 29 |
|
12 | | -## Usage |
13 | | - |
14 | | -Use the `-c` option to specify the path to the CDNJS repository. Default location is `~/cdnjs`. |
| 30 | +Then, run `cdnjs-importer --help` and see what the CLI tool can do. |
15 | 31 |
|
16 | 32 | ```sh |
17 | | -$ cdnjs-importer -c path/to/cdnjs git@github.com:someone/project.git git@github.com:someone/another-project.git |
18 | | -``` |
| 33 | +$ cdnjs-importer --help |
| 34 | +Usage: cdnjs-importer [options] |
19 | 35 |
|
20 | | -## Documentation |
21 | | -Using as module is also possible. |
| 36 | +Options: |
| 37 | + -g, --git-url <git-url> Your library git url. |
| 38 | + -p, --path <path> The path to your cdnjs local repository. |
| 39 | + -h, --help Displays this help. |
| 40 | + -v, --version Displays version information. |
22 | 41 |
|
23 | | -### `CdnJsImporter(options, callback)` |
24 | | -Creates a new instance of `CdnJsImporter`. |
| 42 | +Examples: |
| 43 | + cdnjs-importer -g git@github.com:IonicaBizau/gh.js.git # adds gh.js to cdnjs |
| 44 | + cdnjs-importer -g ... -p path/to/cdnjs |
25 | 45 |
|
26 | | -#### Params |
27 | | -- **Object** `options`: An object containing the following fields: |
28 | | - - `libs` (Array): An array of `Lib` items (see the `add` method what they should contain). They will be downloaded in parallel (default: `[]`). |
29 | | - - `debug` (Boolean|Number): A boolean or number value indicating the log level (default: `false`). |
30 | | - - `cdnjs` (String): The absolute path to the local cdnjs repository. |
| 46 | +The default cdnjs repository location is in ~/cdnjs |
31 | 47 |
|
32 | | -- **Function** `callback`: The callback function. |
| 48 | +Documentation can be found at https://github.com/cdnjs/cdnjs-importer |
| 49 | +``` |
33 | 50 |
|
34 | | -#### Return |
35 | | -- **CdnJsImporter** The `CdnJsImporter` instance. |
| 51 | +## Example |
36 | 52 |
|
37 | | -### `add(lib, callback)` |
38 | | -Adds a new library in the local cdnjs repository. |
| 53 | +Here is an example how to use this package as library. To install it locally, as library, you can do that using `npm`: |
39 | 54 |
|
40 | | -#### Params |
41 | | -- **Object|String** `lib`: The git url as string or an object containing: |
42 | | - - `git` (String): The `git` url. |
43 | | - - `dir` (String): The directory containing the files which should be imported (default: `"/dist"` or `"/build"` or `"/src"` or `"/"`). |
44 | | - - `map` (Array): The file map used by cdnjs in autoupdate process (default: `[{ basePath: lib.dir , files: ["**/*"] }]`). |
45 | | -- **Function** `callback`: The callback function called with `error` and `data`. |
| 55 | +```sh |
| 56 | +$ npm i cdnjs-importer |
| 57 | +``` |
46 | 58 |
|
47 | | -#### Return |
48 | | -- **CdnJsImporter** The `CdnJsImporter` instance. |
| 59 | +```js |
| 60 | +// Dependencies |
| 61 | +var CdnJsImporter = require("cdnjs-importer") |
| 62 | + , Path = require("path") |
| 63 | + ; |
| 64 | + |
| 65 | +// Test adding CaiuSS |
| 66 | +CdnJsImporter({ |
| 67 | + cdnjs: Path.resolve(__dirname, "../../cdnjs") |
| 68 | + , debug: true |
| 69 | + , libs: [ |
| 70 | + "git@github.com:IonicaBizau/CaiuSS.git" |
| 71 | + ] |
| 72 | +}, function (res) { |
| 73 | + console.log(res); |
| 74 | +}); |
| 75 | + |
| 76 | +``` |
| 77 | + |
| 78 | +## Documentation |
| 79 | + |
| 80 | +For full API reference, see the [DOCUMENTATION.md][docs] file. |
49 | 81 |
|
50 | 82 | ## How to contribute |
51 | | -1. File an issue in the repository, using the bug tracker, describing the |
52 | | - contribution you'd like to make. This will help us to get you started on the |
53 | | - right foot. |
54 | | -2. Fork the project in your account and create a new branch: |
55 | | - `your-great-feature`. |
56 | | -3. Commit your changes in that branch. |
57 | | -4. Open a pull request, and reference the initial issue in the pull request |
58 | | - message. |
| 83 | +Have an idea? Found a bug? See [how to contribute][contributing]. |
| 84 | + |
| 85 | +## Press Highlights |
| 86 | +None yet. If you wrote or found an article about this project, [add it][contributing] in this section. :memo: |
59 | 87 |
|
60 | 88 | ## License |
61 | | -See the [LICENSE](./LICENSE) file. |
| 89 | +[KINDLY][license] © [Ionică Bizău][website]–The [LICENSE](/LICENSE) file contains |
| 90 | +a copy of the license. |
| 91 | + |
| 92 | +[license]: http://ionicabizau.github.io/kindly-license/?author=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica@gmail.com%3E&year=2015 |
| 93 | +[contributing]: /CONTRIBUTING.md |
| 94 | +[website]: http://ionicabizau.net |
| 95 | +[docs]: /DOCUMENTATION.md |
| 96 | +[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MG98D7NPFZ3MG |
| 97 | +[donate-now]: http://i.imgur.com/6cMbHOC.png |
0 commit comments