editor init

This commit is contained in:
Bowen Tan 2021-09-22 15:34:52 +08:00
parent 35f33e0073
commit c3429e19bb
9 changed files with 139 additions and 0 deletions

11
packages/editor/README.md Normal file
View File

@ -0,0 +1,11 @@
# `editor`
> TODO: description
## Usage
```
const editor = require('editor');
// TODO: DEMONSTRATE API
```

View File

@ -0,0 +1,7 @@
'use strict';
const editor = require('..');
describe('editor', () => {
it('needs tests');
});

View File

@ -0,0 +1,7 @@
// only for jest
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
};

View File

@ -0,0 +1,3 @@
module.exports = {
...require("../../config/jest.config"),
};

View File

@ -0,0 +1,51 @@
{
"name": "editor",
"version": "0.0.0",
"description": "meta-ui editor",
"author": "Bowen Tan <bowen.tan@smartx.com>",
"homepage": "https://github.com/webzard-io/meta-ui#readme",
"license": "MIT",
"main": "src/main.tsx",
"scripts": {
"dev": "vite",
"test": "jest"
},
"publishConfig": {
"registry": "http://192.168.26.29:7001"
},
"repository": {
"type": "git",
"url": "git+https://github.com/webzard-io/meta-ui.git"
},
"bugs": {
"url": "https://github.com/webzard-io/meta-ui/issues"
},
"dependencies": {
"@chakra-ui/react": "^1.6.8",
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"lodash": "^4.17.21",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@vitejs/plugin-react-refresh": "^1.3.6",
"typescript": "^4.4.3",
"vite": "^2.5.10",
"vite-tsconfig-paths": "^3.3.14",
"babel-jest": "^27.2.1",
"jest": "^27.2.1"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{ts,tsx,html}": [
"prettier --write",
"eslint --fix",
"git add"
]
}
}

View File

@ -0,0 +1,13 @@
import React from 'react';
import ReactDOM from 'react-dom';
export default function renderApp() {
ReactDOM.render(
<React.StrictMode>
<div>Hello, editor</div>
</React.StrictMode>,
document.getElementById('root')
);
}
renderApp();

1
packages/editor/src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference types="vite/client" />

View File

@ -0,0 +1,29 @@
{
"compilerOptions": {
"target": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"noUnusedLocals": true,
"noUnusedParameters": true,
"types": ["@emotion/react/types/css-prop"],
"baseUrl": ".",
"paths": {
"@components/*": ["src/components/*"],
"@traits/*": ["src/traits/*"],
"@types/*": ["src/types/*"],
"@utils/*": ["src/utils/*"],
},
},
"include": ["./src"]
}

View File

@ -0,0 +1,17 @@
import { defineConfig } from 'vite';
import reactRefresh from '@vitejs/plugin-react-refresh';
import tsconfigPaths from 'vite-tsconfig-paths';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [reactRefresh(), tsconfigPaths()],
define: {
// https://github.com/satya164/react-simple-code-editor/issues/86
global: 'globalThis',
},
esbuild: {
// https://dev.to/ajitsinghkamal/using-emotionjs-with-vite-2ndj
jsxFactory: 'jsx',
jsxInject: 'import { jsx } from "@emotion/react"',
},
});