Skip to content

Commit 93ea80a

Browse files
committed
Add tags to dev command
1 parent 4ca5402 commit 93ea80a

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

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

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ const systemTools = {
3131
// TODO: Add all runtime needs
3232
};
3333

34-
// TODO: Logs dont work
35-
3634
const Queue = {
3735
files: [],
3836
locked: false,
@@ -217,7 +215,7 @@ async function dockerCleanup() {
217215
}
218216
}
219217

220-
const runFunction = async ({ port, engine, functionId } = {}) => {
218+
const runFunction = async ({ port, engine, functionId, noVariables, noReload } = {}) => {
221219
// Selection
222220
if(!functionId) {
223221
const answers = await inquirer.prompt(questionsRunFunctions[0]);
@@ -320,21 +318,22 @@ const runFunction = async ({ port, engine, functionId } = {}) => {
320318
}
321319

322320
let variables = [];
323-
if (globalConfig.getEndpoint() === '' || globalConfig.getCookie() === '') {
324-
// TODO: Flag to disable
325-
error("No user is signed in. To sign in, run: appwrite login. Function will run locally, but will not have your function's environment variables set.");
326-
} else {
327-
const { variables: remoteVariables } = await paginate(functionsListVariables, {
328-
functionId: func['$id'],
329-
parseOutput: false
330-
}, 100, 'variables');
331-
332-
remoteVariables.forEach((v) => {
333-
variables.push({
334-
key: v.key,
335-
value: v.value
321+
if(!noVariables) {
322+
if (globalConfig.getEndpoint() === '' || globalConfig.getCookie() === '') {
323+
error("No user is signed in. To sign in, run: appwrite login. Function will run locally, but will not have your function's environment variables set.");
324+
} else {
325+
const { variables: remoteVariables } = await paginate(functionsListVariables, {
326+
functionId: func['$id'],
327+
parseOutput: false
328+
}, 100, 'variables');
329+
330+
remoteVariables.forEach((v) => {
331+
variables.push({
332+
key: v.key,
333+
value: v.value
334+
});
336335
});
337-
});
336+
}
338337
}
339338

340339
await dockerPull(func);
@@ -348,13 +347,15 @@ const runFunction = async ({ port, engine, functionId } = {}) => {
348347
console.log(data);
349348
});
350349

351-
chokidar.watch('.', {
352-
cwd: path.join(process.cwd(), func.path),
353-
ignoreInitial: true,
354-
ignored: [ ...(func.ignore ?? []), 'code.tar.gz', '.appwrite', '.appwrite/', '.appwrite/*', '.appwrite/**', '.appwrite/*.*', '.appwrite/**/*.*' ]
355-
}).on('all', async (_event, filePath) => {
356-
Queue.push(filePath);
357-
});
350+
if(!noReload) {
351+
chokidar.watch('.', {
352+
cwd: path.join(process.cwd(), func.path),
353+
ignoreInitial: true,
354+
ignored: [ ...(func.ignore ?? []), 'code.tar.gz', '.appwrite', '.appwrite/', '.appwrite/*', '.appwrite/**', '.appwrite/*.*', '.appwrite/**/*.*' ]
355+
}).on('all', async (_event, filePath) => {
356+
Queue.push(filePath);
357+
});
358+
}
358359

359360
Queue.events.on('reload', async ({ files }) => {
360361
Queue.lock();
@@ -459,8 +460,8 @@ run
459460
.option(`--functionId <functionId>`, `Function ID`)
460461
.option(`--port <port>`, `Local port`)
461462
.option(`--engine <engine>`, `Local engine, "system" or "docker"`)
462-
// TODO: Option to disable auto reloading
463-
// TODO: Option to enable write operations to function folder
463+
.option(`--noVariables`, `Prevent pulling variables from function settings`)
464+
.option(`--noReload`, `Prevent live reloading of server when changes are made to function files`)
464465
.action(actionRunner(runFunction));
465466

466467
module.exports = {

0 commit comments

Comments
 (0)