feat: 升级midway,支持esm

This commit is contained in:
xiaojunnuo
2024-07-15 00:30:33 +08:00
parent 970c7fd8a0
commit 485e603b51
246 changed files with 3821 additions and 1532 deletions
@@ -1,15 +1,18 @@
import { join } from 'path';
import { FlywayHistory } from 'midway-flyway-js/dist/entity';
import { MidwayConfig } from '@midwayjs/core';
import { UserEntity } from '../modules/authority/entity/user';
import { PipelineEntity } from '../modules/pipeline/entity/pipeline';
import { join } from 'path';
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
// const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(fileURLToPath(import.meta.url));
import { FlywayHistory } from '@certd/midway-flyway-js';
import { UserEntity } from '../modules/authority/entity/user.js';
import { PipelineEntity } from '../modules/pipeline/entity/pipeline.js';
//import { logger } from '../utils/logger';
// load .env file in process.cwd
import { mergeConfig } from './loader';
import { mergeConfig } from './loader.js';
const development = {
keys: '',
keys: '111',
koa: {
port: 7001,
},
@@ -51,14 +54,7 @@ const development = {
logging: true,
// 配置实体模型 或者 entities: '/entity',
entities: [
'**/modules/*/entity/*.ts',
'**/entity/*.js',
'**/entity/*.d.ts',
PipelineEntity,
FlywayHistory,
UserEntity,
],
entities: ['**/modules/*/entity/*.ts', '**/entity/*.js', '**/entity/*.d.ts', PipelineEntity, FlywayHistory, UserEntity],
},
},
},
@@ -83,4 +79,5 @@ const development = {
},
} as MidwayConfig;
mergeConfig(development, 'development');
export default development;
@@ -1,5 +1,5 @@
import { MidwayConfig } from '@midwayjs/core';
import { mergeConfig } from './loader';
import { mergeConfig } from './loader.js';
const preview = {
/**
@@ -1,5 +1,5 @@
import { MidwayConfig } from '@midwayjs/core';
import { mergeConfig } from './loader';
import { mergeConfig } from './loader.js';
const production = {
/**
@@ -0,0 +1,7 @@
import { MidwayConfig } from '@midwayjs/core';
export default {
koa: {
port: null,
},
} as MidwayConfig;
@@ -1,8 +1,7 @@
import path from 'path';
import _ from 'lodash';
const yaml = require('js-yaml');
const fs = require('fs');
import * as _ from 'lodash-es';
import yaml from 'js-yaml';
import fs from 'fs';
function parseEnv(defaultConfig: any) {
const config = {};