chore: 项目环境
This commit is contained in:
parent
1816bf5ead
commit
b1fa271b30
|
@ -0,0 +1,2 @@
|
|||
node_modules/*
|
||||
dist/
|
|
@ -0,0 +1,26 @@
|
|||
module.exports = {
|
||||
env: {
|
||||
browser: true,
|
||||
es6: true,
|
||||
mocha: true,
|
||||
jest: true,
|
||||
node: true,
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/eslint-recommended',
|
||||
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
|
||||
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
|
||||
],
|
||||
globals: {
|
||||
Atomics: 'readonly',
|
||||
SharedArrayBuffer: 'readonly',
|
||||
},
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['@typescript-eslint', 'prettier'],
|
||||
rules: {},
|
||||
}
|
|
@ -102,3 +102,5 @@ dist
|
|||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
TODO.md
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
doc/
|
||||
docs/
|
||||
TODO.md
|
||||
examples/
|
|
@ -0,0 +1,25 @@
|
|||
module.exports = {
|
||||
// 箭头函数只有一个参数的时候可以忽略括号
|
||||
arrowParens: 'avoid',
|
||||
// 括号内部不要出现空格
|
||||
bracketSpacing: true,
|
||||
// 行结束符使用 Unix 格式
|
||||
endOfLine: 'lf',
|
||||
// true: Put > on the last line instead of at a new line
|
||||
jsxBracketSameLine: false,
|
||||
// 行宽
|
||||
printWidth: 100,
|
||||
// 换行方式
|
||||
proseWrap: 'preserve',
|
||||
// 分号
|
||||
semi: false,
|
||||
// 使用单引号
|
||||
singleQuote: true,
|
||||
// 缩进
|
||||
tabWidth: 4,
|
||||
// 使用 tab 缩进
|
||||
useTabs: false,
|
||||
// 后置逗号,多行对象、数组在最后一行增加逗号
|
||||
trailingComma: 'es5',
|
||||
parser: 'typescript',
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"editor.formatOnSave": true
|
||||
}
|
|
@ -1 +1,5 @@
|
|||
# we-next
|
||||
# we-next
|
||||
|
||||
wangEditor next
|
||||
|
||||
运行 `npm run dev` ,然后访问 `http://127.0.0.1:8881/examples/`
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
const path = require('path')
|
||||
|
||||
const srcPath = path.join(__dirname, '..', 'src')
|
||||
const distPath = path.join(__dirname, '..', 'dist')
|
||||
|
||||
module.exports = { srcPath, distPath }
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* @description webpack 通用配置
|
||||
* @author wangfupeng
|
||||
*/
|
||||
|
||||
const path = require('path')
|
||||
const { srcPath } = require('./myPath')
|
||||
|
||||
module.exports = {
|
||||
entry: path.join(srcPath, 'wangEditor.ts'),
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader', 'postcss-loader'],
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
use: ['style-loader', 'css-loader', 'postcss-loader', 'less-loader'],
|
||||
},
|
||||
{
|
||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 500 * 1024, // <=500kb 则使用 base64 (即,希望字体文件一直使用 base64 ,而不单独打包)
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.ts', '.js', '.json', '.less', '.css'],
|
||||
alias: {
|
||||
// utils: path.join(srcPath, 'utils'),
|
||||
// style: path.join(srcPath, 'assets', 'style'),
|
||||
},
|
||||
},
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* @description webpack 配置,开发环境
|
||||
* @author wangfupeng
|
||||
*/
|
||||
|
||||
// const path = require('path')
|
||||
const { smart } = require('webpack-merge')
|
||||
const CommonConf = require('./webpack.common')
|
||||
const { distPath } = require('./myPath')
|
||||
|
||||
module.exports = smart(CommonConf, {
|
||||
mode: 'development',
|
||||
output: {
|
||||
filename: 'wangEditor.js',
|
||||
path: distPath,
|
||||
library: 'wangEditor',
|
||||
libraryTarget: 'umd',
|
||||
},
|
||||
})
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* @description webpack 配置,生产环境
|
||||
* @author wangfupeng
|
||||
*/
|
||||
|
||||
// const path = require('path')
|
||||
const { smart } = require('webpack-merge')
|
||||
const CommonConf = require('./webpack.common')
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
|
||||
const { distPath } = require('./myPath')
|
||||
|
||||
module.exports = smart(CommonConf, {
|
||||
mode: 'production',
|
||||
output: {
|
||||
filename: 'wangEditor.min.js',
|
||||
path: distPath,
|
||||
library: 'wangEditor',
|
||||
libraryTarget: 'umd',
|
||||
},
|
||||
plugins: [new CleanWebpackPlugin()],
|
||||
})
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>wangEditor example</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
wangEditor demo
|
||||
<i class="w-e-icon-close" style="color: #333;"></i>
|
||||
</p>
|
||||
|
||||
<script src="../dist/wangEditor.js"></script>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
module.exports = {
|
||||
roots: ['<rootDir>/test'],
|
||||
testRegex: 'test/(.+)\\.test\\.(js?|ts?)$',
|
||||
transform: {
|
||||
'^.+\\.ts?$': 'ts-jest',
|
||||
},
|
||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
"name": "we-next",
|
||||
"version": "0.0.1",
|
||||
"description": "we next",
|
||||
"main": "dist/wangEditor.js",
|
||||
"types": "dist/wangEditor.d.ts",
|
||||
"module": "src/wangEditor.ts",
|
||||
"scripts": {
|
||||
"dev": "cross-env NODE_ENV=development webpack --config build/webpack.dev.js && http-server -p 8881",
|
||||
"build": "cross-env NODE_ENV=production webpack --config build/webpack.prod.js",
|
||||
"lint": "eslint 'src/**/*.{js,ts}'",
|
||||
"lint-fix": "eslint --fix 'src/**/*.{js,ts}'",
|
||||
"prettier": "prettier --write --config .prettierrc.js 'src/**/*.{js,ts}'",
|
||||
"test": "cross-env NODE_ENV=test jest --passWithNoTests",
|
||||
"test-c": "cross-env NODE_ENV=test jest --coverage"
|
||||
},
|
||||
"jest": {
|
||||
"testEnvironment": "node"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/wangeditor-team/we-next.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/wangeditor-team/we-next/issues"
|
||||
},
|
||||
"homepage": "https://github.com/wangeditor-team/we-next#readme",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^25.2.1",
|
||||
"@types/lodash": "^4.14.150",
|
||||
"@typescript-eslint/eslint-plugin": "^2.31.0",
|
||||
"@typescript-eslint/parser": "^2.31.0",
|
||||
"autoprefixer": "^9.7.6",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"css-loader": "^3.5.3",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-plugin-prettier": "^3.1.3",
|
||||
"http-server": "^0.12.3",
|
||||
"husky": "^4.2.5",
|
||||
"jest": "^26.0.1",
|
||||
"less": "^3.11.1",
|
||||
"less-loader": "^6.0.0",
|
||||
"lint-staged": "^10.2.2",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"prettier": "^2.0.5",
|
||||
"style-loader": "^1.2.1",
|
||||
"ts-jest": "^25.4.0",
|
||||
"ts-loader": "^7.0.2",
|
||||
"typescript": "^3.8.3",
|
||||
"url-loader": "^4.1.0",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11",
|
||||
"webpack-merge": "^4.2.2"
|
||||
},
|
||||
"dependencies": {},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{ts,js}": [
|
||||
"npm run prettier",
|
||||
"npm run lint-fix",
|
||||
"git add ."
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
plugins: [require('autoprefixer')],
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,7 @@
|
|||
body {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
.some-p-class-style {
|
||||
color: red;
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
@font-face {
|
||||
font-family: 'w-e-icon';
|
||||
src: url('../font/w-e-icon.woff?ddq1c7') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
[class^="w-e-icon-"], [class*=" w-e-icon-"] {
|
||||
/* use !important to prevent issues with browser extensions that change fonts */
|
||||
font-family: 'w-e-icon' !important;
|
||||
speak: none;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
line-height: 1;
|
||||
|
||||
/* Better Font Rendering =========== */
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.w-e-icon-close:before {
|
||||
content: "\f00d";
|
||||
}
|
||||
.w-e-icon-upload2:before {
|
||||
content: "\e9c6";
|
||||
}
|
||||
.w-e-icon-trash-o:before {
|
||||
content: "\f014";
|
||||
}
|
||||
.w-e-icon-header:before {
|
||||
content: "\f1dc";
|
||||
}
|
||||
.w-e-icon-pencil2:before {
|
||||
content: "\e906";
|
||||
}
|
||||
.w-e-icon-paint-brush:before {
|
||||
content: "\f1fc";
|
||||
}
|
||||
.w-e-icon-image:before {
|
||||
content: "\e90d";
|
||||
}
|
||||
.w-e-icon-play:before {
|
||||
content: "\e912";
|
||||
}
|
||||
.w-e-icon-location:before {
|
||||
content: "\e947";
|
||||
}
|
||||
.w-e-icon-undo:before {
|
||||
content: "\e965";
|
||||
}
|
||||
.w-e-icon-redo:before {
|
||||
content: "\e966";
|
||||
}
|
||||
.w-e-icon-quotes-left:before {
|
||||
content: "\e977";
|
||||
}
|
||||
.w-e-icon-list-numbered:before {
|
||||
content: "\e9b9";
|
||||
}
|
||||
.w-e-icon-list2:before {
|
||||
content: "\e9bb";
|
||||
}
|
||||
.w-e-icon-link:before {
|
||||
content: "\e9cb";
|
||||
}
|
||||
.w-e-icon-happy:before {
|
||||
content: "\e9df";
|
||||
}
|
||||
.w-e-icon-bold:before {
|
||||
content: "\ea62";
|
||||
}
|
||||
.w-e-icon-underline:before {
|
||||
content: "\ea63";
|
||||
}
|
||||
.w-e-icon-italic:before {
|
||||
content: "\ea64";
|
||||
}
|
||||
.w-e-icon-strikethrough:before {
|
||||
content: "\ea65";
|
||||
}
|
||||
.w-e-icon-table2:before {
|
||||
content: "\ea71";
|
||||
}
|
||||
.w-e-icon-paragraph-left:before {
|
||||
content: "\ea77";
|
||||
}
|
||||
.w-e-icon-paragraph-center:before {
|
||||
content: "\ea78";
|
||||
}
|
||||
.w-e-icon-paragraph-right:before {
|
||||
content: "\ea79";
|
||||
}
|
||||
.w-e-icon-terminal:before {
|
||||
content: "\f120";
|
||||
}
|
||||
.w-e-icon-page-break:before {
|
||||
content: "\ea68";
|
||||
}
|
||||
.w-e-icon-cancel-circle:before {
|
||||
content: "\ea0d";
|
||||
}
|
||||
.w-e-icon-font:before {
|
||||
content: "\ea5c";
|
||||
}
|
||||
.w-e-icon-text-heigh:before {
|
||||
content: "\ea5f";
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @description 入口文件
|
||||
* @author wangfupeng
|
||||
*/
|
||||
|
||||
import './assets/style/a.less'
|
||||
import './assets/style/icon.less'
|
||||
|
||||
console.log('hello we')
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* @description jest demo
|
||||
* @author wangfupeng
|
||||
*/
|
||||
|
||||
test('1 + 1 === 2', () => {
|
||||
expect(1 + 1).toBe(2)
|
||||
})
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
/* Basic Options */
|
||||
// "incremental": true, /* Enable incremental compilation */
|
||||
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
||||
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||
// "checkJs": true, /* Report errors in .js files. */
|
||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
||||
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||
"outDir": "dist", /* Redirect output structure to the directory. */
|
||||
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
// "composite": true, /* Enable project compilation */
|
||||
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
||||
// "removeComments": true, /* Do not emit comments to output. */
|
||||
// "noEmit": true, /* Do not emit outputs. */
|
||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||
|
||||
/* Strict Type-Checking Options */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
||||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||
|
||||
/* Additional Checks */
|
||||
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||
|
||||
/* Module Resolution Options */
|
||||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||
// "types": [], /* Type declaration files to be included in compilation. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
|
||||
/* Source Map Options */
|
||||
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||
|
||||
/* Experimental Options */
|
||||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||
|
||||
/* Advanced Options */
|
||||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
||||
},
|
||||
"include": [
|
||||
"./src/*"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist",
|
||||
"test",
|
||||
"examples"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue