Skip to content

Commit 00efba2

Browse files
committed
Fix QA bugs
1 parent b9cd545 commit 00efba2

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

templates/cli/lib/commands/run.js.twig

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,20 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
149149
variables['OPEN_RUNTIMES_HEADERS'] = JSON.stringify(headers);
150150

151151
await dockerPull(func);
152+
153+
log('Building function using Docker ...');
152154
await dockerBuild(func, variables);
153155

154-
log('Starting function using Docker ...');
155-
hint('Function automatically restarts when you edit your code.');
156+
log('Starting function using Docker ...');
157+
hint('Function automatically restarts when you edit your code.');
156158

157159
await dockerStart(func, variables, port);
158160

159161
new Tail(logsPath).on("line", function(data) {
160-
process.stdout.write(chalk.blackBright(`${data}\n`));
162+
process.stdout.write(chalk.white(`${data}\n`));
161163
});
162164
new Tail(errorsPath).on("line", function(data) {
163-
process.stdout.write(chalk.blackBright(`${data}\n`));
165+
process.stdout.write(chalk.white(`${data}\n`));
164166
});
165167

166168
if(!noReload) {

templates/cli/lib/emulation/docker.js.twig

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ async function dockerPull(func) {
5757
}
5858

5959
async function dockerBuild(func, variables) {
60-
log('Building function using Docker ...');
61-
6260
const runtimeChunks = func.runtime.split("-");
6361
const runtimeVersion = runtimeChunks.pop();
6462
const runtimeName = runtimeChunks.join("-");
@@ -133,7 +131,6 @@ async function dockerStart(func, variables, port) {
133131

134132
const params = [ 'run' ];
135133
params.push('--rm');
136-
params.push('-d');
137134
params.push('--name', id);
138135
params.push('-p', `${port}:3000`);
139136
params.push('-l', 'appwrite-env=dev');
@@ -150,11 +147,19 @@ async function dockerStart(func, variables, port) {
150147
params.push('-v', `${functionDir}/.appwrite/build.tar.gz:/mnt/code/code.tar.gz:ro`);
151148
params.push(imageName, 'sh', '-c', `helpers/start.sh "${tool.startCommand}"`);
152149

153-
childProcess.spawn('docker', params, {
150+
const startProcess = childProcess.spawn('docker', params, {
154151
stdio: 'pipe',
155152
pwd: functionDir
156153
});
157154

155+
startProcess.stdout.on('data', (data) => {
156+
process.stdout.write(chalk.blackBright(data));
157+
});
158+
159+
startProcess.stderr.on('data', (data) => {
160+
process.stdout.write(chalk.blackBright(data));
161+
});
162+
158163
success(`Visit http://localhost:${port}/ to execute your function.`);
159164
}
160165

templates/cli/lib/emulation/utils.js.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const EventEmitter = require('node:events');
22
const { projectsCreateJWT } = require('../commands/projects');
33
const { localConfig } = require("../config");
4+
const { usersGet, usersCreateJWT } = require("../commands/users");
5+
const { log } = require("../parser");
46

57
const openRuntimesVersion = 'v4';
68

0 commit comments

Comments
 (0)