Skip to content

Commit

Permalink
Merge pull request #112 from editor-js/migrate/vite
Browse files Browse the repository at this point in the history
Migrate to vite
  • Loading branch information
robonetphy committed Nov 10, 2023
2 parents 05c392f + 138075d commit a42087b
Show file tree
Hide file tree
Showing 9 changed files with 1,202 additions and 2,858 deletions.
10 changes: 3 additions & 7 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"presets": [
"@babel/preset-env"
],
"plugins": [
"@babel/plugin-transform-runtime"
]
}
"presets": ["@babel/preset-env"],
"plugins": ["@babel/plugin-transform-runtime"]
}
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: 16
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 @@ -2,6 +2,7 @@
docs/
src/
test/
vite.config.js
postcss.config.js
.babelrc
webpack.config.js
yarn.lock
15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ Tool uses Editor.js pasted patterns handling and inserts iframe with embedded co

## Installation

### Install via NPM

Get the package

```shell
npm i --save @editorjs/embed
yarn add @editorjs/embed
```

Include module at your application
Expand All @@ -45,16 +43,7 @@ Include module at your application
import Embed from '@editorjs/embed';
```

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

`https://cdn.jsdelivr.net/npm/@editorjs/embed@latest`

Then require this script on page with Editor.js.

```html
<script src="..."></script>
```
Optionally, you can load this tool from CDN [JsDelivr CDN](https://cdn.jsdelivr.net/npm/@editorjs/embed@latest)

## Usage

Expand Down
38 changes: 21 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
{
"name": "@editorjs/embed",
"version": "2.6.0",
"version": "2.7.0",
"keywords": [
"codex editor",
"embed",
"tool",
"editor.js",
"editorjs"
],
"description": "Embed Tool for Editor.js",
"license": "MIT",
"repository": "https://github.com/editor-js/embed",
"main": "./dist/bundle.js",
"files": [
"dist"
],
"main": "./dist/embed.umd.js",
"module": "./dist/embed.mjs",
"exports": {
".": {
"import": "./dist/embed.mjs",
"require": "./dist/embed.umd.js"
}
},
"scripts": {
"build": "webpack --mode production",
"build:dev": "webpack --mode development --watch",
"dev": "vite",
"build": "vite build",
"test": "mocha -r @babel/register -r ignore-styles --recursive ./test",
"lint": "eslint src/ --ext .js",
"lint:errors": "eslint src/ --ext .js --quiet",
Expand All @@ -25,24 +34,19 @@
"email": "team@codex.so"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-transform-runtime": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.2",
"babel-loader": "^8.1.0",
"@babel/plugin-transform-runtime": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/register": "^7.22.15",
"chai": "^4.2.0",
"css-loader": "^3.5.3",
"debounce": "^1.2.0",
"eslint": "^7.25.0",
"eslint-config-codex": "^1.6.1",
"ignore-styles": "^5.0.1",
"mocha": "^7.1.1",
"postcss-loader": "^3.0.0",
"postcss-nested": "^4.2.1",
"postcss-nested-ancestors": "^2.0.0",
"style-loader": "^1.2.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
}
"vite": "^4.5.0",
"vite-plugin-css-injected-by-js": "^3.3.0"
},
"dependencies": {}
}
6 changes: 6 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
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: "Embed",
fileName: "embed",
},
},
define: {
NODE_ENV: JSON.stringify(NODE_ENV),
VERSION: JSON.stringify(VERSION),
},

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

This file was deleted.

Loading

0 comments on commit a42087b

Please sign in to comment.