-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(esm): convert to using esm modules
- Loading branch information
Showing
33 changed files
with
386 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/mocharc.json", | ||
"require": ["tsx/esm", "esmock"], | ||
"extensions": ["ts"], | ||
"spec": [ | ||
"test/**/*.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
#! /usr/bin/env node | ||
require('../dist').CLI(process.argv.slice(2)) | ||
import { CLI } from '../dist' | ||
CLI(process.argv.slice(2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,38 @@ | ||
const eslint = require('@eslint/js') | ||
const tseslint = require('typescript-eslint') | ||
const globals = require('globals') | ||
const stylistic = require('@stylistic/eslint-plugin') | ||
import { default as tseslint } from 'typescript-eslint' | ||
import { default as globals } from 'globals' | ||
import { default as eslint } from '@eslint/js' | ||
|
||
module.exports = tseslint.config( | ||
export default tseslint.config( | ||
{ | ||
ignores: ['dist/*', 'bin/*'], | ||
rules: { | ||
'@typescript-eslint/no-require-imports': 'off', | ||
}, | ||
// Ignore build folder | ||
ignores: ['dist/*'], | ||
}, | ||
eslint.configs.recommended, | ||
tseslint.configs.strictTypeChecked, | ||
tseslint.configs.stylisticTypeChecked, | ||
{ | ||
// Enable Type generation | ||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
}, | ||
parserOptions: { | ||
projectService: { | ||
allowDefaultProject: ['test/*.ts'], | ||
}, | ||
project: ['./tsconfig.json', './test/tsconfig.json'], | ||
}, | ||
}, | ||
extends: [ | ||
eslint.configs.recommended, | ||
stylistic.configs['recommended-flat'], | ||
tseslint.configs.strictTypeChecked, | ||
tseslint.configs.stylisticTypeChecked, | ||
], | ||
}, | ||
// Disable Type Checking JS files | ||
{ | ||
files: ['**/*.js'], | ||
extends: [tseslint.configs.disableTypeChecked], | ||
} | ||
}, | ||
{ | ||
// For test files ignore some rules | ||
files: ['test/*.ts'], | ||
files: ['test/**/*'], | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
'@typescript-eslint/no-unsafe-assignment': 'off', | ||
'@typescript-eslint/no-unsafe-assignment': 'off' | ||
}, | ||
}, | ||
// Disable Type Checking JS/CJS/MJS files | ||
{ | ||
files: ['**/*.js', '**/*.cjs', '**/*.mjs'], | ||
extends: [tseslint.configs.disableTypeChecked], | ||
}, | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as processLib from 'node:process' | ||
import type { Environment } from './types.ts' | ||
import { EnvCmd } from './env-cmd.js' | ||
import { parseArgs } from './parse-args.js' | ||
|
||
/** | ||
* Executes env - cmd using command line arguments | ||
* @export | ||
* @param {string[]} args Command line argument to pass in ['-f', './.env'] | ||
* @returns {Promise<Environment>} | ||
*/ | ||
export async function CLI(args: string[]): Promise<Environment> { | ||
|
||
// Parse the args from the command line | ||
const parsedArgs = parseArgs(args) | ||
|
||
// Run EnvCmd | ||
try { | ||
return await EnvCmd(parsedArgs) | ||
} | ||
catch (e) { | ||
console.error(e) | ||
return processLib.exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { getEnvVars } from './get-env-vars' | ||
import { getEnvVars } from './get-env-vars.js' | ||
|
||
// Export the core env-cmd API | ||
export * from './types' | ||
export * from './env-cmd' | ||
export * from './types.js' | ||
export * from './cli.js' | ||
export * from './env-cmd.js' | ||
export const GetEnvVars = getEnvVars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.