Skip to content

Commit

Permalink
chore: update to esm
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejilderda committed Dec 29, 2023
1 parent be2ba62 commit 84e4eaf
Show file tree
Hide file tree
Showing 12 changed files with 1,594 additions and 2,537 deletions.
4,073 changes: 1,563 additions & 2,510 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "user.workflow.d0675a7c-9f7f-440a-94d2-511ee57ed5ef",
"version": "1.0.0",
"version": "2.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"alfy": "^0.9.1"
"alfy": "^2.0.0"
}
}
4 changes: 2 additions & 2 deletions src/adjust-timer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const alfy = require('alfy');
import * as time from './utils/time';
import alfy from 'alfy';
import * as time from './utils/time.js';

const vars = process.env;
const { taskId, taskHours, taskName, taskClientName, stopRestart } = vars;
Expand Down
2 changes: 1 addition & 1 deletion src/get-account-id.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const alfy = require('alfy');
import alfy from 'alfy';

console.log(alfy.config.get('accountId').trim());
4 changes: 2 additions & 2 deletions src/list-project-tasks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { alfredError } from './utils/errors';
const alfy = require('alfy');
import alfy from 'alfy';
import { alfredError } from './utils/errors.js';

const vars = process.env;
const { task_assignments } = vars;
Expand Down
6 changes: 3 additions & 3 deletions src/list-projects.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { alfredError } from './utils/errors';
import { apiCall } from './utils/helpers';
const alfy = require('alfy');
import alfy from 'alfy';
import { alfredError } from './utils/errors.js';
import { apiCall } from './utils/helpers.js';

const url = 'https://api.harvestapp.com/v2/users/me/project_assignments?';

Expand Down
9 changes: 5 additions & 4 deletions src/list-todays-timers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { alfredError } from './utils/errors';
import { apiCall } from './utils/helpers';
import { getToday, roundTime } from './utils/time';
const alfy = require('alfy');
import alfy from 'alfy';

import { alfredError } from './utils/errors.js';
import { apiCall } from './utils/helpers.js';
import { getToday, roundTime } from './utils/time.js';

const today = getToday();
const userId = alfy.config.get('userId') || '';
Expand Down
7 changes: 3 additions & 4 deletions src/start-project-task.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { apiCall } from './utils/helpers';
import { getToday } from './utils/time';
import { notify } from './utils/notifications';
const alfy = require('alfy');
import { apiCall } from './utils/helpers.js';
import { getToday } from './utils/time.js';
import { notify } from './utils/notifications.js';

const vars = process.env;
const { projectId, projectName, taskId, taskName } = vars;
Expand Down
6 changes: 3 additions & 3 deletions src/store-credentials.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { notify } from './utils/notifications';
import { apiCall, execute } from './utils/helpers';
const alfy = require('alfy');
import alfy from 'alfy';
import { notify } from './utils/notifications.js';
import { apiCall, execute } from './utils/helpers.js';

const token = process.env.token;
const accountId = process.env.account_id;
Expand Down
4 changes: 2 additions & 2 deletions src/update-task.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { apiCall } from "./utils/helpers";
import { notify } from "./utils/notifications";
import { apiCall } from "./utils/helpers.js";
import { notify } from "./utils/notifications.js";

const vars = process.env;
const { action, goTo, taskId, taskNotes, requestMethod, taskHours } = vars;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/errors.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const alfy = require('alfy');
import alfy from 'alfy';

export const alfredError = (error, title) => {
let errorTitle = title;
Expand Down
9 changes: 6 additions & 3 deletions src/utils/helpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const alfy = require('alfy');
import alfy from 'alfy';
import { promisify } from 'util';
import { exec as execCallback } from 'child_process';

const exec = promisify(execCallback);


export const execute = async (command) => {
const { stdout } = await exec(command);
Expand Down

0 comments on commit 84e4eaf

Please sign in to comment.