Skip to content

Commit

Permalink
chore: dirctory refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Mar 6, 2023
1 parent e84c3c2 commit f1733b1
Show file tree
Hide file tree
Showing 30 changed files with 305 additions and 156 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/ci.marster.yml
Expand Up @@ -15,17 +15,21 @@ jobs:
registry-url: 'https://registry.npmjs.org'

- run: npm install
- run: npm run build:lib
- run: npm run coverage
- run: npm run doc
- run: npm run build:doc

- run: npm run bundle
working-directory: core
- run: npm run bundle:min
working-directory: core

- run: cp -rp coverage build
- run: cp -rp coverage website/build

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

- name: Generate Contributors Images
uses: jaywcjlove/github-action-contributors@main
Expand All @@ -52,7 +56,7 @@ jobs:
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
publish_dir: ./website/build

- name: Generate Changelog
id: changelog
Expand Down Expand Up @@ -86,11 +90,13 @@ jobs:
- name: package.json info
uses: jaywcjlove/github-action-package@main
with:
unset: scripts,jest,eslintConfig,engines,browserslist,devDependencies
path: core/package.json
unset: scripts,devDependencies

- run: npm publish
name: 📦 @uiw/react-markdown-preview publish to NPM
continue-on-error: true
working-directory: core
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand All @@ -109,15 +115,20 @@ jobs:
scope: '@uiwjs'

- run: npm install

- run: npm run bundle
working-directory: core
- run: npm run bundle:min
working-directory: core

- name: Modify @uiw/react-markdown-preview => @uiwjs/react-markdown-preview
uses: jaywcjlove/github-action-package@main
with:
path: core/package.json
rename: '@uiwjs/react-markdown-preview'

- run: npm publish
continue-on-error: true
working-directory: core
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
12 changes: 8 additions & 4 deletions .github/workflows/pr.yml
@@ -1,4 +1,4 @@
name: Build & Deploy
name: PR
on:
pull_request:

Expand All @@ -10,10 +10,14 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'

- run: npm install
- run: npm run build
- run: npm run build:lib
- run: npm run coverage
- run: npm run doc
- run: npm run build:doc

- run: npm run bundle
- run: npm run bundle:min
working-directory: core
- run: npm run bundle:min
working-directory: core
56 changes: 0 additions & 56 deletions .kktrc.ts

This file was deleted.

18 changes: 18 additions & 0 deletions core/.kktrc.ts
@@ -0,0 +1,18 @@
import { LoaderConfOptions, WebpackConfiguration } from 'kkt';
import lessModules from '@kkt/less-modules';

export default (conf: WebpackConfiguration, env: 'production' | 'development', options: LoaderConfOptions) => {
conf = lessModules(conf, env, options);
if (options.bundle) {
conf.output!.library = '@uiw/react-markdown-preview';
conf.externals = {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
};
}
return conf;
};
10 changes: 6 additions & 4 deletions README.md → core/README.md
Expand Up @@ -31,7 +31,8 @@ $ npm install @uiw/react-markdown-preview --save

[![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?logo=codesandbox)](https://codesandbox.io/embed/react-markdown-preview-co1mj?fontsize=14&hidenavigation=1&theme=dark)

```js test:meta
```jsx mdx:preview
import React from 'react';
import MarkdownPreview from '@uiw/react-markdown-preview';

const source = `
Expand All @@ -40,7 +41,7 @@ const source = `
> todo: React component preview markdown text.
`;

function Demo() {
export default function Demo() {
return (
<MarkdownPreview source={source} />
)
Expand All @@ -49,7 +50,8 @@ function Demo() {

## Disable Header links

```js test:meta
```jsx mdx:preview
import React from 'react';
import MarkdownPreview from '@uiw/react-markdown-preview';

const source = `
Expand All @@ -60,7 +62,7 @@ const source = `
### Header 3
`;

function Demo() {
export default function Demo() {
return (
<MarkdownPreview
source={source}
Expand Down
54 changes: 54 additions & 0 deletions core/package.json
@@ -0,0 +1,54 @@
{
"name": "@uiw/react-markdown-preview",
"version": "4.1.9",
"description": "React component preview markdown text in web browser. The minimal amount of CSS to replicate the GitHub Markdown style.",
"homepage": "https://uiwjs.github.io/react-markdown-preview",
"main": "lib/index.js",
"module": "esm/index.js",
"scripts": {
"css:build": "compile-less -d src -o esm",
"css:watch": "compile-less -d src -o esm --watch",
"css:build:dist": "compile-less -d src --combine markdown.css --rm-global",
"bundle": "ncc build src/index.tsx --target web --filename markdown",
"bundle:min": "ncc build src/index.tsx --target web --filename markdown --minify",
"watch": "tsbb watch & npm run css:watch",
"build": "tsbb build && npm run css:build && npm run css:build:dist"
},
"repository": {
"type": "git",
"url": "https://github.com/uiwjs/react-markdown-preview.git"
},
"author": "kenny wang <wowohoo@qq.com>",
"license": "MIT",
"files": [
"dist",
"lib",
"esm",
"markdown.css",
"src/**/*.{ts,tsx,less}"
],
"keywords": [
"react",
"markdown",
"prismjs",
"react-markdown"
],
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
},
"dependencies": {
"@babel/runtime": "^7.17.2",
"@uiw/copy-to-clipboard": "~1.0.12",
"react-markdown": "~8.0.0",
"rehype-attr": "~2.1.0",
"rehype-autolink-headings": "~6.1.1",
"rehype-ignore": "^1.0.1",
"rehype-prism-plus": "~1.5.0",
"rehype-raw": "^6.1.1",
"rehype-rewrite": "~3.0.6",
"rehype-slug": "~5.1.0",
"remark-gfm": "~3.0.1",
"unist-util-visit": "^4.1.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion src/tsconfig.json → core/tsconfig.json
Expand Up @@ -3,5 +3,6 @@
"compilerOptions": {
"baseUrl": "./",
"noEmit": false
}
},
"include": ["src", "./.kktrc.ts"]
}
5 changes: 5 additions & 0 deletions lerna.json
@@ -0,0 +1,5 @@
{
"version": "4.1.9",
"packages": ["core", "website"],
"useWorkspaces": true
}

0 comments on commit f1733b1

Please sign in to comment.