mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
build: 修改runtime publicDir
This commit is contained in:
parent
7de649d8c4
commit
1d8149b5eb
@ -1,5 +1,4 @@
|
|||||||
dist
|
dist
|
||||||
admin-dist
|
|
||||||
entry-dist
|
entry-dist
|
||||||
coverage
|
coverage
|
||||||
node_modules
|
node_modules
|
||||||
|
@ -147,7 +147,7 @@ cd tmatic-editor
|
|||||||
npm run build:runtime:admin
|
npm run build:runtime:admin
|
||||||
```
|
```
|
||||||
|
|
||||||
将/runtime/{vue3 | vue2 | react}/admin-dist 中所有文件以及文件夹复制到 /magic/runtime 目录下
|
将/runtime/{vue3 | vue2 | react}/dist 中所有文件以及文件夹复制到 /magic/runtime 目录下
|
||||||
|
|
||||||
上面的操作我们提供了/magic-admin/setup.sh 脚本文件来实现,开发者可以参考该脚本文件来搭建流水线。
|
上面的操作我们提供了/magic-admin/setup.sh 脚本文件来实现,开发者可以参考该脚本文件来搭建流水线。
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"packageManager": "pnpm@7.1.9",
|
"packageManager": "pnpm@7.1.9",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"bootstrap": "pnpm i && pnpm build",
|
"bootstrap": "pnpm i && pnpm build",
|
||||||
"clean:top": "rimraf */**/dist */**/types */**/admin-dist */**/entry-dist */dist coverage dwt*",
|
"clean:top": "rimraf */**/dist */**/types */dist coverage dwt*",
|
||||||
"clean:modules": "rimraf node_modules **/node_modules **/**/node_modules",
|
"clean:modules": "rimraf node_modules **/node_modules **/**/node_modules",
|
||||||
"clean:all": "pnpm clean:top && pnpm clean:modules",
|
"clean:all": "pnpm clean:top && pnpm clean:modules",
|
||||||
"lint": "eslint . --ext .js,.vue,.ts,.tsx",
|
"lint": "eslint . --ext .js,.vue,.ts,.tsx",
|
||||||
@ -18,8 +18,7 @@
|
|||||||
"pg:react": "pnpm playground:react",
|
"pg:react": "pnpm playground:react",
|
||||||
"build": "pnpm --filter \"@tmagic/*\" build",
|
"build": "pnpm --filter \"@tmagic/*\" build",
|
||||||
"build:runtime:admin": "pnpm --filter \"runtime-*\" build:admin",
|
"build:runtime:admin": "pnpm --filter \"runtime-*\" build:admin",
|
||||||
"build:playground": "pnpm --filter \"runtime-vue3\" --filter \"tmagic-playground\" build",
|
"build:playground": "pnpm --filter \"runtime-vue3\" build && pnpm --filter \"tmagic-playground\" build",
|
||||||
"postbuild:playground": "shx mkdir playground/dist/runtime && shx cp -r runtime/vue3/dist ./playground/dist/runtime/vue3 && cp -r runtime/vue3/entry-dist/* ./playground/dist/runtime/vue3",
|
|
||||||
"docs": "pnpm --filter \"docs\" dev",
|
"docs": "pnpm --filter \"docs\" dev",
|
||||||
"build:docs": "pnpm --filter \"docs\" build",
|
"build:docs": "pnpm --filter \"docs\" build",
|
||||||
"reinstall": "pnpm clean:all && pnpm bootstrap",
|
"reinstall": "pnpm clean:all && pnpm bootstrap",
|
||||||
|
@ -1 +1,2 @@
|
|||||||
VITE_RUNTIME_PATH=/tmagic-editor/playground/runtime/react
|
VITE_RUNTIME_PATH=/tmagic-editor/playground/runtime/react
|
||||||
|
VITE_ENTRY_PATH=./entry/react
|
@ -1 +1,2 @@
|
|||||||
VITE_RUNTIME_PATH=/tmagic-editor/playground/runtime/vue2
|
VITE_RUNTIME_PATH=/tmagic-editor/playground/runtime/vue2
|
||||||
|
VITE_ENTRY_PATH=./entry/vue2
|
@ -1 +1,2 @@
|
|||||||
VITE_RUNTIME_PATH=/tmagic-editor/playground/runtime/vue3
|
VITE_RUNTIME_PATH=/tmagic-editor/playground/runtime/vue3
|
||||||
|
VITE_ENTRY_PATH=./entry/vue3
|
2
playground/.gitignore
vendored
2
playground/.gitignore
vendored
@ -1 +1,3 @@
|
|||||||
dist
|
dist
|
||||||
|
public/entry
|
||||||
|
public/runtime
|
@ -15,23 +15,18 @@
|
|||||||
:stage-rect="stageRect"
|
:stage-rect="stageRect"
|
||||||
>
|
>
|
||||||
<template #workspace-content>
|
<template #workspace-content>
|
||||||
<device-group v-model="stageRect"></device-group>
|
<DeviceGroup v-model="stageRect"></DeviceGroup>
|
||||||
</template>
|
</template>
|
||||||
</m-editor>
|
</m-editor>
|
||||||
|
|
||||||
<el-dialog v-model="previewVisible" destroy-on-close :width="375" custom-class="pre-viewer" title="预览">
|
<el-dialog v-model="previewVisible" destroy-on-close :width="375" custom-class="pre-viewer" title="预览">
|
||||||
<iframe
|
<iframe v-if="previewVisible" width="100%" height="817" :src="previewUrl"></iframe>
|
||||||
v-if="previewVisible"
|
|
||||||
width="100%"
|
|
||||||
height="817"
|
|
||||||
:src="`${VITE_RUNTIME_PATH}/page/index.html?localPreview=1&page=${editor?.editorService.get('page').id}`"
|
|
||||||
></iframe>
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent, ref, toRaw } from 'vue';
|
import { computed, ref, toRaw } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { Coin, Connection, Document } from '@element-plus/icons-vue';
|
import { Coin, Connection, Document } from '@element-plus/icons-vue';
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
@ -47,145 +42,124 @@ import DeviceGroup from '../components/DeviceGroup.vue';
|
|||||||
import componentGroupList from '../configs/componentGroupList';
|
import componentGroupList from '../configs/componentGroupList';
|
||||||
import dsl from '../configs/dsl';
|
import dsl from '../configs/dsl';
|
||||||
|
|
||||||
const { VITE_RUNTIME_PATH } = import.meta.env;
|
const { VITE_RUNTIME_PATH, VITE_ENTRY_PATH } = import.meta.env;
|
||||||
|
|
||||||
export default defineComponent({
|
const runtimeUrl = `${VITE_RUNTIME_PATH}/playground/index.html`;
|
||||||
name: 'EditorApp',
|
const router = useRouter();
|
||||||
|
const editor = ref<InstanceType<typeof TMagicEditor>>();
|
||||||
|
const previewVisible = ref(false);
|
||||||
|
const value = ref(dsl);
|
||||||
|
const defaultSelected = ref(dsl.items[0].id);
|
||||||
|
const propsValues = ref<Record<string, any>>({});
|
||||||
|
const propsConfigs = ref<Record<string, any>>({});
|
||||||
|
const eventMethodList = ref<Record<string, any>>({});
|
||||||
|
const stageRect = ref();
|
||||||
|
|
||||||
components: { DeviceGroup },
|
const previewUrl = computed(
|
||||||
|
() => `${VITE_RUNTIME_PATH}/page/index.html?localPreview=1&page=${editor.value?.editorService.get('page').id}`,
|
||||||
|
);
|
||||||
|
|
||||||
setup() {
|
const menu: MenuBarData = {
|
||||||
const router = useRouter();
|
left: [
|
||||||
const editor = ref<InstanceType<typeof TMagicEditor>>();
|
{
|
||||||
const previewVisible = ref(false);
|
type: 'text',
|
||||||
const value = ref(dsl);
|
text: '魔方',
|
||||||
const defaultSelected = ref(dsl.items[0].id);
|
},
|
||||||
const propsValues = ref<Record<string, any>>({});
|
],
|
||||||
const propsConfigs = ref<Record<string, any>>({});
|
center: ['delete', 'undo', 'redo', 'guides', 'rule', 'zoom'],
|
||||||
const eventMethodList = ref<Record<string, any>>({});
|
right: [
|
||||||
|
{
|
||||||
const save = () => {
|
type: 'button',
|
||||||
localStorage.setItem(
|
text: 'Form Playground',
|
||||||
'magicDSL',
|
handler: () => router.push('form'),
|
||||||
serialize(toRaw(value.value), {
|
},
|
||||||
space: 2,
|
{
|
||||||
unsafe: true,
|
type: 'button',
|
||||||
}).replace(/"(\w+)":\s/g, '$1: '),
|
text: 'Table Playground',
|
||||||
);
|
handler: () => router.push('table'),
|
||||||
editor.value?.editorService.resetModifiedNodeId();
|
},
|
||||||
};
|
'/',
|
||||||
|
{
|
||||||
const menu: MenuBarData = {
|
type: 'button',
|
||||||
left: [
|
text: '预览',
|
||||||
{
|
icon: Connection,
|
||||||
type: 'text',
|
handler: async (services) => {
|
||||||
text: '魔方',
|
if (services?.editorService.get<Map<Id, Id>>('modifiedNodeIds').size > 0) {
|
||||||
},
|
try {
|
||||||
],
|
await ElMessageBox.confirm('有修改未保存,是否先保存再预览', '提示', {
|
||||||
center: ['delete', 'undo', 'redo', 'guides', 'rule', 'zoom'],
|
confirmButtonText: '保存并预览',
|
||||||
right: [
|
cancelButtonText: '预览',
|
||||||
{
|
type: 'warning',
|
||||||
type: 'button',
|
});
|
||||||
text: 'Form Playground',
|
|
||||||
handler: () => router.push('form'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'button',
|
|
||||||
text: 'Table Playground',
|
|
||||||
handler: () => router.push('table'),
|
|
||||||
},
|
|
||||||
'/',
|
|
||||||
{
|
|
||||||
type: 'button',
|
|
||||||
text: '预览',
|
|
||||||
icon: Connection,
|
|
||||||
handler: async (services) => {
|
|
||||||
if (services?.editorService.get<Map<Id, Id>>('modifiedNodeIds').size > 0) {
|
|
||||||
try {
|
|
||||||
await ElMessageBox.confirm('有修改未保存,是否先保存再预览', '提示', {
|
|
||||||
confirmButtonText: '保存并预览',
|
|
||||||
cancelButtonText: '预览',
|
|
||||||
type: 'warning',
|
|
||||||
});
|
|
||||||
save();
|
|
||||||
ElMessage.success('保存成功');
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
previewVisible.value = true;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'button',
|
|
||||||
text: '保存',
|
|
||||||
icon: Coin,
|
|
||||||
handler: () => {
|
|
||||||
save();
|
save();
|
||||||
ElMessage.success('保存成功');
|
ElMessage.success('保存成功');
|
||||||
},
|
} catch (e) {
|
||||||
},
|
console.error(e);
|
||||||
'/',
|
}
|
||||||
{
|
}
|
||||||
type: 'button',
|
previewVisible.value = true;
|
||||||
icon: Document,
|
|
||||||
tooltip: '源码',
|
|
||||||
handler: (service) => service?.uiService.set('showSrc', !service?.uiService.get('showSrc')),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
asyncLoadJs(`${VITE_RUNTIME_PATH}/config-entry/index.umd.js`).then(() => {
|
|
||||||
propsConfigs.value = (globalThis as any).magicPresetConfigs;
|
|
||||||
});
|
|
||||||
asyncLoadJs(`${VITE_RUNTIME_PATH}/value-entry/index.umd.js`).then(() => {
|
|
||||||
propsValues.value = (globalThis as any).magicPresetValues;
|
|
||||||
});
|
|
||||||
asyncLoadJs(`${VITE_RUNTIME_PATH}/event-entry/index.umd.js`).then(() => {
|
|
||||||
eventMethodList.value = (globalThis as any).magicPresetEvents;
|
|
||||||
});
|
|
||||||
|
|
||||||
save();
|
|
||||||
|
|
||||||
return {
|
|
||||||
VITE_RUNTIME_PATH,
|
|
||||||
|
|
||||||
editor,
|
|
||||||
menu,
|
|
||||||
value,
|
|
||||||
defaultSelected,
|
|
||||||
propsValues,
|
|
||||||
propsConfigs,
|
|
||||||
eventMethodList,
|
|
||||||
stageRect: ref(),
|
|
||||||
|
|
||||||
previewVisible,
|
|
||||||
|
|
||||||
runtimeUrl: `${VITE_RUNTIME_PATH}/playground/index.html`,
|
|
||||||
|
|
||||||
componentGroupList,
|
|
||||||
|
|
||||||
moveableOptions: (core?: StageCore): MoveableOptions => {
|
|
||||||
const options: MoveableOptions = {};
|
|
||||||
const id = core?.dr?.target?.id;
|
|
||||||
|
|
||||||
if (!id || !editor.value) return options;
|
|
||||||
|
|
||||||
const node = editor.value.editorService.getNodeById(id);
|
|
||||||
|
|
||||||
if (!node) return options;
|
|
||||||
|
|
||||||
const isPage = node.type === NodeType.PAGE;
|
|
||||||
|
|
||||||
options.draggable = !isPage;
|
|
||||||
options.resizable = !isPage;
|
|
||||||
options.rotatable = !isPage;
|
|
||||||
|
|
||||||
return options;
|
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
},
|
{
|
||||||
|
type: 'button',
|
||||||
|
text: '保存',
|
||||||
|
icon: Coin,
|
||||||
|
handler: () => {
|
||||||
|
save();
|
||||||
|
ElMessage.success('保存成功');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'/',
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: Document,
|
||||||
|
tooltip: '源码',
|
||||||
|
handler: (service) => service?.uiService.set('showSrc', !service?.uiService.get('showSrc')),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const moveableOptions = (core?: StageCore): MoveableOptions => {
|
||||||
|
const options: MoveableOptions = {};
|
||||||
|
const id = core?.dr?.target?.id;
|
||||||
|
|
||||||
|
if (!id || !editor.value) return options;
|
||||||
|
|
||||||
|
const node = editor.value.editorService.getNodeById(id);
|
||||||
|
|
||||||
|
if (!node) return options;
|
||||||
|
|
||||||
|
const isPage = node.type === NodeType.PAGE;
|
||||||
|
|
||||||
|
options.draggable = !isPage;
|
||||||
|
options.resizable = !isPage;
|
||||||
|
options.rotatable = !isPage;
|
||||||
|
|
||||||
|
return options;
|
||||||
|
};
|
||||||
|
|
||||||
|
const save = () => {
|
||||||
|
localStorage.setItem(
|
||||||
|
'magicDSL',
|
||||||
|
serialize(toRaw(value.value), {
|
||||||
|
space: 2,
|
||||||
|
unsafe: true,
|
||||||
|
}).replace(/"(\w+)":\s/g, '$1: '),
|
||||||
|
);
|
||||||
|
editor.value?.editorService.resetModifiedNodeId();
|
||||||
|
};
|
||||||
|
|
||||||
|
asyncLoadJs(`${VITE_ENTRY_PATH}/config/index.umd.js`).then(() => {
|
||||||
|
propsConfigs.value = (globalThis as any).magicPresetConfigs;
|
||||||
});
|
});
|
||||||
|
asyncLoadJs(`${VITE_ENTRY_PATH}/value/index.umd.js`).then(() => {
|
||||||
|
propsValues.value = (globalThis as any).magicPresetValues;
|
||||||
|
});
|
||||||
|
asyncLoadJs(`${VITE_ENTRY_PATH}/event/index.umd.js`).then(() => {
|
||||||
|
eventMethodList.value = (globalThis as any).magicPresetEvents;
|
||||||
|
});
|
||||||
|
|
||||||
|
save();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
1
runtime/react/.gitignore
vendored
1
runtime/react/.gitignore
vendored
@ -1,3 +1,2 @@
|
|||||||
.tmagic
|
.tmagic
|
||||||
admin-dist
|
|
||||||
entry-dist
|
entry-dist
|
||||||
|
@ -23,18 +23,20 @@ import legacy from '@vitejs/plugin-legacy';
|
|||||||
import reactRefresh from '@vitejs/plugin-react-refresh';
|
import reactRefresh from '@vitejs/plugin-react-refresh';
|
||||||
|
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
if (['value', 'config', 'event'].includes(mode)) {
|
if (['value', 'config', 'event', 'value:admin', 'config:admin', 'event:admin'].includes(mode)) {
|
||||||
const capitalToken = mode.charAt(0).toUpperCase() + mode.slice(1);
|
const [type, isAdmin] = mode.split(':');
|
||||||
|
const capitalToken = type.charAt(0).toUpperCase() + type.slice(1);
|
||||||
return {
|
return {
|
||||||
|
publicDir: './.tmagic/public',
|
||||||
build: {
|
build: {
|
||||||
cssCodeSplit: false,
|
cssCodeSplit: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
minify: false,
|
minify: false,
|
||||||
target: 'esnext',
|
target: 'esnext',
|
||||||
outDir: `entry-dist/${mode}-entry`,
|
outDir: isAdmin ? `./dist/entry/react/${type}` : `../../playground/public/entry/react/${type}`,
|
||||||
|
|
||||||
lib: {
|
lib: {
|
||||||
entry: `.tmagic/${mode}-entry.ts`,
|
entry: `.tmagic/${type}-entry.ts`,
|
||||||
name: `magicPreset${capitalToken}s`,
|
name: `magicPreset${capitalToken}s`,
|
||||||
fileName: 'index',
|
fileName: 'index',
|
||||||
formats: ['umd'],
|
formats: ['umd'],
|
||||||
@ -47,8 +49,8 @@ export default defineConfig(({ mode }) => {
|
|||||||
const [type, isAdmin] = mode.split(':');
|
const [type, isAdmin] = mode.split(':');
|
||||||
const base = isAdmin ? `/runtime/${type}/` : `/tmagic-editor/playground/runtime/react/${type}`;
|
const base = isAdmin ? `/runtime/${type}/` : `/tmagic-editor/playground/runtime/react/${type}`;
|
||||||
const outDir = isAdmin
|
const outDir = isAdmin
|
||||||
? path.resolve(process.cwd(), `./admin-dist/${type}`)
|
? path.resolve(process.cwd(), `./dist/${type}`)
|
||||||
: path.resolve(process.cwd(), `./dist/${type}`);
|
: path.resolve(process.cwd(), `../../playground/public/runtime/react/${type}`);
|
||||||
return {
|
return {
|
||||||
plugins: [
|
plugins: [
|
||||||
reactRefresh(),
|
reactRefresh(),
|
||||||
@ -59,6 +61,8 @@ export default defineConfig(({ mode }) => {
|
|||||||
|
|
||||||
root: `./${type}/`,
|
root: `./${type}/`,
|
||||||
|
|
||||||
|
publicDir: '../public',
|
||||||
|
|
||||||
base,
|
base,
|
||||||
|
|
||||||
build: {
|
build: {
|
||||||
|
@ -38,7 +38,7 @@ export default defineConfig({
|
|||||||
|
|
||||||
base: '/tmagic-editor/playground/runtime/react/',
|
base: '/tmagic-editor/playground/runtime/react/',
|
||||||
|
|
||||||
publicDir: 'entry-dist',
|
publicDir: 'public',
|
||||||
|
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
|
@ -5,15 +5,19 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:react": "npm run build:libs && vite --config dev.vite.config.ts",
|
"dev:react": "npm run build:libs && vite --config dev.vite.config.ts",
|
||||||
"build": "npm run build:libs && npm run build:page && npm run build:playground",
|
"build": "npm run build:libs && npm run build:page && npm run build:playground",
|
||||||
"build:admin": "npm run build:libs && npm run build:page:admin && npm run build:playground:admin",
|
"build:admin": "npm run build:libs:admin && npm run build:page:admin && npm run build:playground:admin",
|
||||||
"build:page": "vite build --config build.vite.config.ts --mode page",
|
"build:page": "vite build --config build.vite.config.ts --mode page",
|
||||||
"build:playground": "vite build --config build.vite.config.ts --mode playground",
|
"build:playground": "vite build --config build.vite.config.ts --mode playground",
|
||||||
"build:page:admin": "vite build --config build.vite.config.ts --mode page:admin",
|
"build:page:admin": "vite build --config build.vite.config.ts --mode page:admin",
|
||||||
"build:playground:admin": "vite build --config build.vite.config.ts --mode playground:admin",
|
"build:playground:admin": "vite build --config build.vite.config.ts --mode playground:admin",
|
||||||
"build:libs": "tmagic entry && npm run build:config & npm run build:value & npm run build:event",
|
"build:libs": "tmagic entry && npm run build:config & npm run build:value & npm run build:event",
|
||||||
|
"build:libs:admin": "tmagic entry && npm run build:config:admin && npm run build:value:admin && npm run build:event:admin",
|
||||||
"build:config": "vite build --config build.vite.config.ts --mode config",
|
"build:config": "vite build --config build.vite.config.ts --mode config",
|
||||||
"build:value": "vite build --config build.vite.config.ts --mode value",
|
"build:value": "vite build --config build.vite.config.ts --mode value",
|
||||||
"build:event": "vite build --config build.vite.config.ts --mode event"
|
"build:event": "vite build --config build.vite.config.ts --mode event",
|
||||||
|
"build:config:admin": "vite build --config build.vite.config.ts --mode config:admin",
|
||||||
|
"build:value:admin": "vite build --config build.vite.config.ts --mode value:admin",
|
||||||
|
"build:event:admin": "vite build --config build.vite.config.ts --mode event:admin"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tmagic/cli": "1.1.0-beta.6",
|
"@tmagic/cli": "1.1.0-beta.6",
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<link rel="icon" href="/favicon.png" type="image/png">
|
||||||
<title>React Page</title>
|
<title>React Page</title>
|
||||||
<style>
|
<style>
|
||||||
html,
|
html,
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="icon" href="/favicon.png" type="image/png">
|
||||||
<title>React Playground</title>
|
<title>React Playground</title>
|
||||||
<style>
|
<style>
|
||||||
html,body {margin: 0; padding: 0}
|
html,body {margin: 0; padding: 0}
|
||||||
|
BIN
runtime/react/public/favicon.png
Normal file
BIN
runtime/react/public/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
1
runtime/vue2/.gitignore
vendored
1
runtime/vue2/.gitignore
vendored
@ -1,3 +1,2 @@
|
|||||||
.tmagic
|
.tmagic
|
||||||
admin-dist
|
|
||||||
entry-dist
|
entry-dist
|
||||||
|
@ -25,18 +25,20 @@ import vue from '@vitejs/plugin-vue2';
|
|||||||
import externalGlobals from 'rollup-plugin-external-globals';
|
import externalGlobals from 'rollup-plugin-external-globals';
|
||||||
|
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
if (['value', 'config', 'event'].includes(mode)) {
|
if (['value', 'config', 'event', 'value:admin', 'config:admin', 'event:admin'].includes(mode)) {
|
||||||
const capitalToken = mode.charAt(0).toUpperCase() + mode.slice(1);
|
const [type, isAdmin] = mode.split(':');
|
||||||
|
const capitalToken = type.charAt(0).toUpperCase() + type.slice(1);
|
||||||
return {
|
return {
|
||||||
|
publicDir: './.tmagic/public',
|
||||||
build: {
|
build: {
|
||||||
cssCodeSplit: false,
|
cssCodeSplit: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
minify: false,
|
minify: false,
|
||||||
target: 'esnext',
|
target: 'esnext',
|
||||||
outDir: `entry-dist/${mode}-entry`,
|
outDir: isAdmin ? `./dist/entry/vue2/${type}` : `../../playground/public/entry/vue2/${type}`,
|
||||||
|
|
||||||
lib: {
|
lib: {
|
||||||
entry: `.tmagic/${mode}-entry.ts`,
|
entry: `.tmagic/${type}-entry.ts`,
|
||||||
name: `magicPreset${capitalToken}s`,
|
name: `magicPreset${capitalToken}s`,
|
||||||
fileName: 'index',
|
fileName: 'index',
|
||||||
formats: ['umd'],
|
formats: ['umd'],
|
||||||
@ -49,8 +51,8 @@ export default defineConfig(({ mode }) => {
|
|||||||
const [type, isAdmin] = mode.split(':');
|
const [type, isAdmin] = mode.split(':');
|
||||||
const base = isAdmin ? `/runtime/${type}/` : `/tmagic-editor/playground/runtime/vue2/${type}`;
|
const base = isAdmin ? `/runtime/${type}/` : `/tmagic-editor/playground/runtime/vue2/${type}`;
|
||||||
const outDir = isAdmin
|
const outDir = isAdmin
|
||||||
? path.resolve(process.cwd(), `./admin-dist/${type}`)
|
? path.resolve(process.cwd(), `./dist/${type}`)
|
||||||
: path.resolve(process.cwd(), `./dist/${type}`);
|
: path.resolve(process.cwd(), `../../playground/public/runtime/vue2/${type}`);
|
||||||
return {
|
return {
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
@ -62,6 +64,8 @@ export default defineConfig(({ mode }) => {
|
|||||||
|
|
||||||
root: `./${type}/`,
|
root: `./${type}/`,
|
||||||
|
|
||||||
|
publicDir: '../public',
|
||||||
|
|
||||||
base,
|
base,
|
||||||
|
|
||||||
build: {
|
build: {
|
||||||
|
@ -37,7 +37,7 @@ export default defineConfig({
|
|||||||
|
|
||||||
base: '/tmagic-editor/playground/runtime/vue2/',
|
base: '/tmagic-editor/playground/runtime/vue2/',
|
||||||
|
|
||||||
publicDir: 'entry-dist',
|
publicDir: 'public',
|
||||||
|
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
|
@ -5,15 +5,19 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:vue2": "npm run build:libs && vite --config dev.vite.config.ts",
|
"dev:vue2": "npm run build:libs && vite --config dev.vite.config.ts",
|
||||||
"build": "npm run build:libs && npm run build:page && npm run build:playground",
|
"build": "npm run build:libs && npm run build:page && npm run build:playground",
|
||||||
"build:admin": "npm run build:libs && npm run build:page:admin && npm run build:playground:admin",
|
"build:admin": "npm run build:libs:admin && npm run build:page:admin && npm run build:playground:admin",
|
||||||
"build:page": "vite build --config build.vite.config.ts --mode page",
|
"build:page": "vite build --config build.vite.config.ts --mode page",
|
||||||
"build:playground": "vite build --config build.vite.config.ts --mode playground",
|
"build:playground": "vite build --config build.vite.config.ts --mode playground",
|
||||||
"build:page:admin": "vite build --config build.vite.config.ts --mode page:admin",
|
"build:page:admin": "vite build --config build.vite.config.ts --mode page:admin",
|
||||||
"build:playground:admin": "vite build --config build.vite.config.ts --mode playground:admin",
|
"build:playground:admin": "vite build --config build.vite.config.ts --mode playground:admin",
|
||||||
"build:libs": "tmagic entry && npm run build:config & npm run build:value & npm run build:event",
|
"build:libs": "tmagic entry && npm run build:config & npm run build:value & npm run build:event",
|
||||||
|
"build:libs:admin": "tmagic entry && npm run build:config:admin && npm run build:value:admin && npm run build:event:admin",
|
||||||
"build:config": "vite build --config build.vite.config.ts --mode config",
|
"build:config": "vite build --config build.vite.config.ts --mode config",
|
||||||
"build:value": "vite build --config build.vite.config.ts --mode value",
|
"build:value": "vite build --config build.vite.config.ts --mode value",
|
||||||
"build:event": "vite build --config build.vite.config.ts --mode event"
|
"build:event": "vite build --config build.vite.config.ts --mode event",
|
||||||
|
"build:config:admin": "vite build --config build.vite.config.ts --mode config:admin",
|
||||||
|
"build:value:admin": "vite build --config build.vite.config.ts --mode value:admin",
|
||||||
|
"build:event:admin": "vite build --config build.vite.config.ts --mode event:admin"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tmagic/cli": "1.1.0-beta.6",
|
"@tmagic/cli": "1.1.0-beta.6",
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<link rel="icon" href="/favicon.png" type="image/png">
|
||||||
<title>Vue2 Page</title>
|
<title>Vue2 Page</title>
|
||||||
<style>
|
<style>
|
||||||
html,
|
html,
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="icon" href="/favicon.png" type="image/png">
|
||||||
<title>Vue2 Playground</title>
|
<title>Vue2 Playground</title>
|
||||||
<style>
|
<style>
|
||||||
html,body {margin: 0; padding: 0}
|
html,body {margin: 0; padding: 0}
|
||||||
|
BIN
runtime/vue2/public/favicon.png
Normal file
BIN
runtime/vue2/public/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
2
runtime/vue3/.gitignore
vendored
2
runtime/vue3/.gitignore
vendored
@ -1,3 +1 @@
|
|||||||
.tmagic
|
.tmagic
|
||||||
admin-dist
|
|
||||||
entry-dist
|
|
||||||
|
@ -26,18 +26,20 @@ import vueJsx from '@vitejs/plugin-vue-jsx';
|
|||||||
import externalGlobals from 'rollup-plugin-external-globals';
|
import externalGlobals from 'rollup-plugin-external-globals';
|
||||||
|
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
if (['value', 'config', 'event'].includes(mode)) {
|
if (['value', 'config', 'event', 'value:admin', 'config:admin', 'event:admin'].includes(mode)) {
|
||||||
const capitalToken = mode.charAt(0).toUpperCase() + mode.slice(1);
|
const [type, isAdmin] = mode.split(':');
|
||||||
|
const capitalToken = type.charAt(0).toUpperCase() + type.slice(1);
|
||||||
return {
|
return {
|
||||||
|
publicDir: './.tmagic/public',
|
||||||
build: {
|
build: {
|
||||||
cssCodeSplit: false,
|
cssCodeSplit: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
minify: false,
|
minify: false,
|
||||||
target: 'esnext',
|
target: 'esnext',
|
||||||
outDir: `entry-dist/${mode}-entry`,
|
outDir: isAdmin ? `./dist/entry/vue3/${type}` : `../../playground/public/entry/vue3/${type}`,
|
||||||
|
|
||||||
lib: {
|
lib: {
|
||||||
entry: `.tmagic/${mode}-entry.ts`,
|
entry: `.tmagic/${type}-entry.ts`,
|
||||||
name: `magicPreset${capitalToken}s`,
|
name: `magicPreset${capitalToken}s`,
|
||||||
fileName: 'index',
|
fileName: 'index',
|
||||||
formats: ['umd'],
|
formats: ['umd'],
|
||||||
@ -50,8 +52,8 @@ export default defineConfig(({ mode }) => {
|
|||||||
const [type, isAdmin] = mode.split(':');
|
const [type, isAdmin] = mode.split(':');
|
||||||
const base = isAdmin ? `/runtime/${type}/` : `/tmagic-editor/playground/runtime/vue3/${type}`;
|
const base = isAdmin ? `/runtime/${type}/` : `/tmagic-editor/playground/runtime/vue3/${type}`;
|
||||||
const outDir = isAdmin
|
const outDir = isAdmin
|
||||||
? path.resolve(process.cwd(), `./admin-dist/${type}`)
|
? path.resolve(process.cwd(), `./dist/${type}`)
|
||||||
: path.resolve(process.cwd(), `./dist/${type}`);
|
: path.resolve(process.cwd(), `../../playground/public/runtime/vue3/${type}`);
|
||||||
return {
|
return {
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
@ -64,6 +66,8 @@ export default defineConfig(({ mode }) => {
|
|||||||
|
|
||||||
root: `./${type}/`,
|
root: `./${type}/`,
|
||||||
|
|
||||||
|
publicDir: '../public',
|
||||||
|
|
||||||
base,
|
base,
|
||||||
|
|
||||||
build: {
|
build: {
|
||||||
|
@ -38,7 +38,7 @@ export default defineConfig({
|
|||||||
|
|
||||||
base: '/tmagic-editor/playground/runtime/vue3/',
|
base: '/tmagic-editor/playground/runtime/vue3/',
|
||||||
|
|
||||||
publicDir: 'entry-dist',
|
publicDir: 'public',
|
||||||
|
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
|
@ -5,15 +5,19 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "npm run build:libs && vite --config dev.vite.config.ts",
|
"dev": "npm run build:libs && vite --config dev.vite.config.ts",
|
||||||
"build": "npm run build:libs && npm run build:page && npm run build:playground",
|
"build": "npm run build:libs && npm run build:page && npm run build:playground",
|
||||||
"build:admin": "npm run build:libs && npm run build:page:admin && npm run build:playground:admin",
|
"build:admin": "npm run build:libs:admin && npm run build:page:admin && npm run build:playground:admin",
|
||||||
"build:page": "vite build --config build.vite.config.ts --mode page",
|
"build:page": "vite build --config build.vite.config.ts --mode page",
|
||||||
"build:playground": "vite build --config build.vite.config.ts --mode playground",
|
"build:playground": "vite build --config build.vite.config.ts --mode playground",
|
||||||
"build:page:admin": "vite build --config build.vite.config.ts --mode page:admin",
|
"build:page:admin": "vite build --config build.vite.config.ts --mode page:admin",
|
||||||
"build:playground:admin": "vite build --config build.vite.config.ts --mode playground:admin",
|
"build:playground:admin": "vite build --config build.vite.config.ts --mode playground:admin",
|
||||||
"build:libs": "tmagic entry && npm run build:config & npm run build:value & npm run build:event",
|
"build:libs": "tmagic entry && npm run build:config && npm run build:value && npm run build:event",
|
||||||
|
"build:libs:admin": "tmagic entry && npm run build:config:admin && npm run build:value:admin && npm run build:event:admin",
|
||||||
"build:config": "vite build --config build.vite.config.ts --mode config",
|
"build:config": "vite build --config build.vite.config.ts --mode config",
|
||||||
"build:value": "vite build --config build.vite.config.ts --mode value",
|
"build:value": "vite build --config build.vite.config.ts --mode value",
|
||||||
"build:event": "vite build --config build.vite.config.ts --mode event"
|
"build:event": "vite build --config build.vite.config.ts --mode event",
|
||||||
|
"build:config:admin": "vite build --config build.vite.config.ts --mode config:admin",
|
||||||
|
"build:value:admin": "vite build --config build.vite.config.ts --mode value:admin",
|
||||||
|
"build:event:admin": "vite build --config build.vite.config.ts --mode event:admin"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tmagic/cli": "1.1.0-beta.6",
|
"@tmagic/cli": "1.1.0-beta.6",
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<link rel="icon" href="/favicon.png" type="image/png">
|
||||||
<title>Vue3 Page</title>
|
<title>Vue3 Page</title>
|
||||||
<style>
|
<style>
|
||||||
html,
|
html,
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="icon" href="/favicon.png" type="image/png">
|
||||||
<title>Vue3 Playground</title>
|
<title>Vue3 Playground</title>
|
||||||
<style>
|
<style>
|
||||||
html,body {margin: 0; padding: 0}
|
html,body {margin: 0; padding: 0}
|
||||||
|
BIN
runtime/vue3/public/favicon.png
Normal file
BIN
runtime/vue3/public/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
Loading…
x
Reference in New Issue
Block a user