Skip to content

Commit ff0a25a

Browse files
authored
Merge pull request editor-js#39 from editor-js/migrate/vite
Migrate to vite
2 parents 7cc9471 + 84af39f commit ff0a25a

File tree

7 files changed

+227
-3488
lines changed

7 files changed

+227
-3488
lines changed

.github/workflows/npm-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v2
1313
- uses: actions/setup-node@v1
1414
with:
15-
node-version: 12
15+
node-version: 19
1616
registry-url: https://registry.npmjs.org/
1717
- run: yarn
1818
- run: yarn build

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.idea/
22
assets/
33
src/
4-
webpack.config.js
4+
vite.config.js
55
yarn.lock

README.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,19 @@ Inline Tool for marking code-fragments for the [Editor.js](https://ifmo.su/edito
88

99
## Installation
1010

11-
### Install via NPM
12-
1311
Get the package
1412

1513
```shell
16-
npm i --save-dev @editorjs/inline-code
14+
yarn add @editorjs/inline-code
1715
```
1816

1917
Include module at your application
2018

2119
```javascript
22-
const InlineCode = require('@editorjs/inline-code');
20+
import InlineCode from '@editorjs/inline-code';
2321
```
2422

25-
### Download to your project's source dir
26-
27-
1. Upload folder `dist` from repository
28-
2. Add `dist/bundle.js` file to your page.
29-
30-
### Load from CDN
31-
32-
You can load specific version of package from [jsDelivr CDN](https://www.jsdelivr.com/package/npm/@editorjs/inline-code).
33-
34-
`https://cdn.jsdelivr.net/npm/@editorjs/inline-code@1.0.1`
35-
36-
Require this script on a page with Editor.js.
37-
38-
```html
39-
<script src="..."></script>
40-
```
23+
Optionally, you can load this tool from CDN [JsDelivr CDN](https://cdn.jsdelivr.net/npm/@editorjs/inline-code@latest)
4124

4225
## Usage
4326

package.json

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
{
22
"name": "@editorjs/inline-code",
3-
"version": "1.4.0",
3+
"version": "1.5.0",
44
"keywords": [
55
"codex editor",
66
"inline",
77
"code",
8-
"tool",
98
"editor.js",
109
"editorjs"
1110
],
1211
"description": "InlineCode Tool for Editor.js",
1312
"license": "MIT",
1413
"repository": "https://github.com/editor-js/inline-code",
15-
"main": "./dist/bundle.js",
14+
"files": [
15+
"dist"
16+
],
17+
"main": "./dist/inline-code.umd.js",
18+
"module": "./dist/inline-code.mjs",
19+
"exports": {
20+
".": {
21+
"import": "./dist/inline-code.mjs",
22+
"require": "./dist/inline-code.umd.js"
23+
}
24+
},
1625
"scripts": {
17-
"build": "webpack --mode production",
18-
"build:dev": "webpack --mode development --watch"
26+
"dev": "vite",
27+
"build": "vite build"
1928
},
2029
"author": {
2130
"name": "CodeX Team",
2231
"email": "team@ifmo.su"
2332
},
2433
"devDependencies": {
25-
"@babel/core": "^7.3.4",
26-
"@babel/preset-env": "^7.3.4",
27-
"babel-loader": "^8.0.5",
28-
"css-loader": "^1.0.0",
29-
"raw-loader": "^3.1.0",
30-
"style-loader": "^0.21.0",
31-
"webpack": "^4.29.5",
32-
"webpack-cli": "^3.2.3"
34+
"vite": "^4.5.0",
35+
"vite-plugin-css-injected-by-js": "^3.3.0"
3336
},
3437
"dependencies": {
3538
"@codexteam/icons": "^0.0.5"

vite.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import path from "path";
2+
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
3+
import * as pkg from "./package.json";
4+
5+
const NODE_ENV = process.argv.mode || "development";
6+
const VERSION = pkg.version;
7+
8+
export default {
9+
build: {
10+
copyPublicDir: false,
11+
lib: {
12+
entry: path.resolve(__dirname, "src", "index.js"),
13+
name: "InlineCode",
14+
fileName: "inline-code",
15+
},
16+
},
17+
define: {
18+
NODE_ENV: JSON.stringify(NODE_ENV),
19+
VERSION: JSON.stringify(VERSION),
20+
},
21+
22+
plugins: [cssInjectedByJsPlugin()],
23+
};

webpack.config.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)