Skip to content

Commit

Permalink
Merge pull request #65 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 16, 2023
2 parents 193f5f6 + d20cddb commit f281996
Show file tree
Hide file tree
Showing 9 changed files with 225 additions and 3,631 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
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ src/
.jshintrc
.postcssrc
.stylelintrc
webpack.config.js
vite.config.js
yarn.lock
3 changes: 0 additions & 3 deletions .postcssrc

This file was deleted.

132 changes: 0 additions & 132 deletions .stylelintrc

This file was deleted.

23 changes: 3 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,19 @@ Code Tool for the [Editor.js](https://ifmo.su/editor) allows to include code exa

## Installation

### Install via NPM

Get the package

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

Include module at your application

```javascript
const CodeTool = require('@editorjs/code');
import CodeTool from '@editorjs/code';
```

### 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

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

`https://cdn.jsdelivr.net/npm/@editorjs/code@2.0.0`

Require this script on a page with Editor.js.

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

## Usage

Expand Down
30 changes: 17 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
{
"name": "@editorjs/code",
"version": "2.8.0",
"version": "2.9.0",
"keywords": [
"codex editor",
"code",
"tool",
"editor.js",
"editorjs"
],
"description": "Code Tool for Editor.js",
"license": "MIT",
"repository": "https://github.com/editor-js/code",
"main": "./dist/bundle.js",
"files": [
"dist"
],
"main": "./dist/code.umd.js",
"module": "./dist/code.mjs",
"exports": {
".": {
"import": "./dist/code.mjs",
"require": "./dist/code.umd.js"
}
},
"scripts": {
"build": "webpack --mode production",
"build:dev": "webpack --mode development --watch"
"dev": "vite",
"build": "vite build"
},
"author": {
"name": "CodeX",
"name": "CodeX Team",
"email": "team@codex.so"
},
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"babel-loader": "^8.0.5",
"css-loader": "^3.5.3",
"style-loader": "^1.2.1",
"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.5"
Expand Down
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: "CodeTool",
fileName: "code",
},
},
define: {
NODE_ENV: JSON.stringify(NODE_ENV),
VERSION: JSON.stringify(VERSION),
},

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

This file was deleted.

Loading

0 comments on commit f281996

Please sign in to comment.