1
0
Fork 0
mirror of synced 2024-06-22 16:21:10 +12:00

Changed naming conventions from JS to Web

This commit is contained in:
Eldad Fux 2020-12-24 00:39:48 +02:00
parent 5157d3fdd7
commit f9b5bdd93b
9 changed files with 50 additions and 37 deletions

View file

@ -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();
});
});

View file

@ -245,7 +245,7 @@ $graph = $this->getParam('graph', false);
<div class="info margin-top margin-bottom">
<div class="text-bold margin-bottom-small">Next Steps</div>
<p>After adding your new website, install our JS SDK to integrate with your code and read our <a data-ls-attrs="href={{env.HOME}}/docs/getting-started-for-web" target="_blank" rel="noopener">getting started</a> tutorial.</p>
<p>After adding your new website, install our Web SDK to integrate with your code and read our <a data-ls-attrs="href={{env.HOME}}/docs/getting-started-for-web" target="_blank" rel="noopener">getting started</a> tutorial.</p>
<div class="margin-bottom-no ide" data-lang="bash" data-lang-label="bash">
<pre class="line-numbers"><code class="prism language-bash" data-prism>npm install appwrite</code></pre>

View file

@ -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"
},

8
composer.lock generated
View file

@ -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",

View file

@ -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
);

View file

@ -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
);

View file

@ -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

View file

@ -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.