Skip to content

Commit

Permalink
Attempt to use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
Corentin Mors committed Sep 1, 2023
1 parent 368eb6e commit 42d4990
Show file tree
Hide file tree
Showing 81 changed files with 280 additions and 274 deletions.
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
"bin": {
"dcli": "dist/index.js"
},
"type": "module",
"pkg": {
"assets": [
"node_modules/better-sqlite3/build/Release/better_sqlite3.node",
"node_modules/@json2csv/plainjs/dist/**/*",
"node_modules/@json2csv/formatters/dist/**/*",
"node_modules/@json2csv/transforms/dist/**/*",
"node_modules/@streamparser/json/dist/**/*"
"node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/build/Release/better_sqlite3.node",
"node_modules/@json2csv/**/*",
"node_modules/.pnpm/@[email protected]/node_modules/@json2csv/formatters/dist/**/*",
"node_modules/.pnpm/@[email protected]/node_modules/@json2csv/transforms/dist/**/*",
"node_modules/.pnpm/@[email protected]/node_modules/@streamparser/json/dist/**/*"
]
},
"scripts": {
Expand Down Expand Up @@ -56,7 +57,7 @@
"@types/chai": "^4.3.5",
"@types/inquirer": "^8.2.6",
"@types/mocha": "^10.0.1",
"@types/node": "^18.17.4",
"@types/node": "^20.5.7",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"chai": "^4.3.7",
Expand All @@ -68,7 +69,7 @@
"pkg": "^5.8.1",
"prettier": "^2.8.8",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
"typescript": "^5.2.2"
},
"dependencies": {
"@json2csv/plainjs": "^7.0.1",
Expand Down
76 changes: 40 additions & 36 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/cliVersion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CliVersion } from './types';
import { CliVersion } from './types.js';

export const CLI_VERSION: CliVersion = { major: 1, minor: 13, patch: 0 };
export const breakingChangesVersions: CliVersion[] = [];
Expand Down
2 changes: 1 addition & 1 deletion src/command-handlers/backup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import winston from 'winston';
import fs from 'fs';
import { connectAndPrepare, getDatabasePath } from '../modules/database';
import { connectAndPrepare, getDatabasePath } from '../modules/database/index.js';

