Skip to content

Commit

Permalink
test: Only trigger scripts usage check when ran directly
Browse files Browse the repository at this point in the history
  • Loading branch information
Betree committed Dec 12, 2024
1 parent a478ff9 commit 8882796
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions scripts/ledger/split-payment-processor-fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import models, { Op, sequelize } from '../../server/models';

const startDate = process.env.START_DATE ? new Date(process.env.START_DATE) : new Date('2024-01-01');

if (process.argv.length < 3) {
console.error('Usage: ./scripts/ledger/split-payment-processor-fees.ts migrate|rollback|check (rollbackTimestamp)');
process.exit(1);
}

const getTransactionsToMigrateQuery = `
SELECT *
FROM "Transactions" t
Expand Down Expand Up @@ -219,6 +214,11 @@ export const main = async (command: Command, additionalParameters = undefined) =
};

if (!module.parent) {
if (process.argv.length < 3) {
console.error('Usage: ./scripts/ledger/split-payment-processor-fees.ts migrate|rollback|check (rollbackTimestamp)');
process.exit(1);
}

main(process.argv[2] as Command, process.argv.slice(2))
.then(() => process.exit())
.catch(e => {
Expand Down
10 changes: 5 additions & 5 deletions scripts/ledger/split-taxes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ import models, { Op, sequelize } from '../../server/models';

const startDate = process.env.START_DATE ? new Date(process.env.START_DATE) : new Date('2024-01-01');

if (process.argv.length < 3) {
console.error('Usage: ./scripts/ledger/split-taxes.ts migrate|rollback|check (rollbackTimestamp)');
process.exit(1);
}

const getTransactionsToMigrateQuery = `
SELECT *
FROM "Transactions" t
Expand Down Expand Up @@ -231,6 +226,11 @@ export const main = async (command: Command, additionalParameters = undefined) =
};

if (!module.parent) {
if (process.argv.length < 3) {
console.error('Usage: ./scripts/ledger/split-taxes.ts migrate|rollback|check (rollbackTimestamp)');
process.exit(1);
}

main(process.argv[2] as Command, process.argv.slice(2))
.then(() => process.exit())
.catch(e => {
Expand Down

0 comments on commit 8882796

Please sign in to comment.