ultimate-jekyll-manager 0.0.14 → 0.0.16

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/dist/cli.js CHANGED
@@ -2,16 +2,47 @@
2
2
  const path = require('path');
3
3
  const jetpack = require('fs-jetpack');
4
4
 
5
- // Main Function
6
- function Main() {
7
- const self = this;
5
+ // Command Aliases
6
+ const DEFAULT = 'setup';
7
+ const ALIASES = {
8
+ clean: ['-c', '--clean'],
9
+ 'cloudflare-purge': ['-cf', 'purge', '--cloudflare-purge'],
10
+ install: ['-i', 'i', '--install'],
11
+ setup: ['-s', '--setup'],
12
+ version: ['-v', '--version'],
13
+ };
14
+
15
+ // Function to resolve command name from aliases
16
+ function resolveCommand(options) {
17
+ // Check if a command was explicitly passed via positional argument
18
+ if (options._.length > 0) {
19
+ const command = options._[0];
20
+ for (const [key, aliases] of Object.entries(ALIASES)) {
21
+ if (command === key || aliases.includes(command)) {
22
+ return key;
23
+ }
24
+ }
25
+ return command; // If not found in aliases, return as-is
26
+ }
27
+
28
+ // Check if any alias was passed as a flag (e.g., -g)
29
+ for (const [key, aliases] of Object.entries(ALIASES)) {
30
+ for (const alias of aliases) {
31
+ if (options[alias.replace(/^-+/, '')]) { // Remove leading `-`
32
+ return key;
33
+ }
34
+ }
35
+ }
36
+
37
+ return DEFAULT; // Fallback to default if no match is found
8
38
  }
9
39
 
10
- Main.prototype.process = async function (options) {
11
- const self = this;
40
+ // Main Function
41
+ function Main() {}
12
42
 
13
- // Determine the command (default to "setup" if none provided)
14
- const command = options._[0] || 'setup';
43
+ Main.prototype.process = async function (options) {
44
+ // Determine the command (use default if not provided)
45
+ const command = resolveCommand(options);
15
46
 
16
47
  try {
17
48
  // Get the command file path
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-jekyll-manager",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "Ultimate Jekyll dependency manager",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -72,20 +72,20 @@
72
72
  "json5": "^2.2.3",
73
73
  "lodash": "^4.17.21",
74
74
  "minimatch": "^10.0.1",
75
- "node-powertools": "^2.1.4",
75
+ "node-powertools": "^2.1.5",
76
76
  "npm-api": "^1.0.1",
77
77
  "sass": "^1.84.0",
78
78
  "through2": "^4.0.2",
79
79
  "web-manager": "^3.2.73",
80
80
  "webpack": "^5.97.1",
81
- "wonderful-fetch": "^1.3.2",
82
- "wonderful-version": "^1.2.0",
81
+ "wonderful-fetch": "^1.3.3",
82
+ "wonderful-version": "^1.3.2",
83
83
  "yargs": "^17.7.2"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "gulp": "^5.0.0"
87
87
  },
88
88
  "devDependencies": {
89
- "prepare-package": "^1.1.13"
89
+ "prepare-package": "^1.1.14"
90
90
  }
91
91
  }
File without changes