1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

npm script で呼ばれたjs内でTerminal側の作業ディレクトリを参照する

Last updated at Posted at 2024-11-08
runner.cjs
const process = require("node:process");

// これは nodejs の作業ディレクトリ
const CWD = process.cwd();

// こっちは terminal(bash | PowerShell | CMD) の作業ディレクトリ
// PWD - bashから参照可
// INIT_CWD - bash | PowerShell | CMD で参照可
const PWD = process.env.PWD || process.env.INIT_CWD;
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?