mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 11:20:11 +00:00
build: change build type by api-extractor
This commit is contained in:
parent
ea96be3356
commit
c7a483f0fa
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,6 +5,7 @@ packages/*/lib/
|
|||||||
packages/*/es/
|
packages/*/es/
|
||||||
packages/*/dist/
|
packages/*/dist/
|
||||||
packages/*/output/
|
packages/*/output/
|
||||||
|
packages/*/temp/
|
||||||
packages/demo/
|
packages/demo/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
yarn.lock
|
yarn.lock
|
||||||
|
|||||||
54
api-extractor.json
Normal file
54
api-extractor.json
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
|
|
||||||
|
"mainEntryPointFilePath": "<projectFolder>/temp/index.d.ts",
|
||||||
|
|
||||||
|
"compiler": {
|
||||||
|
"tsconfigFilePath": "<projectFolder>/tsconfig.declaration.json"
|
||||||
|
},
|
||||||
|
|
||||||
|
"dtsRollup": {
|
||||||
|
"enabled": true,
|
||||||
|
"untrimmedFilePath": "",
|
||||||
|
"publicTrimmedFilePath": "<projectFolder>/dist/index.d.ts"
|
||||||
|
},
|
||||||
|
|
||||||
|
"apiReport": {
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
|
||||||
|
"docModel": {
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
"tsdocMetadata": {
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
|
||||||
|
"messages": {
|
||||||
|
"compilerMessageReporting": {
|
||||||
|
"default": {
|
||||||
|
"logLevel": "warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"tsdocMessageReporting": {
|
||||||
|
"default": {
|
||||||
|
"logLevel": "none"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"extractorMessageReporting": {
|
||||||
|
"default": {
|
||||||
|
"logLevel": "warning"
|
||||||
|
},
|
||||||
|
|
||||||
|
"ae-missing-release-tag": {
|
||||||
|
"logLevel": "none"
|
||||||
|
},
|
||||||
|
|
||||||
|
"ae-extra-release-tag": {
|
||||||
|
"logLevel": "none"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -34,6 +34,7 @@
|
|||||||
"@alilc/build-plugin-lce": "^0.0.5",
|
"@alilc/build-plugin-lce": "^0.0.5",
|
||||||
"@alilc/lowcode-test-mate": "^1.0.1",
|
"@alilc/lowcode-test-mate": "^1.0.1",
|
||||||
"@changesets/cli": "^2.27.1",
|
"@changesets/cli": "^2.27.1",
|
||||||
|
"@microsoft/api-extractor": "^7.43.0",
|
||||||
"@types/node": "^20.11.30",
|
"@types/node": "^20.11.30",
|
||||||
"@types/react-router": "5.1.18",
|
"@types/react-router": "5.1.18",
|
||||||
"@vitejs/plugin-react": "^4.2.1",
|
"@vitejs/plugin-react": "^4.2.1",
|
||||||
@ -48,8 +49,7 @@
|
|||||||
"rimraf": "^5.0.2",
|
"rimraf": "^5.0.2",
|
||||||
"rollup": "^4.13.0",
|
"rollup": "^4.13.0",
|
||||||
"vite": "^5.1.6",
|
"vite": "^5.1.6",
|
||||||
"vitest": "^1.3.1",
|
"vitest": "^1.3.1"
|
||||||
"vite-plugin-dts": "^3.7.3"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
|
|||||||
@ -7,7 +7,12 @@
|
|||||||
"module": "dist/lowcodeTypes.js",
|
"module": "dist/lowcodeTypes.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./dist/lowcodeTypes.js"
|
".": {
|
||||||
|
"import": "./dist/lowcodeTypes.js",
|
||||||
|
"module": "./dist/lowcodeTypes.js",
|
||||||
|
"types": "./dist/index.d.ts"
|
||||||
|
},
|
||||||
|
"./package.json": "./package.json"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
@ -16,6 +21,7 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
|
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
|
||||||
"test": "vitest"
|
"test": "vitest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -6,4 +6,4 @@ export interface EventConfig {
|
|||||||
[eventName: string]: any;
|
[eventName: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { Node };
|
export { Node };
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import * as Prop from './prop';
|
import * as Prop from './prop';
|
||||||
|
|
||||||
export type { Prop };
|
export { Prop };
|
||||||
|
|
||||||
export interface RerenderOptions {
|
export interface RerenderOptions {
|
||||||
time: number;
|
time: number;
|
||||||
|
|||||||
9
packages/types/tsconfig.declaration.json
Normal file
9
packages/types/tsconfig.declaration.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "temp",
|
||||||
|
"stripInternal": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "dist"
|
||||||
|
},
|
||||||
"include": ["src"]
|
"include": ["src"]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
import dts from 'vite-plugin-dts';
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
@ -13,12 +12,4 @@ export default defineConfig({
|
|||||||
fileName: 'lowcodeTypes',
|
fileName: 'lowcodeTypes',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
|
||||||
dts({
|
|
||||||
rollupTypes: true,
|
|
||||||
compilerOptions: {
|
|
||||||
stripInternal: true,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -7,7 +7,11 @@
|
|||||||
"module": "dist/index.js",
|
"module": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./dist/lowCodeUtils.js"
|
".": {
|
||||||
|
"import": "./dist/lowCodeUtils.js",
|
||||||
|
"types": "./dist/index.d.ts"
|
||||||
|
},
|
||||||
|
"./package.json": "./package.json"
|
||||||
},
|
},
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"*.css"
|
"*.css"
|
||||||
@ -19,6 +23,7 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
|
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
|
||||||
"test": "vitest"
|
"test": "vitest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
10
packages/utils/tsconfig.declaration.json
Normal file
10
packages/utils/tsconfig.declaration.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "temp",
|
||||||
|
"stripInternal": true,
|
||||||
|
"paths": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"outDir": "dist",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@alilc/lowcode-*": ["packages/*"]
|
"@alilc/lowcode-*": ["packages/*"]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ export default defineConfig({
|
|||||||
react(),
|
react(),
|
||||||
dts({
|
dts({
|
||||||
rollupTypes: true,
|
rollupTypes: true,
|
||||||
|
tsconfigPath: resolve(import.meta.dirname, 'tsconfig.declaration.json'),
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
stripInternal: true,
|
stripInternal: true,
|
||||||
paths: {},
|
paths: {},
|
||||||
|
|||||||
@ -10,7 +10,10 @@
|
|||||||
"module": "dist/rendererCore.js",
|
"module": "dist/rendererCore.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./dist/rendererCore.js"
|
".": {
|
||||||
|
"import": "./dist/rendererCore.js",
|
||||||
|
"types": "./dist/index.d.ts"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
@ -19,6 +22,7 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
|
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
|
||||||
"test": "vitest --run",
|
"test": "vitest --run",
|
||||||
"test:watch": "vitest"
|
"test:watch": "vitest"
|
||||||
},
|
},
|
||||||
|
|||||||
9
runtime/renderer-core/tsconfig.declaration.json
Normal file
9
runtime/renderer-core/tsconfig.declaration.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "temp",
|
||||||
|
"stripInternal": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -12,11 +12,13 @@
|
|||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/rendererReact.js",
|
"import": "./dist/rendererReact.js",
|
||||||
"require": "./dist/rendererReact.cjs"
|
"require": "./dist/rendererReact.cjs",
|
||||||
|
"types": "./dist/index.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
|
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
|
||||||
"test": "vitest"
|
"test": "vitest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
9
runtime/renderer-react/tsconfig.declaration.json
Normal file
9
runtime/renderer-react/tsconfig.declaration.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "temp",
|
||||||
|
"stripInternal": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,10 +9,14 @@
|
|||||||
"module": "dist/runtimeRouter.js",
|
"module": "dist/runtimeRouter.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./dist/runtimeRouter.js"
|
".": {
|
||||||
|
"import": "./dist/runtimeRouter.js",
|
||||||
|
"types": "./dist/index.d.ts"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
|
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
|
||||||
"test": "vitest"
|
"test": "vitest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
9
runtime/router/tsconfig.declaration.json
Normal file
9
runtime/router/tsconfig.declaration.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "temp",
|
||||||
|
"stripInternal": true
|
||||||
|
}
|
||||||
|
}
|
||||||
43
scripts/rollup-dts.mjs
Normal file
43
scripts/rollup-dts.mjs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import { join } from 'node:path';
|
||||||
|
import { existsSync, readdirSync } from 'node:fs';
|
||||||
|
import { Extractor, ExtractorConfig } from '@microsoft/api-extractor';
|
||||||
|
import { rimraf } from 'rimraf';
|
||||||
|
|
||||||
|
const libPath = process.env.PWD;
|
||||||
|
const packages = readdirSync(join(libPath, 'temp/packages'));
|
||||||
|
const typeTempIndexPath = join(libPath, 'temp/packages', packages[0], 'src/index.d.ts');
|
||||||
|
|
||||||
|
if (!existsSync(typeTempIndexPath)) {
|
||||||
|
console.error('🚨类型入口路径错误');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
const configObject = ExtractorConfig.loadFile('../../api-extractor.json');
|
||||||
|
configObject.mainEntryPointFilePath = typeTempIndexPath;
|
||||||
|
|
||||||
|
const extractorConfig = ExtractorConfig.prepare({
|
||||||
|
configObject,
|
||||||
|
projectFolderLookupToken: libPath,
|
||||||
|
packageJsonFullPath: join(libPath, 'package.json'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const extractorResult = Extractor.invoke(extractorConfig, {
|
||||||
|
localBuild: true,
|
||||||
|
showVerboseMessages: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (extractorResult.succeeded) {
|
||||||
|
console.log(`🚀类型声明文件生成成功!!!`);
|
||||||
|
|
||||||
|
await rimraf(join(libPath, 'temp'));
|
||||||
|
} else {
|
||||||
|
console.error(
|
||||||
|
'🚨类型声明文件生成失败:' +
|
||||||
|
+`\n\t${extractorResult.errorCount} errors``\n\tand ${extractorResult.warningCount} warnings`,
|
||||||
|
);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run();
|
||||||
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
|
||||||
"lib": ["DOM", "ESNext", "DOM.Iterable"],
|
"lib": ["DOM", "ESNext", "DOM.Iterable"],
|
||||||
// Target latest version of ECMAScript.
|
// Target latest version of ECMAScript.
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user