unictive-angular 1.0.10 → 1.0.13

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.
Files changed (86) hide show
  1. package/.env +2 -0
  2. package/README.md +7 -5
  3. package/bin/index.js +32 -11
  4. package/bin/utils/auth.js +86 -0
  5. package/package.json +3 -2
  6. package/cobaa/.editorconfig +0 -17
  7. package/cobaa/.vscode/extensions.json +0 -4
  8. package/cobaa/.vscode/launch.json +0 -20
  9. package/cobaa/.vscode/tasks.json +0 -42
  10. package/cobaa/README.md +0 -59
  11. package/cobaa/angular.json +0 -91
  12. package/cobaa/package-lock.json +0 -9930
  13. package/cobaa/package.json +0 -35
  14. package/cobaa/public/favicon.ico +0 -0
  15. package/cobaa/src/app/app.config.ts +0 -12
  16. package/cobaa/src/app/app.html +0 -336
  17. package/cobaa/src/app/app.routes.ts +0 -3
  18. package/cobaa/src/app/app.scss +0 -0
  19. package/cobaa/src/app/app.spec.ts +0 -25
  20. package/cobaa/src/app/app.ts +0 -12
  21. package/cobaa/src/index.html +0 -13
  22. package/cobaa/src/main.ts +0 -6
  23. package/cobaa/src/styles.scss +0 -1
  24. package/cobaa/tsconfig.app.json +0 -15
  25. package/cobaa/tsconfig.json +0 -34
  26. package/cobaa/tsconfig.spec.json +0 -14
  27. package/test23/.editorconfig +0 -17
  28. package/test23/.vscode/extensions.json +0 -4
  29. package/test23/.vscode/launch.json +0 -20
  30. package/test23/.vscode/tasks.json +0 -42
  31. package/test23/README.md +0 -59
  32. package/test23/angular.json +0 -101
  33. package/test23/package-lock.json +0 -9930
  34. package/test23/package.json +0 -42
  35. package/test23/package.json.backup +0 -35
  36. package/test23/public/favicon.ico +0 -0
  37. package/test23/src/app/MODULES/auth/README.md +0 -10
  38. package/test23/src/app/MODULES/dashboard/README.md +0 -10
  39. package/test23/src/app/MODULES/home/README.md +0 -10
  40. package/test23/src/app/app.config.ts +0 -12
  41. package/test23/src/app/app.html +0 -336
  42. package/test23/src/app/app.routes.ts +0 -3
  43. package/test23/src/app/app.scss +0 -0
  44. package/test23/src/app/app.spec.ts +0 -25
  45. package/test23/src/app/app.ts +0 -12
  46. package/test23/src/app/core/README.md +0 -10
  47. package/test23/src/app/core/config/README.md +0 -10
  48. package/test23/src/app/core/guards/README.md +0 -10
  49. package/test23/src/app/core/interceptors/README.md +0 -10
  50. package/test23/src/app/core/models/README.md +0 -10
  51. package/test23/src/app/core/services/README.md +0 -10
  52. package/test23/src/app/shared/README.md +0 -10
  53. package/test23/src/app/shared/directives/README.md +0 -10
  54. package/test23/src/app/shared/pipes/README.md +0 -10
  55. package/test23/src/app/shared/ui/README.md +0 -10
  56. package/test23/src/app/shared/utils/README.md +0 -10
  57. package/test23/src/environments/environment.prod.ts +0 -5
  58. package/test23/src/environments/environment.staging.ts +0 -5
  59. package/test23/src/environments/environment.ts +0 -5
  60. package/test23/src/index.html +0 -13
  61. package/test23/src/main.ts +0 -6
  62. package/test23/src/styles.scss +0 -1
  63. package/test23/tsconfig.app.json +0 -15
  64. package/test23/tsconfig.json +0 -34
  65. package/test23/tsconfig.spec.json +0 -14
  66. package/testt/.editorconfig +0 -17
  67. package/testt/.vscode/extensions.json +0 -4
  68. package/testt/.vscode/launch.json +0 -20
  69. package/testt/.vscode/tasks.json +0 -42
  70. package/testt/README.md +0 -59
  71. package/testt/angular.json +0 -91
  72. package/testt/package-lock.json +0 -9930
  73. package/testt/package.json +0 -35
  74. package/testt/public/favicon.ico +0 -0
  75. package/testt/src/app/app.config.ts +0 -12
  76. package/testt/src/app/app.html +0 -336
  77. package/testt/src/app/app.routes.ts +0 -3
  78. package/testt/src/app/app.scss +0 -0
  79. package/testt/src/app/app.spec.ts +0 -25
  80. package/testt/src/app/app.ts +0 -12
  81. package/testt/src/index.html +0 -13
  82. package/testt/src/main.ts +0 -6
  83. package/testt/src/styles.scss +0 -1
  84. package/testt/tsconfig.app.json +0 -15
  85. package/testt/tsconfig.json +0 -34
  86. package/testt/tsconfig.spec.json +0 -14
