Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update module index to comply with commonjs requirements #478

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions npm_publish/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const ARCH_MAPPING = {
arm64: 'arm64',
};
const PLATFORM_MACOS = 'darwin';
// The "fat" macOS binary includes code for both x64 and arm64 architectures
const GO_ARCH_FAT = 'fat';
// Mapping between Node's `process.platform` to Golang's
const PLATFORM_MAPPING = {
[PLATFORM_MACOS]: PLATFORM_MACOS,
Expand All @@ -24,7 +22,7 @@ let fullPath = null;
/**
* @return {Promise<string>}
*/
export async function findGoIosBinary() {
async function findGoIosBinary() {
if (fullPath) {
// return the previously cached value
return fullPath;
Expand All @@ -33,7 +31,7 @@ export async function findGoIosBinary() {
const binaryName = `ios${process.platform === 'win32' ? '.exe' : ''}`;
const binaryRoot = path.join(__dirname, 'dist');
const goPlatform = PLATFORM_MAPPING[process.platform];
const goArch = goPlatform === PLATFORM_MACOS ? GO_ARCH_FAT : ARCH_MAPPING[process.arch];
const goArch = ARCH_MAPPING[process.arch];
if (goPlatform && goArch) {
const sysFolderName = `go-ios-${goPlatform}-${goArch}_${goPlatform}_${goArch}`;
fullPath = path.join(binaryRoot, sysFolderName, binaryName);
Expand All @@ -51,6 +49,8 @@ export async function findGoIosBinary() {
return fullPath;
}

exports.findGoIosBinary = findGoIosBinary;

/**
* @returns {Promise<void>}
*/
Expand Down
1 change: 1 addition & 0 deletions npm_publish/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "go-ios",
"version": "local-build",
"type":"commonjs",
"description": "Provide a stable and production ready opensource solution to automate iOS device on Linux, Windows and Mac OS X.",
"main": "index.js",
"scripts": {
Expand Down
Loading