Skip to content

Commit

Permalink
refactor: refactor code project folder & refactor the website.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Aug 1, 2023
1 parent 2861ce6 commit 5b37af8
Show file tree
Hide file tree
Showing 31 changed files with 307 additions and 274 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,32 @@ jobs:

- run: npm install
- run: npm run build
- run: npm run test:coverage
- run: npm run coverage

- run: npm run doc

- name: Create Coverage Badges
uses: jaywcjlove/coverage-badges-cli@main
with:
output: coverage/badges.svg
output: core/coverage/badges.svg

- run: npm run bundle
- run: npm run bundle:min
- run: cp -rp coverage build
- run: cp -rp coverage ../www/build
working-directory: core

- name: Generate Contributors Images
uses: jaywcjlove/github-action-contributors@main
with:
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
output: build/CONTRIBUTORS.svg
output: www/build/CONTRIBUTORS.svg
avatarSize: 42

- name: Create Tag
id: create_tag
uses: jaywcjlove/create-tag-action@main
with:
package-path: ./package.json
package-path: ./core/package.json

- name: get tag version
id: tag_version
Expand All @@ -51,7 +52,7 @@ jobs:
with:
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
publish_dir: ./www/build

- name: Generate Changelog
id: changelog
Expand Down Expand Up @@ -84,11 +85,12 @@ jobs:
- name: 📦 @uiw/react-textarea-code-editor publish to NPM
run: npm publish
continue-on-error: true
working-directory: core
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

outputs:
successful: ${{steps.create_tag.outputs.successful }}
# outputs:
# successful: ${{steps.create_tag.outputs.successful }}

# github-package:
# runs-on: ubuntu-latest
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:

- run: npm install
- run: npm run build
- run: npm run doc
- run: npm run test:coverage
- run: npm run coverage
- run: npm run bundle
- run: npm run bundle:min
60 changes: 0 additions & 60 deletions .kktrc.ts

This file was deleted.

5 changes: 5 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"*.{js,jsx,tsx,ts,less,md,json}": [
"prettier --write"
]
}
18 changes: 18 additions & 0 deletions core/.kktrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { LoaderConfOptions, WebpackConfiguration } from 'kkt';
import lessModules from '@kkt/less-modules';

export default (conf: WebpackConfiguration, env: 'development' | 'production', options: LoaderConfOptions) => {
conf = lessModules(conf, env, options);
if (options.bundle) {
conf.output!.library = '@uiw/react-textarea-code-editor';
conf.externals = {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
};
}
return conf;
};
File renamed without changes.
55 changes: 55 additions & 0 deletions core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "@uiw/react-textarea-code-editor",
"version": "2.1.7",
"description": "A simple code editor with syntax highlighting.",
"homepage": "https://uiwjs.github.io/react-textarea-code-editor/",
"main": "cjs/index.js",
"module": "esm/index.js",
"repository": {
"type": "git",
"url": "https://github.com/uiwjs/react-textarea-code-editor.git"
},
"author": "Kenny Wong <[email protected]>",
"license": "MIT",
"files": [
"dist.css",
"dist",
"esm",
"cjs",
"src"
],
"keywords": [
"react",
"textarea",
"textarea-editor",
"textarea-code-editor",
"code-editor",
"code",
"highlighting",
"uiw",
"uiwjs",
"editor"
],
"jest": {
"testMatch": [
"<rootDir>/src/__test__/*.{ts,tsx}"
],
"transformIgnorePatterns": [
"<rootDir>/node_modules/?!(.*)"
],
"coverageReporters": [
"lcov",
"json-summary"
]
},
"peerDependencies": {
"@babel/runtime": ">=7.10.0",
"react": ">=16.9.0",
"react-dom": ">=16.9.0"
},
"dependencies": {
"@babel/runtime": "^7.18.6",
"rehype-prism-plus": "1.5.0",
"rehype": "~12.0.1"
}
}
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.
4 changes: 2 additions & 2 deletions src/utils.ts → core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export function htmlEncode(sHtml: string) {
.replace(/```(tsx?|jsx?|html|xml)(.*)\s+([\s\S]*?)(\s.+)?```/g, (str: string) => {
return str.replace(
/[<&"]/g,
(c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' } as Record<string, string>)[c]),
(c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' }) as Record<string, string>)[c],
);
})
.replace(
/[<&"]/g,
(c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' } as Record<string, string>)[c]),
(c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' }) as Record<string, string>)[c],
);
}

Expand Down
9 changes: 9 additions & 0 deletions core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig",
"include": ["src"],
"compilerOptions": {
"outDir": "./cjs",
"baseUrl": ".",
"noEmit": false
}
}
4 changes: 4 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": "2.1.7",
"packages": ["core", "www"]
}
Loading

0 comments on commit 5b37af8

Please sign in to comment.