nextjs-cms-kit 0.5.1
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/LICENSE +21 -0
- package/README.md +232 -0
- package/dist/commands/db-config.d.ts +3 -0
- package/dist/commands/db-config.d.ts.map +1 -0
- package/dist/commands/db-config.js +20 -0
- package/dist/commands/fix-master-admin.d.ts +3 -0
- package/dist/commands/fix-master-admin.d.ts.map +1 -0
- package/dist/commands/fix-master-admin.js +19 -0
- package/dist/commands/set-master-admin.d.ts +3 -0
- package/dist/commands/set-master-admin.d.ts.map +1 -0
- package/dist/commands/set-master-admin.js +29 -0
- package/dist/commands/setup.d.ts +3 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +61 -0
- package/dist/commands/update-sections.d.ts +3 -0
- package/dist/commands/update-sections.d.ts.map +1 -0
- package/dist/commands/update-sections.js +33 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/lib/actions.d.ts +7 -0
- package/dist/lib/actions.d.ts.map +1 -0
- package/dist/lib/actions.js +62 -0
- package/dist/lib/add-table-keys.d.ts +32 -0
- package/dist/lib/add-table-keys.d.ts.map +1 -0
- package/dist/lib/add-table-keys.js +168 -0
- package/dist/lib/db-config-setup.d.ts +4 -0
- package/dist/lib/db-config-setup.d.ts.map +1 -0
- package/dist/lib/db-config-setup.js +216 -0
- package/dist/lib/fix-master-admin.d.ts +2 -0
- package/dist/lib/fix-master-admin.d.ts.map +1 -0
- package/dist/lib/fix-master-admin.js +7 -0
- package/dist/lib/reload-env.d.ts +16 -0
- package/dist/lib/reload-env.d.ts.map +1 -0
- package/dist/lib/reload-env.js +42 -0
- package/dist/lib/schema-generator.d.ts +10 -0
- package/dist/lib/schema-generator.d.ts.map +1 -0
- package/dist/lib/schema-generator.js +168 -0
- package/dist/lib/set-master-admin.d.ts +2 -0
- package/dist/lib/set-master-admin.d.ts.map +1 -0
- package/dist/lib/set-master-admin.js +53 -0
- package/dist/lib/update-sections.d.ts +2 -0
- package/dist/lib/update-sections.d.ts.map +1 -0
- package/dist/lib/update-sections.js +898 -0
- package/package.json +55 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as p from '@clack/prompts';
|
|
2
|
+
import { fixMasterAdminPrivileges, getMasterAdmin, setMaterAdmin } from './actions';
|
|
3
|
+
export async function setMasterAdmin() {
|
|
4
|
+
p.intro(`Setting up master admin...`);
|
|
5
|
+
/**
|
|
6
|
+
* Check if the master admin is already set
|
|
7
|
+
*/
|
|
8
|
+
const masterAdmin = await getMasterAdmin();
|
|
9
|
+
if (masterAdmin) {
|
|
10
|
+
p.log.info(`Master admin is already set.`);
|
|
11
|
+
const confirm = await p.confirm({
|
|
12
|
+
message: 'Are you sure you want to reset the master admin password?',
|
|
13
|
+
active: 'Yes',
|
|
14
|
+
inactive: 'No',
|
|
15
|
+
});
|
|
16
|
+
if (p.isCancel(confirm) || !confirm) {
|
|
17
|
+
p.cancel('Operation cancelled.');
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
let passwordMatch = false;
|
|
22
|
+
let password = '';
|
|
23
|
+
while (!passwordMatch) {
|
|
24
|
+
password = await p.password({
|
|
25
|
+
message: 'Please provide a password for the master admin',
|
|
26
|
+
validate(value) {
|
|
27
|
+
if (value.length < 8)
|
|
28
|
+
return `Password must be at least 8 characters`;
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
if (p.isCancel(password)) {
|
|
32
|
+
p.cancel('Operation cancelled.');
|
|
33
|
+
process.exit(0);
|
|
34
|
+
}
|
|
35
|
+
const confirmPassword = await p.password({
|
|
36
|
+
message: 'Please write the password again to confirm',
|
|
37
|
+
});
|
|
38
|
+
if (p.isCancel(confirmPassword)) {
|
|
39
|
+
p.cancel('Operation cancelled.');
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
if (password === confirmPassword) {
|
|
43
|
+
passwordMatch = true;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
p.log.error('Passwords do not match. Please try again.');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
await setMaterAdmin(password);
|
|
50
|
+
await fixMasterAdminPrivileges();
|
|
51
|
+
p.outro(`Master admin username is: Master. You're all set! 🎉 \n\n you can login here: http://localhost:3000/auth/login`);
|
|
52
|
+
process.exit(0);
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-sections.d.ts","sourceRoot":"","sources":["../../src/lib/update-sections.ts"],"names":[],"mappings":"AA6hCA,wBAAsB,cAAc,CAAC,SAAS,UAAQ,iBAmBrD"}
|