create-synapse-mfe 1.0.7 → 1.0.8
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/index.js +25 -14
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -27,8 +27,10 @@ const rl = readline.createInterface({
|
|
|
27
27
|
|
|
28
28
|
console.log('\x1b[36m%s\x1b[0m', '🚀 Welcome to create-synapse-mfe CLI v1.0.5!');
|
|
29
29
|
console.log('Scaffolding a Vite-powered Micro-Frontend Architecture...');
|
|
30
|
-
console.log(
|
|
31
|
-
console.log(
|
|
30
|
+
console.log("\x1b[32m✨ What's new in v1.0.4:\x1b[0m");
|
|
31
|
+
console.log(
|
|
32
|
+
' \x1b[34m- Hardened security (removed token from query params & sessionStorage)\x1b[0m'
|
|
33
|
+
);
|
|
32
34
|
console.log(' \x1b[34m- Dynamic Redirect Whitelist matching remotes.json\x1b[0m');
|
|
33
35
|
console.log(' \x1b[34m- Basic Vitest Mock API integrations\x1b[0m');
|
|
34
36
|
console.log(' \x1b[34m- Updated Vite and React Router dependency versions\x1b[0m');
|
|
@@ -38,9 +40,12 @@ const getProjectName = () => {
|
|
|
38
40
|
if (process.argv[2]) {
|
|
39
41
|
resolve(process.argv[2]);
|
|
40
42
|
} else {
|
|
41
|
-
rl.question(
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
rl.question(
|
|
44
|
+
'\n\x1b[33m? Nama direktori proyek Anda:\x1b[0m (synapse-workspace) ',
|
|
45
|
+
(answer) => {
|
|
46
|
+
resolve(answer.trim() || 'synapse-workspace');
|
|
47
|
+
}
|
|
48
|
+
);
|
|
44
49
|
}
|
|
45
50
|
});
|
|
46
51
|
};
|
|
@@ -51,12 +56,16 @@ const getProjectName = () => {
|
|
|
51
56
|
const projectPath = path.join(currentDir, projectName);
|
|
52
57
|
|
|
53
58
|
if (fs.existsSync(projectPath)) {
|
|
54
|
-
console.error(
|
|
59
|
+
console.error(
|
|
60
|
+
`\n\x1b[31m❌ Error: Folder "${projectName}" sudah ada! Harap pilih nama lain.\x1b[0m`
|
|
61
|
+
);
|
|
55
62
|
process.exit(1);
|
|
56
63
|
}
|
|
57
64
|
|
|
58
|
-
console.log(
|
|
59
|
-
|
|
65
|
+
console.log(
|
|
66
|
+
`\n\x1b[32m📦 Mengkloning blueprint MFE ke dalam \x1b[1m${projectName}\x1b[0m...\x1b[0m`
|
|
67
|
+
);
|
|
68
|
+
|
|
60
69
|
const cloneCmd = `git clone --depth 1 ${GIT_REPO} "${projectName}"`;
|
|
61
70
|
if (!runCommand(cloneCmd)) {
|
|
62
71
|
process.exit(1);
|
|
@@ -67,18 +76,18 @@ const getProjectName = () => {
|
|
|
67
76
|
if (fs.existsSync(gitFolder)) {
|
|
68
77
|
fs.rmSync(gitFolder, { recursive: true, force: true });
|
|
69
78
|
}
|
|
70
|
-
|
|
79
|
+
|
|
71
80
|
// Clean up CLI internal tools and NPM workflows from the end-user's boilerplate
|
|
72
81
|
const cliFolder = path.join(projectPath, 'tools', 'create-synapse');
|
|
73
82
|
if (fs.existsSync(cliFolder)) {
|
|
74
83
|
fs.rmSync(cliFolder, { recursive: true, force: true });
|
|
75
84
|
}
|
|
76
|
-
|
|
85
|
+
|
|
77
86
|
const npmWorkflow = path.join(projectPath, '.github', 'workflows', 'publish-npm.yml');
|
|
78
87
|
if (fs.existsSync(npmWorkflow)) {
|
|
79
88
|
fs.rmSync(npmWorkflow, { force: true });
|
|
80
89
|
}
|
|
81
|
-
|
|
90
|
+
|
|
82
91
|
console.log(`\x1b[32m🌱 Memulai repositori Git baru...\x1b[0m`);
|
|
83
92
|
runCommand(`git init`, { cwd: projectPath });
|
|
84
93
|
|
|
@@ -92,10 +101,12 @@ const getProjectName = () => {
|
|
|
92
101
|
console.log(' \x1b[34m- auth-mfe (/auth/login): admin@Synapse.com / password123\x1b[0m');
|
|
93
102
|
console.log(' \x1b[34m- auth-mfe (/auth/login): user@Synapse.com / password123\x1b[0m');
|
|
94
103
|
console.log(' \x1b[34m- standalone MFE (isolated): dev@synapse.local / password123\x1b[0m');
|
|
95
|
-
console.log(
|
|
96
|
-
|
|
104
|
+
console.log(
|
|
105
|
+
' \x1b[34m- docs: /docs/api-mocking, /docs/api-interceptors, /docs/security\x1b[0m\n'
|
|
106
|
+
);
|
|
107
|
+
|
|
97
108
|
console.log('\x1b[35mSelamat Mengoding Micro-Frontend! ⚛️\x1b[0m\n');
|
|
98
|
-
|
|
109
|
+
|
|
99
110
|
rl.close();
|
|
100
111
|
process.exit(0);
|
|
101
112
|
})();
|