package/.env ADDED
@@ -0,0 +1,2 @@
1
+ ADMIN_PASS=UnictiveMedia
2
+ DOTENV_CONFIG_SILENT=true
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # create-angular-project-safe
1
+ # Generate Project Angular Custom
2
2
 
3
- 🚀 **CLI Script untuk membuat proyek Angular dengan struktur kustom (Clean Architecture)**
3
+ 🚀 **CLI Script untuk membuat proyek Angular dengan struktur kustom**
4
4
  ⚡ Kompatibel dengan **macOS, Linux, Windows**
5
5
  👤 by [EkaHersada]
6
6
 
@@ -11,9 +11,10 @@
11
11
  - Otomatis membuat project Angular baru menggunakan **Angular CLI**.
12
12
  - Menambahkan struktur folder **Modules, Core, API, Shared**.
13
13
  - Otomatis membuat file contoh (`AppService`, `User Model`, dll).
14
+ - Mendapatkan fungsi Utility yang sering digunakan untuk pekerjaan.
14
15
  - Auto update `package.json` dengan script tambahan (`start:dev`, `build:dev`, dll).
16
+ - Include environment dev, staging, dan production.
15
17
  - Deteksi sistem operasi (macOS, Linux, Windows).
16
- - Spinner interaktif saat proses berjalan.
17
18
  - Fallback: Install otomatis **Angular CLI** jika belum ada.
18
19
  - Perintah **versi CLI** (`-v` / `--version`).
19
20
 
@@ -36,6 +37,7 @@ unictive-angular -v
36
37
  ## 🚀 Cara Penggunaan
37
38
 
38
39
  ### Buat proyek baru
40
+ Ketik command di bawah ini untuk generate project baru:
39
41
  ```bash
40
42
  unictive-angular
41
43
  ```
@@ -89,11 +91,11 @@ src/app/
89
91
 
90
92
  - **Node.js** (>= 16)
91
93
  - **npm** (>= 8)
92
- - **Angular CLI** (jika belum ada, akan otomatis diinstall)
94
+ - **Angular CLI** (>=18 jika belum ada, akan otomatis diinstall)
93
95
 
94
96
  ---
95
97
 
96
- ## 💡 Jalankan Proyek
98
+ ## 💡 Jalankan Project yang sudah di generate
97
99
 
