mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-19 21:06:06 +08:00
build: 构建playground失败
This commit is contained in:
parent
7695f005f6
commit
a56bb562d8
@ -10,9 +10,10 @@
|
||||
"tmagic": "tmagic entry",
|
||||
"dev:react": "vite --force",
|
||||
"serve": "vite preview",
|
||||
"build": "rimraf ./dist && node scripts/build.mjs --type=all && npm run build:client",
|
||||
"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"
|
||||
"build": "rimraf ./dist && node scripts/build.mjs --type=all",
|
||||
"build:libs": "node scripts/build.mjs --type=res",
|
||||
"build:page": "node scripts/build.mjs --type=page",
|
||||
"build:playground": "node scripts/build.mjs --type=playground"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tmagic/core": "1.6.0-beta.6",
|
||||
|
@ -1,27 +1,10 @@
|
||||
import path from 'node:path';
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
import fse from 'fs-extra';
|
||||
|
||||
import baseConfig from '../vite.config';
|
||||
|
||||
export default defineConfig({
|
||||
...baseConfig,
|
||||
|
||||
plugins: [
|
||||
...(baseConfig.plugins || []),
|
||||
{
|
||||
name: 'vite-plugin-copy-runtime',
|
||||
apply: 'build',
|
||||
enforce: 'post',
|
||||
closeBundle() {
|
||||
const clientFile = path.resolve(__dirname, '../dist/page')
|
||||
fse.copySync(clientFile, path.resolve(__dirname, '../../../playground/public/runtime/react/page'))
|
||||
},
|
||||
}
|
||||
],
|
||||
|
||||
root: './page',
|
||||
|
||||
publicDir: '../public',
|
||||
|
@ -1,26 +1,10 @@
|
||||
import path from 'node:path';
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
import fse from 'fs-extra';
|
||||
|
||||
import baseConfig from '../vite.config';
|
||||
|
||||
export default defineConfig({
|
||||
...baseConfig,
|
||||
|
||||
plugins: [
|
||||
...(baseConfig.plugins || []),
|
||||
{
|
||||
name: 'vite-plugin-copy-runtime',
|
||||
apply: 'build',
|
||||
enforce: 'post',
|
||||
closeBundle() {
|
||||
const clientFile = path.resolve(__dirname, '../dist/playground')
|
||||
fse.copySync(clientFile, path.resolve(__dirname, '../../../playground/public/runtime/react/playground'))
|
||||
},
|
||||
}
|
||||
],
|
||||
|
||||
root: './playground',
|
||||
|
||||
publicDir: '../public',
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
@ -11,21 +12,49 @@ const args = minimist(process.argv.slice(2));
|
||||
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const buildList = [];
|
||||
fse.removeSync(path.resolve(dirname, '../.tmagic'));
|
||||
|
||||
execSync('tmagic entry', {
|
||||
stdio: 'inherit',
|
||||
cwd: path.resolve(dirname, '../'),
|
||||
});
|
||||
|
||||
if (args.type === 'res' || args.type === 'all') {
|
||||
fse.removeSync(path.resolve(dirname, '../dist/entry'));
|
||||
|
||||
for (const mode of ['value', 'config', 'event', 'ds:value', 'ds:config', 'ds:event']) {
|
||||
buildList.push(
|
||||
buildVite({
|
||||
root: path.resolve(dirname, '../'),
|
||||
clearScreen: false,
|
||||
configFile: false,
|
||||
...resViteConfig(mode),
|
||||
}),
|
||||
);
|
||||
const fileName = mode.replace(':', '-');
|
||||
|
||||
buildVite({
|
||||
root: path.resolve(dirname, '../'),
|
||||
clearScreen: false,
|
||||
configFile: false,
|
||||
...resViteConfig(mode),
|
||||
}).then(() => {
|
||||
fse.copySync(
|
||||
path.resolve(dirname, '../dist/entry', fileName),
|
||||
path.resolve(dirname, '../../../playground/public/entry/vue/', fileName),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Promise.all(buildList);
|
||||
const buildRuntime = (type) => {
|
||||
fse.removeSync(path.resolve(dirname, '../dist', type));
|
||||
|
||||
buildVite({
|
||||
root: path.resolve(dirname, '../', type),
|
||||
clearScreen: false,
|
||||
configFile: path.resolve(dirname, '../', type, 'vite.config.ts'),
|
||||
}).then(() => {
|
||||
const clientFile = path.resolve(dirname, '../dist', type);
|
||||
fse.copySync(clientFile, path.resolve(dirname, '../../../playground/public/runtime/react', type));
|
||||
});
|
||||
};
|
||||
|
||||
if (args.type === 'page' || args.type === 'all') {
|
||||
buildRuntime('page');
|
||||
}
|
||||
|
||||
if (args.type === 'playground' || args.type === 'all') {
|
||||
buildRuntime('playground');
|
||||
}
|
||||
|
@ -1,10 +1,4 @@
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
import fse from 'fs-extra';
|
||||
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
export default defineConfig((mode) => {
|
||||
const capitalToken = mode
|
||||
@ -15,19 +9,6 @@ export default defineConfig((mode) => {
|
||||
const fileName = mode.replace(':', '-');
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
{
|
||||
name: 'vite-plugin-copy-runtime',
|
||||
apply: 'build',
|
||||
enforce: 'post',
|
||||
closeBundle() {
|
||||
fse.copySync(
|
||||
path.resolve(dirname, '../dist/entry', fileName),
|
||||
path.resolve(dirname, '../../../playground/public/entry/react/', fileName),
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
publicDir: './.tmagic/public',
|
||||
build: {
|
||||
cssCodeSplit: false,
|
||||
@ -37,7 +18,7 @@ export default defineConfig((mode) => {
|
||||
outDir: `./dist/entry/${fileName}`,
|
||||
|
||||
lib: {
|
||||
entry: `.tmagic/${fileName}-entry.ts`,
|
||||
entry: `./.tmagic/${fileName}-entry.ts`,
|
||||
name: `magicPreset${capitalToken}s`,
|
||||
fileName: 'index',
|
||||
formats: ['umd'],
|
||||
|
@ -10,9 +10,10 @@
|
||||
"tmagic": "tmagic entry",
|
||||
"dev": "vite --force",
|
||||
"serve": "vite preview",
|
||||
"build": "rimraf ./dist && node scripts/build.mjs --type=all && npm run build:client",
|
||||
"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"
|
||||
"build": "rimraf ./dist && node scripts/build.mjs --type=all",
|
||||
"build:libs": "node scripts/build.mjs --type=res",
|
||||
"build:page": "node scripts/build.mjs --type=page",
|
||||
"build:playground": "node scripts/build.mjs --type=playground"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tmagic/core": "1.6.0-beta.6",
|
||||
|
@ -1,29 +1,10 @@
|
||||
import path from 'node:path';
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
import fse from 'fs-extra';
|
||||
|
||||
import baseConfig from '../vite.config';
|
||||
|
||||
export default defineConfig({
|
||||
...baseConfig,
|
||||
|
||||
plugins: [
|
||||
...(baseConfig.plugins || []),
|
||||
{
|
||||
name: 'vite-plugin-copy-runtime',
|
||||
apply: 'build',
|
||||
enforce: 'post',
|
||||
closeBundle() {
|
||||
const clientFile = path.resolve(__dirname, '../dist/page')
|
||||
fse.copySync(clientFile, path.resolve(__dirname, '../../../playground/public/runtime/vue/page'))
|
||||
},
|
||||
}
|
||||
],
|
||||
|
||||
root: './page',
|
||||
|
||||
publicDir: '../public',
|
||||
|
||||
base: `${baseConfig.base}/page`,
|
||||
|
@ -1,28 +1,10 @@
|
||||
import path from 'node:path';
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
import fse from 'fs-extra';
|
||||
|
||||
import baseConfig from '../vite.config';
|
||||
|
||||
export default defineConfig({
|
||||
...baseConfig,
|
||||
|
||||
plugins: [
|
||||
...(baseConfig.plugins || []),
|
||||
{
|
||||
name: 'vite-plugin-copy-runtime',
|
||||
apply: 'build',
|
||||
enforce: 'post',
|
||||
closeBundle() {
|
||||
const clientFile = path.resolve(__dirname, '../dist/playground')
|
||||
fse.copySync(clientFile, path.resolve(__dirname, '../../../playground/public/runtime/vue/playground'))
|
||||
},
|
||||
}
|
||||
],
|
||||
|
||||
root: './playground',
|
||||
|
||||
publicDir: '../public',
|
||||
|
||||
base: `${baseConfig.base}/playground`,
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
@ -11,21 +12,49 @@ const args = minimist(process.argv.slice(2));
|
||||
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const buildList = [];
|
||||
fse.removeSync(path.resolve(dirname, '../.tmagic'));
|
||||
|
||||
execSync('tmagic entry', {
|
||||
stdio: 'inherit',
|
||||
cwd: path.resolve(dirname, '../'),
|
||||
});
|
||||
|
||||
if (args.type === 'res' || args.type === 'all') {
|
||||
fse.removeSync(path.resolve(dirname, '../dist/entry'));
|
||||
|
||||
for (const mode of ['value', 'config', 'event', 'ds:value', 'ds:config', 'ds:event']) {
|
||||
buildList.push(
|
||||
buildVite({
|
||||
root: path.resolve(dirname, '../'),
|
||||
clearScreen: false,
|
||||
configFile: false,
|
||||
...resViteConfig(mode),
|
||||
}),
|
||||
);
|
||||
const fileName = mode.replace(':', '-');
|
||||
|
||||
buildVite({
|
||||
root: path.resolve(dirname, '../'),
|
||||
clearScreen: false,
|
||||
configFile: false,
|
||||
...resViteConfig(mode),
|
||||
}).then(() => {
|
||||
fse.copySync(
|
||||
path.resolve(dirname, '../dist/entry', fileName),
|
||||
path.resolve(dirname, '../../../playground/public/entry/vue/', fileName),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Promise.all(buildList);
|
||||
const buildRuntime = (type) => {
|
||||
fse.removeSync(path.resolve(dirname, '../dist', type));
|
||||
|
||||
buildVite({
|
||||
root: path.resolve(dirname, '../', type),
|
||||
clearScreen: false,
|
||||
configFile: path.resolve(dirname, '../', type, 'vite.config.ts'),
|
||||
}).then(() => {
|
||||
const clientFile = path.resolve(dirname, '../dist', type);
|
||||
fse.copySync(clientFile, path.resolve(dirname, '../../../playground/public/runtime/vue', type));
|
||||
});
|
||||
};
|
||||
|
||||
if (args.type === 'page' || args.type === 'all') {
|
||||
buildRuntime('page');
|
||||
}
|
||||
|
||||
if (args.type === 'playground' || args.type === 'all') {
|
||||
buildRuntime('playground');
|
||||
}
|
||||
|
@ -1,10 +1,4 @@
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
import fse from 'fs-extra';
|
||||
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
export default defineConfig((mode) => {
|
||||
const capitalToken = mode
|
||||
@ -15,19 +9,6 @@ export default defineConfig((mode) => {
|
||||
const fileName = mode.replace(':', '-');
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
{
|
||||
name: 'vite-plugin-copy-runtime',
|
||||
apply: 'build',
|
||||
enforce: 'post',
|
||||
closeBundle() {
|
||||
fse.copySync(
|
||||
path.resolve(dirname, '../dist/entry', fileName),
|
||||
path.resolve(dirname, '../../../playground/public/entry/vue/', fileName),
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
publicDir: './.tmagic/public',
|
||||
build: {
|
||||
cssCodeSplit: false,
|
||||
@ -37,7 +18,7 @@ export default defineConfig((mode) => {
|
||||
outDir: `./dist/entry/${fileName}`,
|
||||
|
||||
lib: {
|
||||
entry: `.tmagic/${fileName}-entry.ts`,
|
||||
entry: `./.tmagic/${fileName}-entry.ts`,
|
||||
name: `magicPreset${capitalToken}s`,
|
||||
fileName: 'index',
|
||||
formats: ['umd'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user