// 현재 실행된 stage 값을 참조하기
// 하지만 스크립트를 따로 작성하는게 더 효율적으로 보인다.

{
  "scripts": {
    "dev:hello": "echo ${npm_lifecycle_event#dev:}"
  }
}


Footnotes

  1. npm 스크립트의 이름을 얻는 방법에 대한 질문과 npm_lifecycle_event 환경 변수를 사용하는 방법으로 제안 ↩

  2. package.json 파일에서 스크립트를 사용하는 방법에 대한 개요, 기본 제공 환경 변수 목록도 포함 — “the npm_lifecycle_event environment variable is set to whichever stage of the cycle is being executed.” 스크립트는 sh 로 돌아서 bash 전용 ${var//a/b} 대신 POSIX ${var#prefix} 를 쓴다 — “Scripts are run by passing the line as a script argument to sh.” ↩

#213

Footnotes

  1. 이 명령은 업그레이드를 수행하기 전에 오래된 패키지를 표시하여 사용자가 업그레이드할 패키지를 선택할 수 있도록 합니다. ↩

  2. npm-check-updates는 지정된 버전을 무시하고 package.json 종속성을 최신 버전으로 업그레이드합니다 . ↩

#62

file: 로 파일 시스템의 패키지 디렉터리를 의존성으로 건다 — npm install --save ../foo/bar 로 설치하면 상대 경로로 이렇게 저장된다.1

{
  "dependencies": {
    "bar": "file:../foo/bar"
  }
}

Footnotes

  1. package.json | npm Docs: “As of version 2.0.0 you can provide a path to a local directory that contains a package.” / “in which case they will be normalized to a relative path and added to your package.json.” ↩

#65