evophp 1.2.3 → 1.3.0

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/bin/evophp.js CHANGED
@@ -11,6 +11,7 @@ yargs(hideBin(process.argv))
11
11
  .command(require("../commands/dependencies"))
12
12
  .command(require("../commands/entry"))
13
13
  .command(require("../commands/help"))
14
+ .command(require("../commands/patch"))
14
15
  .demandCommand(1, "Please specify a valid command. Use --help to see available commands.")
15
16
  .help()
16
17
  .argv;
package/commands/init.js CHANGED
@@ -34,6 +34,22 @@ module.exports = {
34
34
 
35
35
  process.chdir(projectPath);
36
36
 
37
+ // copy sample files if they don't exist
38
+ const sampleFiles = [
39
+ { src: "../templates/sample.config.json", dest: "config.json" },
40
+ { src: "../templates/sample.composer.json", dest: "composer.json" },
41
+ { src: "../templates/sample.package.json", dest: "package.json" },
42
+ { src: "../templates/sample.color-scheme.css", dest: "color-scheme.css" },
43
+ ];
44
+
45
+ sampleFiles.forEach(file => {
46
+ const srcPath = path.join(__dirname, file.src);
47
+ const destPath = path.join(projectPath, file.dest);
48
+ if (!fs.existsSync(destPath)) {
49
+ fs.copyFileSync(srcPath, destPath);
50
+ }
51
+ });
52
+
37
53
  log.info(`Running bootstrap script: node evolution ${name}`);
38
54
  execSync(`node evolution ${name}`, { stdio: "inherit" });
39
55
 
@@ -0,0 +1,193 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const { execSync } = require("child_process");
4
+ const semver = require("semver");
5
+
6
+ // ==============================
7
+ // Utilities
8
+ // ==============================
9
+
10
+ function backupFile(filePath) {
11
+ const backupPath = filePath + ".backup";
12
+ fs.copyFileSync(filePath, backupPath);
13
+ console.log(`Backup created → ${path.basename(backupPath)}`);
14
+ }
15
+
16
+ function readJson(filePath) {
17
+ return JSON.parse(fs.readFileSync(filePath, "utf8"));
18
+ }
19
+
20
+ function writeJson(filePath, data) {
21
+ fs.writeFileSync(filePath, JSON.stringify(data, null, 2));
22
+ }
23
+
24
+ function detectPackageManager() {
25
+ if (fs.existsSync("pnpm-lock.yaml")) return "pnpm";
26
+ if (fs.existsSync("yarn.lock")) return "yarn";
27
+ return "npm";
28
+ }
29
+
30
+ function runInstall(manager) {
31
+ console.log(`Running ${manager} install...`);
32
+ execSync(`${manager} install`, { stdio: "inherit" });
33
+ }
34
+
35
+ // ==============================
36
+ // Merge Logic
37
+ // ==============================
38
+
39
+ function mergeSection(section, target, sample, options = {}) {
40
+ const { upgrade = false, ecosystem = "npm" } = options;
41
+
42
+ if (!sample[section]) return;
43
+
44
+ target[section] = target[section] || {};
45
+
46
+ for (const pkg in sample[section]) {
47
+ const incomingVersion = sample[section][pkg];
48
+ const currentVersion = target[section][pkg];
49
+
50
+ // ADD missing
51
+ if (!currentVersion) {
52
+ target[section][pkg] = incomingVersion;
53
+ console.log(`➕ Added ${section}:${pkg}@${incomingVersion}`);
54
+ continue;
55
+ }
56
+
57
+ // Optional upgrade
58
+ if (upgrade && ecosystem === "npm") {
59
+ try {
60
+ const incomingMin = semver.minVersion(incomingVersion);
61
+ const currentMin = semver.minVersion(currentVersion);
62
+
63
+ if (
64
+ incomingMin &&
65
+ currentMin &&
66
+ semver.gt(incomingMin, currentMin)
67
+ ) {
68
+ target[section][pkg] = incomingVersion;
69
+ console.log(
70
+ `⬆ Upgraded ${section}:${pkg} ${currentVersion} → ${incomingVersion}`
71
+ );
72
+ }
73
+ } catch (err) {
74
+ console.log(`⚠ Skipped version compare for ${pkg}`);
75
+ }
76
+ }
77
+ }
78
+ }
79
+
80
+ // ==============================
81
+ // Patch package.json
82
+ // ==============================
83
+
84
+ function patchPackageJson(options) {
85
+ const packagePath = path.join(process.cwd(), "package.json");
86
+ const samplePath = path.join(
87
+ __dirname,
88
+ "../templates/sample.package.json"
89
+ );
90
+
91
+ if (!fs.existsSync(packagePath)) {
92
+ console.error("package.json not found.");
93
+ process.exit(1);
94
+ }
95
+
96
+ const sample = readJson(samplePath);
97
+ const target = readJson(packagePath);
98
+
99
+ backupFile(packagePath);
100
+
101
+ mergeSection("dependencies", target, sample, {
102
+ ...options,
103
+ ecosystem: "npm",
104
+ });
105
+
106
+ mergeSection("devDependencies", target, sample, {
107
+ ...options,
108
+ ecosystem: "npm",
109
+ });
110
+
111
+ mergeSection("scripts", target, sample, options);
112
+
113
+ writeJson(packagePath, target);
114
+
115
+ console.log("✅ package.json patched successfully.");
116
+
117
+ const manager = detectPackageManager();
118
+ runInstall(manager);
119
+ }
120
+
121
+ // ==============================
122
+ // Patch composer.json
123
+ // ==============================
124
+
125
+ function patchComposerJson(options) {
126
+ const composerPath = path.join(process.cwd(), "composer.json");
127
+ const samplePath = path.join(
128
+ __dirname,
129
+ "../templates/sample.composer.json"
130
+ );
131
+
132
+ if (!fs.existsSync(composerPath)) {
133
+ console.warn("composer.json not found. Skipping...");
134
+ return;
135
+ }
136
+
137
+ const sample = readJson(samplePath);
138
+ const target = readJson(composerPath);
139
+
140
+ backupFile(composerPath);
141
+
142
+ mergeSection("require", target, sample, {
143
+ ...options,
144
+ ecosystem: "composer",
145
+ });
146
+
147
+ mergeSection("require-dev", target, sample, {
148
+ ...options,
149
+ ecosystem: "composer",
150
+ });
151
+
152
+ writeJson(composerPath, target);
153
+
154
+ console.log("✅ composer.json patched successfully.");
155
+
156
+ console.log("Running composer install...");
157
+ execSync("composer install", { stdio: "inherit" });
158
+ }
159
+
160
+ // ==============================
161
+ // CLI Export
162
+ // ==============================
163
+
164
+ module.exports = {
165
+ command: "patch",
166
+ aliases: ["p"],
167
+ describe:
168
+ "Patch package.json and composer.json with missing dependencies",
169
+
170
+ builder: {
171
+ upgrade: {
172
+ type: "boolean",
173
+ default: false,
174
+ describe: "Upgrade outdated dependencies to template version",
175
+ },
176
+ },
177
+
178
+ handler: async (argv) => {
179
+ try {
180
+ const options = {
181
+ upgrade: argv.upgrade,
182
+ };
183
+
184
+ patchPackageJson(options);
185
+ patchComposerJson(options);
186
+
187
+ console.log("🎉 All done!");
188
+ } catch (error) {
189
+ console.error("Error patching files:", error);
190
+ process.exit(1);
191
+ }
192
+ },
193
+ };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "evophp",
3
- "version": "1.2.3",
3
+ "version": "1.3.0",
4
4
  "description": "Command-line installer for the Evolution PHP framework",
5
5
  "bin": {
6
- "evophp": "./bin/evophp.js"
6
+ "evophp": "bin/evophp.js"
7
7
  },
8
8
  "main": "bin/evophp.js",
9
9
  "scripts": {
@@ -20,6 +20,7 @@
20
20
  "dotenv": "^16.4.7",
21
21
  "edit-json-file": "^1.8.0",
22
22
  "rimraf": "^6.0.1",
23
+ "semver": "^7.7.4",
23
24
  "yargs": "^17.7.2"
24
25
  },
25
26
  "keywords": [
@@ -31,4 +32,4 @@
31
32
  ],
32
33
  "author": "Kingsley Okafor",
33
34
  "license": "MIT"
34
- }
35
+ }
@@ -0,0 +1,26 @@
1
+ :root {
2
+ --shadow1: #222020;
3
+ --shadow2: #615959;
4
+ --shadow3: #949494;
5
+ --highlight1: #fff;
6
+ --highlight2: #dbdbdb;
7
+ --highlight3: #bdbdbd;
8
+ --color1: linear-gradient(180deg,#4e73df 10%,#224abe 100%); /* lighter color from the theme */
9
+ --color2: #2e51b6; /* darker color from the theme */
10
+ --yellow: #d1d126;
11
+ --blue: #63b3e9;
12
+ --green: #64bb64;
13
+ --red: #db2a2a;
14
+ --purple: #e547a1;
15
+ --muted: #d1d1d1;
16
+ --color3: #4e73df;
17
+ }
18
+
19
+ body.dark-theme {
20
+ --shadow1: #fff;
21
+ --shadow2: #dbdbdb;
22
+ --shadow3: #bdbdbd;
23
+ --highlight1: #222020;
24
+ --highlight2: #292525;
25
+ --highlight3: #323133;
26
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "<author>/<projectName>",
3
+ "description": "PHP/Vue development framework",
4
+ "type": "library",
5
+ "license": "proprietary",
6
+ "authors": [
7
+ {
8
+ "name": "<author>",
9
+ "email": "<authorEmail>"
10
+ }
11
+ ],
12
+ "minimum-stability": "dev",
13
+ "require": {
14
+ "inhere/sroute": "^3.0",
15
+ "jenssegers/blade": "^1.4",
16
+ "phpmailer/phpmailer": "^6.6",
17
+ "kktsvetkov/assoto": "^0.1",
18
+ "delight-im/cookie": "^3.4",
19
+ "ralouphie/getallheaders": "^3.0",
20
+ "kub-at/php-simple-html-dom-parser": "^1.9",
21
+ "league/oauth2-server": "^8.3",
22
+ "firebase/php-jwt": "^6.3",
23
+ "symfony/filesystem": "^6.2",
24
+ "josantonius/json": "^2.0",
25
+ "elasticemail/elasticemail-php": "^4.0",
26
+ "flow-php/array-dot": "1.x@dev",
27
+ "dragonmantank/cron-expression": "dev-master"
28
+ }
29
+ }
@@ -0,0 +1,114 @@
1
+ {
2
+ "main_website": "",
3
+ "mode": "development",
4
+ "timezone": "UTC",
5
+ "salt": "<salt>",
6
+ "hashing": null,
7
+ "Auth": {
8
+ "tokenLifetime": "86400",
9
+ "roles": {
10
+ "software_engineer": {
11
+ "name": "Software Engineer",
12
+ "capacity": [
13
+ 1,
14
+ 2,
15
+ 3,
16
+ 4,
17
+ 5,
18
+ 6,
19
+ 7,
20
+ 8,
21
+ 9,
22
+ 10
23
+ ]
24
+ },
25
+ "super_admin": {
26
+ "name": "Chief Admin",
27
+ "capacity": [
28
+ 2,
29
+ 3,
30
+ 4,
31
+ 5,
32
+ 6,
33
+ 7,
34
+ 8
35
+ ],
36
+ "index": "/admin/"
37
+ },
38
+ "admin": {
39
+ "name": "Operation Admin",
40
+ "capacity": [
41
+ 4,
42
+ 5
43
+ ]
44
+ },
45
+ "member": {
46
+ "name": "Users",
47
+ "capacity": [
48
+ 6,
49
+ 7,
50
+ 8
51
+ ]
52
+ },
53
+ "pending": {
54
+ "name": "Pending Users",
55
+ "capacity": [
56
+ 10
57
+ ]
58
+ },
59
+ "unverified": {
60
+ "name": "Users Pending Verification",
61
+ "capacity": [
62
+ 9
63
+ ]
64
+ }
65
+ },
66
+ "defaultRole": "member",
67
+ "clients": [
68
+ {
69
+ "client_id": "123456",
70
+ "secret": "123456",
71
+ "domain": "localhost:<port>",
72
+ "protocol": "http"
73
+ }
74
+ ],
75
+ "publickey": "<publickey>"
76
+ },
77
+ "site_name": "<projectName>",
78
+ "loginLink": "/accounts",
79
+ "links": {
80
+ "login": "/accounts",
81
+ "home": "/accounts",
82
+ "registration": "#",
83
+ "recoverPassword": "/accounts/#/recover-password"
84
+ },
85
+ "currentTheme": "Default",
86
+ "currency": {
87
+ "base": "USD",
88
+ "allowed": [
89
+ "USD",
90
+ "NGN",
91
+ "EUR",
92
+ "GBP"
93
+ ],
94
+ "apiKey": "<salt>",
95
+ "endPoint": "https:\/\/v6.exchangerate-api.com\/v6\/{key}\/latest\/{base}",
96
+ "rateKey": "conversion_rates",
97
+ "refreshes": 24
98
+ },
99
+ "modules": {
100
+ "Main": {
101
+ "entry": [
102
+ "Accounts/index",
103
+ "Main/index",
104
+ "Admin/index"
105
+ ],
106
+ "active": true,
107
+ "order": 0
108
+ }
109
+ },
110
+ "logo": null,
111
+ "logoWidth": 200,
112
+ "logoHeight": 69,
113
+ "hosted_logo": null
114
+ }
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "<projectName>",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "dev": "webpack --config webpack.dev.js",
8
+ "build": "webpack --config webpack.prod.js",
9
+ "watch": "webpack --watch --progress --config webpack.dev.js",
10
+ "open": "rundll32 url.dll,FileProtocolHandler http://localhost:<port>",
11
+ "php-server": "php -S localhost:<port>",
12
+ "start": "concurrently \"npm run php-server\" \"npm run watch\" \"npm run open\"",
13
+ "bundle": "node bundle.js"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/kinsokafor/evolution"
18
+ },
19
+ "keywords": [],
20
+ "author": "<author>",
21
+ "license": "ISC",
22
+ "bugs": {
23
+ "url": "https://github.com/kinsokafor/evolution/issues"
24
+ },
25
+ "homepage": "https://github.com/kinsokafor/evolution#readme",
26
+ "devDependencies": {
27
+ "acorn": "^8.14.0",
28
+ "archiver": "^6.0.1",
29
+ "concurrently": "^7.3.0",
30
+ "cross-env": "^7.0.3",
31
+ "css-loader": "^6.7.1",
32
+ "dotenv-webpack": "^8.0.1",
33
+ "edit-json-file": "^1.7.0",
34
+ "file-loader": "^6.2.0",
35
+ "glob": "^9.0.0",
36
+ "html-webpack-plugin": "^5.5.0",
37
+ "livereload": "^0.10.3",
38
+ "mini-css-extract-plugin": "^2.9.2",
39
+ "rimraf": "^4.0.0",
40
+ "sass": "^1.54.0",
41
+ "sass-loader": "^16.0.3",
42
+ "style-loader": "^3.3.1",
43
+ "svg-inline-loader": "^0.8.2",
44
+ "vue": "^3.5.13",
45
+ "vue-loader": "^17.0.0",
46
+ "vue-router": "^4.4.5",
47
+ "vue-style-loader": "^4.1.3",
48
+ "vue3-loading-overlay": "^0.0.0",
49
+ "webpack": "^5.96.1",
50
+ "webpack-cli": "^5.1.4",
51
+ "webpack-livereload-plugin": "^3.0.2",
52
+ "webpack-merge": "^5.8.0"
53
+ },
54
+ "dependencies": {
55
+ "@fortawesome/fontawesome-svg-core": "^6.2.1",
56
+ "@fortawesome/free-brands-svg-icons": "^6.2.1",
57
+ "@fortawesome/free-regular-svg-icons": "^6.2.1",
58
+ "@fortawesome/free-solid-svg-icons": "^6.2.1",
59
+ "@fortawesome/vue-fontawesome": "^3.0.2",
60
+ "@vueuse/core": "^11.2.0",
61
+ "animate.css": "^4.1.1",
62
+ "axios": "^1.7.7",
63
+ "chart.js": "^4.3.3",
64
+ "croppie": "^2.6.5",
65
+ "filepond": "^4.30.4",
66
+ "filepond-plugin-file-validate-type": "^1.2.8",
67
+ "flatpickr": "^4.6.13",
68
+ "jenesius-vue-modal": "^1.8.2",
69
+ "js-sha1": "^0.6.0",
70
+ "lodash": "^4.17.21",
71
+ "pinia": "^2.2.6",
72
+ "vee-validate": "^4.14.7",
73
+ "vue-chartjs": "^5.3.2",
74
+ "vue-select": "^4.0.0-beta.6",
75
+ "vue-trumbowyg": "^4.0.0",
76
+ "vue3-daterange-picker": "^1.0.1",
77
+ "yup": "^1.2.0"
78
+ }
79
+ }