ripal-ui 1.0.0 → 1.0.1

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/config.js ADDED
@@ -0,0 +1,79 @@
1
+ // config.js
2
+ import path from 'path';
3
+ import fs from 'fs';
4
+
5
+ let config = {}; // Placeholder for the config values
6
+
7
+ // Define the default config
8
+ const defaultConfig = {
9
+ appName: "",
10
+ appLangs: {
11
+ default: null,
12
+ en: require('./lang/en.json')
13
+ },
14
+ colors: {
15
+ primary: "#3B82F6",
16
+ transparent: "#ffffff00",
17
+ white: "#fff",
18
+ slate: {
19
+ 100: "#F1F5F9",200: "#E2E8F0",300: "#CBD5E1",
20
+ 400: "#94A3B8",500: "#64748B",600: "#475569",
21
+ 700: "#334155",800: "#1E293B",900: "#0F172A",
22
+ },
23
+ green: {
24
+ 100: "#DCFCE7",200: "#BBF7D0",300: "#86EFAC ",
25
+ 400: "#4ADE7F",500: "#22C55E",600: "#16A34A",
26
+ 700: "#15803D",800: "#166534",900: "#14532D",
27
+ },
28
+ orange: {
29
+ 100: "#FFEDD5",200: "#FED7AA",300: "#FDBA74",
30
+ 400: "#FB923C",500: "#F87316",600: "#EA580C",
31
+ 700: "#C2410C",800: "#9A3412",900: "#7C2D12",
32
+ },
33
+ purple: {
34
+ 100: "#F3E8FF",200: "#E9D5FF",300: "#D8B4FE",
35
+ 400: "#C084FC",500: "#A855F7",600: "#9333EA",
36
+ 700: "#7E22CE",800: "#6B21A8",900: "#581C87",
37
+ },
38
+ blue: {
39
+ 100: "#D8EAFE",200: "#BFD8FE",300: "#94C5FD",
40
+ 400: "#60A5FA",500: "#3B82F6",600: "#2563EB",
41
+ 700: "#1D4ED8",800: "#1E41AF",900: "#1E3A8A",
42
+ },
43
+ red: {
44
+ 100: "#FEE2E2",200: "#FECACA",300: "#FCA5A5",
45
+ 400: "#F87171",500: "#EF4444",600: "#DC2626",
46
+ 700: "#B91C1C",800: "#991B1B",900: "#7F1D1D",
47
+ },
48
+ lime: {
49
+ 100: "#ECFCCB",200: "#D9F99D",300: "#BEF264",
50
+ 400: "#A3E635",500: "#84CC16",600: "#65A30D",
51
+ 700: "#4D7C0F",800: "#3F6212",900: "#365314",
52
+ },
53
+ yellow: {
54
+ 100: "#FEF9C3",200: "#FEF08A",300: "#FDE047",
55
+ 400: "#FACC15",500: "#EAB308",600: "#CA8A04",
56
+ 700: "#A16207",800: "#854D0E",900: "#713F12",
57
+ }
58
+ }
59
+ }
60
+
61
+ try {
62
+ // Resolve the path to ripal-ui.config.js in the user's project root
63
+ const configFilePath = path.resolve(process.cwd(), 'ripal-ui.config.js');
64
+
65
+ // Check if the config file exists
66
+ if (fs.existsSync(configFilePath)) {
67
+ // Load and parse the config file
68
+ config = require(configFilePath);
69
+ } else {
70
+ console.warn("ripal-ui.config.js not found. Using default config.");
71
+ config = defaultConfig;
72
+ }
73
+ } catch (error) {
74
+ console.error("Error loading ripal-ui.config.js:", error);
75
+ config = defaultConfig; // Fallback to default config in case of an error
76
+ }
77
+
78
+ // Export the loaded config
79
+ export default config;
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "ripal-ui",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A collection of React elements and components",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "build": "babel elements components --out-dir dist"
7
+ "build": "babel elements components --out-dir dist",
8
+ "postinstall": "node ./scripts/generateConfig.js"
8
9
  },
9
10
  "dependencies": {
10
11
  "react": "^18.0.0",
@@ -0,0 +1,73 @@
1
+ // ./scripts/generateConfig.js
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ // Define the config file content
6
+ const configContent = `
7
+ const config = {
8
+ appName: "",
9
+ appLangs: {
10
+ default: null,
11
+ en: require('./lang/en.json')
12
+ },
13
+ colors: {
14
+ primary: "#3B82F6",
15
+ transparent: "#ffffff00",
16
+ white: "#fff",
17
+ slate: {
18
+ 100: "#F1F5F9",200: "#E2E8F0",300: "#CBD5E1",
19
+ 400: "#94A3B8",500: "#64748B",600: "#475569",
20
+ 700: "#334155",800: "#1E293B",900: "#0F172A",
21
+ },
22
+ green: {
23
+ 100: "#DCFCE7",200: "#BBF7D0",300: "#86EFAC ",
24
+ 400: "#4ADE7F",500: "#22C55E",600: "#16A34A",
25
+ 700: "#15803D",800: "#166534",900: "#14532D",
26
+ },
27
+ orange: {
28
+ 100: "#FFEDD5",200: "#FED7AA",300: "#FDBA74",
29
+ 400: "#FB923C",500: "#F87316",600: "#EA580C",
30
+ 700: "#C2410C",800: "#9A3412",900: "#7C2D12",
31
+ },
32
+ purple: {
33
+ 100: "#F3E8FF",200: "#E9D5FF",300: "#D8B4FE",
34
+ 400: "#C084FC",500: "#A855F7",600: "#9333EA",
35
+ 700: "#7E22CE",800: "#6B21A8",900: "#581C87",
36
+ },
37
+ blue: {
38
+ 100: "#D8EAFE",200: "#BFD8FE",300: "#94C5FD",
39
+ 400: "#60A5FA",500: "#3B82F6",600: "#2563EB",
40
+ 700: "#1D4ED8",800: "#1E41AF",900: "#1E3A8A",
41
+ },
42
+ red: {
43
+ 100: "#FEE2E2",200: "#FECACA",300: "#FCA5A5",
44
+ 400: "#F87171",500: "#EF4444",600: "#DC2626",
45
+ 700: "#B91C1C",800: "#991B1B",900: "#7F1D1D",
46
+ },
47
+ lime: {
48
+ 100: "#ECFCCB",200: "#D9F99D",300: "#BEF264",
49
+ 400: "#A3E635",500: "#84CC16",600: "#65A30D",
50
+ 700: "#4D7C0F",800: "#3F6212",900: "#365314",
51
+ },
52
+ yellow: {
53
+ 100: "#FEF9C3",200: "#FEF08A",300: "#FDE047",
54
+ 400: "#FACC15",500: "#EAB308",600: "#CA8A04",
55
+ 700: "#A16207",800: "#854D0E",900: "#713F12",
56
+ }
57
+ }
58
+ }
59
+
60
+ export default config
61
+ `;
62
+
63
+ // Path to generate the config file in the user's project root
64
+ const configFilePath = path.resolve(process.cwd(), 'ripal-ui.config.js');
65
+
66
+ // Check if the config file already exists
67
+ if (!fs.existsSync(configFilePath)) {
68
+ // Write the config file
69
+ fs.writeFileSync(configFilePath, configContent);
70
+ console.log('ripal-ui.config.js has been generated in the root project.');
71
+ } else {
72
+ console.log('ripal-ui.config.js already exists. No changes made.');
73
+ }