From 47ead1a12e7d1366fc14dcb13b8cc458c2ec6dd5 Mon Sep 17 00:00:00 2001 From: Abhinav Pandey Date: Sat, 13 Jul 2024 15:08:59 +0530 Subject: [PATCH] Fix ES^ module issues Signed-off-by: Abhinav Pandey --- jest.config.js | 3 +-- package-lock.json | 25 +------------------------ src/commands/commands.ts | 2 +- src/index.ts | 2 +- tests/commands.test.ts | 4 ++-- tests/envManager.test.ts | 2 +- 6 files changed, 7 insertions(+), 31 deletions(-) diff --git a/jest.config.js b/jest.config.js index b45c154..51120f7 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,5 +1,4 @@ -/* eslint-disable no-undef */ -module.exports = { +export default { preset: 'ts-jest', testEnvironment: 'node', testMatch: ['**/__tests__/**/*.ts?(x)', '**/?(*.)+(spec|test).ts?(x)'], diff --git a/package-lock.json b/package-lock.json index 3b65d70..eda3c43 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "license": "MIT", "dependencies": { "chalk": "^5.3.0", - "dotenv": "^16.4.5", "inquirer": "^9.2.11", "yargs": "^17.7.2" }, @@ -19,7 +18,6 @@ }, "devDependencies": { "@types/chalk": "^2.2.0", - "@types/dotenv": "^8.2.0", "@types/inquirer": "^9.0.6", "@types/jest": "^29.5.6", "@types/node": "^20.8.3", @@ -1502,16 +1500,6 @@ "chalk": "*" } }, - "node_modules/@types/dotenv": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@types/dotenv/-/dotenv-8.2.0.tgz", - "integrity": "sha512-ylSC9GhfRH7m1EUXBXofhgx4lUWmFeQDINW5oLuS+gxWdfUeW4zJdeVTYVkexEW+e2VUvlZR2kGnGGipAWR7kw==", - "deprecated": "This is a stub types definition. dotenv provides its own type definitions, so you do not need this installed.", - "dev": true, - "dependencies": { - "dotenv": "*" - } - }, "node_modules/@types/graceful-fs": { "version": "4.1.7", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.7.tgz", @@ -2682,18 +2670,6 @@ "node": ">=6.0.0" } }, - "node_modules/dotenv": { - "version": "16.4.5", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", - "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://dotenvx.com" - } - }, "node_modules/electron-to-chromium": { "version": "1.4.544", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.544.tgz", @@ -4039,6 +4015,7 @@ "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", "dev": true, + "license": "MIT", "dependencies": { "@babel/core": "^7.11.6", "@jest/test-sequencer": "^29.7.0", diff --git a/src/commands/commands.ts b/src/commands/commands.ts index cc5ed3c..a42fb89 100644 --- a/src/commands/commands.ts +++ b/src/commands/commands.ts @@ -1,4 +1,4 @@ -import { readEnvFile, writeEnvFile, parseEnvFile } from './envManager.js'; +import { readEnvFile, writeEnvFile, parseEnvFile } from './envManager'; import fs from 'fs'; import path from 'path'; diff --git a/src/index.ts b/src/index.ts index 9b6002b..c55b108 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node import yargs from 'yargs'; import { hideBin } from 'yargs/helpers'; -import { setEnv, getEnv, deleteEnv, importEnv } from './commands/commands.js'; +import { setEnv, getEnv, deleteEnv, importEnv } from './commands/commands'; yargs(hideBin(process.argv)) .command('set ', 'Set an environment variable', {}, (argv) => { diff --git a/tests/commands.test.ts b/tests/commands.test.ts index f0c221e..91e4b6f 100644 --- a/tests/commands.test.ts +++ b/tests/commands.test.ts @@ -1,5 +1,5 @@ -import { setEnv, getEnv, deleteEnv } from '../src/commands/commands.js'; -import { readEnvFile } from '../src/commands/envManager.js'; +import { setEnv, getEnv, deleteEnv } from '../src/commands/commands'; +import { readEnvFile } from '../src/commands/envManager'; describe('Commands', () => { const testKey = 'TEST_KEY'; diff --git a/tests/envManager.test.ts b/tests/envManager.test.ts index 0580adc..b3f2625 100644 --- a/tests/envManager.test.ts +++ b/tests/envManager.test.ts @@ -1,4 +1,4 @@ -import { readEnvFile, writeEnvFile } from '../src/commands/envManager.js'; +import { readEnvFile, writeEnvFile } from "../src/commands/envManager"; describe('EnvManager', () => { const testKey = 'MANAGER_TEST_KEY';