mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
replace uuid package with crypto.randomUUID
This commit is contained in:
parent
7bbc3b8d3d
commit
b47b339a49
@ -50,7 +50,6 @@
|
||||
"stream-json": "1.7.4",
|
||||
"tar": "6.1.13",
|
||||
"tar-stream": "2.2.0",
|
||||
"uuid": "9.0.0",
|
||||
"ws": "8.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { WebSocket } from 'ws';
|
||||
import { v4 } from 'uuid';
|
||||
import { randomUUID } from 'crypto';
|
||||
import { Writable } from 'stream';
|
||||
import { once } from 'lodash/fp';
|
||||
|
||||
@ -336,7 +336,7 @@ class RemoteStrapiDestinationProvider implements IDestinationProvider {
|
||||
|
||||
hasStarted = true;
|
||||
|
||||
const assetID = v4();
|
||||
const assetID = randomUUID();
|
||||
const { filename, filepath, stats, stream } = asset;
|
||||
|
||||
try {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { v4 } from 'uuid';
|
||||
import { randomUUID } from 'crypto';
|
||||
import { RawData, WebSocket } from 'ws';
|
||||
|
||||
import type { client, server } from '../../../types/remote/protocol';
|
||||
@ -28,7 +28,7 @@ export const createDispatcher = (ws: WebSocket) => {
|
||||
}
|
||||
|
||||
return new Promise<U | null>((resolve, reject) => {
|
||||
const uuid = v4();
|
||||
const uuid = randomUUID();
|
||||
const payload = { ...message, uuid };
|
||||
|
||||
if (options.attachTransfer) {
|
||||
|
@ -4,7 +4,7 @@ const { resolve } = require('path');
|
||||
const fse = require('fs-extra');
|
||||
const chalk = require('chalk');
|
||||
const fetch = require('node-fetch');
|
||||
const { v4: uuidv4 } = require('uuid');
|
||||
const { randomUUID } = require('crypto');
|
||||
const machineID = require('../../../../utils/machine-id');
|
||||
|
||||
const readPackageJSON = async (path) => {
|
||||
@ -36,7 +36,7 @@ const generateNewPackageJSON = (packageObj) => {
|
||||
return {
|
||||
...packageObj,
|
||||
strapi: {
|
||||
uuid: uuidv4(),
|
||||
uuid: randomUUID(),
|
||||
telemetryDisabled: false,
|
||||
},
|
||||
};
|
||||
@ -45,7 +45,7 @@ const generateNewPackageJSON = (packageObj) => {
|
||||
...packageObj,
|
||||
strapi: {
|
||||
...packageObj.strapi,
|
||||
uuid: packageObj.strapi.uuid ? packageObj.strapi.uuid : uuidv4(),
|
||||
uuid: packageObj.strapi.uuid ? packageObj.strapi.uuid : randomUUID(),
|
||||
telemetryDisabled: false,
|
||||
},
|
||||
};
|
||||
|
@ -1,14 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
const { machineIdSync } = require('node-machine-id');
|
||||
const { v4: uuidv4 } = require('uuid');
|
||||
const { randomUUID } = require('crypto');
|
||||
|
||||
module.exports = () => {
|
||||
try {
|
||||
const deviceId = machineIdSync();
|
||||
return deviceId;
|
||||
} catch (error) {
|
||||
const deviceId = uuidv4();
|
||||
const deviceId = randomUUID();
|
||||
return deviceId;
|
||||
}
|
||||
};
|
||||
|
@ -132,8 +132,7 @@
|
||||
"qs": "6.11.1",
|
||||
"resolve-cwd": "3.0.0",
|
||||
"semver": "7.3.8",
|
||||
"statuses": "2.0.1",
|
||||
"uuid": "^8.3.2"
|
||||
"statuses": "2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"supertest": "6.3.3",
|
||||
|
@ -53,8 +53,7 @@
|
||||
"node-machine-id": "^1.1.10",
|
||||
"ora": "^5.4.1",
|
||||
"semver": "7.3.8",
|
||||
"tar": "6.1.13",
|
||||
"uuid": "^8.3.2"
|
||||
"tar": "6.1.13"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.19.1 <=18.x.x",
|
||||
|
@ -3,7 +3,6 @@ import { readFileSync } from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import readline from 'node:readline';
|
||||
import crypto from 'crypto';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import * as sentry from '@sentry/node';
|
||||
import hasYarn from './utils/has-yarn';
|
||||
import checkRequirements from './utils/check-requirements';
|
||||
@ -44,7 +43,7 @@ export const generateNewApp = (projectDirectory: string, options: Partial<NewOpt
|
||||
template: options.template,
|
||||
starter: options.starter,
|
||||
},
|
||||
uuid: (process.env.STRAPI_UUID_PREFIX || '') + uuidv4(),
|
||||
uuid: (process.env.STRAPI_UUID_PREFIX || '') + crypto.randomUUID(),
|
||||
docker: process.env.DOCKER === 'true',
|
||||
deviceId: machineID(),
|
||||
tmpPath,
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { machineIdSync } from 'node-machine-id';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { randomUUID } from 'crypto';
|
||||
|
||||
export default () => {
|
||||
try {
|
||||
const deviceId = machineIdSync();
|
||||
return deviceId;
|
||||
} catch (error) {
|
||||
const deviceId = uuidv4();
|
||||
const deviceId = randomUUID();
|
||||
return deviceId;
|
||||
}
|
||||
};
|
||||
|
21
yarn.lock
21
yarn.lock
@ -7449,7 +7449,6 @@ __metadata:
|
||||
tar: 6.1.13
|
||||
tar-stream: 2.2.0
|
||||
typescript: 5.0.4
|
||||
uuid: 9.0.0
|
||||
ws: 8.13.0
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
@ -7531,7 +7530,6 @@ __metadata:
|
||||
ora: ^5.4.1
|
||||
semver: 7.3.8
|
||||
tar: 6.1.13
|
||||
uuid: ^8.3.2
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@ -8133,7 +8131,6 @@ __metadata:
|
||||
statuses: 2.0.1
|
||||
supertest: 6.3.3
|
||||
typescript: 5.0.4
|
||||
uuid: ^8.3.2
|
||||
bin:
|
||||
strapi: ./bin/strapi.js
|
||||
languageName: unknown
|
||||
@ -31880,15 +31877,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"uuid@npm:9.0.0, uuid@npm:^9.0.0":
|
||||
version: 9.0.0
|
||||
resolution: "uuid@npm:9.0.0"
|
||||
bin:
|
||||
uuid: dist/bin/uuid
|
||||
checksum: 8dd2c83c43ddc7e1c71e36b60aea40030a6505139af6bee0f382ebcd1a56f6cd3028f7f06ffb07f8cf6ced320b76aea275284b224b002b289f89fe89c389b028
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"uuid@npm:^3.3.2":
|
||||
version: 3.4.0
|
||||
resolution: "uuid@npm:3.4.0"
|
||||
@ -31898,6 +31886,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"uuid@npm:^9.0.0":
|
||||
version: 9.0.0
|
||||
resolution: "uuid@npm:9.0.0"
|
||||
bin:
|
||||
uuid: dist/bin/uuid
|
||||
checksum: 8dd2c83c43ddc7e1c71e36b60aea40030a6505139af6bee0f382ebcd1a56f6cd3028f7f06ffb07f8cf6ced320b76aea275284b224b002b289f89fe89c389b028
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"v8-compile-cache@npm:2.3.0, v8-compile-cache@npm:^2.3.0":
|
||||
version: 2.3.0
|
||||
resolution: "v8-compile-cache@npm:2.3.0"
|
||||
|
Loading…
x
Reference in New Issue
Block a user