# Upgrade from v1 to v2

- [Library] The code has been refactored and can now add sites as plugins.

```typescript
// Before
import ZeroBywDownloader from 'zerobyw-dl';
const downloader = new ZeroBywDownloader(destination, configs);

// Now
import { ZeroBywDownloader } from 'comic-dl';
const downloader = new ZeroBywDownloader(destination, configs);
```

- [CLI] The `-b, --batch` flag is now default to 1 when not set.
- Downloaded images are now renamed by index (01 ~ ).
- Downloaders now ignores downloaded chapters by default, set `options.override` to `true` or for CLI use `-O, --override` if you want to override.
- [Library] Writing ComicInfo.xml to file is removed from `getSerieInfo`, thus a seperate function `writeComicInfo` has taken place, options from `getSerieInfo` is moved to `writeComicinfo`, and the typedef is renamed `WriteInfoOptions`.

```typescript
// Before
const serie = await downloader.getSerieInfo('url', { output: true });

// Now
const serie = await downloader.getSerieInfo('url');
await writeComicInfo(serie, { output: true });
```

- [CLI] New flag `-m, --module` is added to specify the module (site) to use, as a matter of which, the short-hand flag to `--max-title-length` is changed to `-M`. If `--module` is not defined, comic-dl will attempt to detect the matching module by url.

```bash
# Before
npx zerobyw-dl dl -c cookie.txt -o ~/Download/zerobyw -a zip -r -i -u serie_url

# Now
npx comic-dl dl -m zerobyw -c cookie.txt -o ~/Download/zerobyw -a zip -r -i -u serie_url -b 10
# You can skip -m flag unless comic-dl fails to detect the site module
# Batch download is now default to 1, set it manually to control downloading speed
```

- [CLI] the `-s, --silence` flag now skips the confirm prompt when downloading series.
