adminforth 3.6.9 → 3.6.11
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.
|
@@ -487,32 +487,42 @@ async function writeTemplateFiles(dirname, cwd, useNpm, includePrismaMigrations,
|
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
489
|
|
|
490
|
-
async function
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
490
|
+
async function installDependenciesPnpm(ctx, cwd) {
|
|
491
|
+
const isWindows = process.platform === 'win32';
|
|
492
|
+
|
|
493
|
+
const nodeBinary = process.execPath;
|
|
494
|
+
const pnpmPath = path.join(path.dirname(nodeBinary), isWindows ? 'pnpm.cmd' : 'pnpm');
|
|
495
|
+
const customDir = ctx.customDir;
|
|
496
|
+
if (isWindows) {
|
|
497
|
+
const res = await Promise.all([
|
|
498
|
+
execAsync(`pnpm install`, { cwd, env: { PATH: process.env.PATH } }),
|
|
499
|
+
execAsync(`pnpm install`, { cwd: customDir, env: { PATH: process.env.PATH } }),
|
|
500
|
+
]);
|
|
501
|
+
} else {
|
|
502
|
+
const res = await Promise.all([
|
|
503
|
+
execAsync(`${nodeBinary} ${pnpmPath} install`, { cwd, env: { PATH: process.env.PATH } }),
|
|
504
|
+
execAsync(`${nodeBinary} ${pnpmPath} install`, { cwd: customDir, env: { PATH: process.env.PATH } }),
|
|
505
|
+
]);
|
|
505
506
|
}
|
|
506
507
|
}
|
|
507
508
|
|
|
508
|
-
async function
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
509
|
+
async function installDependenciesNpm(ctx, cwd) {
|
|
510
|
+
const isWindows = process.platform === 'win32';
|
|
511
|
+
|
|
512
|
+
const nodeBinary = process.execPath;
|
|
513
|
+
const npmPath = path.join(path.dirname(nodeBinary), isWindows ? 'npm.cmd' : 'npm');
|
|
514
|
+
const customDir = ctx.customDir;
|
|
515
|
+
if (isWindows) {
|
|
516
|
+
const res = await Promise.all([
|
|
517
|
+
execAsync(`npm install`, { cwd, env: { PATH: process.env.PATH } }),
|
|
518
|
+
execAsync(`npm install`, { cwd: customDir, env: { PATH: process.env.PATH } }),
|
|
519
|
+
]);
|
|
520
|
+
} else {
|
|
521
|
+
const res = await Promise.all([
|
|
522
|
+
execAsync(`${nodeBinary} ${npmPath} install`, { cwd, env: { PATH: process.env.PATH } }),
|
|
523
|
+
execAsync(`${nodeBinary} ${npmPath} install`, { cwd: customDir, env: { PATH: process.env.PATH } }),
|
|
524
|
+
]);
|
|
525
|
+
}
|
|
516
526
|
}
|
|
517
527
|
|
|
518
528
|
function generateFinalInstructionsPnpm(skipPrismaSetup, options) {
|
|
@@ -586,7 +596,11 @@ export function prepareWorkflow(options) {
|
|
|
586
596
|
{
|
|
587
597
|
title: '📦 Installing dependencies...',
|
|
588
598
|
task: async (ctx) => {
|
|
589
|
-
|
|
599
|
+
if (options.useNpm) {
|
|
600
|
+
await installDependenciesNpm(ctx, ctx.projectDir);
|
|
601
|
+
} else {
|
|
602
|
+
await installDependenciesPnpm(ctx, ctx.projectDir);
|
|
603
|
+
}
|
|
590
604
|
}
|
|
591
605
|
},
|
|
592
606
|
{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ref, watch, type Ref } from 'vue'
|
|
2
2
|
import { defineStore } from 'pinia'
|
|
3
3
|
import { useRoute } from 'vue-router';
|
|
4
|
+
import { randomBrowserUUID } from '@/utils/browserUuid';
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
@@ -22,7 +23,7 @@ export const useToastStore = defineStore('toast', () => {
|
|
|
22
23
|
buttons?: { value: any; label: string }[];
|
|
23
24
|
onResolve?: (value?: any) => void;
|
|
24
25
|
}): string => {
|
|
25
|
-
const toastId =
|
|
26
|
+
const toastId = randomBrowserUUID();
|
|
26
27
|
toasts.value.push({
|
|
27
28
|
...toast,
|
|
28
29
|
id: toastId,
|
|
@@ -45,4 +46,4 @@ export const useToastStore = defineStore('toast', () => {
|
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
return { toasts, addToast, removeToast, resolveToast };
|
|
48
|
-
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const UUID_BYTE_LENGTH = 16;
|
|
2
|
+
|
|
3
|
+
const UUID_HEX = Array.from(
|
|
4
|
+
{ length: 256 },
|
|
5
|
+
(_, index) => index.toString(16).padStart(2, '0'),
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
export function randomBrowserUUID(): string {
|
|
9
|
+
if (typeof crypto.randomUUID === 'function') {
|
|
10
|
+
return crypto.randomUUID();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const bytes = crypto.getRandomValues(
|
|
14
|
+
new Uint8Array(UUID_BYTE_LENGTH),
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
18
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
19
|
+
|
|
20
|
+
return [
|
|
21
|
+
UUID_HEX[bytes[0]],
|
|
22
|
+
UUID_HEX[bytes[1]],
|
|
23
|
+
UUID_HEX[bytes[2]],
|
|
24
|
+
UUID_HEX[bytes[3]],
|
|
25
|
+
'-',
|
|
26
|
+
UUID_HEX[bytes[4]],
|
|
27
|
+
UUID_HEX[bytes[5]],
|
|
28
|
+
'-',
|
|
29
|
+
UUID_HEX[bytes[6]],
|
|
30
|
+
UUID_HEX[bytes[7]],
|
|
31
|
+
'-',
|
|
32
|
+
UUID_HEX[bytes[8]],
|
|
33
|
+
UUID_HEX[bytes[9]],
|
|
34
|
+
'-',
|
|
35
|
+
UUID_HEX[bytes[10]],
|
|
36
|
+
UUID_HEX[bytes[11]],
|
|
37
|
+
UUID_HEX[bytes[12]],
|
|
38
|
+
UUID_HEX[bytes[13]],
|
|
39
|
+
UUID_HEX[bytes[14]],
|
|
40
|
+
UUID_HEX[bytes[15]],
|
|
41
|
+
].join('');
|
|
42
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { randomBrowserUUID } from './browserUuid';
|
|
2
|
+
|
|
1
3
|
const ADMINFORTH_CLIENT_ID_STORAGE_KEY = 'adminforthClientId';
|
|
2
4
|
|
|
3
5
|
export const ADMINFORTH_CLIENT_ID_HEADER = 'x-adminforth-client-id';
|
|
@@ -8,7 +10,7 @@ export function getAdminForthClientId(): string {
|
|
|
8
10
|
return existingClientId;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
const clientId =
|
|
13
|
+
const clientId = randomBrowserUUID();
|
|
12
14
|
sessionStorage.setItem(ADMINFORTH_CLIENT_ID_STORAGE_KEY, clientId);
|
|
13
15
|
return clientId;
|
|
14
16
|
}
|