분류 전체보기

    Node.js 환경에서 파일과 디렉터리를 재귀적으로 삭제할 수 있게 해주는 유틸리티<img src="https://tistory1.daumcdn.net/tistory_admin/blogs/image/category/new_ico_5.gif" style="vertical-align:middle; padding-left:5px; width:10px; height:10px;"/>

    Node.js 환경에서 파일과 디렉터리를 재귀적으로 삭제할 수 있게 해주는 유틸리티

    Node를 위한 UNIX 명령 rm -rf이다. (폴더 삭제)Cross-Platform 방식은 rimraf라는 것을 사용한다.https://www.npmjs.com/package/rimraf  rimraf는 Node.js 환경에서 파일과 디렉터리를 재귀적으로 삭제할 수 있게 해주는 유틸리티이다. 특히, Windows와 같이 파일 시스템 잠금 이슈가 있는 플랫폼에서도 문제없이 동작하도록 설계되어 있다.rimraf는 npm에서 설치할 수 있는 패키지로, 명령어 하나로 모든 하위 디렉터리와 파일을 강제적으로 삭제할 수 있게 해 준다. 이를 통해 rm -rf와 비슷한 동작을 Node.js에서 쉽게 사용할 수 있다.설치npm install rimraf  사용 예시rimraf('path/to/directory', ..

    GraphQL Code Generator, 타입스크립트 정의 자동 생성

    GraphQL Code Generator, 타입스크립트 정의 자동 생성

    GraphQL Code Generator 주요 기능:GraphQL 쿼리로부터 타입스크립트 타입 생성Apollo Client, React Hooks와 통합 지원GraphQL 스키마 및 쿼리 자동 생성  설치, Apollo와 함께 사용할 GraphQL Code Generator 플러그인을 설치https://the-guild.dev/graphql/codegen/docs/getting-started/installationnpm i graphqlnpm i -D typescript @graphql-codegen/clinpm i-D @graphql-codegen/typescript-operations @graphql-codegen/typescript // codegen.tsimport type { CodegenCon..

    [Apollo v.3] Reactive variables

    [Apollo v.3] Reactive variables

    Apollo 버전 3 새로운 기능https://www.apollographql.com/docs/react/local-state/reactive-variables  Reactive variablesReact에서 Apollo Client와 함께 사용하는 variables는 GraphQL 쿼리나 변이를 수행할 때 동적 값을 전달하는 방법이다.  Variables 사용 개요GraphQL 쿼리나 변이에서 동적 파라미터를 받는 부분을 정의한 후, React 컴포넌트에서 해당 변수를 Apollo Client의 useQuery나 useMutation 훅과 함께 전달한다.이렇게 전달된 변수는 쿼리나 변이의 조건을 조정하여 특정 데이터를 가져오거나 수정하는 데 사용된다.  makeVar는 Apollo Client의 Rea..

    카메라 컨트롤, Minecraft Controls

    카메라 컨트롤, Minecraft Controls

    Minecraft Controls 플레이어가 게임 세계와 상호작용하고 탐색할 수 있도록 도와주는 다양한 입력 장치의 설정이다.  PointerLockControls에 키보드 컨트롤 추가import * as THREE from "three";import { PointerLockControls } from "three/examples/jsm/controls/PointerLockControls";import { KeyController } from "./KeyController";/* 주제: Minecraft Controls : PointerLockControls에 키보드 컨트롤 추가 */export default function example() { /* Renderer 만들기 : html에 캔버스 미리..