From 309a83465401077b2a731c798ee1a16e2336b9f0 Mon Sep 17 00:00:00 2001 From: ivaosthu Date: Thu, 10 Nov 2016 14:22:04 +0100 Subject: [PATCH] remove unleash-demo-app to separate repo --- packages/unleash-demo-app/.eslintrc | 6 -- packages/unleash-demo-app/alot-of-clients.js | 41 ----------- packages/unleash-demo-app/index.js | 74 -------------------- packages/unleash-demo-app/package.json | 22 ------ packages/unleash-demo-app/test.js | 0 5 files changed, 143 deletions(-) delete mode 100644 packages/unleash-demo-app/.eslintrc delete mode 100644 packages/unleash-demo-app/alot-of-clients.js delete mode 100644 packages/unleash-demo-app/index.js delete mode 100644 packages/unleash-demo-app/package.json delete mode 100644 packages/unleash-demo-app/test.js diff --git a/packages/unleash-demo-app/.eslintrc b/packages/unleash-demo-app/.eslintrc deleted file mode 100644 index 8f68bb4a87..0000000000 --- a/packages/unleash-demo-app/.eslintrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": [ - "finn", - "finn/node" - ] -} diff --git a/packages/unleash-demo-app/alot-of-clients.js b/packages/unleash-demo-app/alot-of-clients.js deleted file mode 100644 index 95b01fb7c0..0000000000 --- a/packages/unleash-demo-app/alot-of-clients.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -const unleash = require('unleash-client'); - -new Array(1000) - .join(',') - .split(',') - .forEach((v, index) => { - const instance = new unleash.Unleash({ - appName: `demo-app-${index % 5}`, - instanceId: `index-${index}`, - url: 'http://localhost:4242/', - refreshIntervall: 4000, - metricsInterval: 10000, - strategies: [ - new unleash.Strategy('extra', true), - ], - }); - - - instance.on('ready', () => { - console.log('connected to unleash', index); - - setInterval(() => { - instance.isEnabled('toggle-1', null, Boolean(Math.round(Math.random() * 2))); - }, Math.round(Math.random() * 1000)); - setInterval(() => { - instance.isEnabled('toggle-2', null, Boolean(Math.round(Math.random() * 2))); - }, 1500); - setInterval(() => { - instance.isEnabled('toggle-3', null, Boolean(Math.round(Math.random() * 2))); - }, 1300); - setInterval(() => { - instance.isEnabled('toggle-4', null, Boolean(Math.round(Math.random() * 2))); - }, 1300); - }); - instance.on('error', (err) => { - console.error('index', index, err.message); - }); - instance.on('warn', console.warn); - }); diff --git a/packages/unleash-demo-app/index.js b/packages/unleash-demo-app/index.js deleted file mode 100644 index b16b2b0d16..0000000000 --- a/packages/unleash-demo-app/index.js +++ /dev/null @@ -1,74 +0,0 @@ -'use strict'; - -const express = require('express'); -const unleash = require('unleash-client'); -const chalk = require('chalk'); - -const app = express(); - -const instance = unleash.initialize({ - appName: 'demo-app', - url: 'http://localhost:4242/', - refreshIntervall: 4000, - metricsInterval: 10000, - strategies: [ - new unleash.Strategy('extra', true), - ], -}); - - -instance.on('ready', () => { - console.log('connected to unleash'); - - setInterval(() => { - const result = unleash.isEnabled('add-feature-2', null, Boolean(Math.round(Math.random() * 2))); - console.log(chalk.yellow('add-feature-2'), chalk.blue(result.toString())); - }, 1000); - setInterval(() => { - const result = unleash.isEnabled('toggle-2', null, Boolean(Math.round(Math.random() * 2))); - console.log(chalk.green('toggle-2'), chalk.blue(result.toString())); - }, 1500); - setInterval(() => { - const result = unleash.isEnabled('toggle-3', null, Boolean(Math.round(Math.random() * 2))); - console.log(chalk.red('toggle-3'), chalk.blue(result.toString())); - }, 1500); -}); -instance.on('error', (err) => { - console.error(err.message, err.stack); -}); -instance.on('warn', console.warn); - - -function outputFeature (name, feature) { - if (feature.enabled === false) { - return; - } - return `
-

${name}

- -
`; -} - -app.get('/', (req, res) => { - const { data } = instance.repository.storage; - - res.send(` - - - Demo example unleash-client usage - - ${ - Object.keys(data) - .map((key) => outputFeature(key, data[key])) - .filter(Boolean) - .join('
') - } - `); -}); - -app.listen(process.env.PORT || 1337); diff --git a/packages/unleash-demo-app/package.json b/packages/unleash-demo-app/package.json deleted file mode 100644 index e6258d6057..0000000000 --- a/packages/unleash-demo-app/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "unleash-demo-app", - "version": "1.0.0", - "description": "", - "main": "src/index.js", - "scripts": { - "start": "node .", - "test:ci": "echo 'success'" - }, - "dependencies": { - "express": "^4.14.0", - "unleash-client": "^1.0.0-alpha.4" - }, - "devDependencies": { - "@types/express": "^4.0.33", - "@types/node": "^6.0.45", - "chalk": "^1.1.3", - "unleash-api": "1.0.0-alpha.2" - }, - "author": "", - "license": "ISC" -} diff --git a/packages/unleash-demo-app/test.js b/packages/unleash-demo-app/test.js deleted file mode 100644 index e69de29bb2..0000000000