Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deno fixes among others #143

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using

```sh
$ appwrite -v
6.0.0
6.0.1
```

### Install using prebuilt binaries
Expand Down Expand Up @@ -60,7 +60,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
Once the installation completes, you can verify your install using
```
$ appwrite -v
6.0.0
6.0.1
```

## Getting Started
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/databases/update-boolean-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ appwrite databases updateBooleanAttribute \
--collectionId <COLLECTION_ID> \
--key '' \
--required false \
--default false
--default false \

3 changes: 2 additions & 1 deletion docs/examples/databases/update-datetime-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ appwrite databases updateDatetimeAttribute \
--collectionId <COLLECTION_ID> \
--key '' \
--required false \
--default ''
--default '' \

3 changes: 2 additions & 1 deletion docs/examples/databases/update-email-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ appwrite databases updateEmailAttribute \
--collectionId <COLLECTION_ID> \
--key '' \
--required false \
--default [email protected]
--default [email protected] \

3 changes: 2 additions & 1 deletion docs/examples/databases/update-enum-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ appwrite databases updateEnumAttribute \
--key '' \
--elements one two three \
--required false \
--default <DEFAULT>
--default <DEFAULT> \

3 changes: 2 additions & 1 deletion docs/examples/databases/update-float-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ appwrite databases updateFloatAttribute \
--required false \
--min null \
--max null \
--default null
--default null \

3 changes: 2 additions & 1 deletion docs/examples/databases/update-integer-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ appwrite databases updateIntegerAttribute \
--required false \
--min null \
--max null \
--default null
--default null \

3 changes: 2 additions & 1 deletion docs/examples/databases/update-ip-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ appwrite databases updateIpAttribute \
--collectionId <COLLECTION_ID> \
--key '' \
--required false \
--default ''
--default '' \

1 change: 1 addition & 0 deletions docs/examples/databases/update-relationship-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ appwrite databases updateRelationshipAttribute \
--collectionId <COLLECTION_ID> \
--key '' \


4 changes: 3 additions & 1 deletion docs/examples/databases/update-string-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ appwrite databases updateStringAttribute \
--collectionId <COLLECTION_ID> \
--key '' \
--required false \
--default <DEFAULT>
--default <DEFAULT> \


3 changes: 2 additions & 1 deletion docs/examples/databases/update-url-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ appwrite databases updateUrlAttribute \
--collectionId <COLLECTION_ID> \
--key '' \
--required false \
--default https://example.com
--default https://example.com \

4 changes: 2 additions & 2 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# You can use "View source" of this page to see the full script.

# REPO
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0/appwrite-cli-win-x64.exe"
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0/appwrite-cli-win-arm64.exe"
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.1/appwrite-cli-win-x64.exe"
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.1/appwrite-cli-win-arm64.exe"

