create-synapse-mfe 1.0.2 → 1.0.5
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/README.md +18 -0
- package/bin/index.js +24 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ npx create-synapse-mfe@latest
|
|
|
20
20
|
The CLI will interactively ask for your project name (default: `synapse-workspace`).
|
|
21
21
|
|
|
22
22
|
### Example
|
|
23
|
+
|
|
23
24
|
```bash
|
|
24
25
|
npx create-synapse-mfe@latest my-awesome-mfe
|
|
25
26
|
```
|
|
@@ -39,13 +40,30 @@ pnpm install
|
|
|
39
40
|
pnpm run dev:new
|
|
40
41
|
```
|
|
41
42
|
|
|
43
|
+
## 🔐 Default Mock Credentials (Development)
|
|
44
|
+
|
|
45
|
+
Saat `MSW` aktif di mode development, gunakan akun berikut untuk login cepat:
|
|
46
|
+
|
|
47
|
+
- `auth-mfe` (`/auth/login`)
|
|
48
|
+
- `admin@Synapse.com` / `password123`
|
|
49
|
+
- `user@Synapse.com` / `password123`
|
|
50
|
+
- Standalone MFE generated (isolated port, mis. `:4003`)
|
|
51
|
+
- `dev@synapse.local` / `password123`
|
|
52
|
+
|
|
53
|
+
Catatan:
|
|
54
|
+
|
|
55
|
+
- `auth-mfe` menampilkan kredensial mock otomatis di bawah form login (dev + MSW).
|
|
56
|
+
- Dokumentasi detail tersedia di `/docs/api-mocking`, `/docs/api-interceptors`, dan `/docs/security`.
|
|
57
|
+
|
|
42
58
|
## 🏗️ Architecture Blueprint
|
|
43
59
|
|
|
44
60
|
The generated workspace pulls from a clean-slate boilerplate that includes:
|
|
61
|
+
|
|
45
62
|
- `apps/shell`: The main host application router.
|
|
46
63
|
- `apps/auth-mfe`: A remote micro-frontend handling authentication.
|
|
47
64
|
- `apps/docs-mfe`: A remote documentation micro-frontend.
|
|
48
65
|
- `libs/`: Shared libraries holding UI components, types, and API logic.
|
|
49
66
|
|
|
50
67
|
## 📄 License
|
|
68
|
+
|
|
51
69
|
MIT
|
package/bin/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-undef */
|
|
2
3
|
|
|
3
4
|
const { execSync } = require('child_process');
|
|
4
5
|
const fs = require('fs');
|
|
@@ -24,8 +25,13 @@ const rl = readline.createInterface({
|
|
|
24
25
|
output: process.stdout,
|
|
25
26
|
});
|
|
26
27
|
|
|
27
|
-
console.log('\x1b[36m%s\x1b[0m', '🚀 Welcome to create-synapse-mfe CLI!');
|
|
28
|
+
console.log('\x1b[36m%s\x1b[0m', '🚀 Welcome to create-synapse-mfe CLI v1.0.5!');
|
|
28
29
|
console.log('Scaffolding a Vite-powered Micro-Frontend Architecture...');
|
|
30
|
+
console.log('\x1b[32m✨ What\'s new in v1.0.4:\x1b[0m');
|
|
31
|
+
console.log(' \x1b[34m- Hardened security (removed token from query params & sessionStorage)\x1b[0m');
|
|
32
|
+
console.log(' \x1b[34m- Dynamic Redirect Whitelist matching remotes.json\x1b[0m');
|
|
33
|
+
console.log(' \x1b[34m- Basic Vitest Mock API integrations\x1b[0m');
|
|
34
|
+
console.log(' \x1b[34m- Updated Vite and React Router dependency versions\x1b[0m');
|
|
29
35
|
|
|
30
36
|
const getProjectName = () => {
|
|
31
37
|
return new Promise((resolve) => {
|
|
@@ -62,6 +68,17 @@ const getProjectName = () => {
|
|
|
62
68
|
fs.rmSync(gitFolder, { recursive: true, force: true });
|
|
63
69
|
}
|
|
64
70
|
|
|
71
|
+
// Clean up CLI internal tools and NPM workflows from the end-user's boilerplate
|
|
72
|
+
const cliFolder = path.join(projectPath, 'tools', 'create-synapse');
|
|
73
|
+
if (fs.existsSync(cliFolder)) {
|
|
74
|
+
fs.rmSync(cliFolder, { recursive: true, force: true });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const npmWorkflow = path.join(projectPath, '.github', 'workflows', 'publish-npm.yml');
|
|
78
|
+
if (fs.existsSync(npmWorkflow)) {
|
|
79
|
+
fs.rmSync(npmWorkflow, { force: true });
|
|
80
|
+
}
|
|
81
|
+
|
|
65
82
|
console.log(`\x1b[32m🌱 Memulai repositori Git baru...\x1b[0m`);
|
|
66
83
|
runCommand(`git init`, { cwd: projectPath });
|
|
67
84
|
|
|
@@ -70,6 +87,12 @@ const getProjectName = () => {
|
|
|
70
87
|
console.log(`\x1b[33m cd ${projectName}\x1b[0m`);
|
|
71
88
|
console.log('\x1b[33m pnpm install\x1b[0m');
|
|
72
89
|
console.log('\x1b[33m pnpm run dev:new\n\x1b[0m');
|
|
90
|
+
|
|
91
|
+
console.log('\x1b[36m🔐 Mock credentials (development):\x1b[0m');
|
|
92
|
+
console.log(' \x1b[34m- auth-mfe (/auth/login): admin@Synapse.com / password123\x1b[0m');
|
|
93
|
+
console.log(' \x1b[34m- auth-mfe (/auth/login): user@Synapse.com / password123\x1b[0m');
|
|
94
|
+
console.log(' \x1b[34m- standalone MFE (isolated): dev@synapse.local / password123\x1b[0m');
|
|
95
|
+
console.log(' \x1b[34m- docs: /docs/api-mocking, /docs/api-interceptors, /docs/security\x1b[0m\n');
|
|
73
96
|
|
|
74
97
|
console.log('\x1b[35mSelamat Mengoding Micro-Frontend! ⚛️\x1b[0m\n');
|
|
75
98
|
|