From cf9d6e1e9ce33da0ab7712026f56696b3f37ef6f Mon Sep 17 00:00:00 2001 From: TigerZH Date: Sun, 10 Apr 2022 23:16:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E8=B7=A8=E5=A2=83?= =?UTF-8?q?=E7=94=B5=E5=95=86=E6=97=A5=E5=BF=97&=20=E6=9B=B4=E6=96=B0pytho?= =?UTF-8?q?n=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...50\345\242\203\347\224\265\345\225\206.md" | 14 ++++ src/note/python.md | 68 +++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git "a/src/log/\350\267\250\345\242\203\347\224\265\345\225\206.md" "b/src/log/\350\267\250\345\242\203\347\224\265\345\225\206.md" index 294a8808..23b2f60e 100644 --- "a/src/log/\350\267\250\345\242\203\347\224\265\345\225\206.md" +++ "b/src/log/\350\267\250\345\242\203\347\224\265\345\225\206.md" @@ -1,5 +1,19 @@ # 跨境电商 +## 2022-04-10 + +- 添加产品模块 +- 添加产品权限 + +## 2022-04-09 + +- 获取上传SDK +- 配置上传模块 + +## 2022-04-08 + +- 修改礼物提示语 + ## 2022-04-07 - 商户首页修改为文档页面 diff --git a/src/note/python.md b/src/note/python.md index c8804b23..44d27e30 100644 --- a/src/note/python.md +++ b/src/note/python.md @@ -10,6 +10,74 @@ mkdir drf-getting-start && cd drf-getting-start && virtualenv env && source env/bin/activate && pip install django && pip install djangorestframework && django-admin.py startproject apps . && python manage.py migrate && python manage.py createsuperuser ``` +## deploy + +```javascript +#!/usr/bin/env node +var exec = require("child_process").exec; +// 此脚本仅适用个人 +var ora = require("ora"); +const inquirer = require("inquirer"); +const dayjs = require("dayjs"); +const _package = require("../package.json"); +// 当前版本 +const version = _package.version; +// 当前时间 +const now = dayjs().format("YYYYMMDDHHmmss"); +// 项目目录 +const dir_path = `/Users/tigerzh/Documents/workspace/shopify/c18e/front/dist`; +// 服务器nginx部署前端地址 +const target_path = `/data/admin`; +// 版本目录 +const version_path = `${dir_path}-${version}-${now}`; + + +const params = [ + { + type: "rawlist", + name: "commit", + message: "请选择部署环境:", + default: "stage", + choices: [ + "stage: https://form.tigerzh.com", + "production: https://form.tigerzh.com/", + ], + }, +]; +const commendStage = ` + yarn build:stage; + cp -r ${dir_path} ${version_path}; + scp -r ${dir_path} c18e:${target_path}; + scp -r ${version_path} c18e:${target_path}; + rm -rf ${version_path}; + + `; + +const commendProduction = ` + yarn build:prod; + cp -r ${dir_path} ${version_path}; + scp -r ${dir_path} c18e:${target_path}; + scp -r ${version_path} c18e:${target_path}; + rm -rf ${version_path}; +`; + +inquirer.prompt(params).then(async (answers) => { + const commit = answers.commit; + const spinner = ora({ + text: `[${commit}]:部署中...`, + }).start(); + const commend = commit.startsWith("production") + ? commendProduction + : commendStage; + exec(commend, function (err) { + if (err) throw err; + spinner.succeed("部署完成"); + spinner.succeed(Date()); + }); +}); + +``` + ## Setup