Skip to content

Commit

Permalink
chore: fix hooks, styles, directives deps
Browse files Browse the repository at this point in the history
  • Loading branch information
kirklin committed Jul 3, 2024
1 parent fa41b70 commit a651c64
Show file tree
Hide file tree
Showing 31 changed files with 171 additions and 48 deletions.
2 changes: 1 addition & 1 deletion apps/admin/src/store/modules/design/themeUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ButtonColorScene, ColorAction, ColorType, ColorTypeCase, ThemeColor, ThemeConfig } from "@celeris/types";
import { deepMerge, generateColorPalettes } from "@celeris/utils";
import { type GlobalThemeOverrides, commonDark, commonLight } from "naive-ui";
import type { ButtonColorScene, ColorAction, ColorType, ColorTypeCase, ThemeColor, ThemeConfig } from "./types";

/**
* 将字符串的第一个字符大写
Expand Down
File renamed without changes.
21 changes: 17 additions & 4 deletions packages/web/CAComponents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,26 @@
"author": "Kirk Lin (https://github.com/kirklin)",
"license": "MIT",
"homepage": "https://github.com/kirklin/celeris-web",
"main": "index.ts",
"module": "index.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"main": "./index.ts",
"module": "./index.ts",
"types": "./dist/index.d.ts",
"scripts": {
"clean": "pnpm rimraf node_modules && pnpm rimraf dist"
"build": "tsup",
"dev": "tsup --stub",
"clean": "pnpm rimraf node_modules && pnpm rimraf dist",
"prepublishOnly": "npm run build",
"postinstall": "npm run build"
},
"peerDependencies": {
"vue": "^3.3.4"
"naive-ui": ">=2.38.2",
"vue": ">=3.3.4"
},
"dependencies": {},
"devDependencies": {
Expand Down
23 changes: 23 additions & 0 deletions packages/web/CAComponents/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "@celeris/tsconfig/tsconfig.base.json",
"compilerOptions": {
"target": "esnext",
"lib": [
"esnext",
"dom"
],
"baseUrl": ".",
"module": "esnext",
"moduleResolution": "Node",
"strict": true,
"sourceMap": false,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
},
"include": [
"index.ts"
],
"exclude": [
"node_modules"
]
}
10 changes: 10 additions & 0 deletions packages/web/CAComponents/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "tsup";

export default defineConfig({
entry: ["./index.ts"],
clean: true,
format: ["esm", "cjs"],
external: ["vue"],
dts: true,
minify: true,
});
4 changes: 1 addition & 3 deletions packages/web/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export * from "./Application";
export * from "./Icon";
export * from "./Charts";
export * from "./src";
4 changes: 2 additions & 2 deletions packages/web/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"author": "Kirk Lin (https://github.com/kirklin)",
"license": "MIT",
"homepage": "https://github.com/kirklin/celeris-web",
"main": "index.ts",
"module": "index.ts",
"main": "./index.ts",
"module": "./index.ts",
"scripts": {
"clean": "pnpm rimraf node_modules && pnpm rimraf dist"
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions packages/web/components/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./Application";
export * from "./Icon";
export * from "./Charts";
18 changes: 15 additions & 3 deletions packages/web/constants/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@
"author": "Kirk Lin (https://github.com/kirklin)",
"license": "MIT",
"homepage": "https://github.com/kirklin/celeris-web",
"main": "index.ts",
"module": "index.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"main": "./index.ts",
"module": "./index.ts",
"types": "./dist/index.d.ts",
"scripts": {
"clean": "pnpm rimraf node_modules && pnpm rimraf dist"
"build": "tsup",
"dev": "tsup --stub",
"clean": "pnpm rimraf node_modules && pnpm rimraf dist",
"prepublishOnly": "npm run build",
"postinstall": "npm run build"
},
"dependencies": {
"lodash.pick": "4.4.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/web/constants/src/utils/defineConstants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pick from "lodash/pick";
// eslint-disable-next-line ts/no-require-imports,ts/no-var-requires
const pick = require("lodash/pick.js");

/**
* Utility function to determine the raw type of a value.
Expand Down
22 changes: 22 additions & 0 deletions packages/web/constants/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "@celeris/tsconfig/tsconfig.base.json",
"compilerOptions": {
"target": "esnext",
"lib": [
"esnext",
"dom"
],
"baseUrl": ".",
"module": "esnext",
"strict": true,
"sourceMap": false,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
]
}
9 changes: 9 additions & 0 deletions packages/web/constants/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from "tsup";

export default defineConfig({
entry: ["./index.ts"],
clean: true,
format: ["esm", "cjs"],
dts: true,
minify: true,
});
2 changes: 1 addition & 1 deletion packages/web/directives/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from "tsup";
export default defineConfig({
entry: ["./index.ts"],
clean: true,
format: ["esm", "cjs", "iife"],
format: ["esm", "cjs"],
external: ["vue"],
dts: true,
minify: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/web/hooks/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from "tsup";
export default defineConfig({
entry: ["./index.ts"],
clean: true,
format: ["esm", "cjs", "iife"],
format: ["esm", "cjs"],
external: ["vue"],
dts: true,
minify: true,
Expand Down
15 changes: 13 additions & 2 deletions packages/web/locale/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,26 @@
"author": "Kirk Lin (https://github.com/kirklin)",
"license": "MIT",
"homepage": "https://github.com/kirklin/celeris-web",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"main": "./index.ts",
"module": "./index.ts",
"types": "./dist/index.d.ts",
"scripts": {
"clean": "pnpm rimraf node_modules && pnpm rimraf dist"
"build": "tsup",
"dev": "tsup --stub",
"clean": "pnpm rimraf node_modules && pnpm rimraf dist",
"prepublishOnly": "npm run build",
"postinstall": "npm run build"
},
"dependencies": {
"@celeris/constants": "workspace:*",
"@celeris/hooks": "workspace:*",
"@celeris/types": "workspace:*",
"@celeris/utils": "workspace:*",
"iso-639-1": "^3.1.2",
"vue": "^3.4.30",
Expand Down
23 changes: 23 additions & 0 deletions packages/web/locale/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "@celeris/tsconfig/tsconfig.base.json",
"compilerOptions": {
"target": "esnext",
"lib": [
"esnext",
"dom"
],
"baseUrl": ".",
"module": "esnext",
"moduleResolution": "Node",
"strict": true,
"sourceMap": false,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
]
}
10 changes: 10 additions & 0 deletions packages/web/locale/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "tsup";

export default defineConfig({
entry: ["./index.ts"],
clean: true,
format: ["esm", "cjs"],
external: ["vue"],
dts: true,
minify: true,
});
1 change: 0 additions & 1 deletion packages/web/types/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from "./config";
export * from "./global";
export * from "./menu";
export * from "./theme";
export * from "./user";
42 changes: 17 additions & 25 deletions packages/web/utils/src/cipher.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { decrypt as aesDecrypt, encrypt as aesEncrypt } from "crypto-js/aes";
import UTF8, { parse } from "crypto-js/enc-utf8";
import pkcs7 from "crypto-js/pad-pkcs7";
import CTR from "crypto-js/mode-ctr";
import Base64 from "crypto-js/enc-base64";
import MD5 from "crypto-js/md5";
import SHA256 from "crypto-js/sha256";
import SHA512 from "crypto-js/sha512";
import CryptoJS from "crypto-js";

const { AES, enc, pad, mode, MD5, SHA256, SHA512 } = CryptoJS;

// Define an interface for encryption
// 定义一个加密器的接口
export interface Encryption {
encrypt: (plainText: string) => string;
decrypt: (cipherText: string) => string;
}

// Define an interface for Hashing
// 定义一个哈希算法的接口
export interface Hashing {
Expand All @@ -29,33 +25,32 @@ class AesEncryption implements Encryption {
private readonly iv;

constructor({ key, iv }: EncryptionParams) {
this.key = parse(key);
this.iv = parse(iv);
this.key = enc.Utf8.parse(key);
this.iv = enc.Utf8.parse(iv);
}

get getOptions() {
return {
mode: CTR,
padding: pkcs7,
mode: mode.CTR,
padding: pad.Pkcs7,
iv: this.iv,
};
}

encrypt(plainText: string) {
return aesEncrypt(plainText, this.key, this.getOptions).toString();
return AES.encrypt(plainText, this.key, this.getOptions).toString();
}

decrypt(cipherText: string) {
return aesDecrypt(cipherText, this.key, this.getOptions).toString(UTF8);
return AES.decrypt(cipherText, this.key, this.getOptions).toString(enc.Utf8);
}
}

// Define a singleton class for Base64 encryption
class Base64Encryption implements Encryption {
private static instance: Base64Encryption;

private constructor() {
}
private constructor() {}

// Get the singleton instance
// 获取单例实例
Expand All @@ -67,20 +62,19 @@ class Base64Encryption implements Encryption {
}

encrypt(plainText: string) {
return UTF8.parse(plainText).toString(Base64);
return enc.Utf8.parse(plainText).toString(enc.Base64);
}

decrypt(cipherText: string) {
return Base64.parse(cipherText).toString(UTF8);
return enc.Base64.parse(cipherText).toString(enc.Utf8);
}
}

// Define a singleton class for MD5 Hashing
class MD5Hashing implements Hashing {
private static instance: MD5Hashing;

private constructor() {
}
private constructor() {}

// Get the singleton instance
// 获取单例实例
Expand All @@ -100,8 +94,7 @@ class MD5Hashing implements Hashing {
class SHA256Hashing implements Hashing {
private static instance: SHA256Hashing;

private constructor() {
}
private constructor() {}

// Get the singleton instance
// 获取单例实例
Expand All @@ -121,12 +114,11 @@ class SHA256Hashing implements Hashing {
class SHA512Hashing implements Hashing {
private static instance: SHA512Hashing;

private constructor() {
}
private constructor() {}

// Get the singleton instance
// 获取单例实例
public static getInstance(): SHA256Hashing {
public static getInstance(): SHA512Hashing {
if (!SHA512Hashing.instance) {
SHA512Hashing.instance = new SHA512Hashing();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/utils/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/index.ts"],
clean: true,
format: ["esm", "cjs", "iife"],
format: ["esm", "cjs"],
external: ["vue"],
dts: true,
minify: true,
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a651c64

Please sign in to comment.