Skip to content

Fixed incorrect build:browser script#56

Merged
springmeyer merged 1 commit intospringmeyer:mainfrom
thomas-hervey:fix/browser-build
Sep 23, 2025
Merged

Fixed incorrect build:browser script#56
springmeyer merged 1 commit intospringmeyer:mainfrom
thomas-hervey:fix/browser-build

Conversation

@thomas-hervey
Copy link
Copy Markdown
Collaborator

@thomas-hervey thomas-hervey commented Sep 22, 2025

This PR primarily fixes the incorrect platform target for the build:browser script as discussed in this comment.

This PR bring in the following changes:

  • Updated to build:browser to build ./arc.js for browser use, not node.js,
  • Re-builds ./build folder and re-ran all tests,
  • Simplified imports,
  • Updated ./test/build-output.test.js with direct checks in the built files, and
  • Removed redundant Jest config

- Updated to build for browser, not node

- Simplified imports

- Updated and build-output.test.js

- Removed redundant Jest config
@thomas-hervey
Copy link
Copy Markdown
Collaborator Author

@springmeyer this is a PR to resolve the build:browser scrip issue. Let me know if you have any questions. Thanks for your quick attention thus far!

@springmeyer springmeyer requested a review from Copilot September 22, 2025 21:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the incorrect platform target for the build:browser script and modernizes the test imports by replacing TypeScript path aliases with relative imports.

  • Updated the browser build script to generate an IIFE bundle for browser use instead of CommonJS for Node.js
  • Replaced all TypeScript path aliases (@/) with relative imports (../src) in test files
  • Enhanced build output tests with direct checks of the generated browser bundle

Reviewed Changes

Copilot reviewed 13 out of 42 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
package.json Fixed build:browser script to use IIFE format for browser compatibility
arc.js Generated browser bundle now uses IIFE format with global arc variable
src/line-string.ts Renamed LineString class to _LineString to indicate internal use
src/index.ts Added export for _LineString class
src/arc.ts Updated import to use renamed _LineString class
src/great-circle.ts Updated import to use renamed _LineString class
test/*.ts Replaced TypeScript path aliases with relative imports
test/build-output.test.js Enhanced tests with browser bundle validation and ESM testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +24 to +26
test('Browser bundle (arc.js) exists', () => {
const fs = require('fs');
const path = require('path');
Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the require statements to the top of the file to follow Node.js best practices and improve readability.

Copilot uses AI. Check for mistakes.

// Test API completeness
test('All original API methods work', () => {
const arc = require('../dist/index.js');
Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the require statement to the top of the file to follow Node.js best practices and improve readability.

Copilot uses AI. Check for mistakes.
const arcBundle = require('../arc.js');
// Test output consistency between CommonJS and ESM
test('Output consistency between CommonJS and ESM', () => {
const arcCJS = require('../dist/index.js');
Copy link

Copilot AI Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the require statement to the top of the file to follow Node.js best practices and improve readability.

Copilot uses AI. Check for mistakes.
@springmeyer springmeyer merged commit b99d8e3 into springmeyer:main Sep 23, 2025
2 checks passed
@thomas-hervey thomas-hervey deleted the fix/browser-build branch September 23, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants