Merge branch 'master' of git.woa.com:vft-magic/tmagic-editor

This commit is contained in:
marchyang 2024-01-05 14:39:11 +08:00
commit 511acfdb5b
3 changed files with 10 additions and 5 deletions

View File

@ -18,7 +18,7 @@
},
"license": "Apache-2.0",
"scripts": {
"build": "npm run build:type && vite build",
"build": "rimraf ./dist && npm run build:type && vite build --mode=es && vite build --mode=umd",
"build:type": "npm run clear:type && tsc --declaration --emitDeclarationOnly --project tsconfig.build.json",
"clear:type": "rimraf ./types"
},

View File

@ -300,7 +300,7 @@ export const compiledCond = (op: string, fieldValue: any, value: any, range: num
case '<':
return fieldValue < value;
case '<=':
return fieldValue >= value;
return fieldValue <= value;
case 'between':
return range.length > 1 && fieldValue >= range[0] && fieldValue <= range[1];
case 'not_between':

View File

@ -16,30 +16,35 @@
* limitations under the License.
*/
import { defineConfig } from 'vite';
import { defineConfig, type LibraryFormats } from 'vite';
import pkg from './package.json';
const deps = Object.keys(pkg.dependencies);
export default defineConfig({
export default defineConfig(({ mode }) => ({
build: {
cssCodeSplit: false,
sourcemap: true,
minify: false,
target: 'esnext',
emptyOutDir: false,
lib: {
entry: 'src/index.ts',
name: 'TMagicUtils',
formats: ['es', 'umd', 'cjs'].includes(mode) ? [mode as LibraryFormats] : ['es', 'umd'],
fileName: 'tmagic-utils',
},
rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖
external(id: string) {
if (mode === 'umd' && id === 'lodash-es') {
return false;
}
return deps.some((k) => new RegExp(`^${k}`).test(id));
},
},
},
});
}));