slicejs-cli 1.0.33 → 1.0.35

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/client.js CHANGED
@@ -52,6 +52,7 @@ sliceClient
52
52
  .action((componentName, options) => {
53
53
  const { Category } = options;
54
54
  deleteComponent(componentName, Category);
55
+ listComponents();
55
56
  });
56
57
 
57
58
  // Comando para listar todos los componentes
@@ -0,0 +1,12 @@
1
+ export default class Print{
2
+ constructor(){}
3
+
4
+ static error(message) {
5
+ console.error('\x1b[31m', `❌ Error: ${message}`, '\x1b[0m');
6
+ }
7
+
8
+ static success(message) {
9
+ console.log('\x1b[32m', `✅ Success: ${message}`, '\x1b[0m');
10
+ }
11
+
12
+ }
@@ -9,10 +9,10 @@ export default class Validations{
9
9
 
10
10
  static isValidCategory(category){
11
11
  const categoryVariations = {
12
- 'Service': ['service', 'servicio', 'serv'],
13
- 'Visual': ['visual', 'vis'],
14
- 'Provider': ['provider', 'proveedor', 'prov'],
15
- 'Structural': ['structural', 'estructural', 'est']
12
+ 'Service': ['service', 'servicio', 'serv', 's'],
13
+ 'Visual': ['visual', 'vis', 'v'],
14
+ 'Provider': ['provider', 'proveedor', 'prov' , 'p'],
15
+ 'Structural': ['structural', 'estructural', 'est', 'st']
16
16
  };
17
17
 
18
18
  let categoryIsValid = false;
@@ -26,5 +26,5 @@ export default class Validations{
26
26
  return ({isValid: categoryIsValid, category: category})
27
27
  }
28
28
 
29
-
29
+
30
30
  }
@@ -2,25 +2,26 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
  import Validations from '../Validations.js';
4
4
  const __dirname = path.dirname(new URL(import.meta.url).pathname);
5
-
5
+ import Print from '../Print.js';
6
6
 
7
7
  function modifyComponent(componentName, category, addProperties, removeProperties) {
8
8
  if (!componentName) {
9
- console.error('Component name is required');
9
+ Print.error('Component name is required');
10
10
  return;
11
11
  }
12
12
 
13
13
  if (!Validations.isValidComponentName(componentName)) {
14
- console.error('Invalid component name. Please use only alphanumeric characters and start with a letter.');
14
+ Print.error('Invalid component name. Please use only alphanumeric characters and start with a letter.');
15
15
  return;
16
16
  }
17
17
 
18
18
 
19
19
 
20
+
20
21
  let flagCategory = Validations.isValidCategory(category);
21
22
 
22
23
  if (!flagCategory.isValid) {
23
- console.error('Invalid category. Please use one of the following categories: Service, Visual, Provider, Structural');
24
+ Print.error('Invalid category. Please use one of the following categories: Service, Visual, Provider, Structural');
24
25
  return;
25
26
  }
26
27
 
@@ -33,7 +34,7 @@ function modifyComponent(componentName, category, addProperties, removePropertie
33
34
  componentPath=componentPath.slice(1);
34
35
 
35
36
  if (!fs.existsSync(componentPath)) {
36
- console.error(`Component '${componentName}' does not exist.`);
37
+ Print.error(`Component '${componentName}' does not exist.`);
37
38
  return;
38
39
  }
39
40
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicejs-cli",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
4
4
  "description": "Command client for developing web applications with Slice.js",
5
5
  "main": "client.js",
6
6
  "scripts": {