[PR #877] [MERGED] Convert commonjs to esm #3381

Closed
opened 2026-02-28 20:40:49 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/877
Author: @albertogasparin
Created: 4/8/2023
Status: Merged
Merged: 4/10/2023
Merged by: @MatissJanis

Base: masterHead: chore/common-2-esm


📝 Commits (6)

📊 Changes

112 files changed (+694 additions, -799 deletions)

View changed files

📝 .gitignore (+1 -0)
📝 packages/api/app/query.js (+2 -2)
📝 packages/api/index.js (+13 -16)
📝 packages/api/injected.js (+4 -2)
📝 packages/api/methods.js (+39 -84)
📝 packages/api/package.json (+10 -8)
📝 packages/api/test.js (+1 -1)
packages/api/tsconfig.dist.json (+11 -0)
📝 packages/api/utils.js (+2 -4)
📝 packages/desktop-client/src/components/accounts/TransactionsTable.test.js (+1 -2)
📝 packages/desktop-client/src/index.js (+1 -1)
📝 packages/import-ynab4/importer.js (+7 -9)
📝 packages/import-ynab4/index.js (+4 -4)
📝 packages/import-ynab4/package.json (+1 -0)
📝 packages/import-ynab5/importer.js (+3 -5)
📝 packages/import-ynab5/index.js (+4 -4)
📝 packages/import-ynab5/package.json (+1 -0)
📝 packages/loot-core/bin/profile-sql.js (+1 -1)
📝 packages/loot-core/init-node.js (+7 -4)
📝 packages/loot-core/jest.config.js (+1 -1)

...and 80 more files

📄 Description

This PR converts everything (aside from electron) from CommonJS to ESM. It is needed to reduce the changes that will happen during the migration to Typescript (as TS does not play nice with CJS).

Basically:

  • rewrite require() to import
  • rewrite module.exports to exports
  • introduce ts-node to run importers so we can convert them to TS too

Lastly, sorry for this larg-ish PR, not my preference but when I tried to reduce its scope, I would end up with mixed commons/esm that was even more tricky to handle.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/877 **Author:** [@albertogasparin](https://github.com/albertogasparin) **Created:** 4/8/2023 **Status:** ✅ Merged **Merged:** 4/10/2023 **Merged by:** [@MatissJanis](https://github.com/MatissJanis) **Base:** `master` ← **Head:** `chore/common-2-esm` --- ### 📝 Commits (6) - [`f1d8312`](https://github.com/actualbudget/actual/commit/f1d83127f4cd2fc76ce6c973f52da6e0a85b871e) Convert commonjs to esm - [`93f8c12`](https://github.com/actualbudget/actual/commit/93f8c12228d64970c5461ed19992a05071c02b79) Add release note - [`0c28793`](https://github.com/actualbudget/actual/commit/0c2879329e3c8bf156c3e19a15771c55301cfeb4) Fix linting spaces - [`ac5d9ca`](https://github.com/actualbudget/actual/commit/ac5d9ca536de77bc218f86d3f02c1aabe1579a91) Build api via tsc - [`e0d69f8`](https://github.com/actualbudget/actual/commit/e0d69f872a162893386a96b297827746cea1f62d) Move Typescript to devDeps - [`cd306bc`](https://github.com/actualbudget/actual/commit/cd306bc9c18e697a5fd5dc1348341fab10f7714f) Remove unused function ### 📊 Changes **112 files changed** (+694 additions, -799 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+1 -0) 📝 `packages/api/app/query.js` (+2 -2) 📝 `packages/api/index.js` (+13 -16) 📝 `packages/api/injected.js` (+4 -2) 📝 `packages/api/methods.js` (+39 -84) 📝 `packages/api/package.json` (+10 -8) 📝 `packages/api/test.js` (+1 -1) ➕ `packages/api/tsconfig.dist.json` (+11 -0) 📝 `packages/api/utils.js` (+2 -4) 📝 `packages/desktop-client/src/components/accounts/TransactionsTable.test.js` (+1 -2) 📝 `packages/desktop-client/src/index.js` (+1 -1) 📝 `packages/import-ynab4/importer.js` (+7 -9) 📝 `packages/import-ynab4/index.js` (+4 -4) 📝 `packages/import-ynab4/package.json` (+1 -0) 📝 `packages/import-ynab5/importer.js` (+3 -5) 📝 `packages/import-ynab5/index.js` (+4 -4) 📝 `packages/import-ynab5/package.json` (+1 -0) 📝 `packages/loot-core/bin/profile-sql.js` (+1 -1) 📝 `packages/loot-core/init-node.js` (+7 -4) 📝 `packages/loot-core/jest.config.js` (+1 -1) _...and 80 more files_ </details> ### 📄 Description This PR converts everything (aside from electron) from CommonJS to ESM. It is needed to reduce the changes that will happen during the migration to Typescript (as TS does not play nice with CJS). Basically: - rewrite `require()` to `import` - rewrite `module.exports` to `exports` - introduce `ts-node` to run importers so we can convert them to TS too Lastly, sorry for this larg-ish PR, not my preference but when I tried to reduce its scope, I would end up with mixed commons/esm that was even more tricky to handle. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 20:40:49 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#3381