Skip to content

Commit 5b37af8

Browse files
committed
refactor: refactor code project folder & refactor the website.
1 parent 2861ce6 commit 5b37af8

31 files changed

+307
-274
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,32 @@ jobs:
1616

1717
- run: npm install
1818
- run: npm run build
19-
- run: npm run test:coverage
19+
- run: npm run coverage
2020

2121
- run: npm run doc
2222

2323
- name: Create Coverage Badges
2424
uses: jaywcjlove/coverage-badges-cli@main
2525
with:
26-
output: coverage/badges.svg
26+
output: core/coverage/badges.svg
2727

2828
- run: npm run bundle
2929
- run: npm run bundle:min
30-
- run: cp -rp coverage build
30+
- run: cp -rp coverage ../www/build
31+
working-directory: core
3132

3233
- name: Generate Contributors Images
3334
uses: jaywcjlove/github-action-contributors@main
3435
with:
3536
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
36-
output: build/CONTRIBUTORS.svg
37+
output: www/build/CONTRIBUTORS.svg
3738
avatarSize: 42
3839

3940
- name: Create Tag
4041
id: create_tag
4142
uses: jaywcjlove/create-tag-action@main
4243
with:
43-
package-path: ./package.json
44+
package-path: ./core/package.json
4445

4546
- name: get tag version
4647
id: tag_version
@@ -51,7 +52,7 @@ jobs:
5152
with:
5253
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
5354
github_token: ${{ secrets.GITHUB_TOKEN }}
54-
publish_dir: ./build
55+
publish_dir: ./www/build
5556

5657
- name: Generate Changelog
5758
id: changelog
@@ -84,11 +85,12 @@ jobs:
8485
- name: 📦 @uiw/react-textarea-code-editor publish to NPM
8586
run: npm publish
8687
continue-on-error: true
88+
working-directory: core
8789
env:
8890
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
8991

90-
outputs:
91-
successful: ${{steps.create_tag.outputs.successful }}
92+
# outputs:
93+
# successful: ${{steps.create_tag.outputs.successful }}
9294

9395
# github-package:
9496
# runs-on: ubuntu-latest

.github/workflows/pull_request.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313

1414
- run: npm install
1515
- run: npm run build
16-
- run: npm run doc
17-
- run: npm run test:coverage
16+
- run: npm run coverage
1817
- run: npm run bundle
1918
- run: npm run bundle:min

.kktrc.ts

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

.lintstagedrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"*.{js,jsx,tsx,ts,less,md,json}": [
3+
"prettier --write"
4+
]
5+
}

core/.kktrc.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { LoaderConfOptions, WebpackConfiguration } from 'kkt';
2+
import lessModules from '@kkt/less-modules';
3+
4+
export default (conf: WebpackConfiguration, env: 'development' | 'production', options: LoaderConfOptions) => {
5+
conf = lessModules(conf, env, options);
6+
if (options.bundle) {
7+
conf.output!.library = '@uiw/react-textarea-code-editor';
8+
conf.externals = {
9+
react: {
10+
root: 'React',
11+
commonjs2: 'react',
12+
commonjs: 'react',
13+
amd: 'react',
14+
},
15+
};
16+
}
17+
return conf;
18+
};
File renamed without changes.

core/package.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "@uiw/react-textarea-code-editor",
3+
"version": "2.1.7",
4+
"description": "A simple code editor with syntax highlighting.",
5+
"homepage": "https://uiwjs.github.io/react-textarea-code-editor/",
6+
"main": "cjs/index.js",
7+
"module": "esm/index.js",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/uiwjs/react-textarea-code-editor.git"
11+
},
12+
"author": "Kenny Wong <[email protected]>",
13+
"license": "MIT",
14+
"files": [
15+
"dist.css",
16+
"dist",
17+
"esm",
18+
"cjs",
19+
"src"
20+
],
21+
"keywords": [
22+
"react",
23+
"textarea",
24+
"textarea-editor",
25+
"textarea-code-editor",
26+
"code-editor",
27+
"code",
28+
"highlighting",
29+
"uiw",
30+
"uiwjs",
31+
"editor"
32+
],
33+
"jest": {
34+
"testMatch": [
35+
"<rootDir>/src/__test__/*.{ts,tsx}"
36+
],
37+
"transformIgnorePatterns": [
38+
"<rootDir>/node_modules/?!(.*)"
39+
],
40+
"coverageReporters": [
41+
"lcov",
42+
"json-summary"
43+
]
44+
},
45+
"peerDependencies": {
46+
"@babel/runtime": ">=7.10.0",
47+
"react": ">=16.9.0",
48+
"react-dom": ">=16.9.0"
49+
},
50+
"dependencies": {
51+
"@babel/runtime": "^7.18.6",
52+
"rehype-prism-plus": "1.5.0",
53+
"rehype": "~12.0.1"
54+
}
55+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/utils.ts renamed to core/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ export function htmlEncode(sHtml: string) {
1515
.replace(/```(tsx?|jsx?|html|xml)(.*)\s+([\s\S]*?)(\s.+)?```/g, (str: string) => {
1616
return str.replace(
1717
/[<&"]/g,
18-
(c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' } as Record<string, string>)[c]),
18+
(c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' }) as Record<string, string>)[c],
1919
);
2020
})
2121
.replace(
2222
/[<&"]/g,
23-
(c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' } as Record<string, string>)[c]),
23+
(c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' }) as Record<string, string>)[c],
2424
);
2525
}
2626

core/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../tsconfig",
3+
"include": ["src"],
4+
"compilerOptions": {
5+
"outDir": "./cjs",
6+
"baseUrl": ".",
7+
"noEmit": false
8+
}
9+
}

lerna.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"version": "2.1.7",
3+
"packages": ["core", "www"]
4+
}

0 commit comments

Comments
 (0)