- 将所有图片路径从绝对路径改为使用 process.env.PUBLIC_URL - 修复 HomePage.tsx 中所有图片引用 - 修复 CoursePage.tsx 中所有图片引用 - 确保图片在 GitHub Pages 上正确加载 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
pkg-dir 
Find the root directory of a Node.js project or npm package
Install
$ npm install pkg-dir
Usage
/
└── Users
└── sindresorhus
└── foo
├── package.json
└── bar
├── baz
└── example.js
// example.js
const pkgDir = require('pkg-dir');
(async () => {
const rootDir = await pkgDir(__dirname);
console.log(rootDir);
//=> '/Users/sindresorhus/foo'
})();
API
pkgDir([cwd])
Returns a Promise for either the project root path or undefined if it couldn't be found.
pkgDir.sync([cwd])
Returns the project root path or undefined if it couldn't be found.
cwd
Type: string
Default: process.cwd()
Directory to start from.
Related
- pkg-dir-cli - CLI for this module
- pkg-up - Find the closest package.json file
- find-up - Find a file by walking up parent directories
License
MIT © Sindre Sorhus