export const runBackup = async (options: { directory: string; filename: string }) => {
const { db } = await connectAndPrepare({ failIfNoDB: true, forceSync: true });
Expand Down
8 changes: 4 additions & 4 deletions src/command-handlers/configure.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import winston from 'winston';
import { encryptAesCbcHmac256 } from '../modules/crypto/encrypt';
import { deleteLocalKey, setLocalKey, warnUnreachableKeychainDisabled } from '../modules/crypto/keychainManager';
import { connectAndPrepare } from '../modules/database';
import { parseBooleanString } from '../utils';
import { encryptAesCbcHmac256 } from '../modules/crypto/encrypt.js';
import { deleteLocalKey, setLocalKey, warnUnreachableKeychainDisabled } from '../modules/crypto/keychainManager.js';
import { connectAndPrepare } from '../modules/database/index.js';
import { parseBooleanString } from '../utils/index.js';

export const configureSaveMasterPassword = async (boolean: string) => {
let shouldNotSaveMasterPassword = !parseBooleanString(boolean);
Expand Down
10 changes: 5 additions & 5 deletions src/command-handlers/devices.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import winston from 'winston';
import { connectAndPrepare, reset } from '../modules/database';
import { deactivateDevices, listDevices, ListDevicesOutput } from '../endpoints';
import { askConfirmReset, epochTimestampToIso } from '../utils';
import { registerDevice } from '../modules/auth';
import { get2FAStatusUnauthenticated } from '../endpoints/get2FAStatusUnauthenticated';
import { connectAndPrepare, reset } from '../modules/database/index.js';
import { deactivateDevices, listDevices, ListDevicesOutput } from '../endpoints/index.js';
import { askConfirmReset, epochTimestampToIso } from '../utils/index.js';
import { registerDevice } from '../modules/auth/index.js';
import { get2FAStatusUnauthenticated } from '../endpoints/get2FAStatusUnauthenticated.js';

type OutputDevice = ListDevicesOutput['devices'][number] & {
isCurrentDevice: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/command-handlers/exec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Command } from 'commander';
import winston from 'winston';
import { spawn } from 'child_process';
import { getVaultSecret, initVaultSecrets } from '../modules/database';
import { getVaultSecret, initVaultSecrets } from '../modules/database/index.js';

export const runExec = async (_options: unknown, program: Command) => {
const command = program.args.join(' ');
Expand Down
30 changes: 15 additions & 15 deletions src/command-handlers/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export * from './backup';
export * from './configure';
export * from './devices';
export * from './exec';
export * from './inject';
export * from './logout';
export * from './passwords';
export * from './read';
export * from './secureNotes';
export * from './sync';
export * from './teamDevices';
export * from './teamLogs';
export * from './teamMembers';
export * from './teamReport';
export * from './whoami';
export * from './backup.js';
export * from './configure.js';
export * from './devices.js';
export * from './exec.js';
export * from './inject.js';
export * from './logout.js';
export * from './passwords.js';
export * from './read.js';
export * from './secureNotes.js';
export * from './sync.js';
export * from './teamDevices.js';
export * from './teamLogs.js';
export * from './teamMembers.js';
export * from './teamReport.js';
export * from './whoami.js';
2 changes: 1 addition & 1 deletion src/command-handlers/inject.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs';
import { getVaultSecret, initVaultSecrets } from '../modules/database';
import { getVaultSecret, initVaultSecrets } from '../modules/database/index.js';

interface InjectOpts {
in: string;
Expand Down
8 changes: 4 additions & 4 deletions src/command-handlers/logout.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Database } from 'better-sqlite3';
import winston from 'winston';
import { deactivateDevices } from '../endpoints';
import { connectAndPrepare, connect, reset } from '../modules/database';
import { Secrets, DeviceConfiguration } from '../types';
import { askConfirmReset } from '../utils';
import { deactivateDevices } from '../endpoints/index.js';
import { connectAndPrepare, connect, reset } from '../modules/database/index.js';
import { Secrets, DeviceConfiguration } from '../types.js';
import { askConfirmReset } from '../utils/index.js';

export const runLogout = async () => {
const resetConfirmation = await askConfirmReset();
Expand Down
8 changes: 4 additions & 4 deletions src/command-handlers/passwords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import Database from 'better-sqlite3';
import { Clipboard } from '@napi-rs/clipboard';
import { authenticator } from 'otplib';
import winston from 'winston';
import { AuthentifiantTransactionContent, BackupEditTransaction, Secrets, VaultCredential } from '../types';
import { decryptTransactions } from '../modules/crypto';
import { askCredentialChoice, filterMatches } from '../utils';
import { connectAndPrepare } from '../modules/database';
import { AuthentifiantTransactionContent, BackupEditTransaction, Secrets, VaultCredential } from '../types.js';
import { decryptTransactions } from '../modules/crypto/index.js';
import { askCredentialChoice, filterMatches } from '../utils/index.js';
import { connectAndPrepare } from '../modules/database/index.js';

export const runPassword = async (filters: string[] | null, options: { output: 'json' | 'clipboard' | 'password' }) => {
const { output } = options;
Expand Down
8 changes: 4 additions & 4 deletions src/command-handlers/read.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { decryptTransactions } from '../modules/crypto';
import { connectAndPrepare, findVaultSecret } from '../modules/database';
import { AuthentifiantTransactionContent, BackupEditTransaction, SecureNoteTransactionContent } from '../types';
import { beautifySecrets, parsePath } from '../utils';
import { decryptTransactions } from '../modules/crypto/index.js';
import { connectAndPrepare, findVaultSecret } from '../modules/database/index.js';
import { AuthentifiantTransactionContent, BackupEditTransaction, SecureNoteTransactionContent } from '../types.js';
import { beautifySecrets, parsePath } from '../utils/index.js';

export const runRead = async (path: string) => {
const { db, secrets } = await connectAndPrepare({});
Expand Down
Loading

0 comments on commit 42d4990

Please sign in to comment.