-
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.
Signed-off-by: Diwank Singh Tomer <[email protected]>
- Loading branch information
Showing
10 changed files
with
56 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
#!/usr/bin/env node | ||
|
||
const options = require("../.replrc.js"); | ||
const path = require("path"); | ||
const repl = require("local-repl"); | ||
|
||
// It's important to use __dirname to load local-repl | ||
// with local context set to the installed package | ||
// instead of `cwd`. | ||
|
||
const options = { | ||
package: path.join(__dirname, "..", "package.json"), | ||
replrc: path.join(__dirname, "..", ".replrc.js"), | ||
}; | ||
|
||
repl | ||
.start(options) | ||
.catch(console.error); |
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,3 +1,5 @@ | ||
// src/utils/auth.ts | ||
|
||
import isomorphicFetch from "isomorphic-fetch"; | ||
isomorphicFetch; | ||
|
||
|
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,3 +1,5 @@ | ||
// src/utils/crypto.ts | ||
|
||
import assert from "assert"; | ||
import crypto from "crypto"; | ||
|
||
|
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,3 +1,5 @@ | ||
// src/utils/date.ts | ||
|
||
export function now(): number { | ||
const date = new Date(); | ||
const timestamp = date.getTime(); | ||
|
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,23 @@ | ||
// src/utils/ensureEnv.ts | ||
|
||
export const ensureEnv = (key: string, exitCode = -1): void => { | ||
const val: any = process.env[key]; | ||
|
||
// Value exists, continue | ||
if (val) return; | ||
|
||
// Nope, raise / quit | ||
const msg = `"${key}" environment variable is required`; | ||
|
||
// Haz exit code? Quit | ||
if (exitCode !== -1) { | ||
console.error(msg); | ||
process.exit(exitCode); | ||
|
||
// Else throw | ||
} else { | ||
throw new Error(msg); | ||
} | ||
|
||
return; | ||
}; |
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