@tacktext/widget 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/dist/cli.js +15 -0
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -28,6 +28,7 @@ var fs = __toESM(require("fs"));
28
28
  var path = __toESM(require("path"));
29
29
  var readline = __toESM(require("readline"));
30
30
  var crypto = __toESM(require("crypto"));
31
+ var import_child_process = require("child_process");
31
32
  async function prompt(question) {
32
33
  const rl = readline.createInterface({
33
34
  input: process.stdin,
@@ -45,6 +46,12 @@ function generateSlug(name) {
45
46
  const suffix = crypto.randomBytes(3).toString("hex");
46
47
  return `${base}-${suffix}`;
47
48
  }
49
+ function detectPackageManager() {
50
+ const cwd = process.cwd();
51
+ if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
52
+ if (fs.existsSync(path.join(cwd, "yarn.lock"))) return "yarn";
53
+ return "npm";
54
+ }
48
55
  function detectFramework() {
49
56
  const cwd = process.cwd();
50
57
  const pkgPath = path.join(cwd, "package.json");
@@ -184,6 +191,14 @@ async function main() {
184
191
  `);
185
192
  return;
186
193
  }
194
+ const pm = detectPackageManager();
195
+ console.log(`\u{1F4E5} Installing @tacktext/widget via ${pm}...`);
196
+ try {
197
+ const installCmd = pm === "yarn" ? "yarn add @tacktext/widget" : pm === "pnpm" ? "pnpm add @tacktext/widget" : "npm install @tacktext/widget";
198
+ (0, import_child_process.execSync)(installCmd, { cwd: process.cwd(), stdio: "inherit" });
199
+ } catch {
200
+ console.log("\u26A0\uFE0F Auto-install failed. Run manually: npm install @tacktext/widget");
201
+ }
187
202
  injectWidget(entryFile, slug);
188
203
  console.log("\n\u{1F389} Tack is ready!\n");
189
204
  console.log("Next steps:");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tacktext/widget",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Add Figma-like commenting to any web prototype",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",