这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@jaredpalmer
Copy link
Contributor

@jaredpalmer jaredpalmer commented Mar 17, 2022

Allow --dry=json's stdout can be easily jq or JSON.parse'd.

Before

import { exec } from "child_process";

exec(
  "turbo run build --scope=app --since=HEAD^ --dry=json",
  (error, stdout, stderr) => {
    if (error) {
      console.error(`exec error: ${error}`);
      return;
    }

    const { packages } = JSON.parse(stdout);
    // JSON.parse error "• Packages changed since x in scope app" invalid json
  }
);

After

import { exec } from "child_process";

exec(
  "~/dev/vercel/turbo/cli/turbo run build --scope=storefront --since=HEAD^ --dry=json",
  (error, stdout, stderr) => {
    if (error) {
      console.error(`exec error: ${error}`);
      return;
    }

    const stuff = JSON.parse(stdout);
    // no error
  }
);

@vercel
Copy link
Contributor

vercel bot commented Mar 17, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/vercel/turbo-site/DgEwtvruCbE1PWF5FYAQw1r7XYZn
✅ Preview: https://turbo-site-git-jp-fixquietly-resolve-scope.vercel.sh

@jaredpalmer
Copy link
Contributor Author

(Initially i went to refactor ResolvePackages to make it a pure function, but given we are about to change everything with --filter, wasn't worth it)

@gsoltis
Copy link
Contributor

gsoltis commented Mar 17, 2022

I wouldn't mind just dropping the couple of output lines. I don't think they are adding much, since in the actual run case we print the packages in scope. We probably don't need to also repeat the user's flag values back to them.

@jaredpalmer
Copy link
Contributor Author

Fair enough

@kodiakhq kodiakhq bot merged commit 1e87849 into main Mar 17, 2022
@kodiakhq kodiakhq bot deleted the jp/fix/quietly-resolve-scope branch March 17, 2022 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants