feat: Development server for core + plugins (#2448)
This commit is contained in:
1 parent
4de4f20b46
commit
b88cef2b1f
23 files changed
+762
-14
No files matched your search
@@ -1,4 +1,9 @@
|
||||
import { Connection, createConnection, LoggerOptions } from "typeorm"
|
||||
import {
|
||||
Connection,
|
||||
createConnection,
|
||||
getConnectionManager,
|
||||
getConnection,
|
||||
} from "typeorm"
|
||||
import { ShortenedNamingStrategy } from "../utils/naming-strategy"
|
||||
import { AwilixContainer } from "awilix"
|
||||
import { ConnectionOptions } from "typeorm/connection/ConnectionOptions"
|
||||
@@ -17,6 +22,11 @@ export default async ({
|
||||
|
||||
const isSqlite = configModule.projectConfig.database_type === "sqlite"
|
||||
|
||||
const cnnManager = getConnectionManager()
|
||||
if (cnnManager.has("default") && getConnection().isConnected) {
|
||||
await getConnection().close()
|
||||
}
|
||||
|
||||
const connection = await createConnection({
|
||||
type: configModule.projectConfig.database_type,
|
||||
url: configModule.projectConfig.database_url,
|
||||
|
||||
@@ -628,7 +628,7 @@ function resolvePlugin(pluginName: string): {
|
||||
// warnOnIncompatiblePeerDependency(packageJSON.name, packageJSON)
|
||||
|
||||
return {
|
||||
resolve: resolvedPath,
|
||||
resolve: resolvedPath + (process.env.DEV_MODE ? "/src" : ""),
|
||||
id: createPluginId(packageJSON.name),
|
||||
name: packageJSON.name,
|
||||
options: {},
|
||||
|
||||
@@ -26,18 +26,23 @@ export default ({ container, configModule, isTest }: LoaderOptions): void => {
|
||||
|
||||
const coreFull = path.join(__dirname, corePath)
|
||||
|
||||
const ignore = [
|
||||
"**/__fixtures__/**",
|
||||
"**/index.js",
|
||||
"**/index.ts",
|
||||
"**/utils.js",
|
||||
"**/utils.ts",
|
||||
"**/types.js",
|
||||
"**/types.ts",
|
||||
"**/types/**",
|
||||
]
|
||||
if (!useMock) {
|
||||
ignore.push("**/__tests__/**", "**/__mocks__/**")
|
||||
}
|
||||
|
||||
const core = glob.sync(coreFull, {
|
||||
cwd: __dirname,
|
||||
ignore: [
|
||||
"**/__fixtures__/**",
|
||||
"**/index.js",
|
||||
"**/index.ts",
|
||||
"**/utils.js",
|
||||
"**/utils.ts",
|
||||
"**/types.js",
|
||||
"**/types.ts",
|
||||
"**/types/**",
|
||||
],
|
||||
ignore,
|
||||
})
|
||||
|
||||
core.forEach((fn) => {
|
||||
|
||||
Reference in new issue
Block a user