Skip to content

Commit

Permalink
πŸš€ chore(package.json): update package version to 0.1.7
Browse files Browse the repository at this point in the history
✨ feat(readme.md): add documentation for custom provider and license information
  • Loading branch information
ferdiunal committed Apr 18, 2023
1 parent ea77085 commit 0317991
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-cdn-uploader",
"version": "0.1.6",
"version": "0.1.7",
"description": "A Vite plugin to upload built files to various CDN providers",
"main": "dist/index.js",
"scripts": {
Expand Down
72 changes: 70 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,71 @@
# Vite CDN Uploader Plugin
# Vite CDN Uploader Plugin πŸš€

In development, I will update soon.
The Vite CDN Uploader Plugin is a handy utility to automatically upload build files from Vite projects to various CDN providers. It currently supports Amazon S3 and Custom Providers.

## Installation πŸ’»

Install the plugin via npm or yarn:

```bash
npm install --save-dev vite-cdn-uploader
```

or

```bash
yarn add -D vite-cdn-uploader
```

## Usage πŸ› 

First, import the plugin in your Vite configuration file:

```javascript
import { cdnUploaderPlugin, providers } from "vite-cdn-uploader"
```

Then, add the plugin to the `plugins` array in your Vite configuration:

```javascript
export default {
plugins: [
cdnUploaderPlugin({
provider: new providers.AwsS3Provider(),
}),
],
};
```

### Custom Provider πŸŽ›

Create a custom provider by defining a class with a `config` method and an `upload` method:

```javascript
class CustomProvider {
config() {
// Provider Configs
return {};
}
async upload(file, filePath) {
// Upload Process
}
}
```

### Vite Configuration πŸ“

Include your custom provider in your Vite configuration:

```javascript
export default {
plugins: [
cdnUploaderPlugin({
provider: new CustomProvider(),
}),
],
};
```

## License πŸ“„

MIT

0 comments on commit 0317991

Please sign in to comment.