From f9b5bdd93b53d5512b502ae7bf26400e8e0f7738 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 24 Dec 2020 00:39:48 +0200 Subject: [PATCH] Changed naming conventions from JS to Web --- app/tasks/sdks.php | 63 +++++++++++++--------- app/views/console/home/index.phtml | 2 +- composer.json | 2 +- composer.lock | 8 +-- docs/examples/javascript/auth/login.md | 4 +- docs/examples/javascript/auth/register.md | 4 +- docs/sdks/{javascript => web}/CHANGELOG.md | 0 docs/sdks/{javascript => web}/README.md | 2 +- docs/tutorials/add-oauth2-provider.md | 2 +- 9 files changed, 50 insertions(+), 37 deletions(-) rename docs/sdks/{javascript => web}/CHANGELOG.md (100%) rename docs/sdks/{javascript => web}/README.md (93%) diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php index 364b32606..8119f370e 100644 --- a/app/tasks/sdks.php +++ b/app/tasks/sdks.php @@ -5,7 +5,7 @@ use Utopia\CLI\Console; use Appwrite\Spec\Swagger2; use Appwrite\SDK\SDK; use Appwrite\SDK\Language\PHP; -use Appwrite\SDK\Language\JS; +use Appwrite\SDK\Language\Web; use Appwrite\SDK\Language\Node; use Appwrite\SDK\Language\Python; use Appwrite\SDK\Language\Ruby; @@ -36,8 +36,9 @@ $cli $platforms = Config::getParam('platforms'); $selected = \strtolower(Console::confirm('Choose SDK ("*" for all):')); $version = Console::confirm('Choose an Appwrite version'); - $message = Console::confirm('Please enter your commit message:'); - $production = (Console::confirm('Type "Appwrite" to deploy for production') == 'Appwrite'); + $git = (Console::confirm('Should we use git push? (yes/no)') == 'yes'); + $production = ($git) ? (Console::confirm('Type "Appwrite" to push code to production git repos') == 'Appwrite') : false; + $message = ($git) ? Console::confirm('Please enter your commit message:') : ''; $warning = '**This SDK is compatible with Appwrite server version ' . $version . '. For older versions, please check previous releases.**'; if(!in_array($version, ['0.6.2', '0.7.0'])) { @@ -59,7 +60,7 @@ $cli $spec = file_get_contents(__DIR__.'/../config/specs/'.$version.'.'.$language['family'].'.json'); - $result = \realpath(__DIR__.'/..').'/sdks/'.$key.'-'.$language['key']; + $result = \realpath(__DIR__.'/..').'/sdks/'.$version.'/'.$key.'-'.$language['key']; $target = \realpath(__DIR__.'/..').'/sdks/git/'.$language['key'].'/'; $readme = \realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/README.md'); $readme = ($readme) ? \file_get_contents($readme) : ''; @@ -84,7 +85,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND switch ($language['key']) { case 'web': - $config = new JS(); + $config = new Web(); $config->setNPMPackage('appwrite'); $config->setBowerPackage('appwrite'); break; @@ -173,30 +174,42 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND } $gitUrl = $language['gitUrl']; - - if(empty($gitUrl)) { - continue; - } - + if(!$production) { $gitUrl = 'git@github.com:aw-tests/'.$language['gitRepoName'].'.git'; } + + if($git && !empty($gitUrl)) { + // \exec('rm -rf '.$target.' && \ + // mkdir -p '.$target.' && \ + // cd '.$target.' && \ + // git init && \ + // git remote add origin '.$gitUrl.' && \ + // git fetch && \ + // git pull '.$gitUrl.' && \ + // rm -rf '.$target.'/* && \ + // cp -r '.$result.'/ '.$target.'/ && \ + // git add . && \ + // git commit -m "'.$message.'" && \ + // git push -u origin master + // '); - \exec('rm -rf '.$target.' && \ - mkdir -p '.$target.' && \ - cd '.$target.' && \ - git init && \ - git remote add origin '.$gitUrl.' && \ - git fetch && \ - git pull '.$gitUrl.' && \ - rm -rf '.$target.'/* && \ - cp -r '.$result.'/ '.$target.'/ && \ - git add . && \ - git commit -m "'.$message.'" && \ - git push -u origin master'); + Console::success("Pushed {$language['name']} SDK to {$gitUrl}"); + } + else { + \exec('rm -rf '.$target.' && \ + mkdir -p '.$target.' && \ + cd '.$target.' && \ + rm -rf '.$target.'/* && \ + cp -r '.$result.'/ '.$target.'/ && \ + rm -rf '.$result.'/* && \ + mkdir -p '.$result.'/docs/examples && \ + cp -r '.$target.$key.'-'.$language['key'].'/docs/examples/ '.$result.'/docs/examples + '); + + Console::success("Saved {$language['name']} SDK to {$result}"); + } - Console::success("Pushed {$language['name']} SDK to {$gitUrl}"); - \exec('rm -rf '.$target); Console::success("Remove temp directory '{$target}' for {$language['name']} SDK"); @@ -204,4 +217,4 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND } exit(); - }); \ No newline at end of file + }); diff --git a/app/views/console/home/index.phtml b/app/views/console/home/index.phtml index f11dfe35c..7673609ce 100644 --- a/app/views/console/home/index.phtml +++ b/app/views/console/home/index.phtml @@ -245,7 +245,7 @@ $graph = $this->getParam('graph', false);
Next Steps
-

After adding your new website, install our JS SDK to integrate with your code and read our getting started tutorial.

+

After adding your new website, install our Web SDK to integrate with your code and read our getting started tutorial.

npm install appwrite
diff --git a/composer.json b/composer.json index a0a8d4279..8a5bd3f6d 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ }, "require-dev": { "swoole/ide-helper": "4.5.5", - "appwrite/sdk-generator": "0.2.2", + "appwrite/sdk-generator": "0.2.3", "phpunit/phpunit": "9.4.2", "vimeo/psalm": "4.1.1" }, diff --git a/composer.lock b/composer.lock index e45575adb..056ef1223 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "396e46e0a83e8fd5df69d65ba80b16c4", + "content-hash": "00d365ae66b44a9f8457822862f6e470", "packages": [ { "name": "appwrite/php-clamav", @@ -1858,11 +1858,11 @@ }, { "name": "appwrite/sdk-generator", - "version": "0.2.2", + "version": "0.2.3", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "910d403a1703fc282d069b26af1cf46cd9e65e7d" + "reference": "6b564fef01fd681023c1d465783931bade04468d" }, "require": { "ext-curl": "*", @@ -1892,7 +1892,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2020-12-23T16:48:44+00:00" + "time": "2020-12-23T21:58:58+00:00" }, { "name": "composer/package-versions-deprecated", diff --git a/docs/examples/javascript/auth/login.md b/docs/examples/javascript/auth/login.md index 2254a3bc0..5edb2547e 100644 --- a/docs/examples/javascript/auth/login.md +++ b/docs/examples/javascript/auth/login.md @@ -11,6 +11,6 @@ sdk sdk.auth.login( 'email@example.com', 'password', - 'http://example.com/success', // required for JS SDK - 'http://example.com/failure' // required for JS SDK + 'http://example.com/success', // required for Web SDK + 'http://example.com/failure' // required for Web SDK ); \ No newline at end of file diff --git a/docs/examples/javascript/auth/register.md b/docs/examples/javascript/auth/register.md index b0943d7e5..715c36cef 100644 --- a/docs/examples/javascript/auth/register.md +++ b/docs/examples/javascript/auth/register.md @@ -12,6 +12,6 @@ sdk.auth.register( 'email@example.com', 'password', 'http://example.com/confirm', - 'http://example.com/success', // required for JS SDK - 'http://example.com/failure' // required for JS SDK + 'http://example.com/success', // required for Web SDK + 'http://example.com/failure' // required for Web SDK ); \ No newline at end of file diff --git a/docs/sdks/javascript/CHANGELOG.md b/docs/sdks/web/CHANGELOG.md similarity index 100% rename from docs/sdks/javascript/CHANGELOG.md rename to docs/sdks/web/CHANGELOG.md diff --git a/docs/sdks/javascript/README.md b/docs/sdks/web/README.md similarity index 93% rename from docs/sdks/javascript/README.md rename to docs/sdks/web/README.md index 8ab72889e..d1becb4c3 100644 --- a/docs/sdks/javascript/README.md +++ b/docs/sdks/web/README.md @@ -4,7 +4,7 @@ Initialise the Appwrite SDK in your code, and setup your API credentials: ```js -// Init your JS SDK +// Init your Web SDK var appwrite = new Appwrite(); appwrite diff --git a/docs/tutorials/add-oauth2-provider.md b/docs/tutorials/add-oauth2-provider.md index 5d46cac1f..21e8f8495 100644 --- a/docs/tutorials/add-oauth2-provider.md +++ b/docs/tutorials/add-oauth2-provider.md @@ -49,7 +49,7 @@ After you finished adding your new provider to Appwrite you should be able to se Add credentials and check both a successful and a failed login (where the user denies integration on provider page). -You can test your OAuth2 provider by trying to login using the [OAuth2 method](https://appwrite.io/docs/client/account#createOAuth2Session) when integrating the Appwrite JS SDK in a demo app. +You can test your OAuth2 provider by trying to login using the [OAuth2 method](https://appwrite.io/docs/client/account#createOAuth2Session) when integrating the Appwrite Web SDK in a demo app. Pass your new adapter name as the provider parameter. If login is successful, you will be redirected to your success URL parameter. Otherwise, you will be redirected to your failure URL.