From bfe959c219a7681006c86fc41499600395773829 Mon Sep 17 00:00:00 2001 From: Jefferson Ribeiro Date: Tue, 30 Jan 2024 15:41:21 +0100 Subject: [PATCH] Review: fix undefined version & add running feedback --- packages/generator-widget/bin.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/generator-widget/bin.js b/packages/generator-widget/bin.js index c74ff2ca..cf982702 100644 --- a/packages/generator-widget/bin.js +++ b/packages/generator-widget/bin.js @@ -1,8 +1,14 @@ #!/usr/bin/env node +const { readFileSync } = require("fs"); +var { join } = require("path"); const { execSync } = require("child_process"); -const version = process.env.npm_package_version; +const chalk = require("chalk"); +const packageJson = readFileSync(join(__dirname, "package.json")); +const version = JSON.parse(packageJson).version; const args = process.argv.slice(2); + +console.log(chalk.bold.blueBright("Running widget generator...")); execSync(`npm install -g yo @mendix/generator-widget@${version}`); execSync(`yo @mendix/widget@${version} ${args.join(" ")}`, { stdio: "inherit" });