From dfa5bc6c84af2b1fc3fd28b59a86864f70b09abe Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Mon, 13 Sep 2021 17:39:24 +0100 Subject: [PATCH] feat(server): simple unique random default stream names --- .../server/modules/core/services/streams.js | 17 ++- packages/server/modules/shared/architects.js | 122 ------------------ packages/server/package-lock.json | 5 - packages/server/package.json | 1 - 4 files changed, 12 insertions(+), 133 deletions(-) delete mode 100644 packages/server/modules/shared/architects.js diff --git a/packages/server/modules/core/services/streams.js b/packages/server/modules/core/services/streams.js index 8cd516312..70d7f4a48 100644 --- a/packages/server/modules/core/services/streams.js +++ b/packages/server/modules/core/services/streams.js @@ -8,11 +8,6 @@ const Acl = ( ) => knex( 'stream_acl' ) const debug = require( 'debug' ) const { createBranch } = require( './branches' ) -const { uniqueNamesGenerator, adjectives } = require( 'unique-names-generator' ) -const architects = require( `${appRoot}/modules/shared/architects` ) - -const generateStreamName = () => - `${uniqueNamesGenerator( { dictionaries: [ architects ],style: 'capital' } )}\'s ${uniqueNamesGenerator( { dictionaries: [ adjectives ] } )} stream` module.exports = { @@ -175,3 +170,15 @@ module.exports = { return await query } } + +const adjectives = [ + 'Tall', 'Curved', 'Stacked', 'Purple', 'Pink', 'Rectangular', 'Circular', 'Oval', 'Shiny', 'Speckled', 'Blue', 'Stretched', 'Round', 'Spherical', 'Majestic', 'Symmetrical' +] + +const nouns = [ + 'Building', 'House', 'Treehouse', 'Tower', 'Tunnel', 'Bridge', 'Pyramid', 'Structure', 'Edifice', 'Palace', 'Castle', 'Villa' +] + +const generateStreamName = () => { + return `${adjectives[Math.floor( Math.random()*adjectives.length )]} ${nouns[Math.floor( Math.random()*nouns.length )]}` +} diff --git a/packages/server/modules/shared/architects.js b/packages/server/modules/shared/architects.js deleted file mode 100644 index 642184267..000000000 --- a/packages/server/modules/shared/architects.js +++ /dev/null @@ -1,122 +0,0 @@ -'use strict' - -module.exports = [ - 'Amenhotep, son of Hapu', - 'Imhotep', - 'Yu Hao', - 'Villard de Honnecourt', - 'Peter Parler', - 'Leon Battista Alberti', - 'Donato Bramante', - 'Filippo Brunelleschi', - 'Michelozzo Michelozzi', - 'Bernardo Rossellino', - 'Leonardo da Vinci', - 'Vincenzo Scamozzi', - 'Sebastiano Serlio', - 'Lambert Sustris', - 'Pellegrino Tibaldi', - 'Giorgio Vasari', - 'Gian Lorenzo Bernini', - 'Francesco Borromini', - 'Ustad Ahmad Lahauri', - 'Jacob van Campen', - 'Johann Dientzenhofer', - 'Tumas Dingli', - 'Léopold Durand', - 'Pietro Paolo Floriani', - 'François Mansart', - 'Andreas Schlüter', - 'Robert Adam', - 'John Carr of York', - 'William Kent', - 'Jacques-Germain Soufflot', - 'Manuel Caetano de Sousa', - 'William Thornton', - 'James Fowler (architect)|James Fowler', - 'Thomas Fuller (architect)|Thomas Fuller', - 'Friedrich von Gärtner', - 'Edward William Godwin', - 'Philip Charles Hardwick', - 'Victor Horta', - 'William LeBaron Jenney', - 'Leo von Klenze', - 'Henri Labrouste', - 'Alexander Wadsworth Longfellow, Jr.', - 'Auguste de Montferrand', - 'John Nash (architect)|John Nash', - 'Joseph Maria Olbrich', - 'Joseph Paxton', - 'Francis Penrose', - 'Francis Petre', - 'Augustus Pugin', - 'Karl Friedrich Schinkel', - 'Gottfried Semper', - 'J. J. Stevenson', - 'Louis Sullivan', - 'Thomas Telford', - 'Eugène Viollet-le-Duc', - 'Otto Wagner', - 'John Dodsley Webster', - - 'Alvar Aalto', - 'Max Abramovitz', - 'Gunnar Asplund', - 'Luis Barragán', - 'Peter Behrens', - 'Pietro Belluschi', - 'Antonio Bilbao La Vieja', - 'Marcel Breuer', - 'Le Corbusier', - 'Charles Eames', - 'Buckminster Fuller', - 'Antoni Gaudí', - 'Walter Gropius', - 'Hector Guimard', - 'Victor Horta', - 'Friedensreich Hundertwasser', - 'Arne Jacobsen', - 'Philip Johnson', - 'Josep Maria Jujol', - 'Louis Kahn', - 'Károly Kós', - 'Kisho Kurokawa', - 'Edgar-Johan Kuusik', - 'Ricardo Legorreta', - 'Jan Letzel', - 'Liang Sicheng', - 'Adolf Loos', - 'Charles Rennie Mackintosh', - 'Wayne McAllister', - 'Konstantin Melnikov', - 'Erich Mendelsohn', - 'Paulo Mendes da Rocha', - 'Henry Mercer', - 'Giovanni Michelucci', - 'Ludwig Mies van der Rohe', - 'Riccardo Morandi', - 'Luigi Moretti', - 'Pier Luigi Nervi', - 'Ngo Viet Thu', - 'Oscar Niemeyer', - 'Oscar Nitzchke', - 'Frei Otto', - 'Mihály Párkányi', - 'Arthur Peabody', - 'I. M. Pei', - 'Stjepan Planić', - 'Hans Poelzig', - 'William Gray Purcell', - 'Steen Eiler Rasmussen', - 'Aldo Rossi', - 'Eero Saarinen', - 'Rogelio Salmona', - 'Guðjón Samúelsson', - 'Carlo Scarpa', - 'Elisabeth Scott', - 'Albert Speer', - 'Kenzo Tange', - 'Jørn Utzon', - 'Geoffrey Wooding', - 'Frank Lloyd Wright', -] \ No newline at end of file diff --git a/packages/server/package-lock.json b/packages/server/package-lock.json index e6725b517..7d9ce0319 100644 --- a/packages/server/package-lock.json +++ b/packages/server/package-lock.json @@ -12467,11 +12467,6 @@ "unique-slug": "^2.0.0" } }, - "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-slug": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", diff --git a/packages/server/package.json b/packages/server/package.json index de2bab2f0..cd91052e0 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -63,7 +63,6 @@ "sanitize-html": "^2.4.0", "sharp": "^0.28.3", "string-pixel-width": "^1.10.0", - "unique-names-generator": "^4.6.0", "xml-escape": "^1.1.0", "zxcvbn": "^4.4.2" },