Skip to content

Commit 92eb8c0

Browse files
committed
docs: 更新 Node 引入路径和构建脚本
1 parent aac4a8d commit 92eb8c0

File tree

5 files changed

+15
-128
lines changed

5 files changed

+15
-128
lines changed

README.CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ const cherryInstance = new Cherry({
164164
### Node
165165

166166
```javascript
167-
const { default: CherryEngine } = require('cherry-markdown/dist/cherry-markdown.engine.core.common');
167+
const { default: CherryEngine } = require('cherry-markdown/dist/cherry-markdown.engine.core');
168168
const cherryEngineInstance = new CherryEngine();
169169
const htmlContent = cherryEngineInstance.makeHtml('# welcome to cherry editor!');
170170
```

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ const cherryInstance = new Cherry({
163163
### Node
164164

165165
```javascript
166-
const { default: CherryEngine } = require('cherry-markdown/dist/cherry-markdown.engine.core.common');
166+
const { default: CherryEngine } = require('cherry-markdown/dist/cherry-markdown.engine.core');
167167
const cherryEngineInstance = new CherryEngine();
168168
const htmlContent = cherryEngineInstance.makeHtml('# welcome to cherry editor!');
169169
```

packages/cherry-markdown/build/replacePaths.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@ const { replaceInFile } = pkg;
33

44
async function replacePaths() {
55
try {
6-
const results = await replaceInFile({
7-
files: 'dist/types/**/*.d.ts',
8-
from: /~types\//g,
9-
to: '../../types/',
10-
});
6+
const results = await Promise.all([
7+
replaceInFile({
8+
files: 'dist/types/**/*.d.ts',
9+
from: /~types\//g,
10+
to: '../../types/',
11+
}),
12+
replaceInFile({
13+
files: 'dist/types/**/*.d.ts',
14+
from: /@\/addons\//g,
15+
to: './addons/',
16+
}),
17+
]);
1118
for (const result of results) {
1219
if (result.hasChanged) {
1320
console.log(result);

scripts/generate-addons-exports.ts

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

scripts/post-build.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
import * as path from 'path';
22
import * as fs from 'fs';
3-
import { execSync } from 'child_process';
43

54
const cwd = process.cwd();
65
const cherryDist = path.join(cwd, 'packages/cherry-markdown/dist');
76
const cherryVscodePlugin = path.join(cwd, 'packages/vscodePlugin/web-resources/dist');
87

9-
// 1. 生成 cherry markdown addons 插件 exports 配置
10-
console.log('[post-build] Generating addons exports...');
11-
try {
12-
execSync('tsx scripts/generate-addons-exports.ts', { cwd, stdio: 'inherit' });
13-
} catch (error) {
14-
console.warn('[post-build] Failed to generate addons exports:', error);
15-
}
16-
17-
// 2. 复制 dist 到 vscode 插件
8+
// 复制 dist 到 vscode 插件
189
console.log('[post-build] Copying dist to vscode plugin...');
1910
fs.cpSync(cherryDist, cherryVscodePlugin, { recursive: true });
2011
console.log('[post-build] Done!');

0 commit comments

Comments
 (0)