Skip to content

Commit

Permalink
fix(cli): getting platform value
Browse files Browse the repository at this point in the history
  • Loading branch information
mildronize committed May 6, 2024
1 parent b526a5c commit d876e3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions examples/with-node/nammatham.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
/** @type {import('nammatham').NammathamConfigs} */
const nammathamConfig = {
runtime: 'node',
buildOption: {
target: {
arch: 'x64',
platform: 'linux',
runtime: 'node18',
},
},
// buildOption: {
// target: {
// arch: 'x64',
// platform: 'linux',
// runtime: 'node18',
// },
// },
hostConfig: {
version: '2.0',
extensionBundle: {
Expand Down
3 changes: 2 additions & 1 deletion packages/main/src/command/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export function getHostTarget(): TargetOptions {
debug?.(`Host Node.js Version: ${nodeVersion}`);

return {
platform: system.hostPlatform as TargetOptions['platform'],
platform: process.platform === 'win32' ? 'win' : process.platform === 'darwin' ? 'macos' : 'linux',
arch: system.hostArch as TargetOptions['arch'],
/**
* The pkg version 5.8.1 only support node.js version 18.x and below.
Expand Down Expand Up @@ -207,6 +207,7 @@ export async function buildExecutable(options: NammathamConfigs, result: BuildNo
} else {
targetOptions = target;
}
debug?.(`Building executable for target: ${targetOptions.runtime}-${targetOptions.platform}-${targetOptions.arch}`);
if (targetOptions.runtime === 'bun') {
throw new Error(`Conflict target build runtime: ${targetOptions.runtime} with ${options.runtime}`);
}
Expand Down

0 comments on commit d876e3c

Please sign in to comment.