Skip to content

Commit d5a2cdf

Browse files
committed
Use CJS by default, explicit ESM for development utilities
Our Electron app needs to run in Electron 22 which doesn't support ESM in the main process, so we're stuck in CJS for that.
1 parent 70e7a85 commit d5a2cdf

18 files changed

+34
-34
lines changed

.github/workflows/build-auto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
run: npm ci
2323
- name: Prepare extensions
2424
# Don't need to do a full fetch, that would just cause a lot of unnecessary traffic
25-
run: node scripts/prepare-extensions.js
25+
run: node scripts/prepare-extensions.mjs
2626
- name: Compile
2727
run: npm run webpack:compile
2828
- name: Package

.github/workflows/build.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
run: npm run webpack:prod
2727
- name: Package
2828
run: |
29-
node release-automation/build.js --debian --tarball --appimage --x64 --armv7l --arm64
29+
node release-automation/build.mjs --debian --tarball --appimage --x64 --armv7l --arm64
3030
- name: Print file tree
31-
run: node scripts/print-file-tree.js dist
31+
run: node scripts/print-file-tree.mjs dist
3232
- name: Upload artifacts to GitHub Actions
3333
uses: actions/upload-artifact@v4
3434
with:
@@ -58,10 +58,10 @@ jobs:
5858
run: npm run webpack:prod
5959
- name: Package
6060
run: |
61-
node release-automation/build.js --mac --universal
62-
node release-automation/build.js --mac-legacy-10.13-10.14 --mac-legacy-10.15 --x64
61+
node release-automation/build.mjs --mac --universal
62+
node release-automation/build.mjs --mac-legacy-10.13-10.14 --mac-legacy-10.15 --x64
6363
- name: Print file tree
64-
run: node scripts/print-file-tree.js dist
64+
run: node scripts/print-file-tree.mjs dist
6565
- name: Upload artifacts to GitHub Actions
6666
uses: actions/upload-artifact@v4
6767
with:
@@ -112,12 +112,12 @@ jobs:
112112
- name: Package
113113
working-directory: D:\repo
114114
run: |
115-
node release-automation/build.js --windows --microsoft-store --x64 --ia32 --arm64
116-
node release-automation/build.js --windows-portable --x64
117-
node release-automation/build.js --windows-legacy --ia32 --x64
115+
node release-automation/build.mjs --windows --microsoft-store --x64 --ia32 --arm64
116+
node release-automation/build.mjs --windows-portable --x64
117+
node release-automation/build.mjs --windows-legacy --ia32 --x64
118118
- name: Print file tree
119119
working-directory: D:\repo
120-
run: node scripts/print-file-tree.js dist
120+
run: node scripts/print-file-tree.mjs dist
121121
- name: Upload artifacts to GitHub Actions
122122
uses: actions/upload-artifact@v4
123123
with:

