From 1df9370bc21e93267b5432668967118d7001abf2 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 19 Jul 2018 16:26:45 +0200 Subject: Renames to remove mention of Lerna --- packages/monorepo-scripts/src/utils/utils.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'packages/monorepo-scripts/src/utils') diff --git a/packages/monorepo-scripts/src/utils/utils.ts b/packages/monorepo-scripts/src/utils/utils.ts index 78bac1e4e..f04b9b671 100644 --- a/packages/monorepo-scripts/src/utils/utils.ts +++ b/packages/monorepo-scripts/src/utils/utils.ts @@ -4,7 +4,7 @@ import { exec as execAsync } from 'promisify-child-process'; import semver = require('semver'); import { constants } from '../constants'; -import { GitTagsByPackageName, LernaPackage, UpdatedPackage } from '../types'; +import { GitTagsByPackageName, Package, UpdatedPackage } from '../types'; import { changelogUtils } from './changelog_utils'; @@ -12,13 +12,13 @@ export const utils = { log(...args: any[]): void { console.log(...args); // tslint:disable-line:no-console }, - getLernaPackages(rootDir: string): LernaPackage[] { + getPackages(rootDir: string): Package[] { const rootPackageJsonString = fs.readFileSync(`${rootDir}/package.json`, 'utf8'); const rootPackageJson = JSON.parse(rootPackageJsonString); if (_.isUndefined(rootPackageJson.workspaces)) { throw new Error(`Did not find 'workspaces' key in root package.json`); } - const lernaPackages = []; + const packages = []; for (const workspace of rootPackageJson.workspaces) { const workspacePath = workspace.replace('*', ''); const subpackageNames = fs.readdirSync(`${rootDir}/${workspacePath}`); @@ -30,27 +30,27 @@ export const utils = { try { const packageJsonString = fs.readFileSync(`${pathToPackageJson}/package.json`, 'utf8'); const packageJson = JSON.parse(packageJsonString); - const lernaPackage = { + const pkg = { location: pathToPackageJson, - package: packageJson, + packageJson, }; - lernaPackages.push(lernaPackage); + packages.push(pkg); } catch (err) { utils.log(`Couldn't find a 'package.json' for ${subpackageName}. Skipping...`); } } } - return lernaPackages; + return packages; }, - async getUpdatedLernaPackagesAsync(shouldIncludePrivate: boolean): Promise { + async getUpdatedPackagesAsync(shouldIncludePrivate: boolean): Promise { const updatedPublicPackages = await utils.getLernaUpdatedPackagesAsync(shouldIncludePrivate); const updatedPackageNames = _.map(updatedPublicPackages, pkg => pkg.name); - const allLernaPackages = utils.getLernaPackages(constants.monorepoRootPath); - const updatedPublicLernaPackages = _.filter(allLernaPackages, pkg => { - return _.includes(updatedPackageNames, pkg.package.name); + const allPackages = utils.getPackages(constants.monorepoRootPath); + const updatedPackages = _.filter(allPackages, pkg => { + return _.includes(updatedPackageNames, pkg.packageJson.name); }); - return updatedPublicLernaPackages; + return updatedPackages; }, async getLernaUpdatedPackagesAsync(shouldIncludePrivate: boolean): Promise { const result = await execAsync(`${constants.lernaExecutable} updated --json`, { -- cgit v1.2.3