Skip to content

Commit a1ac87e

Browse files
committed
feat:add editor、sandbox、playground component
1 parent 5514e82 commit a1ac87e

File tree

148 files changed

+46691
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+46691
-155
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
indent_size = 4
8+
indent_style = space
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/**
2+
dist/**
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
sourceType: 'module',
5+
},
6+
plugins: [ '@typescript-eslint/eslint-plugin' ],
7+
extends: [
8+
'plugin:@typescript-eslint/eslint-recommended',
9+
'plugin:@typescript-eslint/recommended',
10+
'prettier',
11+
'prettier/@typescript-eslint',
12+
],
13+
root: true,
14+
env: {
15+
node: true,
16+
jest: true,
17+
'shared-node-browser': true,
18+
es6: true
19+
},
20+
rules: {
21+
'@typescript-eslint/no-empty-interface': 'off',
22+
'@typescript-eslint/no-namespace': 'off',
23+
'@typescript-eslint/ban-types': 'off',
24+
'@typescript-eslint/no-var-requires': 'off',
25+
'@typescript-eslint/interface-name-prefix': 'off',
26+
'@typescript-eslint/explicit-function-return-type': 'off',
27+
'@typescript-eslint/no-explicit-any': 'off',
28+
'@typescript-eslint/explicit-module-boundary-types': 'off',
29+
'@typescript-eslint/ban-ts-comment': 'off',
30+
'@typescript-eslint/no-empty-function': 'off',
31+
'@typescript-eslint/no-unused-vars': 'off',
32+
'prefer-rest-params': 'off',
33+
'@typescript-eslint/no-this-alias': 'off',
34+
'semi':[ 'error','always' ],
35+
'prefer-spread': 'off',
36+
"array-bracket-spacing": [ "error","always" ],
37+
"object-curly-spacing": [ "error","always" ]
38+
},
39+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 300,
5+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const webpack = require('webpack');
2+
const path = require('path');
3+
const HtmlWebpackPlugin = require('html-webpack-plugin');
4+
const {commonPlugins, commonRules} = require("./webpack_common.config");
5+
module.exports = {
6+
entry: ['./src/index.tsx'],
7+
output: {
8+
path: path.resolve(__dirname, '../', "dist"),
9+
filename: "bundle.[chunkhash:8].js",
10+
publicPath: '/',
11+
},
12+
target: 'web',
13+
resolve: {
14+
extensions: ['.ts', '.js', '.tsx'],
15+
},
16+
plugins: [
17+
/*new webpack.EvalSourceMapDevToolPlugin({}),*/
18+
new webpack.HotModuleReplacementPlugin(),
19+
new HtmlWebpackPlugin({
20+
template: "./public/index.html"
21+
}),
22+
/*...commonPlugins*/
23+
24+
],
25+
devServer: {
26+
compress: true,
27+
open: true,
28+
port: 9005
29+
},
30+
// devtool: 'eval-source-map',
31+
devtool: false,
32+
module: {
33+
rules: [
34+
...commonRules
35+
]
36+
}
37+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
const webpack = require('webpack');
2+
const commonRules = [
3+
{
4+
test:/\.tsx?$/,
5+
exclude: /node_modules/,
6+
use: [
7+
{
8+
loader: "ts-loader"
9+
}
10+
]
11+
},
12+
{
13+
test: /\.html$/,
14+
exclude: /node_modules/,
15+
use: [
16+
{
17+
loader: "raw-loader"
18+
}
19+
]
20+
},
21+
{
22+
test: /\.txt$/,
23+
exclude: /node_modules/,
24+
use: [
25+
{
26+
loader: "raw-loader"
27+
}
28+
]
29+
},
30+
{
31+
test: /\.png|jpg|gif|jpeg|svg/,
32+
type: 'asset/resource',
33+
parser: {
34+
dataUrlCondition: {
35+
maxSize: 10 * 1024,
36+
},
37+
},
38+
generator: {
39+
filename: 'images/[base]',
40+
},
41+
},
42+
{
43+
test: /\.(eot|ttf|woff|woff2)(\?\S*)?$/,
44+
type: 'asset/resource',
45+
generator: {
46+
filename: 'fonts/[base]',
47+
},
48+
},
49+
{
50+
test: /\.css$/,
51+
use:[ // 由后向前加载
52+
{loader: 'css-loader'},
53+
{loader: "postcss-loader"}
54+
]
55+
},
56+
{
57+
test: /\.less$/,
58+
use:[
59+
{loader: 'css-loader'},
60+
{loader: "postcss-loader"},
61+
{loader: 'less-loader'}
62+
]
63+
},
64+
{ // 处理sass/scss
65+
test: /\.s[ac]ss$/i,
66+
use: [
67+
// 将 CSS 转化成 CommonJS 模块
68+
'css-loader',
69+
// 将 Sass 编译成 CSS
70+
'sass-loader',
71+
],
72+
},
73+
{
74+
//test: /\.styl$/,
75+
test: /\.styl(us)?$/,
76+
use: [
77+
{loader: 'css-loader'},
78+
{loader: "postcss-loader"},
79+
{loader: 'stylus-loader'}
80+
]
81+
}
82+
]
83+
const commonPlugins = [
84+
new webpack.HotModuleReplacementPlugin(),
85+
]
86+
module.exports = { commonRules, commonPlugins };
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const webpack = require('webpack');
2+
const path = require('path');
3+
const HtmlWebpackPlugin = require('html-webpack-plugin');
4+
const {commonPlugins, commonRules} = require("./webpack_common.config");
5+
module.exports = {
6+
entry: ['./src/index.tsx'],
7+
output: {
8+
path: path.resolve(__dirname, '../', "dist"),
9+
filename: "bundle.[chunkhash:8].js",
10+
publicPath: '/',
11+
},
12+
target: 'web',
13+
resolve: {
14+
extensions: ['.ts', '.js', '.tsx'],
15+
},
16+
plugins: [
17+
/*new webpack.EvalSourceMapDevToolPlugin({}),*/
18+
new webpack.HotModuleReplacementPlugin(),
19+
new HtmlWebpackPlugin({
20+
template: "./public/index.html"
21+
}),
22+
/*...commonPlugins*/
23+
24+
],
25+
devServer: {
26+
compress: true,
27+
open: true,
28+
port: 9005
29+
},
30+
// devtool: 'eval-source-map',
31+
devtool: false,
32+
module: {
33+
rules: [
34+
...commonRules
35+
]
36+
}
37+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
<style>
7+
html {
8+
width: 100vw;height:100vh;
9+
}
10+
</style>
11+
</head>
12+
<body style="width: 100%;height: 100%;margin: 0;">
13+
<wu-code-monaco-editor style="width: 100%;height: 100%"></wu-code-monaco-editor>
14+
</body>
15+
<script src="./dist/index.umd.js"></script>
16+
</html>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"watch": ["./src"],
3+
"ext": "ts",
4+
"ignore": ["./src/**/*.spec.ts"],
5+
"exec": "node --inspect-brk -r ts-node/register -r tsconfig-paths/register ./src/index.ts"
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"watch": ["./src"],
3+
"ext": "ts",
4+
"ignore": ["./src/**/*.spec.ts"],
5+
"env": {
6+
"NODE_ENV": "development"
7+
},
8+
"exec": "cross-env NODE_ENV=production tsc -p tsconfig.build.json && node ./build/dev.js"
9+
}

0 commit comments

Comments
 (0)