style(runtime): 配置格式化

This commit is contained in:
roymondchen 2025-08-27 17:01:08 +08:00
parent a10f9d230d
commit 7695f005f6
10 changed files with 42 additions and 36 deletions

View File

@ -1,2 +1,4 @@
.tmagic
entry-dist
dist
*.local
*.local.*

View File

@ -11,7 +11,7 @@
"dev:react": "vite --force",
"serve": "vite preview",
"build": "rimraf ./dist && node scripts/build.mjs --type=all && npm run build:client",
"build:libs": "tmagic entry && node scripts/build.mjs --type=res",
"build:libs": "npm run tmagic && node scripts/build.mjs --type=res",
"build:client": "vite build --config ./page/vite.config.ts && vite build --config ./playground/vite.config.ts"
},
"dependencies": {

View File

@ -2,6 +2,7 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { build as buildVite } from 'vite';
import fse from 'fs-extra';
import minimist from 'minimist';
import resViteConfig from './vite.res.config.mjs';
@ -12,9 +13,9 @@ const dirname = path.dirname(fileURLToPath(import.meta.url));
const buildList = [];
const buildRes = args.type === 'res' || args.type === 'all';
if (args.type === 'res' || args.type === 'all') {
fse.removeSync(path.resolve(dirname, '../dist/entry'));
if (buildRes) {
for (const mode of ['value', 'config', 'event', 'ds:value', 'ds:config', 'ds:event']) {
buildList.push(
buildVite({

View File

@ -14,9 +14,6 @@ export default defineConfig((mode) => {
const fileName = mode.replace(':', '-');
const publicPath = path.resolve(dirname, '../dist/entry', fileName);
fse.removeSync(publicPath);
return {
plugins: [
{
@ -24,7 +21,10 @@ export default defineConfig((mode) => {
apply: 'build',
enforce: 'post',
closeBundle() {
fse.copySync(publicPath, path.resolve(dirname, `../../../playground/public/entry/react/${fileName}`));
fse.copySync(
path.resolve(dirname, '../dist/entry', fileName),
path.resolve(dirname, '../../../playground/public/entry/react/', fileName),
);
},
},
],

View File

@ -8,16 +8,16 @@ export default defineConfig({
},
packages: [
{
button: '@tmagic/react-button' ,
container: '@tmagic/react-container' ,
img: '@tmagic/react-img' ,
'iterator-container': '@tmagic/react-iterator-container' ,
overlay: '@tmagic/react-overlay' ,
page: '@tmagic/react-page' ,
'page-fragment': '@tmagic/react-page-fragment' ,
'page-fragment-container': '@tmagic/react-page-fragment-container' ,
'qrcode': '@tmagic/react-qrcode' ,
'text': '@tmagic/react-text' ,
}
button: '@tmagic/react-button',
container: '@tmagic/react-container',
img: '@tmagic/react-img',
'iterator-container': '@tmagic/react-iterator-container',
overlay: '@tmagic/react-overlay',
page: '@tmagic/react-page',
'page-fragment': '@tmagic/react-page-fragment',
'page-fragment-container': '@tmagic/react-page-fragment-container',
'qrcode': '@tmagic/react-qrcode',
'text': '@tmagic/react-text',
},
],
});

View File

@ -1,2 +1,4 @@
.tmagic
dist
*.local
*.local.*

View File

@ -11,7 +11,7 @@
"dev": "vite --force",
"serve": "vite preview",
"build": "rimraf ./dist && node scripts/build.mjs --type=all && npm run build:client",
"build:libs": "tmagic entry && node scripts/build.mjs --type=res",
"build:libs": "npm run tmagic && node scripts/build.mjs --type=res",
"build:client": "vite build --config ./page/vite.config.ts && vite build --config ./playground/vite.config.ts"
},
"dependencies": {

View File

@ -2,6 +2,7 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { build as buildVite } from 'vite';
import fse from 'fs-extra';
import minimist from 'minimist';
import resViteConfig from './vite.res.config.mjs';
@ -12,9 +13,9 @@ const dirname = path.dirname(fileURLToPath(import.meta.url));
const buildList = [];
const buildRes = args.type === 'res' || args.type === 'all';
if (args.type === 'res' || args.type === 'all') {
fse.removeSync(path.resolve(dirname, '../dist/entry'));
if (buildRes) {
for (const mode of ['value', 'config', 'event', 'ds:value', 'ds:config', 'ds:event']) {
buildList.push(
buildVite({

View File

@ -14,9 +14,6 @@ export default defineConfig((mode) => {
const fileName = mode.replace(':', '-');
const publicPath = path.resolve(dirname, '../dist/entry', fileName);
fse.removeSync(publicPath);
return {
plugins: [
{
@ -24,7 +21,10 @@ export default defineConfig((mode) => {
apply: 'build',
enforce: 'post',
closeBundle() {
fse.copySync(publicPath, path.resolve(dirname, `../../../playground/public/entry/vue/${fileName}`));
fse.copySync(
path.resolve(dirname, '../dist/entry', fileName),
path.resolve(dirname, '../../../playground/public/entry/vue/', fileName),
);
},
},
],

View File

@ -9,16 +9,16 @@ export default defineConfig({
},
packages: [
{
button: '@tmagic/vue-button' ,
container: '@tmagic/vue-container' ,
button: '@tmagic/vue-button',
container: '@tmagic/vue-container',
img: '@tmagic/vue-img' ,
'iterator-container': '@tmagic/vue-iterator-container' ,
overlay: '@tmagic/vue-overlay' ,
page: '@tmagic/vue-page' ,
'page-fragment': '@tmagic/vue-page-fragment' ,
'page-fragment-container': '@tmagic/vue-page-fragment-container' ,
'qrcode': '@tmagic/vue-qrcode' ,
'text': '@tmagic/vue-text' ,
}
'iterator-container': '@tmagic/vue-iterator-container',
overlay: '@tmagic/vue-overlay',
page: '@tmagic/vue-page',
'page-fragment': '@tmagic/vue-page-fragment',
'page-fragment-container': '@tmagic/vue-page-fragment-container',
'qrcode': '@tmagic/vue-qrcode',
'text': '@tmagic/vue-text',
},
],
});