@revideo/cli 0.4.7-alpha.1027 → 0.4.7-beta.1025
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/dist/index.js +0 -0
- package/dist/server/download.js +26 -22
- package/dist/server/index.js +22 -20
- package/dist/server/player.js +106 -80
- package/dist/server/render.js +138 -123
- package/dist/utils.js +13 -14
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/server/download.js
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : {default: mod};
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, '__esModule', {value: true});
|
|
6
8
|
exports.download = void 0;
|
|
7
|
-
const fs_1 = require(
|
|
8
|
-
const path_1 = __importDefault(require(
|
|
9
|
+
const fs_1 = require('fs');
|
|
10
|
+
const path_1 = __importDefault(require('path'));
|
|
9
11
|
async function download(req, res) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
12
|
+
const {projectName} = req.params;
|
|
13
|
+
const resultFilePath = path_1.default.join(
|
|
14
|
+
process.cwd(),
|
|
15
|
+
`output/${projectName}`,
|
|
16
|
+
);
|
|
17
|
+
try {
|
|
18
|
+
await fs_1.promises.access(resultFilePath);
|
|
19
|
+
res.download(resultFilePath, `${projectName}`, async err => {
|
|
20
|
+
if (err) {
|
|
21
|
+
console.error(err);
|
|
22
|
+
res.status(500).send('Error downloading the file.');
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error(`File not found ${resultFilePath}:`, error);
|
|
27
|
+
res.status(404).send('File not found.');
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
exports.download = download;
|
package/dist/server/index.js
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : {default: mod};
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, '__esModule', {value: true});
|
|
6
8
|
exports.createServer = void 0;
|
|
7
|
-
const cors_1 = __importDefault(require(
|
|
8
|
-
const express_1 = __importDefault(require(
|
|
9
|
-
const download_1 = require(
|
|
10
|
-
const player_1 = require(
|
|
11
|
-
const render_1 = require(
|
|
9
|
+
const cors_1 = __importDefault(require('cors'));
|
|
10
|
+
const express_1 = __importDefault(require('express'));
|
|
11
|
+
const download_1 = require('./download');
|
|
12
|
+
const player_1 = require('./player');
|
|
13
|
+
const render_1 = require('./render');
|
|
12
14
|
function createServer(hotReloadDir) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const app = (0, express_1.default)();
|
|
16
|
+
app.use(express_1.default.json({limit: '50mb'}));
|
|
17
|
+
app.use((0, cors_1.default)());
|
|
18
|
+
app.post('/render', render_1.render);
|
|
19
|
+
app.get('/download/:projectName', download_1.download);
|
|
20
|
+
app.get('/player/*', player_1.player);
|
|
21
|
+
if (hotReloadDir) {
|
|
22
|
+
(0, player_1.createHotReloader)(hotReloadDir);
|
|
23
|
+
}
|
|
24
|
+
return app;
|
|
23
25
|
}
|
|
24
26
|
exports.createServer = createServer;
|
package/dist/server/player.js
CHANGED
|
@@ -1,41 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : {default: mod};
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, '__esModule', {value: true});
|
|
6
8
|
exports.player = exports.createHotReloader = exports.buildProject = void 0;
|
|
7
|
-
const vite_plugin_1 = __importDefault(require(
|
|
8
|
-
const chokidar_1 = require(
|
|
9
|
-
const fs_1 = require(
|
|
10
|
-
const vite_1 = require(
|
|
9
|
+
const vite_plugin_1 = __importDefault(require('@revideo/vite-plugin'));
|
|
10
|
+
const chokidar_1 = require('chokidar');
|
|
11
|
+
const fs_1 = require('fs');
|
|
12
|
+
const vite_1 = require('vite');
|
|
11
13
|
const YELLOW_DOT = '\u001b[33m•\u001b[0m';
|
|
12
14
|
const GREEN_CHECK = '\u001b[32m✔\u001b[0m';
|
|
13
15
|
const RED_CROSS = '\u001b[31m✘\u001b[0m';
|
|
14
|
-
const fileNotFoundMessage =
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const fileNotFoundMessage = filePath =>
|
|
17
|
+
`${YELLOW_DOT} File ${filePath} not found. Building project...`;
|
|
18
|
+
const fileNotFoundAfterBuildingMessage = (filePath, padding) =>
|
|
19
|
+
`\r${RED_CROSS} File ${filePath} still not found after building project...`.padEnd(
|
|
20
|
+
padding,
|
|
21
|
+
' ',
|
|
22
|
+
) + '\n';
|
|
23
|
+
const fileChangedMessage = filePath =>
|
|
24
|
+
`${YELLOW_DOT} File ${filePath} has changed. Rebuilding...`;
|
|
25
|
+
const successMessage = (time, padding) =>
|
|
26
|
+
`\r${GREEN_CHECK} Project built successfully. ${time}ms`.padEnd(
|
|
27
|
+
padding,
|
|
28
|
+
' ',
|
|
29
|
+
) + '\n';
|
|
18
30
|
async function buildProject() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
try {
|
|
32
|
+
await (0, vite_1.build)({
|
|
33
|
+
configFile: false,
|
|
34
|
+
plugins: [
|
|
35
|
+
(0, vite_plugin_1.default)({project: process.env.PROJECT_FILE}),
|
|
36
|
+
],
|
|
37
|
+
build: {
|
|
38
|
+
outDir: 'dist',
|
|
39
|
+
rollupOptions: {
|
|
40
|
+
output: {
|
|
41
|
+
entryFileNames: '[name].js',
|
|
42
|
+
chunkFileNames: '[name].js',
|
|
43
|
+
assetFileNames: '[name].[ext]',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error('Error building project:', error);
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
39
52
|
}
|
|
40
53
|
exports.buildProject = buildProject;
|
|
41
54
|
/**
|
|
@@ -43,56 +56,69 @@ exports.buildProject = buildProject;
|
|
|
43
56
|
* @param dir - Directory to watch for changes.
|
|
44
57
|
*/
|
|
45
58
|
async function createHotReloader(dir) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const watcher = (0, chokidar_1.watch)(dir, {
|
|
60
|
+
ignored: ['**/*.meta'],
|
|
61
|
+
});
|
|
62
|
+
watcher.on('change', async path => {
|
|
63
|
+
const rebuildingMessage = fileChangedMessage(path);
|
|
64
|
+
process.stdout.write(rebuildingMessage);
|
|
65
|
+
const start = Date.now();
|
|
66
|
+
try {
|
|
67
|
+
await buildProject();
|
|
68
|
+
process.stdout.write(
|
|
69
|
+
successMessage(Date.now() - start, rebuildingMessage.length + 1),
|
|
70
|
+
);
|
|
71
|
+
} catch (e) {
|
|
72
|
+
// TODO: Add more detailed error message
|
|
73
|
+
console.error(
|
|
74
|
+
'Error building project. Try to run `npm run build` manually and check for errors.',
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
62
78
|
}
|
|
63
79
|
exports.createHotReloader = createHotReloader;
|
|
64
80
|
async function player(req, res) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
81
|
+
let path = `./dist/${req.params[0]}`;
|
|
82
|
+
if (req.params[0] === 'project.js') {
|
|
83
|
+
const playerFileName = (process.env.PROJECT_FILE ?? '')
|
|
84
|
+
.split('/')
|
|
85
|
+
.pop()
|
|
86
|
+
?.replace('.ts', '.js');
|
|
87
|
+
path = `./dist/${playerFileName}`;
|
|
88
|
+
}
|
|
89
|
+
let buildTime = undefined;
|
|
90
|
+
let error = false;
|
|
91
|
+
// Check if the file exists and build the project if it doesn't.
|
|
92
|
+
await fs_1.promises.access(path).catch(async () => {
|
|
93
|
+
buildTime = Date.now();
|
|
94
|
+
process.stdout.write(fileNotFoundMessage(path));
|
|
95
|
+
await buildProject().catch(() => {
|
|
96
|
+
res.status(500).send('Error building project');
|
|
82
97
|
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return
|
|
98
|
+
});
|
|
99
|
+
// If the file still doesn't exist, send an error response.
|
|
100
|
+
await fs_1.promises.access(path).catch(() => {
|
|
101
|
+
process.stdout.write(
|
|
102
|
+
fileNotFoundAfterBuildingMessage(
|
|
103
|
+
path,
|
|
104
|
+
fileNotFoundMessage(path).length + 1,
|
|
105
|
+
),
|
|
106
|
+
);
|
|
107
|
+
res.status(404).send(`File ${path} not found`);
|
|
108
|
+
error = true;
|
|
109
|
+
});
|
|
110
|
+
if (error) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
// If we built the project, update the log message.
|
|
114
|
+
if (buildTime) {
|
|
115
|
+
process.stdout.write(
|
|
116
|
+
successMessage(
|
|
117
|
+
Date.now() - buildTime,
|
|
118
|
+
fileNotFoundMessage(path).length + 1,
|
|
119
|
+
),
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
return res.sendFile(path, {root: './'});
|
|
97
123
|
}
|
|
98
124
|
exports.player = player;
|
package/dist/server/render.js
CHANGED
|
@@ -1,134 +1,149 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : {default: mod};
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, '__esModule', {value: true});
|
|
6
8
|
exports.render = void 0;
|
|
7
|
-
const renderer_1 = require(
|
|
8
|
-
const axios_1 = __importDefault(require(
|
|
9
|
-
const path_1 = __importDefault(require(
|
|
10
|
-
const uuid_1 = require(
|
|
11
|
-
const utils_1 = require(
|
|
9
|
+
const renderer_1 = require('@revideo/renderer');
|
|
10
|
+
const axios_1 = __importDefault(require('axios'));
|
|
11
|
+
const path_1 = __importDefault(require('path'));
|
|
12
|
+
const uuid_1 = require('uuid');
|
|
13
|
+
const utils_1 = require('../utils');
|
|
12
14
|
async function render(req, res) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
15
|
+
const {callbackUrl} = req.body;
|
|
16
|
+
if (callbackUrl) {
|
|
17
|
+
await renderWithCallback(req, res);
|
|
18
|
+
} else {
|
|
19
|
+
await renderWithoutCallback(req, res);
|
|
20
|
+
}
|
|
20
21
|
}
|
|
21
22
|
exports.render = render;
|
|
22
23
|
async function renderWithCallback(req, res) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
status: 'error',
|
|
59
|
-
error: error.message,
|
|
60
|
-
}, {
|
|
61
|
-
headers: {
|
|
62
|
-
// eslint-disable-next-line
|
|
63
|
-
'Content-Type': 'application/json',
|
|
64
|
-
},
|
|
65
|
-
});
|
|
24
|
+
// TODO: validate request body
|
|
25
|
+
const {variables, callbackUrl, settings} = req.body;
|
|
26
|
+
const tempProjectName = (0, uuid_1.v4)();
|
|
27
|
+
const outputFileName = `${tempProjectName}.mp4`;
|
|
28
|
+
res.json({tempProjectName});
|
|
29
|
+
try {
|
|
30
|
+
await (0, renderer_1.renderVideo)({
|
|
31
|
+
projectFile: process.env.PROJECT_FILE || '',
|
|
32
|
+
variables,
|
|
33
|
+
settings: {
|
|
34
|
+
...settings,
|
|
35
|
+
outFile: outputFileName,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
const resultFilePath = path_1.default.join(
|
|
39
|
+
process.cwd(),
|
|
40
|
+
`output/${outputFileName}`,
|
|
41
|
+
);
|
|
42
|
+
const downloadLink = `${req.protocol}://${req.get('host')}/download/${outputFileName}`;
|
|
43
|
+
const response = await axios_1.default.post(
|
|
44
|
+
callbackUrl,
|
|
45
|
+
{
|
|
46
|
+
tempProjectName,
|
|
47
|
+
status: 'success',
|
|
48
|
+
downloadLink,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
headers: {
|
|
52
|
+
// eslint-disable-next-line
|
|
53
|
+
'Content-Type': 'application/json',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
if (response.status !== 200) {
|
|
58
|
+
throw new Error('Callback URL responded with an error');
|
|
66
59
|
}
|
|
60
|
+
(0, utils_1.scheduleCleanup)(resultFilePath);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error(error);
|
|
63
|
+
await axios_1.default.post(
|
|
64
|
+
callbackUrl,
|
|
65
|
+
{
|
|
66
|
+
tempProjectName,
|
|
67
|
+
status: 'error',
|
|
68
|
+
error: error.message,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
headers: {
|
|
72
|
+
// eslint-disable-next-line
|
|
73
|
+
'Content-Type': 'application/json',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
}
|
|
67
78
|
}
|
|
68
79
|
async function renderWithoutCallback(req, res) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
80
|
+
// TODO: validate request body
|
|
81
|
+
const {variables, streamProgress, settings} = req.body;
|
|
82
|
+
const tempProjectName = `${(0, uuid_1.v4)()}.mp4`;
|
|
83
|
+
const resultFilePath = path_1.default.join(
|
|
84
|
+
process.cwd(),
|
|
85
|
+
`output/${tempProjectName}`,
|
|
86
|
+
);
|
|
87
|
+
if (streamProgress) {
|
|
88
|
+
res.writeHead(200, {
|
|
89
|
+
// eslint-disable-next-line
|
|
90
|
+
'Content-Type': 'text/event-stream',
|
|
91
|
+
// eslint-disable-next-line
|
|
92
|
+
'Cache-Control': 'no-cache',
|
|
93
|
+
// eslint-disable-next-line
|
|
94
|
+
Connection: 'keep-alive',
|
|
95
|
+
});
|
|
96
|
+
const sendProgress = (worker, progress) => {
|
|
97
|
+
res.write(`event: progress\n`);
|
|
98
|
+
res.write(`data: ${JSON.stringify({worker, progress})}\n\n`);
|
|
99
|
+
};
|
|
100
|
+
try {
|
|
101
|
+
await (0, renderer_1.renderVideo)({
|
|
102
|
+
projectFile: process.env.PROJECT_FILE || '',
|
|
103
|
+
variables,
|
|
104
|
+
settings: {
|
|
105
|
+
...settings,
|
|
106
|
+
outFile: tempProjectName,
|
|
107
|
+
progressCallback: sendProgress,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
const downloadLink = `${req.protocol}://${req.get('host')}/download/${tempProjectName}`;
|
|
111
|
+
res.write(`event: completed\n`);
|
|
112
|
+
res.write(
|
|
113
|
+
`data: ${JSON.stringify({status: 'success', downloadLink})}\n\n`,
|
|
114
|
+
);
|
|
115
|
+
res.end();
|
|
116
|
+
(0, utils_1.scheduleCleanup)(resultFilePath);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
console.error(error);
|
|
119
|
+
res.write(`event: error\n`);
|
|
120
|
+
res.write(
|
|
121
|
+
`data: ${JSON.stringify({status: 'error', message: error.message})}\n\n`,
|
|
122
|
+
);
|
|
123
|
+
res.end();
|
|
108
124
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
});
|
|
132
|
-
}
|
|
125
|
+
} else {
|
|
126
|
+
try {
|
|
127
|
+
await (0, renderer_1.renderVideo)({
|
|
128
|
+
projectFile: process.env.PROJECT_FILE || '',
|
|
129
|
+
variables,
|
|
130
|
+
settings: {
|
|
131
|
+
...settings,
|
|
132
|
+
outFile: tempProjectName,
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
const downloadLink = `${req.protocol}://${req.get('host')}/download/${tempProjectName}`;
|
|
136
|
+
res.json({
|
|
137
|
+
status: 'success',
|
|
138
|
+
downloadLink: downloadLink,
|
|
139
|
+
});
|
|
140
|
+
(0, utils_1.scheduleCleanup)(resultFilePath);
|
|
141
|
+
} catch (error) {
|
|
142
|
+
console.error(error);
|
|
143
|
+
res.status(500).json({
|
|
144
|
+
status: 'error',
|
|
145
|
+
message: error.message,
|
|
146
|
+
});
|
|
133
147
|
}
|
|
148
|
+
}
|
|
134
149
|
}
|
package/dist/utils.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', {value: true});
|
|
3
3
|
exports.scheduleCleanup = void 0;
|
|
4
|
-
const fs_1 = require(
|
|
4
|
+
const fs_1 = require('fs');
|
|
5
5
|
function scheduleCleanup(filePath) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
setTimeout(clean, 10 * 60 * 1000);
|
|
6
|
+
const clean = async () => {
|
|
7
|
+
try {
|
|
8
|
+
await fs_1.promises.unlink(filePath);
|
|
9
|
+
console.log(`Successfully deleted file: ${filePath}`);
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error(`Error deleting file ${filePath}: ${error}`);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
// Wait 10 minutes before removing file.
|
|
15
|
+
setTimeout(clean, 10 * 60 * 1000);
|
|
17
16
|
}
|
|
18
17
|
exports.scheduleCleanup = scheduleCleanup;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revideo/cli",
|
|
3
|
-
"version": "0.4.7-
|
|
3
|
+
"version": "0.4.7-beta.1025+ebba1735",
|
|
4
4
|
"description": "A CLI for revideo",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "revideo",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"typescript": "^5.4.3"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@revideo/renderer": "^0.4.7-
|
|
29
|
-
"@revideo/telemetry": "^0.4.7-
|
|
28
|
+
"@revideo/renderer": "^0.4.7-beta.1025+ebba1735",
|
|
29
|
+
"@revideo/telemetry": "^0.4.7-beta.1025+ebba1735",
|
|
30
30
|
"chokidar": "^3.5.3",
|
|
31
31
|
"commander": "^12.0.0",
|
|
32
32
|
"cors": "^2.8.5",
|
|
33
33
|
"express": "^4.19.2",
|
|
34
34
|
"uuid": "^9.0.1"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "ebba1735dd433428686915a7a8fa38b19424b2bb"
|
|
37
37
|
}
|