unictive-angular 1.1.1 → 1.1.3
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const { show_status} = require('./showStatus');
|
|
3
|
-
const { execSync, spawn} = require("child_process");
|
|
3
|
+
const { execSync, spawn, spawnSync} = require("child_process");
|
|
4
4
|
const readline = require("readline");
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
@@ -107,7 +107,7 @@ async function create_project() {
|
|
|
107
107
|
// let cmd = `ng new ${projectName} ${zoneless ? "--zoneless" : ""} --ssr=false --skip-git --style=css`;
|
|
108
108
|
let cmd = `ng new ${projectName} --zoneless --ssr=false --skip-git --style=css`;
|
|
109
109
|
// let cmd = `ng new ${projectName} --ssr=false --skip-git --style=css`;
|
|
110
|
-
|
|
110
|
+
spawnSync(cmd.trim(), { stdio: "inherit", shell: true });
|
|
111
111
|
process.chdir(projectName);
|
|
112
112
|
show_status("Project berhasil dibuat!", "success");
|
|
113
113
|
return projectName;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
image: node:
|
|
1
|
+
image: node:24 # Gunakan image Node.js versi 22 untuk menjalankan pipeline
|
|
2
2
|
|
|
3
3
|
definitions:
|
|
4
4
|
caches:
|
|
@@ -8,7 +8,7 @@ definitions:
|
|
|
8
8
|
steps:
|
|
9
9
|
- step: &build-angular
|
|
10
10
|
name: Build Angular App
|
|
11
|
-
image: node:
|
|
11
|
+
image: node:24
|
|
12
12
|
caches:
|
|
13
13
|
- node
|
|
14
14
|
script:
|
|
@@ -5,11 +5,11 @@ const { execSync} = require("child_process");
|
|
|
5
5
|
|
|
6
6
|
const listPackagesToInstall = [
|
|
7
7
|
"npm i tailwindcss @tailwindcss/postcss postcss --force",
|
|
8
|
-
"npm i @ngx-pwa/local-storage
|
|
9
|
-
"npm i primeng --legacy-peer-deps",
|
|
10
|
-
"npm i primeicons @primeuix/themes quill --legacy-peer-deps",
|
|
11
|
-
"npm i sweetalert2
|
|
12
|
-
"npm i @angular/animations
|
|
8
|
+
"npm i @ngx-pwa/local-storage ",
|
|
9
|
+
// "npm i primeng --legacy-peer-deps",
|
|
10
|
+
// "npm i primeicons @primeuix/themes quill --legacy-peer-deps",
|
|
11
|
+
"npm i sweetalert2 ",
|
|
12
|
+
"npm i @angular/animations ",
|
|
13
13
|
];
|
|
14
14
|
|
|
15
15
|
|
|
@@ -33,6 +33,7 @@ async function update_package_json() {
|
|
|
33
33
|
pkg.scripts["build:dev"] = "ng build --configuration=dev";
|
|
34
34
|
pkg.scripts["build:staging"] = "ng build --configuration=staging";
|
|
35
35
|
pkg.scripts["build:prod"] = "ng build --configuration=production";
|
|
36
|
+
pkg.scripts["staging"] = "git pull && npm run build:staging";
|
|
36
37
|
|
|
37
38
|
pkg.scripts["lint"] = "ng lint";
|
|
38
39
|
pkg.scripts["test"] = "ng test --watch=false";
|
package/index.js
CHANGED
|
@@ -18,7 +18,6 @@ const { refactorAngularJson } = require('./bin/utils/refactorAngularJson');
|
|
|
18
18
|
const { create_project } = require('./bin/utils/createProject');
|
|
19
19
|
const { copy_template } = require('./bin/utils/createStructure');
|
|
20
20
|
// const { update_package_json } = require('./utils/updatePackageJson');
|
|
21
|
-
const updateNotifier = require('update-notifier');
|
|
22
21
|
const chalk = require('chalk');
|
|
23
22
|
|
|
24
23
|
|
|
@@ -33,37 +32,53 @@ const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "./package.json"), "
|
|
|
33
32
|
|
|
34
33
|
|
|
35
34
|
|
|
35
|
+
// ===================== Cek Versi via npm view =====================
|
|
36
|
+
function check_latest_version() {
|
|
37
|
+
try {
|
|
38
|
+
const latest = execSync(`npm view ${pkg.name} version`, { stdio: "pipe" }).toString().trim();
|
|
39
|
+
return latest;
|
|
40
|
+
} catch {
|
|
41
|
+
return null; // Gagal cek (offline/error), izinkan lanjut
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function compare_versions(current, latest) {
|
|
46
|
+
const a = current.split(".").map(Number);
|
|
47
|
+
const b = latest.split(".").map(Number);
|
|
48
|
+
for (let i = 0; i < 3; i++) {
|
|
49
|
+
if ((b[i] || 0) > (a[i] || 0)) return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
36
54
|
// ===================== Cek argumen versi =====================
|
|
37
55
|
if (process.argv.includes("-v") || process.argv.includes("--version")) {
|
|
56
|
+
const latest = check_latest_version();
|
|
38
57
|
let versionInfo = `${pkg.name} v${pkg.version}`;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
versionInfo += ` (Versi terbaru: ${notifier.update.latest})`;
|
|
58
|
+
if (latest && compare_versions(pkg.version, latest)) {
|
|
59
|
+
versionInfo += ` (Versi terbaru: ${latest})`;
|
|
42
60
|
}
|
|
43
61
|
console.log(versionInfo);
|
|
44
62
|
process.exit(0);
|
|
45
63
|
}
|
|
46
64
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// const notifier = updateNotifier({ pkg, updateCheckInterval: 0 });
|
|
51
|
-
|
|
52
|
-
if (notifier.update) {
|
|
65
|
+
// ===================== Blokir jika ada versi baru =====================
|
|
66
|
+
const latestVersion = check_latest_version();
|
|
67
|
+
if (latestVersion && compare_versions(pkg.version, latestVersion)) {
|
|
53
68
|
console.log(chalk.yellow(`
|
|
54
69
|
┌───────────────────────────────────────────────────────────────┐
|
|
55
|
-
│
|
|
70
|
+
│ 🚫 UPDATE WAJIB - Perintah tidak dapat dijalankan! │
|
|
56
71
|
├───────────────────────────────────────────────────────────────┤
|
|
57
|
-
│ Versi lokal : ${chalk.red(
|
|
58
|
-
│ Versi terbaru : ${chalk.green(
|
|
72
|
+
│ Versi lokal : ${chalk.red(pkg.version.padEnd(44))}│
|
|
73
|
+
│ Versi terbaru : ${chalk.green(latestVersion.padEnd(44))}│
|
|
59
74
|
│ │
|
|
60
75
|
│ Jalankan perintah berikut untuk update: │
|
|
61
|
-
│ ${chalk.cyan(`npm i -g ${pkg.name}
|
|
76
|
+
│ ${chalk.cyan(`npm i -g ${pkg.name}`.padEnd(60))}│
|
|
62
77
|
│ │
|
|
63
|
-
│
|
|
64
|
-
│ dan perbaikan bug. │
|
|
78
|
+
│ Versi terbaru mungkin berisi fitur baru dan perbaikan bug. │
|
|
65
79
|
└───────────────────────────────────────────────────────────────┘
|
|
66
80
|
`));
|
|
81
|
+
process.exit(1);
|
|
67
82
|
}
|
|
68
83
|
|
|
69
84
|
|
|
@@ -79,7 +94,7 @@ function clear_and_header(version) {
|
|
|
79
94
|
console.log("================================================================");
|
|
80
95
|
console.log(`📦 Versi CLI: ${version}`);
|
|
81
96
|
console.log("🔧 Membuat project Angular dengan struktur:");
|
|
82
|
-
console.log("
|
|
97
|
+
console.log(" PAGES, CORE, API, SHARED");
|
|
83
98
|
console.log("⚡ Kompatibel dengan macOS, Linux, dan Windows");
|
|
84
99
|
console.log("🛡️ Versi Aman - Penanganan Error Lengkap");
|
|
85
100
|
console.log("👤 by - EkaHersada");
|
package/package.json
CHANGED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const { execSync } = require("child_process");
|
|
4
|
-
|
|
5
|
-
function run(cmd) {
|
|
6
|
-
console.log(`\n$ ${cmd}`);
|
|
7
|
-
execSync(cmd, { stdio: "inherit" });
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function branch() {
|
|
11
|
-
return execSync("git rev-parse --abbrev-ref HEAD").toString().trim();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const cmd = process.argv[2];
|
|
15
|
-
const arg = process.argv.slice(3).join(" ");
|
|
16
|
-
|
|
17
|
-
switch (cmd) {
|
|
18
|
-
|
|
19
|
-
case "feature":
|
|
20
|
-
|
|
21
|
-
if (!arg) {
|
|
22
|
-
console.log("❌ feature name required");
|
|
23
|
-
process.exit();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
run("git fetch origin");
|
|
27
|
-
run("git checkout development");
|
|
28
|
-
run("git pull origin development");
|
|
29
|
-
run(`git checkout -b feature/${arg}`);
|
|
30
|
-
|
|
31
|
-
console.log(`✅ feature/${arg} created`);
|
|
32
|
-
break;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
case "sync":
|
|
36
|
-
|
|
37
|
-
const b = branch();
|
|
38
|
-
|
|
39
|
-
run("git fetch origin");
|
|
40
|
-
run("git checkout development");
|
|
41
|
-
run("git pull origin development");
|
|
42
|
-
run(`git checkout ${b}`);
|
|
43
|
-
run("git rebase development");
|
|
44
|
-
|
|
45
|
-
console.log("✅ branch synced");
|
|
46
|
-
break;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
case "commit":
|
|
50
|
-
|
|
51
|
-
if (!arg) {
|
|
52
|
-
console.log("❌ commit message required");
|
|
53
|
-
process.exit();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
run("git add .");
|
|
57
|
-
run(`git commit -m "${arg}"`);
|
|
58
|
-
run(`git push origin ${branch()}`);
|
|
59
|
-
|
|
60
|
-
break;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
case "pr":
|
|
64
|
-
|
|
65
|
-
const bp = branch();
|
|
66
|
-
|
|
67
|
-
run(`gh pr create --base development --head ${bp} --title "${bp}"`);
|
|
68
|
-
|
|
69
|
-
break;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
case "finish":
|
|
73
|
-
|
|
74
|
-
const bf = branch();
|
|
75
|
-
|
|
76
|
-
run("git checkout development");
|
|
77
|
-
run("git pull origin development");
|
|
78
|
-
run(`git merge ${bf}`);
|
|
79
|
-
run("git push origin development");
|
|
80
|
-
|
|
81
|
-
run(`git branch -d ${bf}`);
|
|
82
|
-
run(`git push origin --delete ${bf}`);
|
|
83
|
-
|
|
84
|
-
console.log("🎉 feature merged");
|
|
85
|
-
break;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
case "start":
|
|
89
|
-
|
|
90
|
-
console.log("🚀 starting dev environment");
|
|
91
|
-
|
|
92
|
-
run("git pull");
|
|
93
|
-
run("npm install");
|
|
94
|
-
run("ng serve");
|
|
95
|
-
|
|
96
|
-
break;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
case "release":
|
|
100
|
-
|
|
101
|
-
console.log("📦 releasing project");
|
|
102
|
-
|
|
103
|
-
run("git checkout staging");
|
|
104
|
-
run("git merge development");
|
|
105
|
-
run("git push origin staging");
|
|
106
|
-
|
|
107
|
-
break;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
default:
|
|
111
|
-
|
|
112
|
-
console.log(`
|
|
113
|
-
DX CLI
|
|
114
|
-
|
|
115
|
-
dx feature <name> create feature branch
|
|
116
|
-
dx sync sync with development
|
|
117
|
-
dx commit "msg" commit + push
|
|
118
|
-
dx pr create pull request
|
|
119
|
-
dx finish merge feature
|
|
120
|
-
dx start start dev environment
|
|
121
|
-
dx release release to staging
|
|
122
|
-
`);
|
|
123
|
-
}
|