Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(packages): move packages into their own scope. (#3413)
This will facilitate management of packages internally.
- Loading branch information
Showing
40 changed files
with
68 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,40 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const glob = require('glob'); | ||
const path = require('path'); | ||
|
||
const packageRoot = path.join(__dirname, '../packages'); | ||
|
||
// All the supported packages. Go through the packages directory and create a map of | ||
// name => fullPath. | ||
const packages = fs.readdirSync(packageRoot) | ||
.map(pkgName => ({ name: pkgName, root: path.join(packageRoot, pkgName) })) | ||
.filter(pkg => fs.statSync(pkg.root).isDirectory()) | ||
.reduce((packages, pkg) => { | ||
let pkgJson = JSON.parse(fs.readFileSync(path.join(pkg.root, 'package.json'), 'utf8')); | ||
let name = pkgJson['name']; | ||
packages[name] = { | ||
dist: path.join(__dirname, '../dist', pkg.name), | ||
packageJson: path.join(pkg.root, 'package.json'), | ||
root: pkg.root, | ||
relative: path.relative(path.dirname(__dirname), pkg.root), | ||
main: path.resolve(pkg.root, 'src/index.ts') | ||
}; | ||
return packages; | ||
}, {}); | ||
|
||
module.exports = packages; | ||
const packages = | ||
glob.sync(path.join(packageRoot, '**/package.json')) | ||
.filter(p => !p.match(/blueprints/)) | ||
.map(pkgPath => path.relative(packageRoot, path.dirname(pkgPath))) | ||
.map(pkgName => { | ||
return { name: pkgName, root: path.join(packageRoot, pkgName) }; | ||
}) | ||
.reduce((packages, pkg) => { | ||
let pkgJson = JSON.parse(fs.readFileSync(path.join(pkg.root, 'package.json'), 'utf8')); | ||
let name = pkgJson['name']; | ||
|
||
packages[name] = { | ||
dist: path.join(__dirname, '../dist', pkg.name), | ||
packageJson: path.join(pkg.root, 'package.json'), | ||
root: pkg.root, | ||
relative: path.relative(path.dirname(__dirname), pkg.root), | ||
main: path.resolve(pkg.root, 'src/index.ts') | ||
}; | ||
return packages; | ||
}, {}); | ||
|
||
|
||
module.exports = packages; | ||
|
||
|
||
// If we run this from the command line, just output the list of modules neatly formatted. | ||
if (require.main === module) { | ||
// eslint-disable-next-line no-console | ||
console.log(JSON.stringify(packages, null, 2)); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.