Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v6.0.0 #208

Merged
merged 12 commits into from
Sep 14, 2021
Prev Previous commit
Next Next commit
Log environment in one place during build
  • Loading branch information
smithki committed Sep 10, 2021
commit ec3976acdc94ad00eec1faf3973386a5e13fcd3d
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
command: |
AUTO_VERSION=$(yarn auto version)
if [[ $AUTO_VERSION ]]; then
yarn lerna version $(echo $AUTO_VERSION) --force-publish --no-git-tag-version --yes
yarn lerna version $(echo $AUTO_VERSION) --no-git-tag-version --no-push --yes
fi

- run:
Expand Down
6 changes: 5 additions & 1 deletion scripts/bin/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { runAsyncProcess } from '../utils/run-async-process';
import { handleError } from '../utils/handle-script-error';
import { printSeparator } from '../utils/print-separator';
import { getPackages, logPackages, promptForPackage } from '../utils/workspace-helpers';
import { environment, logEnvironment } from '../utils/environment';

async function buildPkgs(PKG: string) {
printSeparator('Building');
Expand All @@ -25,9 +26,12 @@ async function main() {
const PKG = await promptForPackage();
const { packages } = await getPackages(PKG);

console.log(`\nFound ${packages.length} packages to build:\n`);
console.log(`\nFound ${packages.length} packages to build:`);
logPackages(packages);

console.log(`\nBuilding with the following environment:`);
logEnvironment();

await buildPkgs(PKG);
}

Expand Down
14 changes: 14 additions & 0 deletions scripts/utils/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@
/* eslint-disable global-require */
/* eslint-disable import/no-dynamic-require */

import chalk from 'chalk';
import path from 'path';

export const environment = {
WEB_VERSION: require(path.resolve(__dirname, '../../packages/magic-sdk/package.json')).version,
REACT_NATIVE_VERSION: require(path.resolve(__dirname, '../../packages/@magic-sdk/react-native/package.json')).version,
};

export function logEnvironment() {
console.log(
Object.entries(environment)
.map(([key, value]) => {
return chalk`{rgb(0,255,255) ${key}}{gray :} ${value}`;
})
.reduce((prev, next, i) => {
if (i === 0) return chalk`${prev} {gray -} ${next}`;
return chalk`${prev}\n {gray -} ${next}`;
}, ''),
);
}
5 changes: 0 additions & 5 deletions scripts/utils/microbundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ export async function microbundle(
external?: string;
} = {},
) {
console.log(
Object.entries(environment)
.map(([key, value]) => `${key}=${value}`)
.join(','),
);
if (options.output) {
/* eslint-disable prettier/prettier */
const args = [
Expand Down