aboutsummaryrefslogtreecommitdiffstats
path: root/packages/monorepo-scripts/src/utils/utils.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-19 22:26:45 +0800
committerFabio Berger <me@fabioberger.com>2018-07-19 22:26:45 +0800
commit1df9370bc21e93267b5432668967118d7001abf2 (patch)
treef93659fd5bb33c988893ffdb467bfaa091ddbd0a /packages/monorepo-scripts/src/utils/utils.ts
parent7d840c7a1825f9aad16f3ab644e6f31819fefd59 (diff)
downloaddexon-0x-contracts-1df9370bc21e93267b5432668967118d7001abf2.tar.gz
dexon-0x-contracts-1df9370bc21e93267b5432668967118d7001abf2.tar.zst
dexon-0x-contracts-1df9370bc21e93267b5432668967118d7001abf2.zip
Renames to remove mention of Lerna
Diffstat (limited to 'packages/monorepo-scripts/src/utils/utils.ts')
-rw-r--r--packages/monorepo-scripts/src/utils/utils.ts24
1 files changed, 12 insertions, 12 deletions
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<LernaPackage[]> {
+ async getUpdatedPackagesAsync(shouldIncludePrivate: boolean): Promise<Package[]> {
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<UpdatedPackage[]> {
const result = await execAsync(`${constants.lernaExecutable} updated --json`, {