chore: change build scripts

This commit is contained in:
1ncounter 2024-03-27 17:28:53 +08:00
parent 8e2e22dae1
commit 0014b6aae8
46 changed files with 133 additions and 221 deletions

View File

@ -19,8 +19,8 @@
"package.json"
],
"scripts": {
"build": "vite build",
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest",
"test:cov": ""
},

View File

@ -23,8 +23,8 @@
"package.json"
],
"scripts": {
"build": "vite build",
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest",
"test:cov": ""
},

View File

@ -3,13 +3,13 @@
"version": "2.0.0-beta.0",
"description": "alibaba lowcode editor skeleton",
"type": "module",
"main": "dist/designer.cjs",
"module": "dist/designer.js",
"main": "dist/editorSkeleton.cjs",
"module": "dist/editorSkeleton.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/designer.js",
"require": "./dist/designer.cjs",
"import": "./dist/editorSkeleton.js",
"require": "./dist/editorSkeleton.cjs",
"types": "./dist/index.d.ts"
}
},
@ -22,8 +22,9 @@
"package.json"
],
"scripts": {
"build": "vite build",
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"build": "pnpm run --stream \"/^build:.*/\"",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest"
},
"keywords": [

View File

@ -1,50 +1,45 @@
{
"name": "@alilc/lowcode-engine",
"version": "1.3.2",
"version": "2.0.0-beta.0",
"description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
"main": "lib/engine-core.js",
"module": "es/engine-core.js",
"main": "dist/engine-core.js",
"module": "dist/engine-core.js",
"files": [
"dist",
"es",
"lib"
],
"scripts": {
"start": "build-scripts start",
"version:update": "node ./scripts/version.js",
"build": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build",
"build:umd": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build --config build.umd.json",
"test": "build-scripts test --config build.test.json --jest-passWithNoTests"
"test": "vitest"
},
"license": "MIT",
"dependencies": {
"@alifd/next": "^1.19.12",
"@alilc/lowcode-designer": "1.3.2",
"@alilc/lowcode-editor-core": "1.3.2",
"@alilc/lowcode-editor-skeleton": "1.3.2",
"@alifd/next": "^1.27.8",
"@alilc/lowcode-designer": "workspace:*",
"@alilc/lowcode-editor-core": "workspace:*",
"@alilc/lowcode-editor-skeleton": "workspace:*",
"@alilc/lowcode-engine-ext": "^1.0.0",
"@alilc/lowcode-plugin-command": "1.3.2",
"@alilc/lowcode-plugin-designer": "1.3.2",
"@alilc/lowcode-plugin-outline-pane": "1.3.2",
"@alilc/lowcode-shell": "1.3.2",
"@alilc/lowcode-utils": "1.3.2",
"@alilc/lowcode-workspace": "1.3.2",
"@alilc/lowcode-plugin-command": "workspace:*",
"@alilc/lowcode-plugin-designer": "workspace:*",
"@alilc/lowcode-plugin-outline-pane": "workspace:*",
"@alilc/lowcode-shell": "workspace:*",
"@alilc/lowcode-utils": "workspace:*",
"@alilc/lowcode-workspace": "workspace:*",
"prop-types": "^15.7.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@alib/build-scripts": "^0.1.18",
"@alifd/theme-lowcode-dark": "^0.2.0",
"@alifd/theme-lowcode-light": "^0.2.0",
"@types/domready": "^1.0.0",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"build-plugin-fusion": "0.1.17-beta.0",
"build-plugin-moment-locales": "^0.1.0",
"build-plugin-react-app": "^1.8.0",
"fs-extra": "^10.0.0",
"prop-types": "^15.7.2",
"tsconfig-paths-webpack-plugin": "^3.2.0"
"@types/react-dom": "^18.2.0"
},
"peerDependencies": {
"@alifd/next": "^1.27.8",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"publishConfig": {
"access": "public",

View File

@ -1,9 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib"
"outDir": "dist"
},
"include": [
"./src/"
]
"include": ["src"]
}

View File

@ -25,8 +25,8 @@
"*.css"
],
"scripts": {
"build": "vite build",
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest"
},
"bugs": {

View File

@ -19,8 +19,8 @@
"package.json"
],
"scripts": {
"build": "vite build",
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest"
},
"keywords": [

View File

@ -19,8 +19,8 @@
"package.json"
],
"scripts": {
"build": "vite build",
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest"
},
"dependencies": {

View File

@ -1 +0,0 @@
module.exports = require('../../babel.config');

View File

@ -1,3 +0,0 @@
{
"plugins": ["@alilc/build-plugin-lce", "./build.plugin.js"]
}

View File

@ -1,5 +0,0 @@
module.exports = ({ onGetWebpackConfig }) => {
onGetWebpackConfig((config) => {
config.performance.hints(false);
});
};

View File

@ -1,6 +0,0 @@
{
"plugins": [
"@alilc/build-plugin-lce",
"@alilc/lowcode-test-mate/plugin/index.ts"
]
}

View File

@ -1,37 +0,0 @@
{
"entry": {
"react-simulator-renderer": "src/index"
},
"sourceMap": true,
"library": "___ReactSimulatorRenderer___",
"libraryTarget": "umd",
"externals": {
"react": "var window.React",
"react-dom": "var window.ReactDOM",
"prop-types": "var window.PropTypes",
"@alifd/next": "var Next",
"@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt",
"moment": "var moment",
"lodash": "var _"
},
"polyfill": false,
"outputDir": "dist",
"vendor": false,
"ignoreHtmlTemplate": true,
"plugins": [
"build-plugin-react-app",
[
"build-plugin-fusion",
{
"externalNext": "umd"
}
],
[
"build-plugin-moment-locales",
{
"locales": ["zh-cn"]
}
],
"./build.plugin.js"
]
}

View File

@ -1,33 +0,0 @@
const fs = require('fs');
const { join } = require('path');
const esModules = [].join('|');
const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.'));
const jestConfig = {
// transform: {
// '^.+\\.[jt]sx?$': 'babel-jest',
// // '^.+\\.(ts|tsx)$': 'ts-jest',
// // '^.+\\.(js|jsx)$': 'babel-jest',
// },
// testMatch: ['**/document/node/node.test.ts'],
// testMatch: ['**/designer/builtin-hotkey.test.ts'],
// testMatch: ['**/plugin/plugin-manager.test.ts'],
// testMatch: ['(/tests?/.*(test))\\.[jt]s$'],
transformIgnorePatterns: [
`/node_modules/(?!${esModules})/`,
],
setupFiles: ['./test/utils/host.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
collectCoverage: true,
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
'!**/node_modules/**',
],
};
// 只对本仓库内的 pkg 做 mapping
jestConfig.moduleNameMapper = {};
jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src';
module.exports = jestConfig;

View File

@ -1,39 +1,37 @@
{
"name": "@alilc/lowcode-react-simulator-renderer",
"version": "1.3.2",
"version": "2.0.0-beta.0",
"description": "react simulator renderer for alibaba lowcode designer",
"type": "module",
"main": "lib/index.js",
"module": "es/index.js",
"types": "",
"license": "MIT",
"files": [
"es",
"lib",
"dist"
"dist",
"src",
"package.json"
],
"scripts": {
"test": "build-scripts test --config build.test.json",
"build": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build",
"build:umd": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build --config build.umd.json",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest",
"test:cov": "build-scripts test --config build.test.json --jest-coverage"
},
"dependencies": {
"@alilc/lowcode-designer": "1.3.2",
"@alilc/lowcode-react-renderer": "1.3.2",
"@alilc/lowcode-types": "1.3.2",
"@alilc/lowcode-utils": "1.3.2",
"classnames": "^2.2.6",
"mobx": "^6.3.0",
"mobx-react": "^7.2.0",
"@alilc/lowcode-designer": "workspace:*",
"@alilc/lowcode-react-renderer": "workspace:*",
"classnames": "^2.5.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@alib/build-scripts": "^0.1.18",
"@types/classnames": "^2.2.7",
"@types/node": "^13.7.1",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@types/react-router": "5.1.18"
"@types/react-dom": "^18.2.0"
},
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"publishConfig": {
"access": "public",

View File

@ -0,0 +1,17 @@
import { runInAction } from 'mobx';
import renderer from './renderer';
if (typeof window !== 'undefined') {
(window as any).SimulatorRenderer = renderer;
}
window.addEventListener('beforeunload', () => {
runInAction(() => {
(window as any).LCSimulatorHost = null;
renderer.dispose?.();
(window as any).SimulatorRenderer = null;
(window as any).ReactDOM.unmountComponentAtNode(document.getElementById('app'));
});
});
export default renderer;

View File

@ -1,17 +0,0 @@
import { runInAction } from 'mobx';
import renderer from './renderer';
if (typeof window !== 'undefined') {
(window as any).SimulatorRenderer = renderer;
}
window.addEventListener('beforeunload', () => {
runInAction(() => {
(window as any).LCSimulatorHost = null;
renderer.dispose?.();
(window as any).SimulatorRenderer = null;
(window as any).ReactDOM.unmountComponentAtNode(document.getElementById('app'));
});
});
export default renderer;

View File

@ -0,0 +1,30 @@
import { defineConfig } from 'vite';
import { resolve } from 'node:path';
import react from '@vitejs/plugin-react';
import { devDependencies, peerDependencies } from './package.json';
const externals = [...Object.keys(devDependencies), ...Object.keys(peerDependencies)];
export default defineConfig({
build: {
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(import.meta.dirname, 'src/index.ts'),
name: 'LowCodeSimulatorReactRenderer',
formats: ['es', 'cjs', 'iife'],
// the proper extensions will be added
fileName: 'SimulatorReactRenderer',
},
rollupOptions: {
external: externals,
output: {
// for UMD
globals: {
react: 'React',
'react-dom': 'ReactDOM',
},
},
},
},
plugins: [react()],
});

View File

@ -21,8 +21,8 @@
"package.json"
],
"scripts": {
"build": "vite build",
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest --run",
"test:watch": "vitest"
},

View File

@ -17,8 +17,8 @@
}
},
"scripts": {
"build": "vite build",
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest"
},
"dependencies": {

View File

@ -10,10 +10,10 @@ export default defineConfig({
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(import.meta.dirname, 'src/index.ts'),
name: 'LowCodeRendererCore',
name: 'LowCodeReactRenderer',
formats: ['es', 'cjs', 'iife'],
// the proper extensions will be added
fileName: 'rendererReact',
fileName: 'reactRenderer',
},
rollupOptions: {
external: externals,

View File

@ -15,8 +15,8 @@
}
},
"scripts": {
"build": "vite build",
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest"
},
"dependencies": {

View File

@ -10,8 +10,8 @@
"es"
],
"scripts": {
"build": "vite build",
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest"
},
"license": "MIT",

View File

@ -1,8 +1,5 @@
import { globalContext } from '@alilc/lowcode-editor-core';
import {
IDesigner,
isComponentMeta,
} from '@alilc/lowcode-designer';
import { IDesigner, isComponentMeta } from '@alilc/lowcode-designer';
import { IPublicTypeAssetsJson, getLogger } from '@alilc/lowcode-utils';
import {
IPublicTypeComponentAction,
@ -47,7 +44,10 @@ export class Material implements IPublicApiMaterial {
return this[editorSymbol].get('designer')!;
}
constructor(editor: IPublicModelEditor, readonly workspaceMode: boolean = false) {
constructor(
editor: IPublicModelEditor,
readonly workspaceMode: boolean = false,
) {
this[innerEditorSymbol] = editor;
}
@ -176,9 +176,9 @@ export class Material implements IPublicApiMaterial {
* @param handle
*/
modifyBuiltinComponentAction(
actionName: string,
handle: (action: IPublicTypeComponentAction) => void,
) {
actionName: string,
handle: (action: IPublicTypeComponentAction) => void,
) {
this[designerSymbol].componentActions.modifyBuiltinComponentAction(actionName, handle);
}
@ -195,7 +195,7 @@ export class Material implements IPublicApiMaterial {
];
return () => {
dispose.forEach(d => d && d());
dispose.forEach((d) => d && d());
};
}
@ -207,7 +207,9 @@ export class Material implements IPublicApiMaterial {
this[designerSymbol].contextMenuActions.removeMenuAction(name);
}
adjustContextMenuLayout(fn: (actions: IPublicTypeContextMenuItem[]) => IPublicTypeContextMenuItem[]) {
adjustContextMenuLayout(
fn: (actions: IPublicTypeContextMenuItem[]) => IPublicTypeContextMenuItem[],
) {
this[designerSymbol].contextMenuActions.adjustMenuLayout(fn);
}
}

View File

@ -20,8 +20,8 @@
"package.json"
],
"scripts": {
"build": "vite build",
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest"
},
"dependencies": {

View File

@ -22,8 +22,8 @@
"package.json"
],
"scripts": {
"build": "vite build",
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest"
},
"dependencies": {

View File

@ -15,7 +15,9 @@
"package.json"
],
"scripts": {
"build": "vite build",
"build": "pnpm run \"/^build:.*/\"",
"build:target": "vite build",
"build:dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest",
"test:cov": ""
},

View File

@ -1,29 +0,0 @@
#!/usr/bin/env bash
set -e
lerna run build \
--scope @alilc/lowcode-types \
--scope @alilc/lowcode-utils \
--scope @alilc/lowcode-shell \
--scope @alilc/lowcode-editor-core \
--scope @alilc/lowcode-editor-skeleton \
--scope @alilc/lowcode-designer \
--scope @alilc/lowcode-plugin-designer \
--scope @alilc/lowcode-plugin-command \
--scope @alilc/lowcode-plugin-outline-pane \
--scope @alilc/lowcode-react-renderer \
--scope @alilc/lowcode-react-simulator-renderer \
--scope @alilc/lowcode-renderer-core \
--scope @alilc/lowcode-workspace \
--scope @alilc/lowcode-engine \
--stream
lerna run build:umd \
--scope @alilc/lowcode-engine \
--scope @alilc/lowcode-react-simulator-renderer \
--scope @alilc/lowcode-react-renderer \
--stream
cp ./packages/react-simulator-renderer/dist/js/* ./packages/engine/dist/js/
cp ./packages/react-simulator-renderer/dist/css/* ./packages/engine/dist/css/

0
scripts/dev.mjs Normal file
View File