Skip to content

Commit

Permalink
chore:修改构建代码
Browse files Browse the repository at this point in the history
  • Loading branch information
linzb93 committed May 23, 2024
1 parent 3737ef7 commit 543e984
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"test": "vitest",
"build": "lerna run build"
},
"type": "module",
"devDependencies": {
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.12.12",
Expand Down
1 change: 1 addition & 0 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.14",
"description": "我的工具库-Web端",
"author": "linzb93",
"private":true,
"homepage": "https://github.com/linzb93/utils#readme",
"license": "ISC",
"main": "dist/index.js",
Expand Down
10 changes: 8 additions & 2 deletions packages/core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ export declare const isEmptyObject: (obj: any) => boolean;
*/
export declare const isNumberHasMoreThan2Decimal: (value: number) => boolean;

/**
* 判断两个时间段是否重叠,如有重叠,返回true。
* @param timeList: [{startTime, endTime}],
* @param time: 形如'22:00'的
* @return {boolean} 是否存在重叠
*/
export declare function isTimeOverlay(timeList: TimeRange[]): boolean;

declare interface IValidate {
[key: string]: (str: string) => boolean;
}
Expand Down Expand Up @@ -169,8 +177,6 @@ declare class TimeCtor {
isInRange(startTime: string, endTime: string): boolean;
}

export declare function timeIsSmaller(time0: string, time1: string): boolean;

export declare function timejs(time: string): TimeCtor;

declare interface TimeRange {
Expand Down
1 change: 1 addition & 0 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.14",
"description": "我的工具库-Node端",
"author": "linzb93",
"private":true,
"homepage": "https://github.com/linzb93/utils#readme",
"license": "ISC",
"main": "dist/index.js",
Expand Down
27 changes: 26 additions & 1 deletion packages/node/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
import { defineConfig } from "vitest/config";
import dts from 'vite-plugin-dts';
import pkg from './package.json';
import monoPkg from '../../package.json';

const externalPkgs = (() => {
const output:string[] = [];
if ('dependencies' in pkg) {
output.push(...Object.keys(pkg.dependencies as object));
}
if ('dependencies' in monoPkg) {
output.push(...Object.keys(monoPkg.dependencies as object));
}
return output;
})()

export default defineConfig({
build: {
target: "modules",
target: 'node18',
minify: false,
rollupOptions: {
input: 'lib/index.ts',
output: {
dir: 'dist',
entryFileNames: 'index.js'
},
external: [
...externalPkgs,
/^node:.*/
]
},
lib: {
entry: "lib/index.ts",
fileName: "index",
Expand Down
5 changes: 3 additions & 2 deletions scripts/checkNodeVersion.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const semver = require("semver");
const chalk = require("chalk");
import semver from 'semver';
import chalk from 'chalk';

if (semver.lt(process.version, "18.0.0")) {
console.log(chalk.red("NodeJS版本太低,请切换至v18+"));
process.exit(1);
Expand Down
4 changes: 2 additions & 2 deletions scripts/gitCommitFormat.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const fs = require("fs");
const chalk = require("chalk");
import chalk from 'chalk';
import fs from 'node:fs';

const commitMap = [
{
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"declarationDir": "./types",
"experimentalDecorators": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "Bundler",
"isolatedModules": true,
"lib": ["ESNext", "dom"],
Expand Down

0 comments on commit 543e984

Please sign in to comment.