mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-11 18:42:56 +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/*/dist/
|
||||
packages/*/output/
|
||||
packages/*/temp/
|
||||
packages/demo/
|
||||
package-lock.json
|
||||
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/lowcode-test-mate": "^1.0.1",
|
||||
"@changesets/cli": "^2.27.1",
|
||||
"@microsoft/api-extractor": "^7.43.0",
|
||||
"@types/node": "^20.11.30",
|
||||
"@types/react-router": "5.1.18",
|
||||
"@vitejs/plugin-react": "^4.2.1",
|
||||
@ -48,8 +49,7 @@
|
||||
"rimraf": "^5.0.2",
|
||||
"rollup": "^4.13.0",
|
||||
"vite": "^5.1.6",
|
||||
"vitest": "^1.3.1",
|
||||
"vite-plugin-dts": "^3.7.3"
|
||||
"vitest": "^1.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@ -7,7 +7,12 @@
|
||||
"module": "dist/lowcodeTypes.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
".": "./dist/lowcodeTypes.js"
|
||||
".": {
|
||||
"import": "./dist/lowcodeTypes.js",
|
||||
"module": "./dist/lowcodeTypes.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
@ -16,6 +21,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
|
||||
"test": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@ -6,4 +6,4 @@ export interface EventConfig {
|
||||
[eventName: string]: any;
|
||||
}
|
||||
|
||||
export type { Node };
|
||||
export { Node };
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as Prop from './prop';
|
||||
|
||||
export type { Prop };
|
||||
export { Prop };
|
||||
|
||||
export interface RerenderOptions {
|
||||
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",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import { resolve } from 'node:path';
|
||||
import dts from 'vite-plugin-dts';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
@ -13,12 +12,4 @@ export default defineConfig({
|
||||
fileName: 'lowcodeTypes',
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
dts({
|
||||
rollupTypes: true,
|
||||
compilerOptions: {
|
||||
stripInternal: true,
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
@ -7,7 +7,11 @@
|
||||
"module": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
".": "./dist/lowCodeUtils.js"
|
||||
".": {
|
||||
"import": "./dist/lowCodeUtils.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"sideEffects": [
|
||||
"*.css"
|
||||
@ -19,6 +23,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
|
||||
"test": "vitest"
|
||||
},
|
||||
"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",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"paths": {
|
||||
"@alilc/lowcode-*": ["packages/*"]
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ export default defineConfig({
|
||||
react(),
|
||||
dts({
|
||||
rollupTypes: true,
|
||||
tsconfigPath: resolve(import.meta.dirname, 'tsconfig.declaration.json'),
|
||||
compilerOptions: {
|
||||
stripInternal: true,
|
||||
paths: {},
|
||||
|
||||
@ -10,7 +10,10 @@
|
||||
"module": "dist/rendererCore.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
".": "./dist/rendererCore.js"
|
||||
".": {
|
||||
"import": "./dist/rendererCore.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
@ -19,6 +22,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
|
||||
"test": "vitest --run",
|
||||
"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": {
|
||||
".": {
|
||||
"import": "./dist/rendererReact.js",
|
||||
"require": "./dist/rendererReact.cjs"
|
||||
"require": "./dist/rendererReact.cjs",
|
||||
"types": "./dist/index.d.ts"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
|
||||
"test": "vitest"
|
||||
},
|
||||
"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",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
".": "./dist/runtimeRouter.js"
|
||||
".": {
|
||||
"import": "./dist/runtimeRouter.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
|
||||
"test": "vitest"
|
||||
},
|
||||
"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": {
|
||||
"declaration": true,
|
||||
"lib": ["DOM", "ESNext", "DOM.Iterable"],
|
||||
// Target latest version of ECMAScript.
|
||||
"target": "esnext",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user