fix(normalize-packages): homepage for scoped packages
This commit is contained in:
parent
164cb39c1b
commit
0c027247ec
@ -2,7 +2,7 @@
|
||||
"private": true,
|
||||
"name": "@xen-orchestra/babel-config",
|
||||
"version": "0.0.0",
|
||||
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/packages/@xen-orchestra/babel-config",
|
||||
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/babel-config",
|
||||
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -14,7 +14,7 @@
|
||||
"scheduling",
|
||||
"task"
|
||||
],
|
||||
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/packages/@xen-orchestra/cron",
|
||||
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/cron",
|
||||
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -17,10 +17,11 @@ const deleteProperties = (object, property, properties) => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
require('exec-promise')(() =>
|
||||
getPackages(true).map(({ dir, name, package: pkg }) => {
|
||||
getPackages(true).map(({ dir, name, package: pkg, relativeDir }) => {
|
||||
pkg.name = name
|
||||
pkg.homepage = `https://github.com/vatesfr/xen-orchestra/tree/master/packages/${name}`
|
||||
pkg.homepage = `https://github.com/vatesfr/xen-orchestra/tree/master/${relativeDir}`
|
||||
pkg.bugs = `https://github.com/vatesfr/xen-orchestra/issues`
|
||||
pkg.repository = {
|
||||
type: 'git',
|
||||
|
@ -5,11 +5,13 @@ const ROOT_DIR = `${__dirname}/..`
|
||||
|
||||
const _getPackages = scope => {
|
||||
const inScope = scope !== undefined
|
||||
const dir = `${ROOT_DIR}/${inScope ? scope : 'packages'}`
|
||||
const relativeDir = inScope ? scope : 'packages'
|
||||
const dir = `${ROOT_DIR}/${relativeDir}`
|
||||
return fromCallback(cb => fs.readdir(dir, cb)).then(names =>
|
||||
names.map(name => ({
|
||||
dir: `${dir}/${name}`,
|
||||
name: inScope ? `${scope}/${name}` : name,
|
||||
relativeDir: `${relativeDir}/${name}`,
|
||||
}))
|
||||
)
|
||||
}
|
||||
@ -20,13 +22,13 @@ exports.getPackages = (readPackageJson = false) => {
|
||||
pkgs = [].concat(...pkgs) // flatten
|
||||
return readPackageJson
|
||||
? Promise.all(
|
||||
pkgs.map(pkg =>
|
||||
readFile(`${pkg.dir}/package.json`).then(data => {
|
||||
pkg.package = JSON.parse(data)
|
||||
return pkg
|
||||
}, noop)
|
||||
)
|
||||
).then(pkgs => pkgs.filter(pkg => pkg !== undefined))
|
||||
pkgs.map(pkg =>
|
||||
readFile(`${pkg.dir}/package.json`).then(data => {
|
||||
pkg.package = JSON.parse(data)
|
||||
return pkg
|
||||
}, noop)
|
||||
)
|
||||
).then(pkgs => pkgs.filter(pkg => pkg !== undefined))
|
||||
: pkgs
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user