@storm-software/git-tools 2.125.5 → 2.126.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/git.cjs CHANGED
@@ -1999,14 +1999,38 @@ var runReadme = async ({
1999
1999
  project,
2000
2000
  output: output3,
2001
2001
  clean = true,
2002
- prettier = true
2002
+ prettier = true,
2003
+ workspace = false
2003
2004
  }) => {
2004
2005
  const projectGraph = await projectGraph_js.createProjectGraphAsync({
2005
2006
  exitOnError: true
2006
2007
  });
2007
2008
  const projectConfigs = projectGraph_js.readProjectsConfigurationFromProjectGraph(projectGraph);
2008
- if (project) {
2009
- await runProjectReadme(project, {
2009
+ const workspaceRoot = chunkDFXXNV3C_cjs.findWorkspaceRootSafe(process.cwd());
2010
+ if (!workspaceRoot) {
2011
+ throw new Error(
2012
+ "Unable to find the workspace root. Please ensure you are running this command from within a workspace."
2013
+ );
2014
+ }
2015
+ let resolvedProject = project;
2016
+ if (workspace) {
2017
+ if (!fs$1.existsSync(Path.join(workspaceRoot, "project.json"))) {
2018
+ throw new Error(
2019
+ `The \`workspace\` flag was provided to the \`storm-git readme\` command-line interface, but a project.json file could not be found at the workspace root (${workspaceRoot}). Please ensure you are running this command from the root of your workspace.`
2020
+ );
2021
+ }
2022
+ const projectJson = JSON.parse(
2023
+ fs$1.readFileSync(Path.join(workspaceRoot, "project.json"), "utf8") ?? "{}"
2024
+ );
2025
+ if (!projectJson?.name) {
2026
+ throw new Error(
2027
+ `The \`workspace\` flag was provided to the \`storm-git readme\` command-line interface, but a name field could not be found in the project.json file at the workspace root (${workspaceRoot}). Please ensure the project.json file at the workspace root contains a name field.`
2028
+ );
2029
+ }
2030
+ resolvedProject = projectJson.name;
2031
+ }
2032
+ if (resolvedProject) {
2033
+ await runProjectReadme(resolvedProject, {
2010
2034
  templates,
2011
2035
  output: output3,
2012
2036
  clean,
@@ -3900,8 +3924,8 @@ function createProgram(config5) {
3900
3924
  "./tools/readme-templates"
3901
3925
  ).option(
3902
3926
  "--project <project>",
3903
- "The specific project to generate a README.md file for"
3904
- ).option("--output <path>", "Where to output the generated README.md file").option(
3927
+ "The specific project to generate a README.md file for. Defaults to the workspace root README.md if not provided."
3928
+ ).option("--workspace", "Run for the workspace root's README.md file").option("--output <path>", "Where to output the generated README.md file").option(
3905
3929
  "--clean",
3906
3930
  "Should the output README.md file be cleaned before generation",
3907
3931
  true