Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6d84d4f

Browse files
Clean: Refactor config,scripts and remove leetcode.js
1 parent beef221 commit 6d84d4f

File tree

5 files changed

+17
-62
lines changed

5 files changed

+17
-62
lines changed

‎config.js‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎config/config.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { readFileSync } from "fs";
2+
import path from "path";
3+
import { fileURLToPath } from "url";
4+
5+
//Node.js 10 supports ECMAScript modules, where __dirname and __filename are no longer available.
6+
//https://stackoverflow.com/a/50053801/12988588
7+
//https://stackoverflow.com/a/55859500/12988588
8+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
9+
10+
const configFilePath = path.resolve(__dirname, "../.env.json");
11+
const configDataRaw = readFileSync(configFilePath);
12+
const config = JSON.parse( configDataRaw );
13+
14+
export default config;

‎index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import axios from "axios";
2-
import config from "./config";
2+
import config from "./config/config";
33

44
const body2 = `{"operationName":"getContestRankingData","variables":{"username":"aditi"},"query":"query getContestRankingData($username: String!) {\
55
userContestRanking(username: aditi) {\

‎leetcode.js‎

Lines changed: 0 additions & 57 deletions
This file was deleted.

‎run.sh‎ renamed to ‎scripts/run.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

33
filename="1ドル"
44
[[ -z "${filename}" ]] && filename=index.js
5+
cd $(git rev-parse --show-toplevel)
56
node --experimental-specifier-resolution=node ${filename}
7+
cd -

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /