github-pages-deploy-action/node_modules/pkg-dir/index.js

11 lines
297 B
JavaScript
Raw Normal View History

2020-01-28 13:07:56 +08:00
'use strict';
const path = require('path');
const findUp = require('find-up');
2020-03-22 05:13:25 +08:00
module.exports = cwd => findUp('package.json', {cwd}).then(fp => fp ? path.dirname(fp) : null);
2020-01-28 13:07:56 +08:00
module.exports.sync = cwd => {
2020-03-22 05:13:25 +08:00
const fp = findUp.sync('package.json', {cwd});
return fp ? path.dirname(fp) : null;
2020-01-28 13:07:56 +08:00
};