98
100
  ```bash
99
101
  cd nama-project && ng serve
package/bin/index.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  /**
4
4
  * Script installer Angular Project dengan struktur kustom
@@ -18,33 +18,43 @@ const { create_structure } = require('./utils/createStructure');
18
18
  const { update_package_json } = require('./utils/updatePackageJson');
19
19
  const updateNotifier = require('update-notifier');
20
20
  const chalk = require('chalk');
21
+ const { login, logout } = require("./utils/auth");
21
22
 
22
23
 
23
24
  // Baca versi dari package.json
24
25
  const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "../package.json"), "utf8"));
25
26
 
27
+
28
+
26
29
  // ===================== Cek argumen versi =====================
27
30
  if (process.argv.includes("-v") || process.argv.includes("--version")) {
28
31
  console.log(`${pkg.name} v${pkg.version}`);
29
32
  process.exit(0);
30
33
  }
31
34
 
35
+
32
36
  // ===================== Notifikasi Update =====================
33
37
  const notifier = updateNotifier({ pkg, updateCheckInterval: 1000 * 60 * 60 * 6 });
38
+ // const notifier = updateNotifier({ pkg, updateCheckInterval: 0 });
34
39
 
35
40
  if (notifier.update) {
36
- console.log(`
37
- ${chalk.yellow('⚠ Update tersedia untuk unictive-angular CLI ini!')}
38
- ${chalk.gray('Versi lokal ')} : ${chalk.red(notifier.update.current)}
39
- ${chalk.gray('Versi terbaru')} : ${chalk.green(notifier.update.latest)}
40
-
41
- ${chalk.gray('Jalankan perintah berikut untuk update:')}
42
- ${chalk.cyan(`npm i -g ${pkg.name}`)}
43
-
44
- ${chalk.gray('Catatan: Versi terbaru ini mungkin berisi fitur tambahan dan perbaikan bug.')}
45
- `);
41
+ console.log(chalk.yellow(`
42
+ ┌───────────────────────────────────────────────────────────────┐
43
+ │ ⚠ Update tersedia untuk unictive-angular CLI ini! │
44
+ ├───────────────────────────────────────────────────────────────┤
45
+ │ Versi lokal : ${chalk.red(notifier.update.current)} │
46
+ │ Versi terbaru : ${chalk.green(notifier.update.latest)} │
47
+ │ │
48
+ │ Jalankan perintah berikut untuk update: │
49
+ │ ${chalk.cyan(`npm i -g ${pkg.name}`)} │
50
+ │ │
51
+ │ Catatan: Versi terbaru mungkin berisi fitur baru │
52
+ │ dan perbaikan bug. │
53
+ └───────────────────────────────────────────────────────────────┘
54
+ `));
46
55
  }
47
56
 
57
+
48
58
  // ===================== Utility =====================
49
59
  const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
50
60
  const clear = () => process.stdout.write("\x1Bc");
@@ -149,6 +159,17 @@ function copyRecursiveSync(src, dest) {
149
159
  // ===================== MARK:Main =====================
150
160
  async function main() {
151
161
 
162
+
163
+ // Periksa argumen logout
164
+ if (process.argv.includes("--logout")) {
165
+ logout();
166
+ console.log("🔒 Logout berhasil. Password akan diminta lagi nanti.");
167
+ process.exit(0);
168
+ }
169
+
170
+
171
+ await login();
172
+
152
173
  const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "../package.json"), "utf8"));
153
174
  clear_and_header(pkg.version);
154
175
 
@@ -0,0 +1,86 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const os = require("os");
4
+ const readline = require("readline");
5
+ process.env.DOTENV_CONFIG_SILENT = 'true';
6
+ require("dotenv").config();
7
+
8
+ // Lokasi file cache (disimpan di HOME user)
9
+ const CACHE_FILE = path.join(os.homedir(), ".my-cli-auth");
10
+
11
+ // Fungsi untuk minta password (input tersembunyi)
12
+ function askPassword(promptText) {
13
+ return new Promise((resolve) => {
14
+ const rl = readline.createInterface({
15
+ input: process.stdin,
16
+ output: process.stdout
17
+ });
18
+
19
+ process.stdin.on("data", (char) => {
20
+ char = char + "";
21
+ switch (char) {
22
+ case "\n":
23
+ case "\r":
24
+ case "\u0004":
25
+ process.stdout.write("\n");
26
+ break;
27
+ default:
28
+ process.stdout.clearLine(0);
29
+ process.stdout.cursorTo(0);
30
+ process.stdout.write(promptText + Array(rl.line.length + 1).join("*"));
31
+ break;
32
+ }
33
+ });
34
+
35
+ rl.question(promptText, (password) => {
36
+ rl.close();
37
+ resolve(password);
38
+ });
39
+ });
40
+ }
41
+
42
+ // Cek status login
43
+ function isAuthenticated() {
44
+ return fs.existsSync(CACHE_FILE);
45
+ }
46
+
47
+ // Simpan status login
48
+ function setAuthenticated() {
49
+ fs.writeFileSync(CACHE_FILE, Date.now().toString(), "utf8");
50
+ }
51
+
52
+ // Hapus status login
53
+ function logout() {
54
+ if (fs.existsSync(CACHE_FILE)) {
55
+ fs.unlinkSync(CACHE_FILE);
56
+ }
57
+ }
58
+
59
+ // Proses login
60
+ async function login() {
61
+ if (isAuthenticated()) {
62
+ console.log("🔐 Sudah login. Tidak perlu autentikasi ulang.");
63
+ return;
64
+ }
65
+
66
+ const correctPassword = process.env.ADMIN_PASS;
67
+ if (!correctPassword) {
68
+ console.error("❌ ADMIN_PASS tidak ditemukan di file .env");
69
+ process.exit(1);
70
+ }
71
+
72
+ const input = await askPassword("Harap login terlebih dahulu. (Masukkan password): ");
73
+ if (input !== correctPassword) {
74
+ console.error("❌ Password salah. Akses ditolak!");
75
+ process.exit(1);
76
+ }
77
+
78
+ console.log("✅ Login berhasil. Token disimpan.");
79
+ setAuthenticated();
80
+ }
81
+
82
+ module.exports = {
83
+ login,
84
+ logout,
85
+ isAuthenticated
86
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unictive-angular",
3
- "version": "1.0.10",
3
+ "version": "1.0.13",
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"
@@ -17,7 +17,8 @@
17
17
  "author": "EkaHersada",
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
- "chalk": "^5.6.0",
20
+ "chalk": "^4.1.2",
21
+ "dotenv": "^17.2.1",
21
22
  "update-notifier": "^5.1.0"
22
23
  }
23
24
  }
@@ -1,17 +0,0 @@
1
- # Editor configuration, see https://editorconfig.org
2
- root = true
3
-
4
- [*]
5
- charset = utf-8
6
- indent_style = space
7
- indent_size = 2
8
- insert_final_newline = true
9
- trim_trailing_whitespace = true
10
-
11
- [*.ts]
12
- quote_type = single
13
- ij_typescript_use_double_quotes = false
14
-
15
- [*.md]
16
- max_line_length = off
17
- trim_trailing_whitespace = false
@@ -1,4 +0,0 @@
1
- {
2
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
3
- "recommendations": ["angular.ng-template"]
4
- }
@@ -1,20 +0,0 @@
1
- {
2
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
3
- "version": "0.2.0",
4
- "configurations": [
5
- {
6
- "name": "ng serve",
7
- "type": "chrome",
8
- "request": "launch",
9
- "preLaunchTask": "npm: start",
10
- "url": "http://localhost:4200/"
11
- },
12
- {
13
- "name": "ng test",
14
- "type": "chrome",
15
- "request": "launch",
16
- "preLaunchTask": "npm: test",
17
- "url": "http://localhost:9876/debug.html"
18
- }
19
- ]
20
- }
@@ -1,42 +0,0 @@
1
- {
2
- // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3
- "version": "2.0.0",
4
- "tasks": [
5
- {
6
- "type": "npm",
7
- "script": "start",
8
- "isBackground": true,
9
- "problemMatcher": {
10
- "owner": "typescript",
11
- "pattern": "$tsc",
12
- "background": {
13
- "activeOnStart": true,
14
- "beginsPattern": {
15
- "regexp": "(.*?)"
16
- },
17
- "endsPattern": {
18
- "regexp": "bundle generation complete"
19
- }
20
- }
21
- }
22
- },
23
- {
24
- "type": "npm",
25
- "script": "test",
26
- "isBackground": true,
27
- "problemMatcher": {
28
- "owner": "typescript",
29
- "pattern": "$tsc",
30
- "background": {
31
- "activeOnStart": true,
32
- "beginsPattern": {
33
- "regexp": "(.*?)"
34
- },
35
- "endsPattern": {
36
- "regexp": "bundle generation complete"
37
- }
38
- }
39
- }
40
- }
41
- ]
42
- }
package/cobaa/README.md DELETED
@@ -1,59 +0,0 @@
1
- # Cobaa
2
-
3
- This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.0.3.
4
-
5
- ## Development server
6
-
7
- To start a local development server, run:
8
-
9
- ```bash
10
- ng serve
11
- ```
12
-
13
- Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
14
-
15
- ## Code scaffolding
16
-
17
- Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
18
-
19
- ```bash
20
- ng generate component component-name
21
- ```
22
-
23
- For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
24
-
25
- ```bash
26
- ng generate --help
27
- ```
28
-
29
- ## Building
30
-
31
- To build the project run:
32
-
33
- ```bash
34
- ng build
35
- ```
36
-
37
- This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
38
-
39
- ## Running unit tests
40
-
41
- To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
42
-
43
- ```bash
44
- ng test
45
- ```
46
-
47
- ## Running end-to-end tests
48
-
49
- For end-to-end (e2e) testing, run:
50
-
51
- ```bash
52
- ng e2e
53
- ```
54
-
55
- Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
56
-
57
- ## Additional Resources
58
-
59
- For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
@@ -1,91 +0,0 @@
1
- {
2
- "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
- "version": 1,
4
- "newProjectRoot": "projects",
5
- "projects": {
6
- "cobaa": {
7
- "projectType": "application",
8
- "schematics": {
9
- "@schematics/angular:component": {
10
- "style": "scss"
11
- }
12
- },
13
- "root": "",
14
- "sourceRoot": "src",
15
- "prefix": "app",
16
- "architect": {
17
- "build": {
18
- "builder": "@angular/build:application",
19
- "options": {
20
- "browser": "src/main.ts",
21
- "tsConfig": "tsconfig.app.json",
22
- "inlineStyleLanguage": "scss",
23
- "assets": [
24
- {
25
- "glob": "**/*",
26
- "input": "public"
27
- }
28
- ],
29
- "styles": [
30
- "src/styles.scss"
31
- ]
32
- },
33
- "configurations": {
34
- "production": {
35
- "budgets": [
36
- {
37
- "type": "initial",
38
- "maximumWarning": "500kB",
39
- "maximumError": "1MB"
40
- },
41
- {
42
- "type": "anyComponentStyle",
43
- "maximumWarning": "4kB",
44
- "maximumError": "8kB"
45
- }
46
- ],
47
- "outputHashing": "all"
48
- },
49
- "development": {
50
- "optimization": false,
51
- "extractLicenses": false,
52
- "sourceMap": true
53
- }
54
- },
55
- "defaultConfiguration": "production"
56
- },
57
- "serve": {
58
- "builder": "@angular/build:dev-server",
59
- "configurations": {
60
- "production": {
61
- "buildTarget": "cobaa:build:production"
62
- },
63
- "development": {
64
- "buildTarget": "cobaa:build:development"
65
- }
66
- },
67
- "defaultConfiguration": "development"
68
- },
69
- "extract-i18n": {
70
- "builder": "@angular/build:extract-i18n"
71
- },
72
- "test": {
73
- "builder": "@angular/build:karma",
74
- "options": {
75
- "tsConfig": "tsconfig.spec.json",
76
- "inlineStyleLanguage": "scss",
77
- "assets": [
78
- {
79
- "glob": "**/*",
80
- "input": "public"
81
- }
82
- ],
83
- "styles": [
84
- "src/styles.scss"
85
- ]
86
- }
87
- }
88
- }
89
- }
90
- }
91
- }