ui-thing 0.0.9 → 0.0.10

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/package.json CHANGED
@@ -1,17 +1,19 @@
1
1
  {
2
2
  "name": "ui-thing",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "CLI used to add Nuxt 3 components to a project",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "main": "./dist/index.js",
8
8
  "repository": {
9
- "url": "https://github.com/BayBreezy/ui-thing-cli"
9
+ "url": "git+https://github.com/BayBreezy/ui-thing-cli.git"
10
10
  },
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
14
- "bin": "./dist/index.js",
14
+ "bin": {
15
+ "ui-thing": "dist/index.js"
16
+ },
15
17
  "scripts": {
16
18
  "build": "tsup",
17
19
  "dev": "tsup --watch",
@@ -57,7 +57,7 @@ export const init = new Command()
57
57
  type: true,
58
58
  });
59
59
  }
60
- // Wriet changes to nuxt config
60
+ // Write changes to nuxt config
61
61
  await updateConfig(cfg.nuxtConfig, "nuxt.config.ts");
62
62
  // instal deps
63
63
  await installPackages(uiConfig.packageManager, INIT_DEPS, INIT_DEV_DEPS);
@@ -0,0 +1,42 @@
1
+ import { Command } from "commander";
2
+ import prompts from "prompts";
3
+
4
+ import { addShortcutFiles } from "../utils/addShortcutFiles";
5
+ import { addModuleToConfig, getNuxtConfig, updateConfig } from "../utils/config";
6
+ import { installPackages } from "../utils/installPackages";
7
+ import { printFancyBoxMessage } from "../utils/printFancyBoxMessage";
8
+
9
+ export const addShortcuts = new Command()
10
+ .command("shortcuts")
11
+ .name("shortcuts")
12
+ .description("Add the defineShortcuts & useShortcuts composables to your project.")
13
+ .action(async () => {
14
+ await addShortcutFiles();
15
+
16
+ // Get nuxt config
17
+ const cfg = await getNuxtConfig();
18
+ addModuleToConfig(cfg.nuxtConfig, ["@vueuse/nuxt"]);
19
+ // Write changes to nuxt config
20
+ await updateConfig(cfg.nuxtConfig, "nuxt.config.ts");
21
+
22
+ const { pkgManager } = await prompts({
23
+ name: "pkgManager",
24
+ type: "select",
25
+ message: "Which package manager are you using?",
26
+ choices: [
27
+ { title: "npm", value: "npm" },
28
+ { title: "yarn", value: "yarn" },
29
+ { title: "pnpm", value: "pnpm" },
30
+ { title: "bun", value: "bun" },
31
+ ],
32
+ });
33
+ if (!pkgManager) return process.exit(0);
34
+
35
+ // install prettier dep
36
+ await installPackages(pkgManager, undefined, ["@vueuse/math", "@vueuse/nuxt"]);
37
+ printFancyBoxMessage(
38
+ "All Done!",
39
+ { title: "Shortcuts Added" },
40
+ `Check the composables folder for the defineShortcuts & useShortcuts composables.`
41
+ );
42
+ });