Skip to content

Commit 62d3a22

Browse files
committed
init project.
0 parents  commit 62d3a22

26 files changed

+648
-0
lines changed

.babelrc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"env": {
3+
"cjs": {
4+
"plugins": [
5+
[
6+
"babel-plugin-transform-remove-imports",
7+
{ "test": "(less|css)$" }
8+
]
9+
]
10+
},
11+
"esm": {
12+
"plugins": [
13+
[
14+
"babel-plugin-transform-rename-import",
15+
{ "original": "^(.+?)\\.less$", "replacement": "$1.css" }
16+
]
17+
]
18+
},
19+
"esm:dev": {
20+
"presets": [
21+
"@babel/preset-react",
22+
[
23+
"@tsbb/babel-preset-tsbb",
24+
{
25+
"modules": false,
26+
"targets": {
27+
"browsers": [ "last 2 versions" ]
28+
},
29+
"transformRuntime": {
30+
"useESModules": true
31+
}
32+
}
33+
]
34+
]
35+
}
36+
}
37+
}

.github/workflows/ci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build & Deploy
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
build-deploy:
9+
runs-on: ubuntu-18.04
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: 14
15+
16+
- run: npm install
17+
- run: npm run build
18+
- run: npm run doc
19+
20+
- run: npm install @jsdevtools/npm-publish -g
21+
- run: npm-publish --token="${{ secrets.NPM_TOKEN }}" ./package.json
22+
23+
- name: Create Tag
24+
id: create_tag
25+
uses: jaywcjlove/[email protected]
26+
with:
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
package-path: ./package.json
29+
30+
- name: Generate Changelog
31+
id: changelog
32+
uses: jaywcjlove/[email protected]
33+
with:
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
head-ref: ${{steps.create_tag.outputs.version}}
36+
filter-author: (jaywcjlove|小弟调调™|dependabot\[bot\]|Renovate Bot)
37+
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
38+
39+
- name: Deploy
40+
uses: peaceiris/actions-gh-pages@v3
41+
with:
42+
github_token: ${{ secrets.GITHUB_TOKEN }}
43+
publish_dir: ./build
44+
45+
- name: Create Release
46+
uses: ncipollo/release-action@v1
47+
if: steps.create_tag.outputs.successful
48+
with:
49+
token: ${{ secrets.GITHUB_TOKEN }}
50+
name: ${{ steps.create_tag.outputs.version }}
51+
tag: ${{ steps.create_tag.outputs.version }}
52+
body: |
53+
[![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-run-web@${{steps.create_tag.outputs.versionNumber}}/file/README.md) [![npm bundle size](https://img.shields.io/bundlephobia/minzip/@uiw/react-run-web)](https://bundlephobia.com/result?p=@uiw/react-run-web@${{steps.create_tag.outputs.versionNumber}})
54+
55+
```bash
56+
npm i @uiw/react-run-web@${{steps.create_tag.outputs.versionNumber}}
57+
```
58+
59+
${{ steps.changelog.outputs.compareurl }}
60+
61+
${{ steps.changelog.outputs.changelog }}

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
lib
2+
build
3+
node_modules
4+
npm-debug.log*
5+
package-lock.json
6+
7+
.eslintcache
8+
.DS_Store
9+
.cache
10+
.vscode
11+
12+
*.bak
13+
*.tem
14+
*.temp
15+
#.swp
16+
*.*~
17+
~*.*

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install lint-staged

.kktrc.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import path from 'path';
2+
import webpack, { Configuration } from 'webpack';
3+
import { LoaderConfOptions } from 'kkt';
4+
import WebpackDevServer from 'webpack-dev-server';
5+
import lessModules from '@kkt/less-modules';
6+
import rawModules from '@kkt/raw-modules';
7+
import scopePluginOptions from '@kkt/scope-plugin-options';
8+
import pkg from './package.json';
9+
10+
export default (conf: Configuration, env: 'development' | 'production', options: LoaderConfOptions) => {
11+
conf = rawModules(conf, env, { ...options });
12+
conf = scopePluginOptions(conf, env, {
13+
...options,
14+
allowedFiles: [path.resolve(process.cwd(), 'README.md'), path.resolve(process.cwd(), 'src')],
15+
});
16+
conf = lessModules(conf, env, options);
17+
// Get the project version.
18+
conf.plugins!.push(
19+
new webpack.DefinePlugin({
20+
VERSION: JSON.stringify(pkg.version),
21+
}),
22+
);
23+
if (env === 'production') {
24+
conf.output = { ...conf.output, publicPath: './' };
25+
}
26+
return conf;
27+
};
28+
29+
/**
30+
* Modify WebpackDevServer Configuration Example
31+
*/
32+
export const devServer = (config: WebpackDevServer.Configuration) => {
33+
// Return your customised Webpack Development Server config.
34+
return config;
35+
};

.prettierignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
**/*.md
2+
**/*.svg
3+
**/*.ejs
4+
**/*.yml
5+
package.json
6+
node_modules
7+
dist
8+
build
9+
lib
10+
test

.prettierrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 120,
5+
"endOfLine": "auto",
6+
"overrides": [
7+
{
8+
"files": ".prettierrc",
9+
"options": { "parser": "json" }
10+
}
11+
]
12+
}

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Run Web
2+
===
3+
4+
Online Code Editor for Rapid Web Development, [Preview Demo](https://uiwjs.github.io/react-run-web#/?html=<div>Hello%20World</div>&js=console.log('hello%20world')&css=div%20{%20color:%20red;}).
5+
6+
## Install
7+
8+
```bash
9+
npm install @uiw/react-run-web
10+
```
11+
12+
## Usage
13+
14+
```jsx
15+
import RunWeb from '@uiw/react-run-web';
16+
17+
<RunWeb
18+
css="div {color:red;}"
19+
js="console.log('hello world!')"
20+
html="<div>ttt</div>"
21+
/>
22+
```
23+
24+
## Online Code Preview
25+
26+
[Preview Demo Example](https://uiwjs.github.io/react-run-web#/?html=<div>Hello%20World</div>&js=console.log('hello%20world')&css=div%20{%20color:%20red;}).
27+
28+
```url
29+
https://uiwjs.github.io/react-run-web#/?html=...&js=...&css=...
30+
```
31+
32+
## Development
33+
34+
Runs the project in development mode.
35+
36+
```bash
37+
# Step 1, run first, listen to the component compile and output the .js file
38+
# listen for compilation output type .d.ts file
39+
npm run watch
40+
# Step 2, development mode, listen to compile preview website instance
41+
npm run start
42+
```
43+
44+
**production**
45+
46+
Builds the app for production to the build folder.
47+
48+
```bash
49+
npm run build
50+
```
51+
52+
The build is minified and the filenames include the hashes.
53+
Your app is ready to be deployed!

package.json

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"name": "@uiw/react-run-web",
3+
"version": "1.0.0",
4+
"description": "Online Code Editor for Rapid Web Development.",
5+
"homepage": "https://uiwjs.github.io/react-run-web/",
6+
"main": "lib/cjs/index.js",
7+
"module": "lib/esm/index.js",
8+
"scripts": {
9+
"prepare": "husky install && npm run build:lib",
10+
"doc": "kkt build --app-src ./website",
11+
"start": "kkt start --app-src ./website",
12+
"build": "npm run build:lib && npm run doc",
13+
"build:lib": "npm run ts:build && npm run types:esm && npm run types:cjs",
14+
"watch": "npm run ts:watch & npm run types:watch",
15+
"types:build": "tsbb types --sourceRoot src --target ESNEXT --jsx --emitDeclarationOnly false",
16+
"types:watch": "npm run types:esm -- --watch & npm run types:cjs -- --watch",
17+
"types:esm": "npm run types:build -- --outDir ../lib/esm",
18+
"types:cjs": "npm run types:build -- --outDir ../lib/cjs",
19+
"ts:watch": "tsbb watch --env-name esm:dev --env-name cjs --target react",
20+
"ts:build": "tsbb build --target react",
21+
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
22+
"test": "kkt test --env=jsdom --app-src=./website",
23+
"test:coverage": "kkt test --env=jsdom --coverage --app-src=./website"
24+
},
25+
"repository": {
26+
"type": "git",
27+
"url": "https://github.com/uiwjs/react-run-web.git"
28+
},
29+
"author": "Kenny Wong <[email protected]>",
30+
"license": "MIT",
31+
"keywords": [
32+
"react",
33+
"run-web",
34+
"code-editor",
35+
"editor"
36+
],
37+
"lint-staged": {
38+
"*.{js,jsx,tsx,ts,less,md,json}": [
39+
"prettier --write"
40+
]
41+
},
42+
"peerDependencies": {
43+
"@babel/runtime": ">=7.10.0",
44+
"react": ">=16.9.0",
45+
"react-dom": ">=16.9.0"
46+
},
47+
"devDependencies": {
48+
"@kkt/less-modules": "6.10.4",
49+
"@kkt/raw-modules": "6.10.4",
50+
"@kkt/scope-plugin-options": "6.10.4",
51+
"@types/react": "17.0.11",
52+
"@types/react-dom": "17.0.8",
53+
"@types/react-router-dom": "5.1.7",
54+
"@types/react-test-renderer": "17.0.1",
55+
"@uiw/react-split": "5.7.4",
56+
"@uiw/react-markdown-preview": "3.1.1",
57+
"husky": "6.0.0",
58+
"kkt": "6.10.4",
59+
"lint-staged": "11.0.0",
60+
"prettier": "2.3.1",
61+
"react": "17.0.2",
62+
"react-dom": "17.0.2",
63+
"react-router-dom": "5.2.0",
64+
"react-test-renderer": "17.0.2",
65+
"tsbb": "2.2.1"
66+
},
67+
"eslintConfig": {
68+
"extends": [
69+
"react-app",
70+
"react-app/jest"
71+
]
72+
},
73+
"browserslist": {
74+
"production": [
75+
">0.2%",
76+
"not dead",
77+
"not op_mini all"
78+
],
79+
"development": [
80+
"last 1 chrome version",
81+
"last 1 firefox version",
82+
"last 1 safari version"
83+
]
84+
}
85+
}

0 commit comments

Comments
 (0)