Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ const nextConfig = {
dangerouslyAllowSVG: true,
contentDispositionType: "attachment",
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
remotePatterns: [
{
protocol: "https",
hostname: "*.s3.ap-northeast-2.amazonaws.com",
},
],
},
};

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "npm run open-browser && concurrently --raw \"npm run generate-api-routers\" \"next dev --experimental-https\"",
"dev": "npm run set-domain && npm run open-browser && next dev -H local.fineants.co --experimental-https",
"open-browser": "vite-node ./scripts/open-browser.ts",
"set-domain": "node ./scripts/set-domain.mjs",
"generate-api-routers": "vite-node ./scripts/proxy-api-router-generator.ts",
"build": "next build",
"start": "next start",
Expand All @@ -22,7 +23,6 @@
"@mui/x-date-pickers": "^7.22.3",
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.59.15",
"chokidar": "^4.0.1",
"dayjs": "^1.11.13",
"lightweight-charts": "^4.2.1",
"next": "14.2.10",
Expand Down
2 changes: 1 addition & 1 deletion scripts/open-browser.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { exec } from "child_process";
import os from "os";

const url = "https://localhost:3000";
const url = "https://local.fineants.co:3000";

if (os.platform() === "win32") {
exec(`start ${url}`);
Expand Down
98 changes: 0 additions & 98 deletions scripts/proxy-api-router-generator.ts

This file was deleted.

69 changes: 69 additions & 0 deletions scripts/set-domain.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { execSync } from "child_process";
import fs from "fs";
import os from "os";

const HOSTS_FILE =
os.platform() === "win32"
? "C:\\Windows\\System32\\drivers\\etc\\hosts"
: "/etc/hosts";
const DOMAIN = "local.fineants.co";
const IP_ADDRESS = "127.0.0.1";
const ENTRY = `${IP_ADDRESS} ${DOMAIN}`;


// 관리자 권한 여부 확인 함수
function isAdmin() {
try {
if (os.platform() === "win32") {
execSync("net session", { stdio: "ignore" });
return true;
} else {
return process.getuid && process.getuid() === 0;
}
} catch (err) {
return false;
}
}

// hosts 파일에서 특정 도메인이 존재하는지 확인하는 함수
function isDomainInHosts(domain) {
try {
const content = fs.readFileSync(HOSTS_FILE, "utf8");
return content.split("\n").some((line) => line.includes(domain));
} catch (err) {
console.error("❌ hosts 파일을 읽는 중 오류가 발생했습니다:", err);
return false;
}
}

// hosts 파일에 도메인 추가
function appendToHosts() {
try {
fs.appendFileSync(HOSTS_FILE, `\n${ENTRY}\n`);
console.log(`✅ ${DOMAIN} 도메인을 hosts 파일에 성공적으로 추가했습니다.`);
} catch (err) {
console.error("❌ hosts 파일을 수정하는 중 오류가 발생했습니다:", err);
}
}

function run() {
if (isDomainInHosts(DOMAIN)) {
console.log(`✅ ${DOMAIN} 도메인이 이미 hosts 파일에 등록되어 있습니다.`);
return;
}

console.log(`⚠️ ${DOMAIN} 도메인이 hosts 파일에 없습니다. 추가를 시도합니다.`);

if (isAdmin()) {
appendToHosts();
} else {
console.log("⚠️ hosts 파일을 수정하려면 관리자 권한이 필요합니다.");
if (os.platform() === "win32") {
console.log("🔒 관리자 권한으로 이 스크립트를 실행해주세요.");
} else {
console.log(`🔒 다음 명령어를 사용해 sudo로 실행해주세요:\n sudo node ${process.argv[1]}`);
}
}
}

run();
163 changes: 0 additions & 163 deletions scripts/utils/api-router-generator-utils.ts

This file was deleted.

Loading