Skip to content

Commit 16ef0c7

Browse files
committed
move scripts
1 parent 6f61b1d commit 16ef0c7

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

.github/workflows/getCurrentDay.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
- name: Install dependencies
2121
run: npm install
2222
- name: Generate config
23-
run: node ./generate-config.js
23+
run: node ./scripts/generate-config.js
2424
- name: Prepare day
2525
# Yes its hacky but idc
26-
run: node ./prepare_day.js today ${{ secrets.SESSION_COOKIE }}
26+
run: node ./scripts/prepare_day.js today ${{ secrets.SESSION_COOKIE }}
2727
- name: Commit changes
2828
run: |
2929
git config --local user.email "github-actions[bot]@users.noreply.github.com"

package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@
1010
},
1111
"packageManager": "bun@1.3.0",
1212
"scripts": {
13-
"start:2024": "bun ./start_all.js 2024",
14-
"start:2023": "bun ./start_all.js 2023",
15-
"start:2022": "bun ./start_all.js 2022",
16-
"start:2021": "bun ./start_all.js 2021",
13+
"start:2025": "bun ./scripts/start_all.js 2025",
14+
"start:2024": "bun ./scripts/start_all.js 2024",
15+
"start:2023": "bun ./scripts/start_all.js 2023",
16+
"start:2022": "bun ./scripts/start_all.js 2022",
17+
"start:2021": "bun ./scripts/start_all.js 2021",
1718
"start:2020": "bun ./start_all.js 2020",
18-
"start:2019": "bun ./start_all.js 2019",
19-
"start:all": "bun ./start_all.js",
20-
"start:today": "bun ./start_all.js today",
21-
"prepare-today": "bun ./prepare_day.js",
19+
"start:2019": "bun ./scripts/start_all.js 2019",
20+
"start:all": "bun ./scripts/start_all.js",
21+
"start:today": "bun ./scripts/start_all.js today",
22+
"prepare-today": "bun ./scripts/prepare_day.js",
2223
"lint": "eslint .",
2324
"lint:fix": "eslint . --fix",
24-
"generate-config": "bun ./generate-config.js"
25+
"generate-config": "bun ./scripts/generate-config.js"
2526
},
2627
"repository": {
2728
"type": "git",

prepare_day.js renamed to scripts/prepare_day.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from "node:fs";
22
import * as cheerio from "cheerio";
3-
import { config } from "./config/config.js";
3+
import { config } from "../config/config.js";
44

55
// ========================= //
66
// = Copyright (c) NullDev = //

start_all.js renamed to scripts/start_all.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import fs from "node:fs";
22
import path from "node:path";
33
import { execSync } from "node:child_process";
4-
import { fileURLToPath } from "url";
5-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
64

75
// ========================= //
86
// = Copyright (c) NullDev = //
@@ -18,7 +16,7 @@ if (YEARS[0] === "today"){
1816
DAY = String(new Date().getDate());
1917
}
2018

21-
if (!YEARS.length) YEARS = fs.readdirSync(__dirname, { withFileTypes: true })
19+
if (!YEARS.length) YEARS = fs.readdirSync(".", { withFileTypes: true })
2220
.filter(d => d.isDirectory() && d.name.startsWith("2"))
2321
.map(d => d.name);
2422

@@ -36,7 +34,7 @@ YEARS.forEach(y => {
3634
-----------------------------\x1b[0m\n`,
3735
);
3836

39-
const dirs = fs.readdirSync(path.join(__dirname, y), { withFileTypes: true })
37+
const dirs = fs.readdirSync(path.join(".", y), { withFileTypes: true })
4038
.filter(dirEnt => dirEnt.isDirectory() && String(dirEnt.name).toLowerCase().includes("day_"))
4139
.map(dirEnt => dirEnt.name);
4240

@@ -50,8 +48,8 @@ YEARS.forEach(y => {
5048
DIRECTORIES.forEach(element => {
5149
const day = element.replace("Day_", "");
5250

53-
const PART1 = path.join(__dirname, y, element, "part_1.js");
54-
const PART2 = path.join(__dirname, y, element, "part_2.js");
51+
const PART1 = path.join(".", y, element, "part_1.js");
52+
const PART2 = path.join(".", y, element, "part_2.js");
5553

5654
console.log(`\x1b[36m---====[ DAY ${day} ]====---\x1b[0m\n`);
5755

0 commit comments

Comments
 (0)