### Install CloudBase CLI Source: https://github.com/tencent/cloudbase-framework/blob/master/CLI_GUIDE.md Installs the CloudBase CLI tool globally using npm. Ensure Node.js and npm are installed first. This command downloads and installs the latest version of the CLI. ```bash npm i -g @cloudbase/cli ``` -------------------------------- ### Node.js Application Entry Point Examples Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-plugin-node/README.md Examples of how to export an application instance from an entry file for different Node.js frameworks (Koa, NestJS). ```javascript const Koa = require('koa'); const { router } = require('./routes/'); const app = new Koa(); app.use(router.routes()); module.exports = app; ``` ```javascript const express = require('express'); const { NestFactory } = require('@nestjs/core'); const { ExpressAdapter } = require('@nestjs/platform-express'); const { AppModule } = require('./dist/app.module'); const expressApp = express(); const adapter = new ExpressAdapter(expressApp); exports.tcbGetApp = async () => { const app = await NestFactory.create(AppModule, adapter); await app.init(); return expressApp; }; ``` -------------------------------- ### Project Setup and Local Preview Commands Source: https://github.com/tencent/cloudbase-framework/blob/master/community/posts/2020-08-12-如何用云开发快速搭建实时 TodoList 应用/index.md Steps and commands for cloning the project repository, configuring it, and running it locally. ```shell git clone https://github.com/oteam-sources/watch-todolist.git ``` ```shell yarn deploy:database ``` ```shell yarn dev ``` ```shell npm run dev ``` -------------------------------- ### Create React Full Stack Project with Cloudbase Source: https://github.com/tencent/cloudbase-framework/blob/master/README.en.md This example guides you through creating a React full-stack application with Cloudbase, incorporating cloud functions, static website deployment, and cloud database. It includes a link to the React demo template and a direct Cloudbase project creation link. ```APIDOC CreateAndDeployCloudBaseProject: url: https://console.cloud.tencent.com/tcb/env/index?action=CreateAndDeployCloudBaseProject parameters: tdl_anchor: "github" tdl_site: 0 appUrl: https://github.com/TencentCloudBase/cloudbase-templates workDir: react-demo appName: react-demo ``` -------------------------------- ### Cloudbase Configuration Example Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-plugin-mp/README.md Example configuration for the cloudbaserc.json file, specifying the use of the @cloudbase/framework-plugin-mp and its input parameters for deployment. ```json { "envId": "{{envId}}", "framework": { "plugins": { "client": { "use": "@cloudbase/framework-plugin-mp", "inputs": { "appid": "", "privateKeyPath": "", "localPath": "./", "ignores": ["node_modules/**/*"], "deployMode": "preview", "previewOptions": { "desc": "CloudBase Framework 一键预览", "setting": { "es6": true }, "qrcodeOutputPath": "./qrcode.jpg", "pagePath": "pages/index/index" } } } } } } ``` -------------------------------- ### Check CloudBase CLI Installation Source: https://github.com/tencent/cloudbase-framework/blob/master/CLI_GUIDE.md Verifies the installation of the CloudBase CLI by displaying its version. If a version number is outputted, the installation was successful. ```bash cloudbase -v ``` -------------------------------- ### Install CloudBase CLI Source: https://github.com/tencent/cloudbase-framework/blob/master/README.en.md Installs the latest version of the CloudBase Command Line Interface globally using npm. ```bash npm install -g @cloudbase/cli@latest ``` -------------------------------- ### CloudBase CLI Initialization Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-plugin-database/README.md Commands to initialize the CloudBase CLI for project setup. This includes initializing an existing backend project or creating a new one from a template. ```bash cloudbase ``` ```bash cloudbase init ``` -------------------------------- ### Create Koa Project with Cloudbase Source: https://github.com/tencent/cloudbase-framework/blob/master/README.en.md This example demonstrates setting up a Koa.js application with Cloudbase for server deployment. It provides a link to the Koa starter template on GitHub and a direct Cloudbase project creation link. ```APIDOC CreateAndDeployCloudBaseProject: url: https://console.cloud.tencent.com/tcb/env/index?action=CreateAndDeployCloudBaseProject parameters: tdl_anchor: "github" tdl_site: 0 appUrl: https://github.com/TencentCloudBase/cloudbase-templates workDir: koa-starter appName: koa-starter ``` -------------------------------- ### Local Development and Testing Scripts Source: https://github.com/tencent/cloudbase-framework/blob/master/CONTRIBUTING.md Provides commands for setting up the development environment, running the framework locally, and testing changes by linking the local framework into a project. ```bash npm install npm run dev:all ``` ```bash # In your project: CLOUDBASE_FX_ENV=dev cloudbase framework deploy ``` -------------------------------- ### CloudBase CLI Initialization Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-plugin-container/README.md Commands to initialize the CloudBase CLI for project setup. Use `cloudbase` for existing projects or `cloudbase init` for new projects from templates. ```bash cloudbase cloudbase init ``` -------------------------------- ### 3-Minute App Launch with CloudBase Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-core/README.md A guide on how to launch an application in just 3 minutes using CloudBase, showcasing its efficiency and ease of use. ```markdown - [3 分钟上线一款应用,我是怎么做到的?](https://mp.weixin.qq.com/s/tAuNIw3f0LcbfuQkb4k1OA) ``` -------------------------------- ### Install Ant Design UI Library Source: https://github.com/tencent/cloudbase-framework/blob/master/community/posts/2020-09-17-基于云开发 CloudBase 搭建在线视频会议应用/index.md Installs the Ant Design library and Ant Design icons as project dependencies. ```bash npm i ant-d @ant-design/icons -S ``` -------------------------------- ### Deno Standard Library Import Example Source: https://github.com/tencent/cloudbase-framework/blob/master/community/posts/2020-08-31-第一个Deno部署工具是如何打造的/index.md Example of importing a module from the Deno standard library, specifically `reset` from `colors.ts`. This demonstrates the versioned file import best practice in Deno development. ```typescript import { reset } from 'https://deno.land/std@0.62.0/fmt/colors.ts'; ``` -------------------------------- ### Container Plugin Configuration Example (Local Package) Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-plugin-container/README.md Example of `cloudbaserc.json` configuration for the container plugin using a local code package. Specifies service name, path, and local directory. ```json { "envId": "{{envId}}", "framework": { "plugins": { "client": { "use": "@cloudbase/framework-plugin-container", "inputs": { "serviceName": "node-api", "servicePath": "/node-api", "localPath": "./" } } } } } ``` -------------------------------- ### Cloudbase Framework Deno Plugin Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-core/README.md Enables one-click deployment of Deno applications. Versioning and installation are handled via npm. ```deno npm install @cloudbase/framework-plugin-deno ``` -------------------------------- ### CloudBase Framework Auth Plugin Configuration Example Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-plugin-auth/README.md An alternative configuration example for the CloudBase Framework Auth Plugin, using 'client' as the plugin key. This illustrates flexibility in naming the plugin configuration within `cloudbaserc.json`. ```json { "envId": "YOU_ENV_ID", "framework": { "plugins": { "client": { "use": "@cloudbase/framework-plugin-auth", "inputs": { "configs": [ { "platform": "NONLOGIN", "status": "ENABLE" } ] } } } } } ``` -------------------------------- ### Cloudbase Framework Deno Plugin Source: https://github.com/tencent/cloudbase-framework/blob/master/README.md Enables one-click deployment of Deno applications. Versioning and installation are handled via npm. ```deno npm install @cloudbase/framework-plugin-deno ``` -------------------------------- ### uploadOptions Configuration Example Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-plugin-mp/README.md An example JSON configuration demonstrating the usage of `uploadOptions` within the CloudBase Framework client plugin when `deployMode` is set to `upload`. This includes specifying the version, description, and build settings for a mini-program application upload. ```json { "envId": "{{envId}}", "framework": { "plugins": { "client": { "use": "@cloudbase/framework-plugin-mp", "inputs": { "appid": "", "privateKey": "", "localPath": "./", "ignores": ["node_modules/**/*"], "deployMode": "upload", "uploadOptions": { "version": "1.0.0", "desc": "CloudBase Framework 一键上传", "setting": { "es6": false } } } } } } } ``` -------------------------------- ### Deploying Kodexplorer with CloudBase Framework Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-core/README.md A practical guide on deploying Kodexplorer, a web-based file manager, using CloudBase Framework for a seamless cloud deployment experience. ```markdown - [实战丨借助云开发 Framework 快速部署 Kodexplorer](https://cloudbase.net/community/share/articles/1526e12a6006ce400018eefa7882b506.html) ``` -------------------------------- ### Local Development and Testing Scripts Source: https://github.com/tencent/cloudbase-framework/blob/master/CONTRIBUTING.en.md Scripts for setting up local development, linking the framework, and deploying with a specific environment. These commands are essential for developers working on the CloudBase Framework locally. ```bash npm install npm run dev:all ``` ```bash npm run link # Use the native CloudBase Framework in the project CLOUDBASE_FX_ENV=dev cloudbase framework deploy ``` ```bash # Note that $SecretId $SecretKey $EnvId needs to be replaced with a real value cloudbase login --apiKeyId $SecretId --apiKey $SecretKey CLOUDBASE_FX_ENV=dev envId=$EnvId node scripts/local-e2e.js ``` -------------------------------- ### Building Real-time Todo List Apps with CloudBase Framework Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-core/README.md A guide on quickly building real-time Todo List applications using CloudBase Framework, demonstrating its ease of use for dynamic apps. ```markdown - [如何用云开发快速搭建实时 Todo List 应用](https://cloudbase.net/community/share/articles/b1cb7d3a5f39e4f300b41bcd78e9aedd.html) ``` -------------------------------- ### CloudBase Framework Website Plugin Configuration Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-plugin-website/README.md Example configuration for the cloudbaserc.json file, specifying plugin usage and custom inputs for website deployment. ```json { "envId": "{{envId}}", "framework": { "plugins": { "client": { "use": "@cloudbase/framework-plugin-website", "inputs": { "installCommand": "npm install --prefer-offline --no-audit --progress=false", "buildCommand": "npm run build", "outputPath": "dist", "cloudPath": "/path", "ignore": [".git", ".github", "node_modules", "cloudbaserc.js"] } } } } } ``` -------------------------------- ### CloudBase Framework Node Plugin Configuration Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-plugin-node/README.md Example configuration in `cloudbaserc.json` for the Node.js plugin, specifying entry file, path, name, and platform. ```json { "envId": "{{envId}}", "framework": { "plugins": { "server": { "use": "@cloudbase/framework-plugin-node", "inputs": { "entry": "app.js", "path": "/nodeapp", "name": "nodeapp" } } } } } ``` -------------------------------- ### Advanced Configuration: Container Platform Source: https://github.com/tencent/cloudbase-framework/blob/master/packages/framework-plugin-node/README.md Example configuration for deploying a Node.js app to the container platform (Cloud Hosting) with custom CPU and memory settings. ```json { "use": "@cloudbase/framework-plugin-node", "inputs": { "entry": "app.js", "path": "/nodeapp", "name": "nodeapp", "platform": "container", "containerOptions": { "cpu": 2, "mem": 2 } } } ``` -------------------------------- ### Create React Project with Cloudbase Source: https://github.com/tencent/cloudbase-framework/blob/master/README.en.md This example shows how to set up a React application using Cloudbase, enabling cloud functions and static website deployment. It provides a link to the React starter template on GitHub and a direct Cloudbase project creation link. ```APIDOC CreateAndDeployCloudBaseProject: url: https://console.cloud.tencent.com/tcb/env/index?action=CreateAndDeployCloudBaseProject parameters: tdl_anchor: "github" tdl_site: 0 appUrl: https://github.com/TencentCloudBase/cloudbase-templates workDir: react-starter appName: react-starter ``` -------------------------------- ### Closing Issues Commit Example Source: https://github.com/tencent/cloudbase-framework/blob/master/CONTRIBUTING.en.md Demonstrates how to reference issues that are resolved by a commit, using the 'Closes' keyword followed by the issue number(s). Multiple issues can be closed in a single commit. ```APIDOC Closes #234 ``` ```APIDOC Closes #123, #245, #992 ``` -------------------------------- ### Initialize Cloudbase React Project Source: https://github.com/tencent/cloudbase-framework/blob/master/community/posts/2020-09-17-基于云开发 CloudBase 搭建在线视频会议应用/index.md Creates a new Cloudbase project using the 'react-starter' template. ```bash cloudbase init --template react-starter ``` -------------------------------- ### Breaking Change Commit Example Source: https://github.com/tencent/cloudbase-framework/blob/master/CONTRIBUTING.en.md Illustrates the required format for commit messages that introduce breaking changes, including a clear description of the change, migration instructions, and the reason for the modification. ```APIDOC BREAKING CHANGE: isolate scope bindings definition has changed and the inject option for the directive controller injection was removed. To migrate the code follow the example below: Before: ... ... After: ... ... The removed `inject` wasn't generaly useful for directives so there should be no code using it. ``` -------------------------------- ### Rollback Commit Example Source: https://github.com/tencent/cloudbase-framework/blob/master/CONTRIBUTING.en.md Provides the standard format for commit messages when reverting a previous commit. It includes the 'revert:' prefix, a reference to the reverted commit hash, and the commit body. ```APIDOC revert:(): This reverts commit hash