Skip to content
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
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import tseslint from 'typescript-eslint';
export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.recommended,
{ignores:['**/*.js', '**/node_modules/**']},
{ ignores: ['**/*.js', '**/node_modules/**'] }
);
12 changes: 12 additions & 0 deletions helper_scripts/build_ts_and_umd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { execSync } = require('child_process');
const path = require('path');

// Build the main TypeScript files
console.log('Building main TypeScript files...');
execSync('npx tsc', { stdio: 'inherit' });

// Build the UMD modules using Rollup
console.log('Building UMD modules with Rollup...');
execSync('npx rollup -c rollup.config.mjs', { stdio: 'inherit' });
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not familiar with UMD modules, what benefit do they give?

Copy link
Member Author

Choose a reason for hiding this comment

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


console.log('Build complete!');
18 changes: 18 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

/** @type {import("jest").Config} **/
module.exports = {
testEnvironment: "node",
workerIdleMemoryLimit: 0.2,
transform: {
'^.+\\.[jt]sx?$': [
'ts-jest',
{
useESM: true,
tsconfig: 'tsconfig.jest.json',
},
],
},
testMatch: [
'**/tests/**/*.test.ts'
],
};
1 change: 0 additions & 1 deletion main/background.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!doctype html>
<html>
<head>
<script src="util/geometryutil.js"></script>
<script src="util/clipper.js"></script>
<script src="util/parallel.js"></script>
<script type="module">
Expand Down
3 changes: 2 additions & 1 deletion main/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { NfpCache } from '../build/nfpDb.js';
import { HullPolygon } from '../build/util/HullPolygon.js';
import * as GeometryUtil from '../build/util/geometryutil.js';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are both built versions necessary, or should this import the UMD as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

both are needed the UMD is for the worker, and the non UMD is used in non worker context.


window.onload = function () {
const { ipcRenderer } = require('electron');
Expand Down Expand Up @@ -193,7 +194,7 @@ window.onload = function () {
}

p.require('../../main/util/clipper.js');
p.require('../../main/util/geometryutil.js');
p.require('../../build/util/umd/geometryutil.umd.js');

p.map(process).then(function (processed) {
function getPart(source) {
Expand Down
1 change: 1 addition & 0 deletions main/deepnest.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { Point } from '../build/util/point.js';
import { HullPolygon } from '../build/util/HullPolygon.js';
import * as GeometryUtil from '../build/util/geometryutil.js';

const { simplifyPolygon: simplifyPoly } = require("@deepnest/svg-preprocessor");

Expand Down
1 change: 0 additions & 1 deletion main/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<script src="util/pathsegpolyfill.js"></script>
<script src="util/clipper.js"></script>
<script src="util/parallel.js"></script>
<script src="util/geometryutil.js"></script>
<script src="util/interact.js"></script>
<script src="util/ractive.js"></script>
<script src="util/svgpanzoom.js"></script>
Expand Down
1 change: 1 addition & 0 deletions main/svgparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import '../build/util/domparser.js';
// Dependencies
import { Matrix } from '../build/util/matrix.js';
import { Point } from '../build/util/point.js';
import * as GeometryUtil from '../build/util/geometryutil.js';

export class SvgParser {
constructor(){
Expand Down
Loading
Loading