Skip to content

Commit

Permalink
fix: distDirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
caohuilin committed Dec 4, 2024
1 parent ca48d38 commit 4878404
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
6 changes: 3 additions & 3 deletions packages/solutions/app-tools/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const build = async (

await registerCompiler(
appContext.appDirectory,
appContext.distDirectory!,
appContext.distDirectory,
resolvedConfig?.source?.alias,
);

Expand All @@ -52,7 +52,7 @@ export const build = async (

await buildServerConfig({
appDirectory,
distDirectory: distDirectory!,
distDirectory,
configFile: serverConfigFile,
});

Expand All @@ -77,7 +77,7 @@ export const build = async (

await buildServerConfig({
appDirectory,
distDirectory: distDirectory!,
distDirectory,
configFile: serverConfigFile,
});

Expand Down
4 changes: 2 additions & 2 deletions packages/solutions/app-tools/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const dev = async (

await registerCompiler(
appContext.appDirectory,
appContext.distDirectory!,
appContext.distDirectory,
normalizedConfig?.source?.alias,
);

Expand All @@ -65,7 +65,7 @@ export const dev = async (

await buildServerConfig({
appDirectory,
distDirectory: distDirectory!,
distDirectory,
configFile: serverConfigFile,
watch: true,
});
Expand Down
10 changes: 5 additions & 5 deletions packages/solutions/app-tools/src/commands/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const start = async (api: CLIPluginAPI<AppTools<'shared'>>) => {

const meta = getMeta(metaName);
const serverConfigPath = path.resolve(
distDirectory!,
distDirectory,
SERVER_DIR,
`${meta}.server`,
);
Expand All @@ -50,7 +50,7 @@ export const start = async (api: CLIPluginAPI<AppTools<'shared'>>) => {

const app = await createProdServer({
metaName,
pwd: distDirectory!,
pwd: distDirectory,
config: {
...userConfig,
dev: userConfig.dev as any,
Expand All @@ -70,17 +70,17 @@ export const start = async (api: CLIPluginAPI<AppTools<'shared'>>) => {
sharedDirectory: getTargetDir(
appContext.sharedDirectory,
appContext.appDirectory,
appContext.distDirectory!,
appContext.distDirectory,
),
apiDirectory: getTargetDir(
appContext.apiDirectory,
appContext.appDirectory,
appContext.distDirectory!,
appContext.distDirectory,
),
lambdaDirectory: getTargetDir(
appContext.lambdaDirectory,
appContext.appDirectory,
appContext.distDirectory!,
appContext.distDirectory,
),
},
runMode,
Expand Down
2 changes: 1 addition & 1 deletion packages/solutions/app-tools/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const appTools = (
const resolvedConfig = api.getNormalizedConfig();
if (resolvedConfig.output.cleanDistPath) {
const appContext = api.getAppContext();
await emptyDir(appContext.distDirectory!);
await emptyDir(appContext.distDirectory);
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/solutions/app-tools/src/plugins/serverBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default (): CliPluginFuture<AppTools<'shared'>> => ({
}
const modernConfig = api.getNormalizedConfig();

const distDir = path.resolve(distDirectory!);
const distDir = path.resolve(distDirectory);
const serverDir = path.resolve(appDirectory, SERVER_DIR);
const sharedDir = path.resolve(appDirectory, SHARED_DIR);
const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
Expand Down
21 changes: 10 additions & 11 deletions packages/solutions/app-tools/src/utils/loadPlugins.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import type { CLIPluginAPI } from '@modern-js/plugin-v2';
import type { Plugin } from '@modern-js/plugin-v2';
import { loadServerPlugins as loadServerPluginInstances } from '@modern-js/prod-server';
import type { ServerPlugin as ServerPluginInstance } from '@modern-js/server-core';
import type { ServerPlugin } from '@modern-js/types';
import type { InternalPlugins } from '@modern-js/types';
import {
compatibleRequire,
createDebugger,
dynamicImport,
getInternalPlugins,
tryResolve,
} from '@modern-js/utils';
import type { AppTools } from '../types';
const debug = createDebugger('load-plugins');

export async function getServerPlugins(
api: CLIPluginAPI<AppTools<'shared'>>,
Expand Down Expand Up @@ -35,17 +45,6 @@ export async function loadServerPlugins(
return instances;
}

import type { Plugin } from '@modern-js/plugin-v2';
import type { InternalPlugins } from '@modern-js/types';
import {
compatibleRequire,
createDebugger,
dynamicImport,
getInternalPlugins,
tryResolve,
} from '@modern-js/utils';
const debug = createDebugger('load-plugins');

const resolveCliPlugin = async (
p: string,
appDirectory: string,
Expand Down

0 comments on commit 4878404

Please sign in to comment.