Skip to content

Commit

Permalink
Import only what's needed from the API for importer packages
Browse files Browse the repository at this point in the history
  • Loading branch information
jlongster committed Dec 2, 2022
1 parent e30c2c6 commit 8abd71c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
3 changes: 1 addition & 2 deletions packages/api/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
let bundle = require('./app/bundle.api.js');
let injected = require('./injected');
let methods = require('./methods');
let utils = require('./utils');

let injected = require('./injected');
let actualApp;

async function init({ budgetId, config } = {}) {
Expand Down
10 changes: 7 additions & 3 deletions packages/import-ynab4/importer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// This is a special usage of the API because this package is embedded
// into Actual itself. We only want to pull in the methods in that
// case and ignore everything else; otherwise we'd be pulling in the
// entire backend bundle from the API
const actual = require('@actual-app/api/methods');
const { amountToInteger } = require('@actual-app/api/utils');
const AdmZip = require('adm-zip');
const d = require('date-fns');
const normalizePathSep = require('slash');
const uuid = require('uuid');
const AdmZip = require('adm-zip');
const actual = require('@actual-app/api');
const amountToInteger = actual.utils.amountToInteger;

// Utils

Expand Down
6 changes: 5 additions & 1 deletion packages/import-ynab5/importer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// This is a special usage of the API because this package is embedded
// into Actual itself. We only want to pull in the methods in that
// case and ignore everything else; otherwise we'd be pulling in the
// entire backend bundle from the API
const actual = require('@actual-app/api/methods');
const d = require('date-fns');
const uuid = require('uuid');
const actual = require('@actual-app/api');

function amountFromYnab(amount) {
// ynabs multiplies amount by 1000 and actual by 100
Expand Down

0 comments on commit 8abd71c

Please sign in to comment.