curatedreels-deploy 1.0.1
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/README.md +176 -0
- package/dist/clients/deno.d.ts +60 -0
- package/dist/clients/deno.d.ts.map +1 -0
- package/dist/clients/deno.js +173 -0
- package/dist/clients/deno.js.map +1 -0
- package/dist/clients/vercel.d.ts +82 -0
- package/dist/clients/vercel.d.ts.map +1 -0
- package/dist/clients/vercel.js +363 -0
- package/dist/clients/vercel.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +165 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrator.d.ts +44 -0
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +201 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/services/bundles.d.ts +42 -0
- package/dist/services/bundles.d.ts.map +1 -0
- package/dist/services/bundles.js +213 -0
- package/dist/services/bundles.js.map +1 -0
- package/dist/services/license.d.ts +39 -0
- package/dist/services/license.d.ts.map +1 -0
- package/dist/services/license.js +103 -0
- package/dist/services/license.js.map +1 -0
- package/dist/services/mongodb.d.ts +21 -0
- package/dist/services/mongodb.d.ts.map +1 -0
- package/dist/services/mongodb.js +161 -0
- package/dist/services/mongodb.js.map +1 -0
- package/dist/utils/credentials.d.ts +26 -0
- package/dist/utils/credentials.d.ts.map +1 -0
- package/dist/utils/credentials.js +176 -0
- package/dist/utils/credentials.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MongoDB Setup Service
|
|
3
|
+
*
|
|
4
|
+
* Configures MongoDB Atlas database for CuratedReels
|
|
5
|
+
* - Creates collections
|
|
6
|
+
* - Sets up indexes
|
|
7
|
+
* - Seeds initial data
|
|
8
|
+
*/
|
|
9
|
+
import { MongoClient } from 'mongodb';
|
|
10
|
+
import { readFile } from 'fs/promises';
|
|
11
|
+
import { getBundlesDir } from './bundles.js';
|
|
12
|
+
/**
|
|
13
|
+
* Setup MongoDB database
|
|
14
|
+
*/
|
|
15
|
+
export async function setupMongoDB(uri) {
|
|
16
|
+
const client = new MongoClient(uri);
|
|
17
|
+
try {
|
|
18
|
+
await client.connect();
|
|
19
|
+
const db = client.db('curatedreels');
|
|
20
|
+
// Load schema from bundle
|
|
21
|
+
const schema = await loadSchema();
|
|
22
|
+
// Create collections and indexes
|
|
23
|
+
await createCollections(db, schema);
|
|
24
|
+
// Seed initial data
|
|
25
|
+
if (schema.seedData) {
|
|
26
|
+
await seedData(db, schema.seedData);
|
|
27
|
+
}
|
|
28
|
+
// Verify setup
|
|
29
|
+
await verifySetup(db);
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
await client.close();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Load database schema from bundle
|
|
37
|
+
*/
|
|
38
|
+
async function loadSchema() {
|
|
39
|
+
const schemaPath = `${getBundlesDir()}/schema.json`;
|
|
40
|
+
const content = await readFile(schemaPath, 'utf-8');
|
|
41
|
+
return JSON.parse(content);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create collections and indexes
|
|
45
|
+
*/
|
|
46
|
+
async function createCollections(db, schema) {
|
|
47
|
+
for (const collectionDef of schema.collections) {
|
|
48
|
+
const { name, indexes, validator } = collectionDef;
|
|
49
|
+
// Create collection if it doesn't exist
|
|
50
|
+
const collections = await db.listCollections({ name }).toArray();
|
|
51
|
+
if (collections.length === 0) {
|
|
52
|
+
const options = {};
|
|
53
|
+
if (validator) {
|
|
54
|
+
options.validator = validator;
|
|
55
|
+
}
|
|
56
|
+
await db.createCollection(name, options);
|
|
57
|
+
}
|
|
58
|
+
const collection = db.collection(name);
|
|
59
|
+
// Create indexes
|
|
60
|
+
for (const index of indexes) {
|
|
61
|
+
try {
|
|
62
|
+
await collection.createIndex(index.key, {
|
|
63
|
+
unique: index.unique || false,
|
|
64
|
+
name: index.name || undefined
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
// Index might already exist, ignore duplicate key errors
|
|
69
|
+
if (!(error instanceof Error && error.message.includes('already exists'))) {
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Seed initial data
|
|
78
|
+
*/
|
|
79
|
+
async function seedData(db, seedData) {
|
|
80
|
+
if (!seedData)
|
|
81
|
+
return;
|
|
82
|
+
for (const seed of seedData) {
|
|
83
|
+
const collection = db.collection(seed.collection);
|
|
84
|
+
// Only seed if collection is empty
|
|
85
|
+
const count = await collection.countDocuments();
|
|
86
|
+
if (count === 0) {
|
|
87
|
+
await collection.insertMany(seed.documents);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Verify database setup
|
|
93
|
+
*/
|
|
94
|
+
async function verifySetup(db) {
|
|
95
|
+
// Check required collections exist
|
|
96
|
+
const requiredCollections = ['videos', 'organizations', 'users'];
|
|
97
|
+
const collections = await db.listCollections().toArray();
|
|
98
|
+
const collectionNames = collections.map((c) => c.name);
|
|
99
|
+
for (const required of requiredCollections) {
|
|
100
|
+
if (!collectionNames.includes(required)) {
|
|
101
|
+
throw new Error(`Required collection ${required} not found`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Check indexes on videos collection
|
|
105
|
+
const videosIndexes = await db.collection('videos').indexes();
|
|
106
|
+
const indexNames = videosIndexes.map((i) => i.name);
|
|
107
|
+
const requiredIndexes = ['slug_1', 'category_1', 'ageRange_1'];
|
|
108
|
+
for (const required of requiredIndexes) {
|
|
109
|
+
if (!indexNames.includes(required)) {
|
|
110
|
+
throw new Error(`Required index ${required} not found on videos collection`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Test MongoDB connection
|
|
116
|
+
*/
|
|
117
|
+
export async function testConnection(uri) {
|
|
118
|
+
const client = new MongoClient(uri);
|
|
119
|
+
try {
|
|
120
|
+
await client.connect();
|
|
121
|
+
await client.db().admin().ping();
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
throw new Error(`MongoDB connection failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
await client.close();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get database statistics
|
|
133
|
+
*/
|
|
134
|
+
export async function getDatabaseStats(uri) {
|
|
135
|
+
const client = new MongoClient(uri);
|
|
136
|
+
try {
|
|
137
|
+
await client.connect();
|
|
138
|
+
const db = client.db('curatedreels');
|
|
139
|
+
const stats = await db.stats();
|
|
140
|
+
const collections = await db.listCollections().toArray();
|
|
141
|
+
const collectionStats = await Promise.all(collections.map(async (c) => {
|
|
142
|
+
const coll = db.collection(c.name);
|
|
143
|
+
const count = await coll.countDocuments();
|
|
144
|
+
return {
|
|
145
|
+
name: c.name,
|
|
146
|
+
documentCount: count
|
|
147
|
+
};
|
|
148
|
+
}));
|
|
149
|
+
return {
|
|
150
|
+
database: stats.db,
|
|
151
|
+
dataSize: stats.dataSize,
|
|
152
|
+
storageSize: stats.storageSize,
|
|
153
|
+
indexesSize: stats.indexSize,
|
|
154
|
+
collections: collectionStats
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
await client.close();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=mongodb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongodb.js","sourceRoot":"","sources":["../../src/services/mongodb.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAE,Q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CAAA;QAED,OAAO;YACH,QAAQ,EAAE,KAAK,CAAC,EAAE;YAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,WAAW,EAAE,KAAK,CAAC,SAAS;YAC5B,WAAW,EAAE,eAAe;SAC/B,CAAA;IACL,CAAC;YAAS,CAAC;QACP,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IACxB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credentials Collection
|
|
3
|
+
*
|
|
4
|
+
* Interactive prompts to collect customer's infrastructure credentials
|
|
5
|
+
*/
|
|
6
|
+
export interface DeploymentCredentials {
|
|
7
|
+
vercelToken: string;
|
|
8
|
+
vercelTeamId?: string;
|
|
9
|
+
denoToken: string;
|
|
10
|
+
denoOrg?: string;
|
|
11
|
+
mongodbUri: string;
|
|
12
|
+
telegramBotToken: string;
|
|
13
|
+
telegramGroupId?: string;
|
|
14
|
+
cloudinaryCloudName?: string;
|
|
15
|
+
cloudinaryApiKey?: string;
|
|
16
|
+
cloudinaryApiSecret?: string;
|
|
17
|
+
youtubeApiKey?: string;
|
|
18
|
+
projectName: string;
|
|
19
|
+
customDomain?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function collectCredentials(): Promise<DeploymentCredentials>;
|
|
22
|
+
/**
|
|
23
|
+
* Validate credentials format
|
|
24
|
+
*/
|
|
25
|
+
export declare function validateCredentials(credentials: DeploymentCredentials): boolean;
|
|
26
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/utils/credentials.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,WAAW,qBAAqB;IAElC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IAGrB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAGhB,UAAU,EAAE,MAAM,CAAA;IAGlB,gBAAgB,EAAE,MAAM,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;IAGxB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAG5B,aAAa,CAAC,EAAE,MAAM,CAAA;IAGtB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAkKzE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,qBAAqB,GAAG,OAAO,CAgB/E"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credentials Collection
|
|
3
|
+
*
|
|
4
|
+
* Interactive prompts to collect customer's infrastructure credentials
|
|
5
|
+
*/
|
|
6
|
+
import prompts from 'prompts';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
export async function collectCredentials() {
|
|
9
|
+
console.log(chalk.gray('\nWe need your infrastructure credentials to deploy CuratedReels.\n'));
|
|
10
|
+
console.log(chalk.white('Required services:'));
|
|
11
|
+
console.log(chalk.gray(' • Vercel (hosting)'));
|
|
12
|
+
console.log(chalk.gray(' • Deno Deploy (bot)'));
|
|
13
|
+
console.log(chalk.gray(' • MongoDB Atlas (database)'));
|
|
14
|
+
console.log(chalk.gray(' • Telegram Bot API\n'));
|
|
15
|
+
const credentials = await prompts([
|
|
16
|
+
// Project Configuration
|
|
17
|
+
{
|
|
18
|
+
type: 'text',
|
|
19
|
+
name: 'projectName',
|
|
20
|
+
message: 'Project name (lowercase, no spaces):',
|
|
21
|
+
validate: (value) => {
|
|
22
|
+
if (!/^[a-z0-9-]+$/.test(value)) {
|
|
23
|
+
return 'Only lowercase letters, numbers, and hyphens allowed';
|
|
24
|
+
}
|
|
25
|
+
if (value.length < 3 || value.length > 32) {
|
|
26
|
+
return 'Must be between 3-32 characters';
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
// Vercel
|
|
32
|
+
{
|
|
33
|
+
type: 'password',
|
|
34
|
+
name: 'vercelToken',
|
|
35
|
+
message: 'Vercel API Token:',
|
|
36
|
+
validate: (value) => {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'text',
|
|
42
|
+
name: 'vercelTeamId',
|
|
43
|
+
message: 'Vercel Team ID (optional, press Enter to skip):',
|
|
44
|
+
initial: ''
|
|
45
|
+
},
|
|
46
|
+
// Deno Deploy
|
|
47
|
+
{
|
|
48
|
+
type: 'password',
|
|
49
|
+
name: 'denoToken',
|
|
50
|
+
message: 'Deno Deploy Access Token:',
|
|
51
|
+
validate: (value) => value.length > 20 || 'Invalid Deno token'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: 'text',
|
|
55
|
+
name: 'denoOrg',
|
|
56
|
+
message: 'Deno Organization (optional, press Enter to skip):',
|
|
57
|
+
initial: ''
|
|
58
|
+
},
|
|
59
|
+
// MongoDB
|
|
60
|
+
{
|
|
61
|
+
type: 'text',
|
|
62
|
+
name: 'mongodbUri',
|
|
63
|
+
message: 'MongoDB Atlas Connection URI:',
|
|
64
|
+
validate: (value) => {
|
|
65
|
+
if (!value.startsWith('mongodb+srv://') && !value.startsWith('mongodb://')) {
|
|
66
|
+
return 'Invalid MongoDB URI (should start with "mongodb+srv://" or "mongodb://")';
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
// Telegram
|
|
72
|
+
{
|
|
73
|
+
type: 'password',
|
|
74
|
+
name: 'telegramBotToken',
|
|
75
|
+
message: 'Telegram Bot Token:',
|
|
76
|
+
validate: (value) => {
|
|
77
|
+
if (!/^\d+:.+/.test(value)) {
|
|
78
|
+
return 'Invalid bot token format (should be like "123456:ABC-DEF1234")';
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: 'text',
|
|
85
|
+
name: 'telegramGroupId',
|
|
86
|
+
message: 'Telegram Group ID (optional, can set later):',
|
|
87
|
+
initial: ''
|
|
88
|
+
},
|
|
89
|
+
// Optional services
|
|
90
|
+
{
|
|
91
|
+
type: 'confirm',
|
|
92
|
+
name: 'enableCloudinary',
|
|
93
|
+
message: 'Enable Cloudinary for video uploads?',
|
|
94
|
+
initial: true
|
|
95
|
+
}
|
|
96
|
+
]);
|
|
97
|
+
// Cloudinary (conditional)
|
|
98
|
+
if (credentials.enableCloudinary) {
|
|
99
|
+
const cloudinary = await prompts([
|
|
100
|
+
{
|
|
101
|
+
type: 'text',
|
|
102
|
+
name: 'cloudinaryCloudName',
|
|
103
|
+
message: 'Cloudinary Cloud Name:'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
type: 'password',
|
|
107
|
+
name: 'cloudinaryApiKey',
|
|
108
|
+
message: 'Cloudinary API Key:'
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: 'password',
|
|
112
|
+
name: 'cloudinaryApiSecret',
|
|
113
|
+
message: 'Cloudinary API Secret:'
|
|
114
|
+
}
|
|
115
|
+
]);
|
|
116
|
+
credentials.cloudinaryCloudName = cloudinary.cloudinaryCloudName;
|
|
117
|
+
credentials.cloudinaryApiKey = cloudinary.cloudinaryApiKey;
|
|
118
|
+
credentials.cloudinaryApiSecret = cloudinary.cloudinaryApiSecret;
|
|
119
|
+
}
|
|
120
|
+
// YouTube API (optional)
|
|
121
|
+
const { enableYoutube } = await prompts({
|
|
122
|
+
type: 'confirm',
|
|
123
|
+
name: 'enableYoutube',
|
|
124
|
+
message: 'Enable YouTube metadata extraction?',
|
|
125
|
+
initial: false
|
|
126
|
+
});
|
|
127
|
+
if (enableYoutube) {
|
|
128
|
+
const { youtubeApiKey } = await prompts({
|
|
129
|
+
type: 'password',
|
|
130
|
+
name: 'youtubeApiKey',
|
|
131
|
+
message: 'YouTube Data API Key:'
|
|
132
|
+
});
|
|
133
|
+
credentials.youtubeApiKey = youtubeApiKey;
|
|
134
|
+
}
|
|
135
|
+
// Custom domain (optional)
|
|
136
|
+
const { useCustomDomain } = await prompts({
|
|
137
|
+
type: 'confirm',
|
|
138
|
+
name: 'useCustomDomain',
|
|
139
|
+
message: 'Add custom domain for frontend?',
|
|
140
|
+
initial: false
|
|
141
|
+
});
|
|
142
|
+
if (useCustomDomain) {
|
|
143
|
+
const { customDomain } = await prompts({
|
|
144
|
+
type: 'text',
|
|
145
|
+
name: 'customDomain',
|
|
146
|
+
message: 'Custom domain (e.g., app.yourdomain.com):',
|
|
147
|
+
validate: (value) => {
|
|
148
|
+
if (!/^[a-z0-9.-]+\.[a-z]{2,}$/.test(value)) {
|
|
149
|
+
return 'Invalid domain format';
|
|
150
|
+
}
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
credentials.customDomain = customDomain;
|
|
155
|
+
}
|
|
156
|
+
return credentials;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Validate credentials format
|
|
160
|
+
*/
|
|
161
|
+
export function validateCredentials(credentials) {
|
|
162
|
+
const required = [
|
|
163
|
+
'vercelToken',
|
|
164
|
+
'denoToken',
|
|
165
|
+
'mongodbUri',
|
|
166
|
+
'telegramBotToken',
|
|
167
|
+
'projectName'
|
|
168
|
+
];
|
|
169
|
+
for (const field of required) {
|
|
170
|
+
if (!credentials[field]) {
|
|
171
|
+
throw new Error(`Missing required credential: ${field}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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EAAE,iBAAiB;QACvB,OAAO,EAAE,iCAAiC;QAC1C,OAAO,EAAE,KAAK;KACjB,CAAC,CAAA;IAEF,IAAI,eAAe,EAAE,CAAC;QAClB,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,OAAO,CAAC;YACnC,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,2CAA2C;YACpD,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;gBAChB,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC1C,OAAO,uBAAuB,CAAA;gBAClC,CAAC;gBACD,OAAO,IAAI,CAAA;YACf,CAAC;SACJ,CAAC,CAAA;QACF,WAAW,CAAC,YAAY,GAAG,YAAY,CAAA;IAC3C,CAAC;IAED,OAAO,WAAW,CAAA;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAkC;IAClE,MAAM,QAAQ,GAAG;QACb,aAAa;QACb,WAAW;QACX,YAAY;QACZ,kBAAkB;QAClB,aAAa;KAChB,CAAA;IAED,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC3B,IAAI,CAAC,WAAW,CAAC,KAAoC,CAAC,EAAE,CAAC;YACrD,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAA;QAC5D,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAA;AACf,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "curatedreels-deploy",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "White-label deployment CLI for CuratedReels",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"curatedreels-deploy": "./dist/index.js",
|
|
8
|
+
"curatedreels": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"dev": "tsx src/index.ts",
|
|
17
|
+
"prepublishOnly": "npm run build"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"curatedreels",
|
|
21
|
+
"curatedreels",
|
|
22
|
+
"deployment",
|
|
23
|
+
"white-label",
|
|
24
|
+
"saas",
|
|
25
|
+
"telegram",
|
|
26
|
+
"video",
|
|
27
|
+
"curation"
|
|
28
|
+
],
|
|
29
|
+
"author": "CuratedReels",
|
|
30
|
+
"license": "PROPRIETARY",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/choicexchangedev-cpu/curatedreels-releases"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://curatedreels.com",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"chalk": "^5.3.0",
|
|
38
|
+
"dotenv": "^16.4.1",
|
|
39
|
+
"mongodb": "^6.3.0",
|
|
40
|
+
"node-fetch": "^3.3.2",
|
|
41
|
+
"ora": "^8.0.1",
|
|
42
|
+
"prompts": "^2.4.2",
|
|
43
|
+
"tar": "^7.0.1",
|
|
44
|
+
"vercel": "^50.4.10"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^20.11.5",
|
|
48
|
+
"@types/prompts": "^2.4.9",
|
|
49
|
+
"@types/tar": "^6.1.11",
|
|
50
|
+
"tsx": "^4.7.0",
|
|
51
|
+
"typescript": "^5.3.3"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=18.0.0"
|
|
55
|
+
}
|
|
56
|
+
}
|