Skip to content

Commit

Permalink
Merge pull request #89 from editor-js/migrate/vite
Browse files Browse the repository at this point in the history
Migrate to vite
  • Loading branch information
robonetphy authored Nov 10, 2023
2 parents f0e9f01 + 4b4ecc6 commit 1500864
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 3,562 deletions.
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
@@ -1,5 +1,6 @@
.idea/
assets/
src/
webpack.config.js
vite.config.js
postcss.config.js
yarn.lock
31 changes: 7 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,19 @@ This Tool for the [Editor.js](https://editorjs.io) allows you to add ordered or

## Installation

### Install via NPM

Get the package

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

Include module at your application

```javascript
import List from '@editorjs/list';
import List from "@editorjs/list";
```

### Download to your project's source dir

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

### Load from CDN

Load the script from [jsDelivr CDN](https://www.jsdelivr.com/package/npm/@editorjs/list) and connect to your page.

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

## Usage

Expand All @@ -63,8 +47,8 @@ var editor = EditorJS({

## Config Params

| Field | Type | Description |
| ----------- | -------- | --------------------------- |
| Field | Type | Description |
| ------------ | -------- | -------------------------------------------------------------- |
| defaultStyle | `string` | type of a list: `ordered` or `unordered`, default is `ordered` |

## Tool's settings
Expand All @@ -75,11 +59,10 @@ You can choose list`s type.

## Output data

| Field | Type | Description |
| ----- | ---------- | -------------------------------------- |
| Field | Type | Description |
| ----- | ---------- | ---------------------------------------- |
| style | `string` | type of a list: `ordered` or `unordered` |
| items | `string[]` | the array of list's items |

| items | `string[]` | the array of list's items |

```json
{
Expand Down
29 changes: 16 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@
{
"name": "@editorjs/list",
"version": "1.8.0",
"version": "1.9.0",
"keywords": [
"codex editor",
"list",
"tool",
"editor.js",
"editorjs"
],
"description": "List Tool for Editor.js",
"license": "MIT",
"repository": "https://github.com/editor-js/list",
"main": "./dist/bundle.js",
"files": [
"dist"
],
"main": "./dist/list.umd.js",
"module": "./dist/list.mjs",
"exports": {
".": {
"import": "./dist/list.mjs",
"require": "./dist/list.umd.js"
}
},
"scripts": {
"build": "webpack --mode production",
"build:dev": "webpack --mode development --watch"
"dev": "vite",
"build": "vite build"
},
"author": {
"name": "CodeX",
"email": "team@codex.so"
},
"devDependencies": {
"@babel/core": "^7.10.2",
"@babel/preset-env": "^7.10.2",
"babel-loader": "^8.1.0",
"css-loader": "^3.5.3",
"postcss-loader": "^3.0.0",
"postcss-nested": "^4.2.1",
"postcss-nested-ancestors": "^2.0.0",
"style-loader": "^1.2.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
"vite": "^4.5.0",
"vite-plugin-css-injected-by-js": "^3.3.0"
},
"dependencies": {
"@codexteam/icons": "^0.0.4"
Expand Down
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: "List",
fileName: "list",
},
},
define: {
NODE_ENV: JSON.stringify(NODE_ENV),
VERSION: JSON.stringify(VERSION),
},

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

This file was deleted.

Loading

0 comments on commit 1500864

Please sign in to comment.