diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b46bad..98c762c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## [0.0.6](https://github.com/serverless-components/tencent-laravel/compare/v0.0.5...v0.0.6) (2020-09-02) + + +### Bug Fixes + +* support cfs config ([1af615b](https://github.com/serverless-components/tencent-laravel/commit/1af615bf4bf6950c862387b25f414f8d14cc1fbe)) +* update tencnet-component-toolkit for api mark ([b5de551](https://github.com/serverless-components/tencent-laravel/commit/b5de551fe3fcddfc7021f01f7b0563c0b2cc9669)) + ## [0.0.5](https://github.com/serverless-components/tencent-laravel/compare/v0.0.4...v0.0.5) (2020-08-26) diff --git a/README.en.md b/README.en.md deleted file mode 100755 index 86cd9cd..0000000 --- a/README.en.md +++ /dev/null @@ -1,130 +0,0 @@ -[![Serverless PHP Laravel Tencent Cloud](https://img.serverlesscloud.cn/20191226/1577347087676-website_%E9%95%BF.png)](http://serverless.com) - -# Tencent Laravel Serverless Component - -[简体中文](./README.md) | English - -## Introduction - -[Laravel](https://github.com/laravel/laravel) Serverless Component for Tencent Cloud, support `Laravel >= 6.0`. - -## Content - -0. [Prepare](#0-prepare) -1. [Install](#1-install) -1. [Create](#2-create) -1. [Configure](#3-configure) -1. [Deploy](#4-deploy) -1. [Remove](#5-Remove) - -### 0. Prepare - -#### Initial Laravel Project - -Before use this component, you should init a `laravel` project: - -```bash -composer create-project --prefer-dist laravel/laravel serverless-laravel -``` - -> Notice:Laravel use Composer manage dependencies, so you should install Composer firstly. Refer to [Official Install](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos) - -#### Modify Laravel Project - -When cloud funtion running, only `/tmp` folder is writable, so we should change the `APP_STORAGE` folder to `/tmp`. - -Add this line in `bootstrap/app.php` after `$app = new Illuminate\Foundation\Application`: - -```php -$app->useStoragePath(env('APP_STORAGE', '/tmp')); -``` - -We will also need to customize the location for compiled views, as well as customize a few variables in the .env file: - -```dotenv -# views compiled path -VIEW_COMPILED_PATH=/tmp/storage/framework/views - -# We cannot store sessions to disk: if you don't need sessions (e.g. API) -# then use `array`, else store sessions in database or cookies -SESSION_DRIVER=array - -# Logging to stderr allows the logs to end up in Cloudwatch -LOG_CHANNEL=stderr - -# app storage dir must be /tmp -APP_STORAGE=/tmp -``` - -### 1. Install - -Install the Serverless Framework globally: - -```bash -$ npm install -g serverless -``` - -### 2. Create - -Just create the following simple boilerplate: - -```bash -$ touch serverless.yml -$ touch .env # your Tencent api keys -``` - -Add the access keys of a [Tencent CAM Role](https://console.cloud.tencent.com/cam/capi) with `AdministratorAccess` in the `.env` file, using this format: - -``` -# .env -TENCENT_SECRET_ID=XXX -TENCENT_SECRET_KEY=XXX -``` - -- If you don't have a Tencent Cloud account, you could [sign up](https://intl.cloud.tencent.com/register) first. - -### 3. Configure - -```yml -# serverless.yml - -component: laravel -name: laravelDemo -org: orgDemo -app: appDemo -stage: dev - -inputs: - src: ./ - region: ap-guangzhou - runtime: Php7 - apigatewayConf: - protocols: - - http - - https - environment: release -``` - -- [More Options](./docs/configure.md) - -### 4. Deploy - -> Notice: **Before deploying, you should clear local run config cache, run `php artisan config:clear`.** - -```bash -$ sls deploy -``` - -> Notice: `sls` is short for `serverless` command. - -  - -### 5. Remove - -```bash -$ sls remove -``` - -### More Components - -Checkout the [Serverless Components](https://github.com/serverless/components) repo for more information. diff --git a/README.md b/README.md index a7fc418..dd5e0a6 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ # 腾讯云 Laravel Serverless Component -简体中文 | [English](./README.en.md) - ## 简介 腾讯云 [Laravel](https://github.com/laravel/laravel) Serverless Component, 支持 `Laravel >= 6.0`。 @@ -89,7 +87,7 @@ inputs: environment: release ``` -- [更多配置](./docs/configure.md) +- [更多配置](https://github.com/serverless-components/tencent-laravel/tree/master/docs/configure.md) ### 3. 部署 @@ -132,3 +130,9 @@ TENCENT_SECRET_KEY=123 ### 更多组件 可以在 [Serverless Components](https://github.com/serverless/components/blob/master/README.cn.md) repo 中查询更多组件的信息。 + +## License + +MIT License + +Copyright (c) 2020 Tencent Cloud, Inc. diff --git a/package.json b/package.json index 59473f9..14e3725 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,9 @@ }, "husky": { "hooks": { - "pre-commit": "lint-staged", + "pre-commit": "ygsec && lint-staged", "commit-msg": "commitlint -E HUSKY_GIT_PARAMS", - "pre-push": "npm run lint:fix && npm run prettier:fix" + "pre-push": "ygsec && npm run lint:fix && npm run prettier:fix" } }, "lint-staged": { @@ -46,6 +46,7 @@ "@semantic-release/npm": "^7.0.4", "@semantic-release/release-notes-generator": "^9.0.1", "@serverless/platform-client-china": "^1.0.19", + "@ygkit/secure": "0.0.3", "axios": "^0.19.2", "babel-eslint": "^10.1.0", "dotenv": "^8.2.0", @@ -53,7 +54,7 @@ "eslint-config-prettier": "^6.10.0", "eslint-plugin-import": "^2.20.1", "eslint-plugin-prettier": "^3.1.2", - "husky": "^4.2.3", + "husky": "^4.2.5", "jest": "^25.0.1", "lint-staged": "^10.0.8", "prettier": "^1.19.1", diff --git a/release.config.js b/release.config.js index a13798c..98b3864 100644 --- a/release.config.js +++ b/release.config.js @@ -11,8 +11,7 @@ module.exports = { preset: 'angular', parserOpts: { noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'] - }, - releaseRules: [{ type: 'feat', release: 'patch' }] + } } ], [ diff --git a/serverless.component.yml b/serverless.component.yml index 9930245..e723d43 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -1,5 +1,5 @@ name: laravel -version: 0.0.5 +version: 0.0.7 author: Tencent Cloud, Inc org: Tencent Cloud, Inc description: Deploy a serverless Laravel application on Tencent SCF and API Gateway. diff --git a/src/package.json b/src/package.json index 9a9d323..9931624 100644 --- a/src/package.json +++ b/src/package.json @@ -1,7 +1,7 @@ { "dependencies": { "download": "^8.0.0", - "tencent-component-toolkit": "^1.13.2", + "tencent-component-toolkit": "^1.16.3", "type": "^2.0.0" } } diff --git a/src/utils.js b/src/utils.js index 03b6847..095ec8e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -249,6 +249,9 @@ const prepareInputs = async (instance, credentials, inputs = {}) => { layers: ensureIterable(tempFunctionConf.layers ? tempFunctionConf.layers : inputs.layers, { default: [] }), + cfs: ensureIterable(tempFunctionConf.cfs ? tempFunctionConf.cfs : inputs.cfs, { + default: [] + }), publish: inputs.publish, traffic: inputs.traffic, lastVersion: instance.state.lastVersion, diff --git a/tests/integration.test.js b/tests/integration.test.js index 0a68e85..8bef758 100644 --- a/tests/integration.test.js +++ b/tests/integration.test.js @@ -10,7 +10,7 @@ jest.setTimeout(600000) const instanceYaml = { org: 'orgDemo', app: 'appDemo', - component: 'laravel@dev', + component: 'laravel', name: `laravel-integration-tests-${generateId()}`, stage: 'dev', inputs: {