feat: 修改stystem-ui的页面打包
This commit is contained in:
parent
673a982014
commit
acce2c991e
64
apps/ui/config/rollup.components.config.js
Normal file
64
apps/ui/config/rollup.components.config.js
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import resolve from '@rollup/plugin-node-resolve';
|
||||||
|
import typescript from '@rollup/plugin-typescript';
|
||||||
|
import commonjs from '@rollup/plugin-commonjs';
|
||||||
|
import postcss from 'rollup-plugin-postcss';
|
||||||
|
import autoprefixer from 'autoprefixer';
|
||||||
|
import cssnano from 'cssnano';
|
||||||
|
import terser from '@rollup/plugin-terser';
|
||||||
|
|
||||||
|
import postcssImport from 'postcss-import';
|
||||||
|
import dts from 'rollup-plugin-dts';
|
||||||
|
|
||||||
|
import * as glob from 'glob';
|
||||||
|
import path from 'path';
|
||||||
|
const isApps = process.env.TYPE === 'apps';
|
||||||
|
const components = glob.sync('./src/components/**/index.ts');
|
||||||
|
const entrys = components.map((entry) => {
|
||||||
|
return entry;
|
||||||
|
});
|
||||||
|
console.log('entry', entrys);
|
||||||
|
const output = path.resolve('./dist');
|
||||||
|
console.log('output', output);
|
||||||
|
/**
|
||||||
|
* @type {import('rollup').RollupOptions[]}
|
||||||
|
*/
|
||||||
|
const configs = entrys
|
||||||
|
.map((entry) => {
|
||||||
|
const directory = path.dirname(entry);
|
||||||
|
const lastDirectory = directory.split('/').pop();
|
||||||
|
const input = path.resolve(entry);
|
||||||
|
const buildConfig = {
|
||||||
|
input: input, // 修改输入文件为 TypeScript 文件
|
||||||
|
output: {
|
||||||
|
file: path.join(output, `./${lastDirectory}.js`),
|
||||||
|
format: 'es', // 输出格式为 ES Module
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
resolve({
|
||||||
|
browser: true, // 处理浏览器版本的依赖
|
||||||
|
}),
|
||||||
|
commonjs(),
|
||||||
|
typescript({
|
||||||
|
tsconfig: './tsconfig.json',
|
||||||
|
compilerOptions: {
|
||||||
|
declaration: false, // 生成声明文件
|
||||||
|
declarationDir: './dist', // 声明文件输出目录
|
||||||
|
// outDir: './types', //
|
||||||
|
},
|
||||||
|
}), // 添加 TypeScript 插件
|
||||||
|
// terser(), // 压缩输出的 ES Module 文件
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const tsConfig = {
|
||||||
|
input: input,
|
||||||
|
output: {
|
||||||
|
file: path.join(output, `./${lastDirectory}.d.ts`),
|
||||||
|
format: 'esm',
|
||||||
|
},
|
||||||
|
plugins: [dts()],
|
||||||
|
};
|
||||||
|
return [buildConfig, tsConfig];
|
||||||
|
})
|
||||||
|
.flat();
|
||||||
|
|
||||||
|
export default [...configs];
|
@ -8,7 +8,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "rollup -c -w",
|
"dev": "rollup -c -w",
|
||||||
"build": "npm run clean && rollup -c",
|
"build": "npm run clean && rollup -c",
|
||||||
"pub": "envision switchOrg system && envision deploy ./deploy -v 0.0.1 -k ui -y y",
|
"build:components": "rollup -c ./config/rollup.components.config.js",
|
||||||
|
"pub": "envision switchOrg system && envision deploy ./dist -v 0.0.2 -k ui -y y",
|
||||||
"clean": "rimraf dist"
|
"clean": "rimraf dist"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
@ -21,7 +22,9 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
|
"glob": "^11.0.0",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
|
"rollup-plugin-dts": "^6.1.1",
|
||||||
"style-to-object": "^1.0.8"
|
"style-to-object": "^1.0.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -5,7 +5,7 @@ import postcss from 'rollup-plugin-postcss';
|
|||||||
import autoprefixer from 'autoprefixer';
|
import autoprefixer from 'autoprefixer';
|
||||||
import cssnano from 'cssnano';
|
import cssnano from 'cssnano';
|
||||||
import terser from '@rollup/plugin-terser';
|
import terser from '@rollup/plugin-terser';
|
||||||
|
import dts from 'rollup-plugin-dts';
|
||||||
import postcssImport from 'postcss-import';
|
import postcssImport from 'postcss-import';
|
||||||
|
|
||||||
const isApps = process.env.TYPE === 'apps';
|
const isApps = process.env.TYPE === 'apps';
|
||||||
@ -13,29 +13,43 @@ const entrys = ['index'];
|
|||||||
/**
|
/**
|
||||||
* @type {import('rollup').RollupOptions[]}
|
* @type {import('rollup').RollupOptions[]}
|
||||||
*/
|
*/
|
||||||
const configs = entrys.map((entry) => ({
|
const configs = entrys
|
||||||
input: `./src/${entry}.ts`, // 修改输入文件为 TypeScript 文件
|
.map((entry) => {
|
||||||
output: {
|
const buildConfig = {
|
||||||
file: `./dist/${entry}.js`,
|
input: `./src/${entry}.ts`, // 修改输入文件为 TypeScript 文件
|
||||||
// dir: 'dist',
|
output: {
|
||||||
format: 'es', // 输出格式为 ES Module
|
file: `./dist/${entry}.js`,
|
||||||
},
|
// dir: 'dist',
|
||||||
plugins: [
|
format: 'es', // 输出格式为 ES Module
|
||||||
resolve({
|
|
||||||
browser: true, // 处理浏览器版本的依赖
|
|
||||||
}),
|
|
||||||
commonjs(),
|
|
||||||
typescript({
|
|
||||||
tsconfig: './tsconfig.json',
|
|
||||||
compilerOptions: {
|
|
||||||
declaration: !isApps, // 生成声明文件
|
|
||||||
declarationDir: './dist', // 声明文件输出目录
|
|
||||||
// outDir: './types', //
|
|
||||||
},
|
},
|
||||||
}), // 添加 TypeScript 插件
|
plugins: [
|
||||||
terser(), // 压缩输出的 ES Module 文件
|
resolve({
|
||||||
],
|
browser: true, // 处理浏览器版本的依赖
|
||||||
}));
|
}),
|
||||||
|
commonjs(),
|
||||||
|
typescript({
|
||||||
|
tsconfig: './tsconfig.json',
|
||||||
|
compilerOptions: {
|
||||||
|
// declaration: !isApps, // 生成声明文件
|
||||||
|
declaration: false, // 生成声明文件
|
||||||
|
declarationDir: './dist', // 声明文件输出目录
|
||||||
|
// outDir: './types', //
|
||||||
|
},
|
||||||
|
}), // 添加 TypeScript 插件
|
||||||
|
terser(), // 压缩输出的 ES Module 文件
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const dtsConfig = {
|
||||||
|
input: `./src/${entry}.ts`,
|
||||||
|
output: {
|
||||||
|
file: `./dist/${entry}.d.ts`,
|
||||||
|
format: 'esm',
|
||||||
|
},
|
||||||
|
plugins: [dts()],
|
||||||
|
};
|
||||||
|
return [buildConfig, dtsConfig];
|
||||||
|
})
|
||||||
|
.flat();
|
||||||
|
|
||||||
const entryCss = ['index'];
|
const entryCss = ['index'];
|
||||||
const configsCss = entryCss.map((entry) => ({
|
const configsCss = entryCss.map((entry) => ({
|
||||||
|
66
pnpm-lock.yaml
generated
66
pnpm-lock.yaml
generated
@ -74,9 +74,15 @@ importers:
|
|||||||
dayjs:
|
dayjs:
|
||||||
specifier: ^1.11.13
|
specifier: ^1.11.13
|
||||||
version: 1.11.13
|
version: 1.11.13
|
||||||
|
glob:
|
||||||
|
specifier: ^11.0.0
|
||||||
|
version: 11.0.0
|
||||||
lodash-es:
|
lodash-es:
|
||||||
specifier: ^4.17.21
|
specifier: ^4.17.21
|
||||||
version: 4.17.21
|
version: 4.17.21
|
||||||
|
rollup-plugin-dts:
|
||||||
|
specifier: ^6.1.1
|
||||||
|
version: 6.1.1(rollup@4.24.0)(typescript@5.6.3)
|
||||||
style-to-object:
|
style-to-object:
|
||||||
specifier: ^1.0.8
|
specifier: ^1.0.8
|
||||||
version: 1.0.8
|
version: 1.0.8
|
||||||
@ -1792,6 +1798,11 @@ packages:
|
|||||||
resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==}
|
resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
glob@11.0.0:
|
||||||
|
resolution: {integrity: sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==}
|
||||||
|
engines: {node: 20 || >=22}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
gopd@1.0.1:
|
gopd@1.0.1:
|
||||||
resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==}
|
resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==}
|
||||||
|
|
||||||
@ -1981,6 +1992,10 @@ packages:
|
|||||||
jackspeak@3.4.3:
|
jackspeak@3.4.3:
|
||||||
resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}
|
resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}
|
||||||
|
|
||||||
|
jackspeak@4.0.2:
|
||||||
|
resolution: {integrity: sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==}
|
||||||
|
engines: {node: 20 || >=22}
|
||||||
|
|
||||||
jest-worker@27.5.1:
|
jest-worker@27.5.1:
|
||||||
resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==}
|
resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==}
|
||||||
engines: {node: '>= 10.13.0'}
|
engines: {node: '>= 10.13.0'}
|
||||||
@ -2059,6 +2074,10 @@ packages:
|
|||||||
lru-cache@10.4.3:
|
lru-cache@10.4.3:
|
||||||
resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==}
|
resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==}
|
||||||
|
|
||||||
|
lru-cache@11.0.2:
|
||||||
|
resolution: {integrity: sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==}
|
||||||
|
engines: {node: 20 || >=22}
|
||||||
|
|
||||||
lz-string@1.5.0:
|
lz-string@1.5.0:
|
||||||
resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==}
|
resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@ -2136,6 +2155,10 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
webpack: ^5.0.0
|
webpack: ^5.0.0
|
||||||
|
|
||||||
|
minimatch@10.0.1:
|
||||||
|
resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==}
|
||||||
|
engines: {node: 20 || >=22}
|
||||||
|
|
||||||
minimatch@3.1.2:
|
minimatch@3.1.2:
|
||||||
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
|
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
|
||||||
|
|
||||||
@ -2267,6 +2290,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==}
|
resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==}
|
||||||
engines: {node: '>=16 || 14 >=14.18'}
|
engines: {node: '>=16 || 14 >=14.18'}
|
||||||
|
|
||||||
|
path-scurry@2.0.0:
|
||||||
|
resolution: {integrity: sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==}
|
||||||
|
engines: {node: 20 || >=22}
|
||||||
|
|
||||||
path-to-regexp@0.1.10:
|
path-to-regexp@0.1.10:
|
||||||
resolution: {integrity: sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==}
|
resolution: {integrity: sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==}
|
||||||
|
|
||||||
@ -2852,6 +2879,13 @@ packages:
|
|||||||
resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
|
resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
|
||||||
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
|
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
|
||||||
|
|
||||||
|
rollup-plugin-dts@6.1.1:
|
||||||
|
resolution: {integrity: sha512-aSHRcJ6KG2IHIioYlvAOcEq6U99sVtqDDKVhnwt70rW6tsz3tv5OSjEiWcgzfsHdLyGXZ/3b/7b/+Za3Y6r1XA==}
|
||||||
|
engines: {node: '>=16'}
|
||||||
|
peerDependencies:
|
||||||
|
rollup: ^3.29.4 || ^4
|
||||||
|
typescript: ^4.5 || ^5.0
|
||||||
|
|
||||||
rollup-plugin-postcss@4.0.2:
|
rollup-plugin-postcss@4.0.2:
|
||||||
resolution: {integrity: sha512-05EaY6zvZdmvPUDi3uCcAQoESDcYnv8ogJJQRp6V5kZ6J6P7uAVJlrTZcaaA20wTH527YTnKfkAoPxWI/jPp4w==}
|
resolution: {integrity: sha512-05EaY6zvZdmvPUDi3uCcAQoESDcYnv8ogJJQRp6V5kZ6J6P7uAVJlrTZcaaA20wTH527YTnKfkAoPxWI/jPp4w==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
@ -5056,6 +5090,15 @@ snapshots:
|
|||||||
package-json-from-dist: 1.0.1
|
package-json-from-dist: 1.0.1
|
||||||
path-scurry: 1.11.1
|
path-scurry: 1.11.1
|
||||||
|
|
||||||
|
glob@11.0.0:
|
||||||
|
dependencies:
|
||||||
|
foreground-child: 3.3.0
|
||||||
|
jackspeak: 4.0.2
|
||||||
|
minimatch: 10.0.1
|
||||||
|
minipass: 7.1.2
|
||||||
|
package-json-from-dist: 1.0.1
|
||||||
|
path-scurry: 2.0.0
|
||||||
|
|
||||||
gopd@1.0.1:
|
gopd@1.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
get-intrinsic: 1.2.4
|
get-intrinsic: 1.2.4
|
||||||
@ -5229,6 +5272,10 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@pkgjs/parseargs': 0.11.0
|
'@pkgjs/parseargs': 0.11.0
|
||||||
|
|
||||||
|
jackspeak@4.0.2:
|
||||||
|
dependencies:
|
||||||
|
'@isaacs/cliui': 8.0.2
|
||||||
|
|
||||||
jest-worker@27.5.1:
|
jest-worker@27.5.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.6
|
||||||
@ -5289,6 +5336,8 @@ snapshots:
|
|||||||
|
|
||||||
lru-cache@10.4.3: {}
|
lru-cache@10.4.3: {}
|
||||||
|
|
||||||
|
lru-cache@11.0.2: {}
|
||||||
|
|
||||||
lz-string@1.5.0: {}
|
lz-string@1.5.0: {}
|
||||||
|
|
||||||
magic-string@0.30.12:
|
magic-string@0.30.12:
|
||||||
@ -5346,6 +5395,10 @@ snapshots:
|
|||||||
tapable: 2.2.1
|
tapable: 2.2.1
|
||||||
webpack: 5.95.0(@swc/core@1.7.36)(esbuild@0.23.1)
|
webpack: 5.95.0(@swc/core@1.7.36)(esbuild@0.23.1)
|
||||||
|
|
||||||
|
minimatch@10.0.1:
|
||||||
|
dependencies:
|
||||||
|
brace-expansion: 2.0.1
|
||||||
|
|
||||||
minimatch@3.1.2:
|
minimatch@3.1.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
brace-expansion: 1.1.11
|
brace-expansion: 1.1.11
|
||||||
@ -5458,6 +5511,11 @@ snapshots:
|
|||||||
lru-cache: 10.4.3
|
lru-cache: 10.4.3
|
||||||
minipass: 7.1.2
|
minipass: 7.1.2
|
||||||
|
|
||||||
|
path-scurry@2.0.0:
|
||||||
|
dependencies:
|
||||||
|
lru-cache: 11.0.2
|
||||||
|
minipass: 7.1.2
|
||||||
|
|
||||||
path-to-regexp@0.1.10: {}
|
path-to-regexp@0.1.10: {}
|
||||||
|
|
||||||
path-type@4.0.0: {}
|
path-type@4.0.0: {}
|
||||||
@ -6003,6 +6061,14 @@ snapshots:
|
|||||||
|
|
||||||
reusify@1.0.4: {}
|
reusify@1.0.4: {}
|
||||||
|
|
||||||
|
rollup-plugin-dts@6.1.1(rollup@4.24.0)(typescript@5.6.3):
|
||||||
|
dependencies:
|
||||||
|
magic-string: 0.30.12
|
||||||
|
rollup: 4.24.0
|
||||||
|
typescript: 5.6.3
|
||||||
|
optionalDependencies:
|
||||||
|
'@babel/code-frame': 7.25.7
|
||||||
|
|
||||||
rollup-plugin-postcss@4.0.2(postcss@8.4.47):
|
rollup-plugin-postcss@4.0.2(postcss@8.4.47):
|
||||||
dependencies:
|
dependencies:
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user