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