unictive-angular 1.0.40 → 1.0.42

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.
@@ -17,6 +17,7 @@ const folders_to_copy = [
17
17
  "src/app/app.ts",
18
18
  "src/app/app.html",
19
19
  "src/environments",
20
+ "tools",
20
21
 
21
22
  // "package.json",
22
23
  // "tailwind.config.js",
@@ -0,0 +1,123 @@
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
+ }
@@ -8,7 +8,8 @@ const listPackagesToInstall = [
8
8
  "npm i @ngx-pwa/local-storage --legacy-peer-deps",
9
9
  "npm i primeng --legacy-peer-deps",
10
10
  "npm i primeicons @primeuix/themes quill --legacy-peer-deps",
11
- "npm i sweetalert2 --legacy-peer-deps"
11
+ "npm i sweetalert2 --legacy-peer-deps",
12
+ "npm link"
12
13
  ];
13
14
 
14
15
 
@@ -41,6 +42,13 @@ async function update_package_json() {
41
42
 
42
43
 
43
44
 
45
+ // ------------------- Bin -------------------
46
+ pkg.bin = pkg.bin || {};
47
+ pkg.bin["dx"] = "./tools/dx.js";
48
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
49
+ show_status('Menambahkan field "bin" ke package.json!', "success");
50
+
51
+
44
52
  listPackagesToInstall.forEach(command => {
45
53
  console.log(`Menjalankan: ${command}`);
46
54
  try {
@@ -51,6 +59,9 @@ async function update_package_json() {
51
59
  }
52
60
  });
53
61
 
62
+
63
+
64
+
54
65
 
55
66
 
56
67
  // ------------------- Angular file replacements -------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unictive-angular",
3
- "version": "1.0.40",
3
+ "version": "1.0.42",
4
4
  "description": "CLI untuk membuat project Angular dengan struktur kustom (Modules, Core, API, Shared).",
5
5
  "scripts": {
6
6
  "build": "npm version patch && npm publish --access public"