清理代码
This commit is contained in:
17
package.json
17
package.json
@@ -45,18 +45,18 @@
|
|||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"commander": "^14.0.2",
|
"commander": "^14.0.2",
|
||||||
"cookie": "^1.0.2",
|
"cookie": "^1.1.1",
|
||||||
"ioredis": "^5.8.2",
|
"ioredis": "^5.8.2",
|
||||||
"minio": "^8.0.6",
|
"minio": "^8.0.6",
|
||||||
"pg": "^8.16.3",
|
"pg": "^8.16.3",
|
||||||
"pm2": "^6.0.13",
|
"pm2": "^6.0.14",
|
||||||
"sequelize": "^6.37.7"
|
"sequelize": "^6.37.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kevisual/code-center-module": "0.0.24",
|
"@kevisual/code-center-module": "0.0.24",
|
||||||
"@kevisual/context": "^0.0.4",
|
"@kevisual/context": "^0.0.4",
|
||||||
"@kevisual/file-listener": "^0.0.2",
|
"@kevisual/file-listener": "^0.0.2",
|
||||||
"@kevisual/local-app-manager": "0.1.26",
|
"@kevisual/local-app-manager": "0.1.27",
|
||||||
"@kevisual/logger": "^0.0.4",
|
"@kevisual/logger": "^0.0.4",
|
||||||
"@kevisual/oss": "0.0.12",
|
"@kevisual/oss": "0.0.12",
|
||||||
"@kevisual/permission": "^0.0.3",
|
"@kevisual/permission": "^0.0.3",
|
||||||
@@ -69,11 +69,8 @@
|
|||||||
"@types/jsonwebtoken": "^9.0.10",
|
"@types/jsonwebtoken": "^9.0.10",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/node": "^24.10.1",
|
"@types/node": "^24.10.1",
|
||||||
"@types/react": "^19.2.6",
|
|
||||||
"@types/semver": "^7.7.1",
|
"@types/semver": "^7.7.1",
|
||||||
"@types/uuid": "^11.0.0",
|
|
||||||
"archiver": "^7.0.1",
|
"archiver": "^7.0.1",
|
||||||
"cross-env": "^10.1.0",
|
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"dayjs": "^1.11.19",
|
"dayjs": "^1.11.19",
|
||||||
"dotenv": "^17.2.3",
|
"dotenv": "^17.2.3",
|
||||||
@@ -83,22 +80,16 @@
|
|||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"minio": "^8.0.6",
|
"minio": "^8.0.6",
|
||||||
"nanoid": "^5.1.6",
|
"nanoid": "^5.1.6",
|
||||||
"node-fetch": "^3.3.2",
|
|
||||||
"nodemon": "^3.1.11",
|
"nodemon": "^3.1.11",
|
||||||
"p-queue": "^9.0.1",
|
"p-queue": "^9.0.1",
|
||||||
"pg": "^8.16.3",
|
"pg": "^8.16.3",
|
||||||
"pm2": "^6.0.13",
|
"pm2": "^6.0.14",
|
||||||
"rimraf": "^6.1.2",
|
|
||||||
"semver": "^7.7.3",
|
"semver": "^7.7.3",
|
||||||
"sequelize": "^6.37.7",
|
"sequelize": "^6.37.7",
|
||||||
"socket.io": "^4.8.1",
|
"socket.io": "^4.8.1",
|
||||||
"strip-ansi": "^7.1.2",
|
"strip-ansi": "^7.1.2",
|
||||||
"tape": "^5.9.0",
|
|
||||||
"tar": "^7.5.2",
|
"tar": "^7.5.2",
|
||||||
"tsx": "^4.20.6",
|
|
||||||
"turbo": "^2.6.1",
|
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"uuid": "^13.0.0",
|
|
||||||
"zod": "^4.1.13"
|
"zod": "^4.1.13"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
|||||||
1284
pnpm-lock.yaml
generated
1284
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,35 +0,0 @@
|
|||||||
import path, { dirname } from 'path';
|
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
|
||||||
const __dirname = dirname(__filename);
|
|
||||||
export const directoryPath = path.resolve(__dirname);
|
|
||||||
|
|
||||||
export const defaultImportModules = [
|
|
||||||
{
|
|
||||||
name: 'sequelize',
|
|
||||||
version: '^6.6.5',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'pg',
|
|
||||||
version: '^8.12.1',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
export const dynamicImport = async (name: string) => {
|
|
||||||
// const nodeModules = path.resolve(directoryPath, 'node_modules');
|
|
||||||
// const nodeName = path.resolve(nodeModules, name);
|
|
||||||
console.log(`Dynamic import module ${name}`);
|
|
||||||
try {
|
|
||||||
return await import(name);
|
|
||||||
// const require = getRequire();
|
|
||||||
// const nodeCache = require.cache[require.resolve(name)];
|
|
||||||
// if (nodeCache) {
|
|
||||||
// console.log(`${name} is cached`);
|
|
||||||
// }
|
|
||||||
// return require(name);
|
|
||||||
} catch (e) {
|
|
||||||
console.error(`Failed to import module ${name}: ${e.message}`);
|
|
||||||
throw `Failed to import module ${name}: ${e.message}`;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
import { exec } from 'child_process';
|
|
||||||
import path from 'path';
|
|
||||||
import fs from 'fs';
|
|
||||||
|
|
||||||
import { fileURLToPath } from 'url'
|
|
||||||
import { dirname } from 'path'
|
|
||||||
const __filename = fileURLToPath(import.meta.url)
|
|
||||||
const __dirname = dirname(__filename)
|
|
||||||
|
|
||||||
export const directoryPath = path.resolve(__dirname);
|
|
||||||
const packagePath = path.resolve(directoryPath, 'package.json');
|
|
||||||
const exists = (filePath: string) => {
|
|
||||||
try {
|
|
||||||
fs.accessSync(filePath);
|
|
||||||
return true;
|
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const installPackage = async (packageName: string) => {
|
|
||||||
if (!exists(packagePath)) {
|
|
||||||
fs.writeFileSync(packagePath, JSON.stringify({ name: 'npm-install', version: '1.0.0' }), 'utf-8');
|
|
||||||
}
|
|
||||||
return await new Promise((resolve, reject) => {
|
|
||||||
console.log(`Starting installation of ${packageName}...`);
|
|
||||||
// 在程序运行路径下执行 npm install 命令
|
|
||||||
console.log(`npm install ${packageName}`);
|
|
||||||
|
|
||||||
exec(`npm install ${packageName}`, { cwd: directoryPath }, (error, stdout, stderr) => {
|
|
||||||
if (error) {
|
|
||||||
console.error(`Error installing package: ${stderr}`);
|
|
||||||
reject(new Error(`Failed to install package ${packageName}`));
|
|
||||||
} else {
|
|
||||||
console.log(`Package ${packageName} installed successfully: ${stdout}`);
|
|
||||||
resolve(stdout);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
export const getPackage = async () => {
|
|
||||||
if (!exists(packagePath)) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Failed to read package.json');
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import fetch from 'node-fetch';
|
import { useConfig } from '@kevisual/use-config';
|
||||||
import { useConfig } from '@kevisual/use-config/env';
|
|
||||||
|
|
||||||
type GithubConfig = {
|
type GithubConfig = {
|
||||||
clientId: string;
|
clientId: string;
|
||||||
|
|||||||
@@ -9,11 +9,7 @@ export const existDenpend = [
|
|||||||
'pg', // commonjs
|
'pg', // commonjs
|
||||||
'@kevisual/router', // 共享模块
|
'@kevisual/router', // 共享模块
|
||||||
'ioredis', // commonjs
|
'ioredis', // commonjs
|
||||||
'socket.io', // commonjs
|
|
||||||
'minio', // commonjs
|
'minio', // commonjs
|
||||||
'pino', // commonjs
|
|
||||||
'pino-pretty', // commonjs
|
|
||||||
'@msgpack/msgpack', // commonjs
|
|
||||||
];
|
];
|
||||||
// export const manager = new Manager({ mainApp: app });
|
// export const manager = new Manager({ mainApp: app });
|
||||||
export { manager };
|
export { manager };
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { CustomError } from '@kevisual/router';
|
import { CustomError } from '@kevisual/router';
|
||||||
import { app } from '../../app.ts';
|
import { app } from '../../app.ts';
|
||||||
import { PageModel } from './models/index.ts';
|
import { PageModel } from './models/index.ts';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { nanoid, customAlphabet } from 'nanoid'
|
||||||
import { ContainerModel } from '../container/models/index.ts';
|
import { ContainerModel } from '../container/models/index.ts';
|
||||||
import { Op } from 'sequelize';
|
import { Op } from 'sequelize';
|
||||||
import { getDeck } from './module/cache-file.ts';
|
import { getDeck } from './module/cache-file.ts';
|
||||||
@@ -12,6 +12,11 @@ export const clearBlank = (newStyle: any) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const uuidv4 = () => {
|
||||||
|
const alphabet = '0123456789abcdef';
|
||||||
|
const nanoidCustom = customAlphabet(alphabet, 36);
|
||||||
|
return nanoidCustom();
|
||||||
|
}
|
||||||
app
|
app
|
||||||
.route({
|
.route({
|
||||||
path: 'page',
|
path: 'page',
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import { CustomError } from '@kevisual/router';
|
import { CustomError } from '@kevisual/router';
|
||||||
import { app } from '../../app.ts';
|
import { app } from '../../app.ts';
|
||||||
import { PageModel } from './models/index.ts';
|
import { PageModel } from './models/index.ts';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
|
||||||
import { ContainerModel } from '../container/models/index.ts';
|
|
||||||
import { Op } from 'sequelize';
|
|
||||||
import { AppListModel, AppModel } from '../app-manager/index.ts';
|
import { AppListModel, AppModel } from '../app-manager/index.ts';
|
||||||
import { cachePage, getZip } from './module/cache-file.ts';
|
import { cachePage, getZip } from './module/cache-file.ts';
|
||||||
import { uniqBy } from 'lodash-es';
|
import { uniqBy } from 'lodash-es';
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "@kevisual/types/json/backend.json",
|
"extends": "@kevisual/types/json/backend.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"module": "NodeNext",
|
||||||
|
"target": "esnext",
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"./node_modules/@types"
|
"./node_modules/@types"
|
||||||
|
|||||||
Reference in New Issue
Block a user