Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to vite #233

Merged
merged 11 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
node-version: 19
registry-url: https://registry.npmjs.org/
- run: yarn
- run: yarn build
Expand Down
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ dev/
src/
.babelrc
.eslintrc
webpack.config.js
vite.config.js
postcss.config.js
yarn.lock
19 changes: 2 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ This Tool is also capable of uploading & displaying video files using the `<vide

## Installation

### Install via NPM

Get the package

```shell
npm i --save-dev @editorjs/image
yarn add @editorjs/image
```

Include module at your application
Expand All @@ -38,20 +36,7 @@ Include module at your application
import ImageTool from '@editorjs/image';
```

### Other methods

#### Manual downloading and connecting

1. Upload folder `dist` from repository
2. Add `dist/bundle.js` file to your page.

#### Loading from CDN

You can load a specific version of package from [jsDelivr CDN](https://www.jsdelivr.com/package/npm/@editorjs/image).

`https://cdn.jsdelivr.net/npm/@editorjs/[email protected]`

Then require this script on page with Editor.js through the `<script src=""></script>` tag.
Optionally, you can load this tool from [JsDelivr CDN](https://cdn.jsdelivr.net/npm/@editorjs/image@latest)

## Usage

Expand Down
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
{
"name": "@editorjs/image",
"version": "2.8.2",
"version": "2.9.0",
"keywords": [
"codex editor",
"tool",
"image",
"editor.js",
"editorjs"
],
"description": "Image Tool for Editor.js",
"license": "MIT",
"repository": "https://github.com/editor-js/image",
"main": "./dist/bundle.js",
"files": [
"dist"
],
"main": "./dist/image.umd.js",
"module": "./dist/image.mjs",
"exports": {
".": {
"import": "./dist/image.mjs",
"require": "./dist/image.umd.js"
}
},
"scripts": {
"build": "webpack --mode production",
"build:dev": "webpack --mode development --watch",
"dev": "vite",
"build": "vite build",
"lint": "eslint src/ --ext .js",
"lint:errors": "eslint src/ --ext .js --quiet",
"lint:fix": "eslint src/ --ext .js --fix"
Expand All @@ -24,27 +33,18 @@
"email": "[email protected]"
},
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.3.4",
"@babel/runtime": "^7.2.0",
"@codexteam/ajax": "^4.2.0",
"babel-loader": "^8.0.5",
"css-loader": "^3.5.2",
"eslint": "^6.8.0",
"eslint-config-codex": "^1.3.3",
"eslint-loader": "^4.0.0",
"formidable": "^1.2.1",
"postcss-loader": "^3.0.0",
"postcss-nested": "^4.1.0",
"postcss-nested-ancestors": "^2.0.0",
"request": "^2.88.0",
"style-loader": "^1.1.4",
"svg-inline-loader": "^0.8.0",
"webpack": "^4.29.5",
"webpack-cli": "^3.2.3"
"vite": "^4.5.0",
"vite-plugin-css-injected-by-js": "^3.3.0"
},
"dependencies": {
"@codexteam/icons": "^0.0.6"
}
}
}
7 changes: 7 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
plugins: [
require('postcss-nested-ancestors'),
require('postcss-nested'),
],
};

23 changes: 23 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import path from "path";
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
import * as pkg from "./package.json";

const NODE_ENV = process.argv.mode || "development";
const VERSION = pkg.version;

export default {
build: {
copyPublicDir: false,
lib: {
entry: path.resolve(__dirname, "src", "index.js"),
name: "ImageTool",
fileName: "image",
},
},
define: {
NODE_ENV: JSON.stringify(NODE_ENV),
VERSION: JSON.stringify(VERSION),
},

plugins: [cssInjectedByJsPlugin()],
};
87 changes: 0 additions & 87 deletions webpack.config.js

This file was deleted.

Loading
Loading