aboutsummaryrefslogtreecommitdiffstats
path: root/packages/monorepo-scripts/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/monorepo-scripts/src')
-rw-r--r--packages/monorepo-scripts/src/deps_versions.ts54
1 files changed, 27 insertions, 27 deletions
diff --git a/packages/monorepo-scripts/src/deps_versions.ts b/packages/monorepo-scripts/src/deps_versions.ts
index 5c9a2d6ff..2c0aa6c54 100644
--- a/packages/monorepo-scripts/src/deps_versions.ts
+++ b/packages/monorepo-scripts/src/deps_versions.ts
@@ -6,51 +6,51 @@ import { sync as globSync } from 'glob';
import * as _ from 'lodash';
interface Dependencies {
- [depName: string]: string;
+ [depName: string]: string;
}
interface Versions {
- [packageName: string]: string;
+ [packageName: string]: string;
}
interface VersionsByDependency {
- [depName: string]: Versions;
+ [depName: string]: Versions;
}
const PACKAGE_JSON_GLOB = '../*/package.json';
function log(...args: any[]) {
- console.log(...args); // tslint:disable-line:no-console
+ console.log(...args); // tslint:disable-line:no-console
}
function getDependencies(path: string): Dependencies {
- const file = fs.readFileSync(path).toString();
- const parsed = JSON.parse(file);
- const dependencies = {
- ...parsed.dependencies,
- ...parsed.devDependencies,
- };
- return dependencies;
+ const file = fs.readFileSync(path).toString();
+ const parsed = JSON.parse(file);
+ const dependencies = {
+ ...parsed.dependencies,
+ ...parsed.devDependencies,
+ };
+ return dependencies;
}
const files = globSync(PACKAGE_JSON_GLOB);
const versionsByDependency: VersionsByDependency = {};
files.map(path => {
- const [_1, packageName, _2] = path.split('/');
- const dependencies = getDependencies(path);
- _.map(dependencies, (version: string, depName: string) => {
- if (_.isUndefined(versionsByDependency[depName])) {
- versionsByDependency[depName] = {};
- }
- versionsByDependency[depName][packageName] = version;
- });
+ const [_1, packageName, _2] = path.split('/');
+ const dependencies = getDependencies(path);
+ _.map(dependencies, (version: string, depName: string) => {
+ if (_.isUndefined(versionsByDependency[depName])) {
+ versionsByDependency[depName] = {};
+ }
+ versionsByDependency[depName][packageName] = version;
+ });
});
_.map(versionsByDependency, (versions: Versions, depName: string) => {
- if (_.uniq(_.values(versions)).length === 1) {
- delete versionsByDependency[depName];
- } else {
- log(chalk.bold(depName));
- _.map(versions, (version: string, packageName: string) => {
- log(`├── ${packageName} -> ${version}`);
- });
- }
+ if (_.uniq(_.values(versions)).length === 1) {
+ delete versionsByDependency[depName];
+ } else {
+ log(chalk.bold(depName));
+ _.map(versions, (version: string, packageName: string) => {
+ log(`├── ${packageName} -> ${version}`);
+ });
+ }
});