ui-thing 0.0.8 → 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/CHANGELOG.md +36 -0
- package/README.md +8 -0
- package/dist/index.js +523 -380
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
- package/src/commands/init.ts +1 -1
- package/src/commands/shortcuts.ts +42 -0
- package/src/comp.ts +145 -139
- package/src/index.ts +2 -0
- package/src/templates/shortcuts.ts +217 -0
- package/src/utils/addShortcutFiles.ts +12 -0
- package/src/utils/constants.ts +0 -2
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ui-thing",
|
|
3
|
-
"version": "0.0.
|
|
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":
|
|
14
|
+
"bin": {
|
|
15
|
+
"ui-thing": "dist/index.js"
|
|
16
|
+
},
|
|
15
17
|
"scripts": {
|
|
16
18
|
"build": "tsup",
|
|
17
19
|
"dev": "tsup --watch",
|
package/src/commands/init.ts
CHANGED
|
@@ -57,7 +57,7 @@ export const init = new Command()
|
|
|
57
57
|
type: true,
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
//
|
|
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
|
+
});
|