Hve Blog
취소

JS/TS | 배열 메서드

배열 메서드 아래의 배열 메서드는 모두 원본 배열을 건드리지 않는다. reduce를 제외한 메서드의 인자는 공통적으로 (element, index)=>any 형태의 콜백 함수이며, index를 사용하지 않는다면 (element)=>any로 사용해도 된다. 반복 foreach : 요소 반복 const items = [1, 2, 3, ...

Node.js | rollup + typescript 환경 구성

node.js 프로젝트 세팅 yarn init 패키지 설치 electron 설치 yarn add electron typescript 설치 yarn add -D typescript yarn add tslib rollup 설치 yarn add -D rollup yarn add -D @rollup/plugin-node-resolve @r...

RUST | rust 리눅스 환경 구축

rust 설치 # rust 설치 curl https://sh.rustup.rs -sSf | sh # 환경변수 즉시 반영 (터미널 재시작시 자동 적용 됨) source $HOME/.cargo/env rustc (단일 파일 빌드) # main.rs를 빌드 rustc main.rs cargo # 프로젝트 생성 cargo new 프로젝트명 -...

npm link

npm link npm link는 로컬에서 패키지를 심볼릭 링크를 통해 다른 프로젝트에서 사용할 수 있도록 하는 명령어다. 외부로 배포하지 않은 채로 로컬 패키지에 임포트할 수 있으며, 심볼릭 링크를 이용하므로 패키지의 변경사항이 즉시 반영되므로 패키지 개발 중 테스트에 유용하다. 링크 생성 & 연결 # [P] 링크를 생성할 패키지 프로...

Typescript | Iterator 이해

Iterable, Iterator 타입 선정리를 하면 다음과 같다. Iterable은 Symbol.iterator 필드에 ()=>Iterator을 가진 객체 Iterator는 next 필드에 ()=>IteratorResult을 가진 객체 IteratorResult는 { value:any, done:boolean } 형식의 타...

저장용 | React.js 프로젝트 세팅

프로젝트 생성 npm create vite@latest framework : React varient : typescript React.js 디렉토리 구조 생성 mkdir src/data mkdir src/components mkdir src/context mkdir src/utils mkdir src/lib mkdir src/ap...

React.js | vite 기반 React 프로젝트 생성

Vite 기반 React 프로젝트 생성 npm create vite@latest 생성할 디렉토리에서 다음 명령을 통해 간단히 실행할 수 있다. 생성 중 framework와 varient를 물어보는데, 방향키를 통해 선택하고 Enter로 진행할 수 있다. framework는 React를 선택하면 되며 variant의 경우 일반적으로 typesc...

SSH | SSH 리버스 터널링

SSH 리버스 터널링 (SSH 포트포워딩) SSH 리버스 터널링은 SSH 서버를 경유해 타 서버로 연결할 수 있도록 해준다. 접속하려는 서버에서 경유 서버에 리버스 터널링으로 연결하면, 다른 사용자가 서버에 직접 접근하지 않고 경유 서버에 연결함으로써 서버에 접근할 수 있다. 따라서 다음과 같은 경우에 사용이 가능하다. 네트워크에서 공유기...

Node.js | npm 패키지 개발시 ESM, CommonJS 모두 대응하기

// CommonJS (CJS) 방식 const MyPackage = require("my-package"); // ECMAScript Modules (ESM) 방식 import MyPackage from "my-package"; 현재 Node.js에서는 크게 두가지의 모듈 시스템을 지원하는데, CommonJS (CJS)와 ECMAScript M...

저장용 | jest 설치

의존성 yarn add -D typescript jest @types/jest ts-node ts-jest jest.config.ts 추가 module.exports = { preset: 'ts-jest', testEnvironment: 'node', transform: { '^.+\\.tsx?$': 'ts-jest', ...

Hub | Typescript

설치 node.js에 typescript 설치 설정 파일 tsconfig.json compilerOptions 정보

Hub | Electron 프레임워크

관련 정보 자료 허브 : 타입스크립트 세팅 프로젝트 세팅 리액트 기반 프로젝트 세팅 (비권장) 트러블슈팅 …was compiled against a different Node.js version 오류

개발 환경 | WSL2 설치

WSL WSL(Windows Subsystem for Linux)는 윈도우 환경에서 네이티브 Linux 환경을 설치하고 실행할 수 있게 해주는 기능이다. WSL 설치 최초 설치 wsl --install cmd 또는 Powershell을 관리자 권한으로 실행하고 명령을 실행한다. 1 온라인 목록 확인 wsl --list --online ...

윈도우 openssh 서버 설치

모든 명령어는 powershell에서 실행된다 윈도우 openssh 설치 Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 서비스 실행 및 부팅시 자동 실행 설정 # 서비스 실행 Start-Service sshd # 부팅시 서비스 실행 등록 Set-Service -Name sshd...

Typescript | tsconfig.json - compilerOptions

프로젝트 incremental 증분 빌드를 허용한다. 필요 정보는 .tsbuildinfo 디렉토리에 저장된다. 작성 예정 tsBuildInfoFile composite disableSourceOfProjectReferenceRedirect disableSolutionSearching disableReferencedProje...

Node.js | Typescript 세팅

Typescript 설치 패키지 설치 yarn add typescript tsx @types/node --dev 패키지 별 용도 typescript : typescript를 javascript로 컴파일 @types/node : node.js에서 typescript의 타입 유형을 로드한다. 추가로 VSCode에서 코드 힌팅을 해당 패키지...

Node.js | fs 모듈

node:fs node:fs 모듈은 파일과 디렉토리에 접근 및 조작할 수 있는 기능을 제공한다. 목차 임포트 각 API 타입별 차이 API 파일 쓰기 파일 읽기 파일 제거 디렉토리 생성 디렉토리 제거 파일 존재 및 상태 확인 파일 복사 파일...

Git | Branch 관련 명령어

Branch 확인 # git barnch > git branch * main 브랜치 목록을 확인한다. -a 옵션을 사용하면 원격 저장소으 브랜치도 확인할 수 있다. # git status > git status On branch main Your branch is up to date with 'origin/main'. noth...

Typescript | type, interface 문법

type 문법 // type 타입명 = 타입 type Name = string; type Age = number; type Address = number|string; // number 또는 string이 올 수 있음 type Sex = "male"|"female"; // 값 자체가 올 수 있음 typeof를 통한 type 지정 const D...

Node.js | "...was compiled against a different Node.js version using" 문제

“…was compiled against a different Node.js version using” 에러 Error: The module '라이브러리 경로' was compiled against a different Node.js version using NODE_MODULE_VERSION 115. This version of Node.js re...