-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- renamed fs to dotenv - added better methods of testing locally - migrated source files to a 'src' subdirectory to make microbundle happier - fixed an issue that would cause errors to get obfuscated when logged
- Loading branch information
1 parent
f97c5f5
commit f90436e
Showing
38 changed files
with
788 additions
and
153 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
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"packageManager": "[email protected]", | ||
"description": "Simply a key rotation tool!~ ❤️", | ||
"main": "dist/index.js", | ||
"source": "index.ts", | ||
"source": "src/index.ts", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"build": "microbundle --target node -f cjs" | ||
|
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.
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.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,13 @@ | |
"packageManager": "[email protected]", | ||
"description": "Simply a key rotation tool!~ ❤️", | ||
"main": "dist/index.js", | ||
"source": "index.ts", | ||
"source": "src/index.ts", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"build": "microbundle --target node -f cjs" | ||
}, | ||
"dependencies": { | ||
"@rain-cafe/logger": "^1.0.2" | ||
"@rain-cafe/logger": "^1.0.3" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
|
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,15 @@ | ||
import { DotEnvSourceModule } from './source'; | ||
import { DotEnvTargetModule } from './target'; | ||
|
||
/** | ||
* @deprecated Please use {@link DotEnv} instead! :3 | ||
*/ | ||
export const FS = { | ||
Source: DotEnvSourceModule, | ||
Target: DotEnvTargetModule, | ||
}; | ||
|
||
export const DotEnv = { | ||
Source: DotEnvSourceModule, | ||
Target: DotEnvTargetModule, | ||
}; |
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,43 @@ | ||
import path from 'node:path'; | ||
import { SourceModule, KeyInfo } from '../types'; | ||
import { read, readSync } from './utils/dotenv'; | ||
|
||
export class DotEnvSourceModule extends SourceModule { | ||
protected declare options: DotEnvSourceModule.Options; | ||
private keyInfos: KeyInfo[]; | ||
|
||
constructor({ targets, file, ...options }: DotEnvSourceModule.Options) { | ||
super({ targets }); | ||
|
||
this.options = { | ||
...this.options, | ||
...options, | ||
file: path.isAbsolute(file) ? file : path.join(process.cwd(), file), | ||
}; | ||
|
||
this.keyInfos = readSync(this.options.file, this.options.properties); | ||
} | ||
|
||
get name(): string { | ||
return 'dotenv'; | ||
} | ||
|
||
get originalKeyInfos(): KeyInfo[] { | ||
return this.keyInfos; | ||
} | ||
|
||
async source(): Promise<KeyInfo[]> { | ||
return await read(this.options.file, this.options.properties); | ||
} | ||
|
||
async revert(): Promise<void> {} | ||
|
||
async cleanup(): Promise<void> {} | ||
} | ||
|
||
namespace DotEnvSourceModule { | ||
export type Options = { | ||
file: string; | ||
properties?: string[]; | ||
} & SourceModule.Options; | ||
} |
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,28 @@ | ||
import { ITargetModule, KeyInfo } from '../types'; | ||
import path from 'node:path'; | ||
import { merge } from './utils/dotenv'; | ||
|
||
export class DotEnvTargetModule implements ITargetModule { | ||
private options: DotEnvTargetModule.Options; | ||
|
||
constructor({ file, ...options }: DotEnvTargetModule.Options) { | ||
this.options = { | ||
...options, | ||
file: path.isAbsolute(file) ? file : path.join(process.cwd(), file), | ||
}; | ||
} | ||
|
||
get name(): string { | ||
return 'dotenv'; | ||
} | ||
|
||
async target(keyInfos: KeyInfo[]): Promise<void> { | ||
return await merge(this.options.file, keyInfos); | ||
} | ||
} | ||
|
||
export namespace DotEnvTargetModule { | ||
export type Options = { | ||
file: string; | ||
}; | ||
} |
Oops, something went wrong.