.github/workflows/release.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ jobs:
3232
run: npm run webpack:prod
3333
- name: Package
3434
run: |
35-
node release-automation/build.js --debian --tarball --appimage --x64 --armv7l --arm64 --production
35+
node release-automation/build.mjs --debian --tarball --appimage --x64 --armv7l --arm64 --production
3636
- name: Print file tree
37-
run: node scripts/print-file-tree.js dist
37+
run: node scripts/print-file-tree.mjs dist
3838
- name: Upload artifacts to GitHub Actions
3939
uses: actions/upload-artifact@v4
4040
with:
@@ -45,9 +45,9 @@ jobs:
4545
dist/*.AppImage
4646
- name: Upload artifacts to tag
4747
run: |
48-
node scripts/upload-to-github-releases.js TurboWarp desktop "dist/*.deb"
49-
node scripts/upload-to-github-releases.js TurboWarp desktop "dist/*.tar.gz"
50-
node scripts/upload-to-github-releases.js TurboWarp desktop "dist/*.AppImage"
48+
node scripts/upload-to-github-releases.mjs TurboWarp desktop "dist/*.deb"
49+
node scripts/upload-to-github-releases.mjs TurboWarp desktop "dist/*.tar.gz"
50+
node scripts/upload-to-github-releases.mjs TurboWarp desktop "dist/*.AppImage"
5151
env:
5252
GH_TOKEN: "${{ github.token }}"
5353

@@ -76,9 +76,9 @@ jobs:
7676
python3 -c "import os; open(os.getenv('APPLE_API_KEY_NAME'), 'w').write(os.getenv('APPLE_API_KEY_DATA'))" >/dev/null 2>&1
7777
# @electron/notaraize documentation says key should be an absolute path
7878
export APPLE_API_KEY="$(pwd)/$APPLE_API_KEY_NAME"
79-
node release-automation/build.js --mac --universal --production
79+
node release-automation/build.mjs --mac --universal --production
8080
# These macOS versions never ran on an Apple Silicon device, so only need x64
81-
node release-automation/build.js --mac-legacy-10.13-10.14 --mac-legacy-10.15 --x64 --production
81+
node release-automation/build.mjs --mac-legacy-10.13-10.14 --mac-legacy-10.15 --x64 --production
8282
# for safety
8383
rm "$APPLE_API_KEY_NAME"
8484
env:
@@ -92,15 +92,15 @@ jobs:
9292
# special characters that the shell will mess with
9393
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CSC_KEY_PASSWORD }}
9494
- name: Print file tree
95-
run: node scripts/print-file-tree.js dist
95+
run: node scripts/print-file-tree.mjs dist
9696
- name: Upload artifacts to GitHub Actions
9797
uses: actions/upload-artifact@v4
9898
with:
9999
name: mac
100100
path: dist/*.dmg
101101
- name: Upload artifacts to tag
102102
run: |
103-
node scripts/upload-to-github-releases.js TurboWarp desktop "dist/*.dmg"
103+
node scripts/upload-to-github-releases.mjs TurboWarp desktop "dist/*.dmg"
104104
env:
105105
GH_TOKEN: "${{ github.token }}"
106106

@@ -148,12 +148,12 @@ jobs:
148148
- name: Package
149149
working-directory: D:\repo
150150
run: |
151-
node release-automation/build.js --windows --microsoft-store --x64 --ia32 --arm64 --production
152-
node release-automation/build.js --windows-portable --x64 --production
153-
node release-automation/build.js --windows-legacy --ia32 --x64 --production
151+
node release-automation/build.mjs --windows --microsoft-store --x64 --ia32 --arm64 --production
152+
node release-automation/build.mjs --windows-portable --x64 --production
153+
node release-automation/build.mjs --windows-legacy --ia32 --x64 --production
154154
- name: Print file tree
155155
working-directory: D:\repo
156-
run: node scripts/print-file-tree.js dist
156+
run: node scripts/print-file-tree.mjs dist
157157
- name: Upload unsigned artifacts to GitHub Actions
158158
uses: actions/upload-artifact@v4
159159
with:
@@ -194,6 +194,6 @@ jobs:
194194
- name: Upload signed artifacts to tag
195195
working-directory: D:\repo
196196
run: |
197-
node scripts/upload-to-github-releases.js TurboWarp desktop "dist/*.exe"
197+
node scripts/upload-to-github-releases.mjs TurboWarp desktop "dist/*.exe"
198198
env:
199199
GH_TOKEN: "${{ github.token }}"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Build an optimized version of the webpack portions with:
9898
npm run webpack:prod
9999
```
100100

101-
Then to package up the final Electron binaries, use either our build script `release-automation/build.js` (see [release-automation/README.md](release-automation/README.md)) or the [electron-builder CLI](https://www.electron.build/cli). Either way the final builds are saved in the `dist` folder. Here are some examples using the electron-builder CLI directly:
101+
Then to package up the final Electron binaries, use either our build script `release-automation/build.mjs` (see [release-automation/README.md](release-automation/README.md)) or the [electron-builder CLI](https://www.electron.build/cli). Either way the final builds are saved in the `dist` folder. Here are some examples using the electron-builder CLI directly:
102102

103103
```bash
104104
# You can also do manual builds with electron-builder's CLI, for example:

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This document is the authoritative source for TurboWarp's changelogs. Everything else gets generated from this list by `node scripts/generate-changelogs.js`.
1+
This document is the authoritative source for TurboWarp's changelogs. Everything else gets generated from this list by `node scripts/generate-changelogs.jsm`.
22

33
Prefix notes with "Windows:", "macOS:", or "Linux:" as needed. Do not use **formatting** or [links](https://desktop.turbowarp.org/).
44

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"email": "[email protected]",
88
"name": "Thomas Weber"
99
},
10-
"type": "module",
10+
"type": "commonjs",
1111
"scripts": {
12-
"fetch": "node scripts/download-library-files.js && node scripts/download-packager.js && node scripts/prepare-extensions.js",
12+
"fetch": "node scripts/download-library-files.mjs && node scripts/download-packager.mjs && node scripts/prepare-extensions.mjs",
1313
"webpack:compile": "webpack",
1414
"webpack:watch": "webpack --watch",
1515
"webpack:prod": "cross-env NODE_ENV=production webpack",
File renamed without changes.

scripts/download-library-files.js renamed to scripts/download-library-files.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as fs from 'node:fs';
22
import * as fsPromises from 'node:fs/promises';
33
import * as pathUtil from 'node:path';
44
import { brotliCompress, brotliDecompress } from 'node:zlib';
5-
import { computeMD5, computeSHA256, persistentFetch } from './lib.js';
5+
import { computeMD5, computeSHA256, persistentFetch } from './lib.mjs';
66

77
/**
88
* @typedef AssetMetadata

scripts/download-packager.js renamed to scripts/download-packager.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as fs from 'node:fs';
22
import * as pathUtil from 'node:path';
3-
import { computeSHA256, persistentFetch } from './lib.js';
3+
import { computeSHA256, persistentFetch } from './lib.mjs';
44
import packagerInfo from './packager.json' with { type: 'json' };
55

66
const path = pathUtil.join(import.meta.dirname, '../src-renderer/packager/standalone.html');
File renamed without changes.

0 commit comments

Comments
 (0)