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

🔖 v3.0.0-beta.0 #39

Merged
merged 1 commit into from
Sep 10, 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
26 changes: 26 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

public
27 changes: 27 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:vue/vue3-essential',
'@vue/eslint-config-typescript'
],
parserOptions: {
ecmaVersion: 'latest'
},
rules: {
quotes: ['error', 'single'], // 使用单引号
semi: ['error', 'never'], // 禁止在语句末尾使用分号
'space-before-function-paren': ['error', 'always'], // function 左括号之前需要有空格
'arrow-spacing': ['error', { before: true, after: true }], // 箭头函数箭头前后需要有空格
'comma-spacing': ['error', { 'before': false, 'after': true }], // 逗号后面有空格,前面没有空格
'object-curly-spacing': ['error', 'always'], // 大括号左右需要有空格
'space-before-blocks': ['error', 'always'], // 大括号之前需要有空格
'space-infix-ops': 'error', // 运算符周围需要有空格
'key-spacing': ['error', { beforeColon: false, afterColon: true }], // 冒号左边不需要空格,右边需要空格
'indent': ['error', 2], // 缩进为2个空格
'vue/html-indent': ['error', 2, {}], // 模板缩进为2个空格
}
}
37 changes: 37 additions & 0 deletions .github/workflows/github-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and Deploy

on:
pull_request:
branches: main
push:
branches: main

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Node Version Change ➕
uses: actions/setup-node@v3
with:
node-version: 16

- name: Use Pnpm ➕
uses: pnpm/action-setup@v2
with:
version: 6
run_install: false

- name: Install and Build 🔧
run: |
pnpm i
pnpm run gh-pages

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
token: ${{ secrets.PERSONAL_TOKEN }}
folder: dist
58 changes: 22 additions & 36 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,36 @@
name: Node.js Package & gh-pages Build
name: Build and Publish

on:
pull_request:
branches:
- main
branches: main
push:
branches: main

jobs:
publish-npm:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Node Version Change ➕
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- uses: pnpm/action-setup@v2

- name: Use Pnpm ➕
uses: pnpm/action-setup@v2
with:
version: 6
run_install: false
- run: pnpm i
- run: pnpm run build
- run: pnpm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

create-githubpage:
# needs: publish-npm
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2
with:
version: 6
run_install: false
- name: gh-pages build
run: |

- name: Install and Build 🔧
run: |
pnpm i
pnpm run gh-pages
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
publish_dir: ./dist
pnpm run build

- name: Publish 🚀
run: pnpm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
19 changes: 1 addition & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
.DS_Store
node_modules
/dist

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
dist/*
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": false,
"source.fixAll.eslint": true
}
}
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# simple-m-editor

> A markdown editor with Vue@2.7
> A markdown editor with Vue@3

If you want to use it with the eaiser vue version, you can use [email protected]
If you want to use it with [email protected], you can use [email protected].
If you want to use it with [email protected] or older version, you can use [email protected].

![GitHub package.json version](https://img.shields.io/github/package-json/v/hellomrbigshot/simple-m-editor)
![GitHub](https://img.shields.io/github/license/hellomrbigshot/simple-m-editor)
Expand All @@ -28,8 +29,8 @@ pnpm i simple-m-editor
// you can add class "m-editor-preview" to your element to
// use the same style as the editor shows
<script setup>
import mEditor from 'simple-m-editor'
import 'simple-m-editor/dist/simple-m-editor.css'
import { MEditor, marked } from 'simple-m-editor'
import 'simple-m-editor/dist/style.css'
const text = ref('')
const markdownContent = ref('')
const handleChange = (data) => {
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
55 changes: 32 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,51 @@
{
"name": "simple-m-editor",
"version": "1.0.0-beta.2",
"private": false,
"type": "module",
"main": "./dist/simple-m-editor.umd.cjs",
"module": "./dist/simple-m-editor.js",
"exports": {
".": {
"import": "./dist/simple-m-editor.js",
"require": "./dist/simple-m-editor.umd.cjs"
}
},
"repository": {
"type": "git",
"url": "https://github.com/hellomrbigshot/simple-m-editor.git"
"version": "3.0.0-beta.0",
"main": "dist/vue-next-m-editor.umd.js",
"module": "vue-next-m-editor.mjs",
"unpkg": "dist/vue-next-m-editor.umd.js",
"browser": {
"./sfc": "src/components/index.tsx"
},
"types": "dist/src/index.d.ts",
"scripts": {
"dev": "vite",
"build": "vite build",
"gh-pages": "vite build --mode gh-pages",
"preview": "vite preview"
},
"files": [
"dist"
],
"dependencies": {
"highlight.js": "^11.1.0",
"lodash": "^4.17.21",
"marked": "^2.1.3",
"sass": "^1.57.1"
"@vitejs/plugin-vue": "^4.3.4",
"highlight.js": "^11.7.0",
"lodash-es": "^4.17.21",
"marked": "^7.0.5",
"marked-highlight": "^2.0.5"
},
"devDependencies": {
"@vitejs/plugin-vue2": "^2.2.0",
"vite": "^4.0.4",
"vue": "^2.7.0"
"@rollup/plugin-typescript": "^11.1.3",
"@rushstack/eslint-patch": "^1.3.3",
"@types/highlightjs": "^9.12.2",
"@types/lodash-es": "^4.17.5",
"@types/marked": "^5.0.1",
"@types/node": "^18.11.18",
"@vitejs/plugin-vue-jsx": "^3.0.2",
"@vue/eslint-config-typescript": "^11.0.3",
"eslint": "^8.49.0",
"eslint-plugin-vue": "^9.17.0",
"sass": "^1.42.1",
"tslib": "^2.3.0",
"typescript": "^4.4.3",
"vite": "^4.1.1",
"vue": "^3.3.4"
},
"peerDependencies": {
"vue": "^2.7.0"
"vue": "^3.0.0"
},
"engines": {
"node": ">=16",
"pnpm": ">=6.10"
"npm": ">=6"
}
}
Loading