create-dacosta-proj 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-dacosta-proj",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "bin": {
5
5
  "create-dacosta-proj": "./index.js"
6
6
  }
@@ -1,14 +1,14 @@
1
1
  // Packages / Helpers
2
2
 
3
3
  const generateUniqueId = require('generate-unique-id');
4
- const redis = require('@/helpers/getRedis');
4
+ const { global } = require('@/config/global');
5
5
 
6
6
  async function generateId(customLength) {
7
7
  const id = generateUniqueId({ length: customLength || 32 });
8
- const exists = await redis.exists(`${process.env.PROJECT_ID}_ids_${id}`);
8
+ const exists = await global.redis.exists(`${process.env.PROJECT_ID}_ids_${id}`);
9
9
  if (exists) return await generateId(customLength);
10
10
  else {
11
- await redis.set(`${process.env.PROJECT_ID}_ids_${id}`, '.');
11
+ await global.redis.set(`${process.env.PROJECT_ID}_ids_${id}`, '.');
12
12
  return id;
13
13
  }
14
14
  }
@@ -6,7 +6,7 @@ require('module-alias/register');
6
6
  // Packages / Helpers
7
7
 
8
8
  const { SimpleSupabase } = require('simple-supabase');
9
- const redis = require('@/helpers/getRedis');
9
+ const { createClient: createRedisClient } = require('redis');
10
10
  const { global } = require('@/config/global');
11
11
 
12
12
  // Start System
@@ -29,6 +29,12 @@ const { global } = require('@/config/global');
29
29
  });
30
30
 
31
31
  global.db = db;
32
+
33
+ // Redis
34
+
35
+ const redis = createRedisClient();
36
+ await redis.connect();
37
+
32
38
  global.redis = redis;
33
39
 
34
40
  // ------- Start Here -------
@@ -1,4 +0,0 @@
1
- const redis = require('redis');
2
- const client = redis.createClient();
3
- client.connect();
4
- module.exports = client;