From f1460065010f9c931cd4b9707112d1b4a2f25263 Mon Sep 17 00:00:00 2001 From: Alexey Khachaturyan Date: Thu, 5 May 2022 21:32:39 +0300 Subject: [PATCH] Replaced shortid with nanoid --- packages/widget-id/package.json | 2 +- packages/widget-id/src/control.tsx | 4 ++-- yarn.lock | 15 ++++----------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/packages/widget-id/package.json b/packages/widget-id/package.json index fc422d7..8c37339 100644 --- a/packages/widget-id/package.json +++ b/packages/widget-id/package.json @@ -17,7 +17,7 @@ }, "dependencies": { "moment": "^2.24.0", - "shortid": "^2.2.14" + "nanoid": "^3.3.4" }, "publishConfig": { "access": "public" diff --git a/packages/widget-id/src/control.tsx b/packages/widget-id/src/control.tsx index 8c93d86..5633a40 100644 --- a/packages/widget-id/src/control.tsx +++ b/packages/widget-id/src/control.tsx @@ -1,5 +1,5 @@ import * as React from 'react' -import shortid from 'shortid' +import { nanoid } from 'nanoid' import { WidgetProps } from '@ncwidgets/common-typings' export class Control extends React.Component { @@ -33,7 +33,7 @@ export class Control extends React.Component { const timestamp = useTimestamp ? Date.now() + '-' : '' const postfix = usePostfix ? '-' + usePostfix : '' - const id = prefix + timestamp + shortid() + postfix + const id = prefix + timestamp + nanoid() + postfix onChange(id) } diff --git a/yarn.lock b/yarn.lock index f8b0809..6e2a637 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8255,10 +8255,10 @@ nan@^2.12.1: resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== -nanoid@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-2.0.3.tgz#dde999e173bc9d7bd2ee2746b89909ade98e075e" - integrity sha512-NbaoqdhIYmY6FXDRB4eYtDVC9Z9eCbn8TyaiC16LNKtpPv/aqa0tOPD8y6gNE4yUNnaZ7LLhYtXOev/6+cBtfw== +nanoid@^3.3.4: + version "3.3.4" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" + integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== nanomatch@^1.2.9: version "1.2.13" @@ -11257,13 +11257,6 @@ shellwords@^0.1.1: resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== -shortid@^2.2.14: - version "2.2.14" - resolved "https://registry.yarnpkg.com/shortid/-/shortid-2.2.14.tgz#80db6aafcbc3e3a46850b3c88d39e051b84c8d18" - integrity sha512-4UnZgr9gDdA1kaKj/38IiudfC3KHKhDc1zi/HSxd9FQDR0VLwH3/y79tZJLsVYPsJgIjeHjqIWaWVRJUj9qZOQ== - dependencies: - nanoid "^2.0.0" - signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"