vueless 0.0.667 → 0.0.668

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.
@@ -0,0 +1,5 @@
1
+ import { vuelssInit } from "./init.js";
2
+
3
+ export const commands = {
4
+ init: vuelssInit,
5
+ };
@@ -0,0 +1,39 @@
1
+ /* eslint-disable no-console */
2
+
3
+ import { cwd } from "node:process";
4
+ import path from "node:path";
5
+ import { writeFile } from "node:fs/promises";
6
+ import { styleText } from "node:util";
7
+
8
+ import {
9
+ DEFAULT_VUELESS_CONFIG_NAME,
10
+ DEFAULT_VUELESS_CONFIG_CONTNET,
11
+ TYPESCRIPT_EXT,
12
+ JAVASCRIPT_EXT,
13
+ } from "../constants.js";
14
+
15
+ const destPath = path.join(cwd(), DEFAULT_VUELESS_CONFIG_NAME);
16
+
17
+ const vuelessInitOptions = ["--ts", "--js"];
18
+
19
+ export async function vuelssInit(options) {
20
+ const isValidOptions = options.every((option) => vuelessInitOptions.includes(option));
21
+
22
+ if (options.length && !isValidOptions) {
23
+ throw new Error("Ivalid options were provided");
24
+ }
25
+
26
+ const fileExt = options.includes("--ts") ? TYPESCRIPT_EXT : JAVASCRIPT_EXT;
27
+ const formattedDestPath = path.format({ ...path.parse(destPath), base: "", ext: fileExt });
28
+
29
+ console.log(formattedDestPath);
30
+
31
+ await writeFile(formattedDestPath, DEFAULT_VUELESS_CONFIG_CONTNET, "utf-8");
32
+
33
+ const successMessage = styleText(
34
+ "green",
35
+ `Success: ${formattedDestPath.split(path.sep).at(-1)} was created in ${cwd()} directory`,
36
+ );
37
+
38
+ console.log(successMessage);
39
+ }
@@ -0,0 +1,48 @@
1
+ export const DEFAULT_VUELESS_CONFIG_NAME = "vueless.config.js";
2
+ export const DEFAULT_EXIT_CODE = 0;
3
+ export const FAILURE_CODE = 1;
4
+ export const TYPESCRIPT_EXT = ".ts";
5
+ export const JAVASCRIPT_EXT = ".js";
6
+ export const DEFAULT_VUELESS_CONFIG_CONTNET = `
7
+ export default {
8
+ /**
9
+ * Global settings.
10
+ */
11
+ strategy: "merge",
12
+ brand: "grayscale",
13
+ gray: "cool",
14
+ darkMode: "auto",
15
+ ring: 4,
16
+ ringOffset: 0,
17
+ ringOffsetColorLight: "#ffffff", // white
18
+ ringOffsetColorDark: "#111827", // gray-900
19
+ rounding: 8,
20
+
21
+ /**
22
+ * Directive settings.
23
+ */
24
+ directive: {},
25
+
26
+ /**
27
+ * Component settings.
28
+ */
29
+ component: /*tw*/ {},
30
+
31
+ /**
32
+ * Tailwind CSS theme config.
33
+ * https://tailwindcss.com/docs/theme
34
+ */
35
+ tailwindTheme: {
36
+ extend: {
37
+ colors: {},
38
+ },
39
+ },
40
+
41
+ /**
42
+ * Custom classes TailwindMerge settings.
43
+ * All lists of rules available here:
44
+ * https://github.com/dcastil/tailwind-merge/blob/v2.3.0/src/lib/default-config.ts
45
+ */
46
+ tailwindMerge: {},
47
+ };
48
+ `;
package/bin/index.js ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+
3
+ /* eslint-disable no-console */
4
+
5
+ import { commands } from "./commands/index.js";
6
+
7
+ import { DEFAULT_EXIT_CODE, FAILURE_CODE } from "./constants.js";
8
+
9
+ const [command, ...options] = process.argv.slice(2);
10
+
11
+ try {
12
+ if (!command || command === "undefiend") {
13
+ process.exit(DEFAULT_EXIT_CODE);
14
+ }
15
+
16
+ if (command in commands) {
17
+ commands[command](options);
18
+ } else {
19
+ throw new Error(`There is no such command: ${command}`);
20
+ }
21
+ } catch (error) {
22
+ console.error(error.message);
23
+ process.exit(error.code || FAILURE_CODE);
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.667",
3
+ "version": "0.0.668",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -33,7 +33,7 @@
33
33
  "build": "npm run pre:start && storybook build --docs",
34
34
  "preview": "vite preview --host --outDir=storybook-static",
35
35
  "ts:check": "vue-tsc --build --force",
36
- "release:prepare": "npm run pre:start && rm -rf dist && mkdir -p dist && cp -r src/. package.json LICENSE README.md dist/",
36
+ "release:prepare": "npm run pre:start && rm -rf dist && mkdir -p dist && cp -r src/. package.json LICENSE README.md dist/ && cp -r bin dist/bin",
37
37
  "release:beta": "release-it --ci --npm.publish --preRelease=beta --increment=prerelease",
38
38
  "release:patch": "release-it patch --ci --npm.publish",
39
39
  "release:minor": "release-it minor --ci --npm.publish --git.tag --github.release",
@@ -42,6 +42,9 @@
42
42
  "lint:fix": "eslint --fix src/ .storybook/",
43
43
  "lint:ci": "eslint --no-fix --max-warnings=0"
44
44
  },
45
+ "bin": {
46
+ "vueless": "./bin/index.js"
47
+ },
45
48
  "dependencies": {
46
49
  "@tailwindcss/forms": "^0.5.9",
47
50
  "cva": "^1.0.0-beta.1",