mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-01 19:38:16 +08:00
chore: amis 暴露版本信息供外部读取 (#5656)
* publish beta * chore: amis 暴露版本信息供外部读取 * 解决用例报错
This commit is contained in:
parent
ac9804979c
commit
6d26ee61d1
@ -363,6 +363,12 @@ if (fis.project.currentMedia() === 'publish-sdk') {
|
||||
file.subpath === '/examples/loader.ts'
|
||||
) {
|
||||
file.setContent(file.getContent().replace(/@version/g, package.version));
|
||||
} else if (file.subpath === '/packages/amis-core/src/index.tsx') {
|
||||
file.setContent(
|
||||
file
|
||||
.getContent()
|
||||
.replace(/__buildVersion/g, JSON.stringify(package.version))
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -12,6 +12,8 @@ Object.defineProperty(window, 'DragEvent', {
|
||||
value: class DragEvent {}
|
||||
});
|
||||
|
||||
global.__buildVersion = '';
|
||||
|
||||
global.beforeAll(() => {
|
||||
console.warn = msg => {
|
||||
// warning 先关了,实在太吵。
|
||||
|
@ -11,6 +11,7 @@
|
||||
"@rollup/plugin-commonjs": "^22.0.2",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^14.1.0",
|
||||
"@rollup/plugin-replace": "^5.0.1",
|
||||
"@rollup/plugin-typescript": "^8.3.4",
|
||||
"@testing-library/jest-dom": "^5.16.4",
|
||||
"@types/file-saver": "^2.0.1",
|
||||
@ -43,7 +44,7 @@
|
||||
"esm"
|
||||
],
|
||||
"dependencies": {
|
||||
"amis-formula": "^2.3.2-beta.1",
|
||||
"amis-formula": "*",
|
||||
"classnames": "2.3.1",
|
||||
"file-saver": "^2.0.2",
|
||||
"hoist-non-react-statics": "^3.3.2",
|
||||
|
@ -5,6 +5,7 @@ import resolve from '@rollup/plugin-node-resolve';
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
import license from 'rollup-plugin-license';
|
||||
import autoExternal from 'rollup-plugin-auto-external';
|
||||
import replace from '@rollup/plugin-replace';
|
||||
import {
|
||||
name,
|
||||
version,
|
||||
@ -87,8 +88,7 @@ function transpileDynamicImportForCJS(options) {
|
||||
|
||||
return {
|
||||
left: 'Promise.resolve().then(function() {return new Promise(function(fullfill) {require([',
|
||||
right:
|
||||
'], function(mod) {fullfill(tslib.__importStar(mod))})})})'
|
||||
right: '], function(mod) {fullfill(tslib.__importStar(mod))})})})'
|
||||
};
|
||||
|
||||
// return {
|
||||
@ -131,6 +131,12 @@ function getPlugins(format = 'esm') {
|
||||
jsnext: true,
|
||||
main: true
|
||||
}),
|
||||
replace({
|
||||
'preventAssignment': true,
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
'__buildDate__': () => JSON.stringify(new Date()),
|
||||
'__buildVersion': JSON.stringify(version)
|
||||
}),
|
||||
typescript(typeScriptOptions),
|
||||
commonjs({
|
||||
sourceMap: false
|
||||
|
@ -92,6 +92,9 @@ import {FormRenderer} from './renderers/Form';
|
||||
import type {FormHorizontal} from './renderers/Form';
|
||||
import {enableDebug, promisify, replaceText, wrapFetcher} from './utils/index';
|
||||
|
||||
// @ts-ignore
|
||||
export const version = __buildVersion;
|
||||
|
||||
export {
|
||||
clearStoresCache,
|
||||
updateEnv,
|
||||
|
Loading…
Reference in New Issue
Block a user