mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-07 03:29:57 +00:00
Working name generation
This commit is contained in:
parent
2a8bd18e9b
commit
bb4c2b1f82
@ -26,7 +26,14 @@ import * as fs from 'fs'
|
|||||||
import * as fetch from 'isomorphic-fetch'
|
import * as fetch from 'isomorphic-fetch'
|
||||||
import * as cf from '../../utils/common-flags';
|
import * as cf from '../../utils/common-flags';
|
||||||
import { flags } from '@oclif/command';
|
import { flags } from '@oclif/command';
|
||||||
import { nanoid } from 'nanoid/non-secure';
|
import { uniqueNamesGenerator, adjectives, colors, animals } from 'unique-names-generator'
|
||||||
|
|
||||||
|
function randomName() {
|
||||||
|
return uniqueNamesGenerator({
|
||||||
|
dictionaries: [adjectives, colors, animals],
|
||||||
|
separator: '-'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
interface FlagsDef {
|
interface FlagsDef {
|
||||||
help: void;
|
help: void;
|
||||||
@ -179,7 +186,7 @@ export default class InstanceInitCmd extends Command {
|
|||||||
responseBody = await res.json()
|
responseBody = await res.json()
|
||||||
|
|
||||||
const sshKeyID = responseBody.ssh_keys[0].id
|
const sshKeyID = responseBody.ssh_keys[0].id
|
||||||
const randomDropletID = nanoid()
|
const randomDropletID = randomName()
|
||||||
|
|
||||||
console.log('Creating droplet...')
|
console.log('Creating droplet...')
|
||||||
res = await fetch('https://api.digitalocean.com/v2/droplets', {
|
res = await fetch('https://api.digitalocean.com/v2/droplets', {
|
||||||
|
10
npm-shrinkwrap.json
generated
10
npm-shrinkwrap.json
generated
@ -12439,11 +12439,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
|
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
|
||||||
"integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw=="
|
"integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw=="
|
||||||
},
|
},
|
||||||
"nanoid": {
|
|
||||||
"version": "3.1.30",
|
|
||||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz",
|
|
||||||
"integrity": "sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ=="
|
|
||||||
},
|
|
||||||
"nanomatch": {
|
"nanomatch": {
|
||||||
"version": "1.2.13",
|
"version": "1.2.13",
|
||||||
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
|
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
|
||||||
@ -18097,6 +18092,11 @@
|
|||||||
"set-value": "^2.0.1"
|
"set-value": "^2.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"unique-names-generator": {
|
||||||
|
"version": "4.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/unique-names-generator/-/unique-names-generator-4.6.0.tgz",
|
||||||
|
"integrity": "sha512-m0fke1emBeT96UYn2psPQYwljooDWRTKt9oUZ5vlt88ZFMBGxqwPyLHXwCfkbgdm8jzioCp7oIpo6KdM+fnUlQ=="
|
||||||
|
},
|
||||||
"unique-stream": {
|
"unique-stream": {
|
||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.3.1.tgz",
|
||||||
|
@ -253,7 +253,6 @@
|
|||||||
"minimatch": "^3.0.4",
|
"minimatch": "^3.0.4",
|
||||||
"moment": "^2.27.0",
|
"moment": "^2.27.0",
|
||||||
"moment-duration-format": "^2.3.2",
|
"moment-duration-format": "^2.3.2",
|
||||||
"nanoid": "^3.1.30",
|
|
||||||
"ndjson": "^2.0.0",
|
"ndjson": "^2.0.0",
|
||||||
"net-keepalive": "^3.0.0",
|
"net-keepalive": "^3.0.0",
|
||||||
"node-cleanup": "^2.1.2",
|
"node-cleanup": "^2.1.2",
|
||||||
@ -284,6 +283,7 @@
|
|||||||
"through2": "^2.0.3",
|
"through2": "^2.0.3",
|
||||||
"tmp": "^0.2.1",
|
"tmp": "^0.2.1",
|
||||||
"typed-error": "^3.2.1",
|
"typed-error": "^3.2.1",
|
||||||
|
"unique-names-generator": "^4.6.0",
|
||||||
"update-notifier": "^4.1.0",
|
"update-notifier": "^4.1.0",
|
||||||
"which": "^2.0.2",
|
"which": "^2.0.2",
|
||||||
"window-size": "^1.1.0"
|
"window-size": "^1.1.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user