mirror of
https://github.com/primer/css.git
synced 2024-11-23 20:38:58 +03:00
fix warning about root
This commit is contained in:
parent
b183d91cbc
commit
c371303a8a
@ -8,8 +8,7 @@ module.exports = function addPackageMeta(options = {}) {
|
||||
return (files, metal, done) => {
|
||||
const root = metal.source()
|
||||
for (const [path, file] of Object.entries(files)) {
|
||||
const fullPath = join(root, path)
|
||||
const pkg = getPackageRelativeTo(dirname(fullPath))
|
||||
const pkg = getPackageRelativeTo(path, root)
|
||||
if (pkg) {
|
||||
file[namespace].package = fields ? pluck(pkg, fields) : pkg
|
||||
} else {
|
||||
@ -20,7 +19,8 @@ module.exports = function addPackageMeta(options = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
function getPackageRelativeTo(dir) {
|
||||
function getPackageRelativeTo(file, root) {
|
||||
let dir = join(root, dirname(file))
|
||||
if (dir in cache) {
|
||||
return cache[dir]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user