diff --git a/README.md b/README.md index b0042ed..ca89794 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Write html: Import style: ```css -@import '@opentiny/fluent-editor/dist/style.css' +@import '@opentiny/fluent-editor/style.css' ``` Initialize the FluentEditor editor: diff --git a/README.zh-CN.md b/README.zh-CN.md index 21ecad8..f25c8cb 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -30,7 +30,7 @@ npm i @opentiny/fluent-editor 引入样式: ```css -@import '@opentiny/fluent-editor/dist/style.css' +@import '@opentiny/fluent-editor/style.css' ``` 初始化 FluentEditor 编辑器: diff --git a/packages/docs/fluent-editor/.vitepress/theme/vars.css b/packages/docs/fluent-editor/.vitepress/theme/vars.css index b254f62..ca22590 100644 --- a/packages/docs/fluent-editor/.vitepress/theme/vars.css +++ b/packages/docs/fluent-editor/.vitepress/theme/vars.css @@ -16,6 +16,6 @@ } /* 隐藏 Playground 和全屏按钮 */ -._example-tooltip_18ews_2:nth-child(1) svg { +.example-actions-playground, .example-actions-fullscreen { display: none; } \ No newline at end of file diff --git a/packages/docs/fluent-editor/docs/quick-start.md b/packages/docs/fluent-editor/docs/quick-start.md index 4551338..7da1499 100644 --- a/packages/docs/fluent-editor/docs/quick-start.md +++ b/packages/docs/fluent-editor/docs/quick-start.md @@ -17,7 +17,7 @@ npm i @opentiny/fluent-editor 引入样式: ```css -@import '@opentiny/fluent-editor/dist/style.css' +@import '@opentiny/fluent-editor/style.css' ``` 初始化 Fluent Editor 编辑器: diff --git a/packages/docs/package.json b/packages/docs/package.json index 3aa1b87..ef5d06c 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -9,7 +9,7 @@ "preview": "vitepress preview fluent-editor" }, "devDependencies": { - "@vitepress-code-preview/container": "^1.0.7", + "@vitepress-code-preview/container": "^1.0.8", "@vitepress-code-preview/plugin": "^1.0.4", "vite": "^2.3.0", "vitepress": "^1.3.2" diff --git a/packages/fluent-editor/package.json b/packages/fluent-editor/package.json index 20664ed..a476b1b 100644 --- a/packages/fluent-editor/package.json +++ b/packages/fluent-editor/package.json @@ -1,6 +1,6 @@ { "name": "@opentiny/fluent-editor", - "version": "3.17.1", + "version": "3.17.2", "description": "A rich text editor based on Quill 2.0, which extends rich modules and formats on the basis of Quill. It's powerful and out-of-the-box.", "homepage": "https://opentiny.github.io/fluent-editor/", "keywords": [ @@ -23,24 +23,21 @@ "url": "https://github.com/opentiny/fluent-editor/issues" }, "main": "src/index.ts", - "files": [ - "dist/*" - ], "module": "src/index.ts", "exports": { ".": { "import": "./src/index.ts", "require": "./src/index.ts" }, - "./dist/style.css": { - "import": "./dist/style.css", - "require": "./dist/style.css" + "./style.css": { + "import": "./style.css", + "require": "./style.css" } }, "scripts": { "start": "vite build && vite", "dev": "vite", - "build": "vite build", + "build": "vite build && node scripts/pre-release.js", "test": "jest", "format": "prettier './{src,test}/**/*.{js,ts,tsx,vue}' --write" }, @@ -60,12 +57,14 @@ "@types/quill": "^2.0.9", "@typescript-eslint/eslint-plugin": "^5.7.0", "@typescript-eslint/parser": "^5.7.0", + "commander": "^6.2.0", "eslint": "^8.5.0", "jest": "^26.6.3", "lint-staged": "^12.1.4", "lodash-es": "^4.17.15", "prettier": "^2.3.0", "sass": "^1.47.0", + "shelljs": "^0.8.4", "ts-jest": "^26.5.6", "ts-node": "^9.1.1", "typescript": "^4.2.4", diff --git a/packages/fluent-editor/scripts/pre-release.js b/packages/fluent-editor/scripts/pre-release.js new file mode 100644 index 0000000..a8e5fdb --- /dev/null +++ b/packages/fluent-editor/scripts/pre-release.js @@ -0,0 +1,38 @@ +const path = require('path') +const shelljs = require('shelljs') +const program = require('commander') + +shelljs.cp('-rf', 'package.json', 'dist') +const targetFile = path.resolve(__dirname, '../dist/package.json') +const packagejson = require(targetFile) +const currentVersion = packagejson.version +const versionArr = currentVersion.split('.') +const [mainVersion, subVersion, phaseVersion] = versionArr + +// 默认版本号 +const defaultVersion = `${mainVersion}.${subVersion}.${+phaseVersion+1}` + +let newVersion = defaultVersion + +// 从命令行参数中取版本号 +program + .option('-v, --versions ', 'Add release version number', defaultVersion) + +program.parse(process.argv) + +if (program.versions) { + newVersion = program.versions +} + +console.log('newVersion:', newVersion) + +function preRelease() { + shelljs.sed('-i', `"version": "${currentVersion}"`, `"version": "${newVersion}"`, targetFile) + shelljs.sed('-i', `"main": "src/index.ts"`, `"main": "index.cjs.js"`, targetFile) + shelljs.sed('-i', `"module": "src/index.ts"`, `"module": "index.es.js"`, targetFile) + shelljs.sed('-i', `"import": "./src/index.ts"`, `"import": "./index.es.js"`, targetFile) + shelljs.sed('-i', `"require": "./src/index.ts"`, `"require": "./index.cjs.js"`, targetFile) + shelljs.cp('-rf', '../../README.md', 'dist') +} + +preRelease() diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 08e1166..9fa8b82 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,8 +15,8 @@ importers: version: link:../fluent-editor devDependencies: '@vitepress-code-preview/container': - specifier: ^1.0.7 - version: 1.0.7(vue@3.4.37) + specifier: ^1.0.8 + version: 1.0.8(vue@3.4.37) '@vitepress-code-preview/plugin': specifier: ^1.0.4 version: 1.0.4 @@ -57,6 +57,9 @@ importers: '@typescript-eslint/parser': specifier: ^5.7.0 version: 5.62.0(eslint@8.57.0)(typescript@4.9.5) + commander: + specifier: ^6.2.0 + version: 6.2.1 eslint: specifier: ^8.5.0 version: 8.57.0 @@ -75,6 +78,9 @@ importers: sass: specifier: ^1.47.0 version: 1.77.8 + shelljs: + specifier: ^0.8.4 + version: 0.8.5 ts-jest: specifier: ^26.5.6 version: 26.5.6(jest@26.6.3)(typescript@4.9.5) @@ -1600,8 +1606,8 @@ packages: vue: 3.4.37 dev: true - /@vitepress-code-preview/container@1.0.7(vue@3.4.37): - resolution: {integrity: sha512-TIfEyB0W0zHrUcpkSEPbOUdtCEQN6Qog+PlcFHcdvdudyiRwJB/aeTfJJJ4iDT268qp3lQKwKrJ+QCnLNIbtuw==} + /@vitepress-code-preview/container@1.0.8(vue@3.4.37): + resolution: {integrity: sha512-XRUYg51UvscKXbaq5y2+BxneLGfpnrBsTOZ6kHOmMN5skSE7JOtVDJrZn4XecvW4hP8G4JFgXLpfbizE5foZCw==} engines: {node: '>= 16'} peerDependencies: vue: ^3.3.0 @@ -2352,6 +2358,11 @@ packages: delayed-stream: 1.0.0 dev: true + /commander@6.2.1: + resolution: {integrity: sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==} + engines: {node: '>= 6'} + dev: true + /commander@9.5.0: resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} engines: {node: ^12.20.0 || >=14} @@ -3542,6 +3553,11 @@ packages: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} dev: true + /interpret@1.4.0: + resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==} + engines: {node: '>= 0.10'} + dev: true + /is-accessor-descriptor@1.0.1: resolution: {integrity: sha512-YBUanLI8Yoihw923YeFUS5fs0fF2f5TSFTNiYAAzhhDscDa3lEqYuz1pDOEP5KvX94I9ey3vsqjJcLVFVU+3QA==} engines: {node: '>= 0.10'} @@ -5275,6 +5291,13 @@ packages: picomatch: 2.3.1 dev: true + /rechoir@0.6.2: + resolution: {integrity: sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==} + engines: {node: '>= 0.10'} + dependencies: + resolve: 1.22.8 + dev: true + /regex-not@1.0.2: resolution: {integrity: sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==} engines: {node: '>=0.10.0'} @@ -5556,6 +5579,16 @@ packages: engines: {node: '>=8'} dev: true + /shelljs@0.8.5: + resolution: {integrity: sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==} + engines: {node: '>=4'} + hasBin: true + dependencies: + glob: 7.2.3 + interpret: 1.4.0 + rechoir: 0.6.2 + dev: true + /shellwords@0.1.1: resolution: {integrity: sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==} requiresBuild: true