pull/265/head
xiaojunnuo 2024-12-09 22:40:17 +08:00
parent fef1305e41
commit 15beb79631
8 changed files with 34 additions and 48 deletions

View File

@ -9,6 +9,7 @@ RUN npm install -g pnpm@8.15.7
RUN cp /workspace/certd-client/dist/* /workspace/certd-server/public/ -rf
RUN cd /workspace/certd-server && pnpm install && npm run build-on-docker
FROM node:20-alpine
EXPOSE 7001
EXPOSE 7002

View File

@ -1,12 +0,0 @@
{
"extends": "./node_modules/mwts/",
"ignorePatterns": ["node_modules", "dist", "test", "typings"],
"env": {
"mocha": true
},
"rules": {
"max-len": ["error", 160],
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/ban-ts-comment": "off"
}
}

View File

@ -1,7 +0,0 @@
{
"printWidth": 160,
"bracketSpacing": true,
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "avoid"
}

View File

@ -1,4 +0,0 @@
module.exports = {
...require('mwts/.prettierrc.json'),
"printWidth": 160,
}

View File

@ -1,29 +1,16 @@
# my_midway_project
# certd-server
## QuickStart
## heap分析
<!-- add docs here for user -->
```shell
# node_modules\@midwayjs\bootstrap\dist\bootstrap.js
# 注释 137行
// process.once('SIGINT', this.onSignal.bind(t
see [midway docs][midway] for more detail.
### Development
```bash
$ npm i
$ npm run dev
$ open http://localhost:7001/
```
### Deploy
```shell
npm run heap
```bash
$ npm start
```
### npm scripts
- Use `npm run lint` to check code style.
- Use `npm test` to run unit test.
[midway]: https://midwayjs.org

View File

@ -1,5 +1,24 @@
import fs from 'fs';
//读取 packages/core/pipline/package.json的版本号
//删除references
import { default as packageJson } from './tsconfig.json' assert { type: 'json' };
delete packageJson.references;
fs.writeFileSync('./tsconfig.json', JSON.stringify(packageJson, null, 2));
//瘦身
const filePath = './node_modules/typeorm/platform/PlatformTools.js';
const find = `const cli_highlight_1 = require("cli-highlight");`;
const rep = 'const cli_highlight_1 ={highlight: (str) => { return str }};';
// 在 filePath 找到 find那一行 用 rep 替换
function slimming(filePath, find, rep) {
fs.readFile(filePath, 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
var result = data.replace(find, rep);
fs.writeFile(filePath, result, 'utf8', function (err) {
if (err) return console.log(err);
});
});
}
slimming(filePath, find, rep);

View File

@ -24,9 +24,10 @@
"dev-build": "echo 1",
"build-on-docker": "node ./before-build.js && npm run build",
"up-mw-deps": "npx midway-version -u -w",
"heap": "cross-env NODE_ENV=pgpl clinic heapprofiler -- node ./bootstrap.js",
"heap": "cross-env NODE_ENV=local clinic heapprofiler -- node ./bootstrap.js",
"flame": "clinic flame -- node ./bootstrap.js",
"tsc": "tsc --skipLibCheck"
"tsc": "tsc --skipLibCheck",
"slimming": "node ./slimming.js"
},
"dependencies": {
"@alicloud/pop-core": "^1.7.10",

View File

@ -71,7 +71,8 @@ const development = {
type: 'better-sqlite3',
database: './data/db.sqlite',
synchronize: false, // 如果第一次使用,不存在表,有同步的需求可以写 true
logging: true,
logging: false,
highlightSql: false,
// 配置实体模型 或者 entities: '/entity',
entities: ['**/modules/**/entity/*.js', ...libServerEntities, ...commercialEntities, PipelineEntity, FlywayHistory, UserEntity],