diff --git a/README.md b/README.md index b07c23e..eb842fc 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,24 @@ -# avdo +# avocado [![Build status][travis-badge]][travis-badge-url] [![npm version][npm-badge]][npm-badge-url] [![Coverage status][coveralls-badge]][coveralls-badge-url] -`avdo` is a command line tool (similar to [`svgo`][svgo]) that optimizes Android +`avocado` is a command line tool (similar to [`svgo`][svgo]) that optimizes Android `VectorDrawable` (VD) and `AnimatedVectorDrawable` (AVD) xml files. ## Installation -You can install `avdo` using [npm][npm] w/ the following command: +You can install `avocado` using [npm][npm] w/ the following command: ```sh -npm install -g avdo +npm install -g avocado ``` ## Usage ```text -Usage: avdo [options] [file] +Usage: avocado [options] [file] Options: @@ -35,31 +35,31 @@ Options: ```sh # Optimize (and overwrite) a VD/AVD file. -avdo vector.xml +avocado vector.xml # Optimize (and overwrite) multiple VD/AVD files. -avdo *.xml +avocado *.xml # Optimize a VD/AVD file and write the output to a new file. -avdo vector.xml -o vector_min.xml +avocado vector.xml -o vector_min.xml # Optimize a VD/AVD using standard input and standard output. -cat vector.xml | avdo -i - -o - > vector_min.xml +cat vector.xml | avocado -i - -o - > vector_min.xml # Optimize (and overwrite) all of the VD/AVD files in a directory. -avdo -d path/to/directory +avocado -d path/to/directory # Optimize all VD/AVD files in a directory and write them to a new directory. -avdo -d path/to/input/directory -o path/to/output/directory +avocado -d path/to/input/directory -o path/to/output/directory # Optimize all files ending with '.xml' and write them to a new directory. -avdo *.xml -o path/to/output/directory +avocado *.xml -o path/to/output/directory # Pass a string as input and write the output to a new file. -avdo -s '...' -o vector_min.xml +avocado -s '...' -o vector_min.xml ``` -`avdo` rewrites the `VectorDrawable` using the smallest number of ``s and ``s possible, reducing their file sizes and making them faster to parse and draw at runtime. The example below shows the contents of a `VectorDrawable` before and after being run through `avdo`. +`avocado` rewrites the `VectorDrawable` using the smallest number of ``s and ``s possible, reducing their file sizes and making them faster to parse and draw at runtime. The example below shows the contents of a `VectorDrawable` before and after being run through `avocado`. #### Before @@ -142,12 +142,12 @@ To test the tool, run: npm run test ``` - [travis-badge]: https://travis-ci.org/alexjlockwood/avdo.svg?branch=master - [travis-badge-url]: https://travis-ci.org/alexjlockwood/avdo - [coveralls-badge]: https://coveralls.io/repos/github/alexjlockwood/avdo/badge.svg?branch=master - [coveralls-badge-url]: https://coveralls.io/github/alexjlockwood/avdo?branch=master - [npm-badge]: https://badge.fury.io/js/avdo.svg - [npm-badge-url]: https://www.npmjs.com/package/avdo + [travis-badge]: https://travis-ci.org/alexjlockwood/avocado.svg?branch=master + [travis-badge-url]: https://travis-ci.org/alexjlockwood/avocado + [coveralls-badge]: https://coveralls.io/repos/github/alexjlockwood/avocado/badge.svg?branch=master + [coveralls-badge-url]: https://coveralls.io/github/alexjlockwood/avocado?branch=master + [npm-badge]: https://badge.fury.io/js/avocado.svg + [npm-badge-url]: https://www.npmjs.com/package/avocado [svgo]: https://github.com/svg/svgo [vscode]: https://code.visualstudio.com/ [npm]: https://www.npmjs.com/get-npm diff --git a/bin/avdo b/bin/avocado similarity index 100% rename from bin/avdo rename to bin/avocado diff --git a/package-lock.json b/package-lock.json index 1c90fd8..3febe85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "avdo", + "name": "avocado", "version": "0.1.5", "lockfileVersion": 1, "requires": true, diff --git a/package.json b/package.json index d71a95f..ec48e13 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,12 @@ { - "name": "avdo", - "version": "0.1.5", + "name": "avocado", + "version": "1.0.0", "description": "Vector Drawable & Animated Vector Drawable optimization tool", "main": "dist/index.js", "types": "dist/index.d.ts", "bin": { - "avdo": "./bin/avdo" + "avdo": "./bin/avocado", + "avocado": "./bin/avocado" }, "scripts": { "prepublishOnly": "npm run build", @@ -15,7 +16,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/alexjlockwood/avdo" + "url": "https://github.com/alexjlockwood/avocado" }, "keywords": [ "Android", diff --git a/src/lib/avdo.ts b/src/lib/avocado.ts similarity index 98% rename from src/lib/avdo.ts rename to src/lib/avocado.ts index cda9281..8d4e1c3 100644 --- a/src/lib/avdo.ts +++ b/src/lib/avocado.ts @@ -47,7 +47,7 @@ const batchedPlugins = (function(ps: Plugin[]) { } return arr; }, - [] as Plugin[][] + [] as Plugin[][], ); })(Object.keys(plugins).map(k => plugins[k])); @@ -58,7 +58,7 @@ export interface Options { pretty?: boolean; } -export class Avdo { +export class Avocado { constructor( private readonly options: Options = { plugins: batchedPlugins, diff --git a/src/lib/index.ts b/src/lib/index.ts index ebe6cac..cd69089 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -5,7 +5,7 @@ import * as cli from 'commander'; -import { Avdo, Options } from './avdo'; +import { Avocado, Options } from './avocado'; import { js2xml } from './js2xml'; @@ -24,10 +24,10 @@ const writeFileFn: ( options?: string, ) => Promise = promisify(fs.writeFile); -let avdo: Avdo; +let avocado: Avocado; /** - * Runs the avdo command line tool. + * Runs the avocado command line tool. */ export async function run() { const pkgJson: { @@ -92,7 +92,7 @@ export async function run() { } } - avdo = new Avdo(); + avocado = new Avocado(); if (output) { if (input && input[0] !== '-') { @@ -208,7 +208,7 @@ function processData( const startTime = Date.now(); const prevFileSize = Buffer.byteLength(data, 'utf8'); - return avdo.optimize(data).then(result => { + return avocado.optimize(data).then(result => { // if (config.datauri) { // result.data = encodeSVGDatauri(result.data, config.datauri); // } @@ -322,7 +322,7 @@ function printErrorAndExit(error: any) { // // Flatten an array of plugins grouped per type, sort and write output // var list = [].concat -// .apply([], new Avdo().config.plugins) +// .apply([], new Avocado().config.plugins) // .sort((a, b) => a.name.localeCompare(b.name)) // .map(plugin => ` [ ${plugin.name.green} ] ${plugin.description}`) // .join('\n'); @@ -331,7 +331,7 @@ function printErrorAndExit(error: any) { /* npm run build && \ -node bin/avdo --multipass -s \ +node bin/avocado --multipass -s \ ' { const orig = splitted[0]; const should = splitted[1]; const params = splitted[2]; - let avdo: Avdo; + let avocado: Avocado; const plugin = plugins[name]; const origActive = plugin.active; @@ -36,11 +36,11 @@ describe('plugin tests', () => { if (params) { plugin.params = { ...origParams, ...JSON.parse(params) }; } - avdo = new Avdo({ + avocado = new Avocado({ plugins: [[plugin]], pretty: true, }); - const result = avdo.optimize(orig).then(res => { + const result = avocado.optimize(orig).then(res => { normalize(res).should.be.equal(should); }); plugin.active = origActive;