$APPWRITE_BINARY_NAME = "appwrite.exe"

Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ printSuccess() {
downloadBinary() {
echo "[2/4] Downloading executable for $OS ($ARCH) ..."

GITHUB_LATEST_VERSION="6.0.0"
GITHUB_LATEST_VERSION="6.0.1"
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"

Expand Down
4 changes: 2 additions & 2 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class Client {
'x-sdk-name': 'Command Line',
'x-sdk-platform': 'console',
'x-sdk-language': 'cli',
'x-sdk-version': '6.0.0',
'user-agent' : `AppwriteCLI/6.0.0 (${os.type()} ${os.version()}; ${os.arch()})`,
'x-sdk-version': '6.0.1',
'user-agent' : `AppwriteCLI/6.0.1 (${os.type()} ${os.version()}; ${os.arch()})`,
'X-Appwrite-Response-Format' : '1.6.0',
};
}
Expand Down
75 changes: 65 additions & 10 deletions lib/commands/databases.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/commands/generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const DEFAULT_ENDPOINT = 'https://cloud.appwrite.io/v1';
const loginCommand = async ({ email, password, endpoint, mfa, code }) => {
const oldCurrent = globalConfig.getCurrentSession();

const configEndpoint = endpoint ?? globalConfig.getEndpoint() ?? DEFAULT_ENDPOINT;
const configEndpoint = (endpoint ?? globalConfig.getEndpoint()) || DEFAULT_ENDPOINT;

if (globalConfig.getCurrentSession() !== '') {
log('You are currently signed in as ' + globalConfig.getEmail());
Expand Down
8 changes: 4 additions & 4 deletions lib/commands/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ const runFunction = async ({ port, functionId, withVariables, reload, userId } =
process.exit();
});

const logsPath = path.join(process.cwd(), func.path, '.appwrite/logs.txt');
const errorsPath = path.join(process.cwd(), func.path, '.appwrite/errors.txt');
const logsPath = path.join(localConfig.getDirname(), func.path, '.appwrite/logs.txt');
const errorsPath = path.join(localConfig.getDirname(), func.path, '.appwrite/errors.txt');

if(!fs.existsSync(path.dirname(logsPath))) {
fs.mkdirSync(path.dirname(logsPath), { recursive: true });
Expand Down Expand Up @@ -131,7 +131,7 @@ const runFunction = async ({ port, functionId, withVariables, reload, userId } =
}
}

const functionPath = path.join(process.cwd(), func.path);
const functionPath = path.join(localConfig.getDirname(), func.path);
const envPath = path.join(functionPath, '.env');
if(fs.existsSync(envPath)) {
const env = parseDotenv(fs.readFileSync(envPath).toString() ?? '');
Expand Down Expand Up @@ -192,7 +192,7 @@ const runFunction = async ({ port, functionId, withVariables, reload, userId } =
}

chokidar.watch('.', {
cwd: path.join(process.cwd(), func.path),
cwd: path.join(localConfig.getDirname(), func.path),
ignoreInitial: true,
ignored: (xpath) => {
const relativePath = path.relative(functionPath, xpath);
Expand Down
4 changes: 4 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ class Local extends Config {
this.configDirectoryPath =_path.dirname(absolutePath);
}

getDirname() {
return _path.dirname(this.path)
}

getFunctions() {
if (!this.has("functions")) {
return [];
Expand Down
12 changes: 6 additions & 6 deletions lib/emulation/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function dockerBuild(func, variables) {
const runtimeName = runtimeChunks.join("-");
const imageName = `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`;

const functionDir = path.join(process.cwd(), func.path);
const functionDir = path.join(localConfig.getDirname(), func.path);

const id = func.$id;

Expand Down Expand Up @@ -124,7 +124,7 @@ async function dockerBuild(func, variables) {
return;
}

const copyPath = path.join(process.cwd(), func.path, '.appwrite', 'build.tar.gz');
const copyPath = path.join(localConfig.getDirname(), func.path, '.appwrite', 'build.tar.gz');
const copyDir = path.dirname(copyPath);
if (!fs.existsSync(copyDir)) {
fs.mkdirSync(copyDir, { recursive: true });
Expand All @@ -143,7 +143,7 @@ async function dockerBuild(func, variables) {

await dockerStop(id);

const tempPath = path.join(process.cwd(), func.path, 'code.tar.gz');
const tempPath = path.join(localConfig.getDirname(), func.path, 'code.tar.gz');
if (fs.existsSync(tempPath)) {
fs.rmSync(tempPath, { force: true });
}
Expand All @@ -153,7 +153,7 @@ async function dockerBuild(func, variables) {

async function dockerStart(func, variables, port) {
// Pack function files
const functionDir = path.join(process.cwd(), func.path);
const functionDir = path.join(localConfig.getDirname(), func.path);

const runtimeChunks = func.runtime.split("-");
const runtimeVersion = runtimeChunks.pop();
Expand Down Expand Up @@ -211,12 +211,12 @@ async function dockerCleanup(functionId) {
await dockerStop(functionId);

const func = localConfig.getFunction(functionId);
const appwritePath = path.join(process.cwd(), func.path, '.appwrite');
const appwritePath = path.join(localConfig.getDirname(), func.path, '.appwrite');
if (fs.existsSync(appwritePath)) {
fs.rmSync(appwritePath, { recursive: true, force: true });
}

const tempPath = path.join(process.cwd(), func.path, 'code.tar.gz');
const tempPath = path.join(localConfig.getDirname(), func.path, 'code.tar.gz');
if (fs.existsSync(tempPath)) {
fs.rmSync(tempPath, { force: true });
}
Expand Down
2 changes: 1 addition & 1 deletion lib/emulation/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const systemTools = {
},
'deno': {
isCompiled: false,
startCommand: "deno start",
startCommand: "deno run --allow-run --allow-net --allow-write --allow-read --allow-env src/server.ts",
dependencyFiles: [ ]
},
'dart': {
Expand Down
2 changes: 1 addition & 1 deletion lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const parseError = (err) => {
} catch {
}

const version = '6.0.0';
const version = '6.0.1';
const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``;
const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`;

Expand Down
2 changes: 1 addition & 1 deletion lib/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const getInstallCommand = (runtime) => {
case 'dart':
return 'dart pub get';
case 'deno':
return "deno install";
return "deno cache src/main.ts";
case 'node':
return 'npm install';
case 'bun':
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "appwrite-cli",
"homepage": "https://appwrite.io/support",
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
"version": "6.0.0",
"version": "6.0.1",
"license": "BSD-3-Clause",
"main": "index.js",
"bin": {
Expand Down
6 changes: 3 additions & 3 deletions scoop/appwrite.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json",
"version": "6.0.0",
"version": "6.0.1",
"description": "The Appwrite CLI is a command-line application that allows you to interact with Appwrite and perform server-side tasks using your terminal.",
"homepage": "https://github.com/appwrite/sdk-for-cli",
"license": "BSD-3-Clause",
"architecture": {
"64bit": {
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0/appwrite-cli-win-x64.exe",
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.1/appwrite-cli-win-x64.exe",
"bin": [
[
"appwrite-cli-win-x64.exe",
Expand All @@ -15,7 +15,7 @@
]
},
"arm64": {
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0/appwrite-cli-win-arm64.exe",
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.1/appwrite-cli-win-arm64.exe",
"bin": [
[
"appwrite-cli-win-arm64.exe",
Expand Down