1.0.12 • Published 1 year ago

teth-sdk v1.0.12

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

环境要求

  1. 建议node >= 12.16

使用

npm install teth-sdk

add teth.config.ts

import {TethConfig} from 'teth-sdk';

module.exports = {
    // 平台申请的app的英文名称
    appName: 'test',

    // 平台的该app的密钥
    appSecret: 'xxxxxx',

    // 该服务所在实例,默认os.hostname()
    // 当处于服务发现模式时,该实例ID需要和服务发现获取的实例ID保持一致,否则会被忽略掉
    instanceId: require('os').hostname(),

    // 该服务所在实例的地区或机房,默认default
    region: 'default',

    // 外部访问实例的host:机器+端口
    // accessUrl: '127.0.0.1:' + port,

    // 指标采集时,流量指标默认有一个维度uri,其值是请求path
    // 但是有时候path的取值个数会有几百上千种,特别是无效流量path。
    // 为了避免维度爆炸或者避免无效流量采集而带来内存占用,在此对uri的取值
    uriAdjust(uriPath: string) {
        // 根据app来转换uri维度
        // /app/index : 保留原样 /app/index
        // /app/auth.tar: 变成 /all_static
        // /Application/xxxx : 变成 /other-request
        if (uriPath.startsWith('/app')) {
            // 静态资源请求
            if (uriPath.includes('.')) {
                return '/all_static';
            }
            return uriPath;
        }
        return '/all_other_request';
    },

    packageDir: __dirname,

    // logPaths: [
    //     'log/xxxxx'
    // ],
} as TethConfig;

import sdk

import teth from 'teth-sdk';

teth.start({
    // 配置文件路径
    configPath: require.resolve('./teth.config'),
});

研发

开发

# 进行watch 编译,产出到dist
npm run dev

# lint
npm run lint

开发注意

  1. 记得对example进行压测 / cpu profile分析,以确定本次升级修改前后是否有性能退化
  2. 禁止使用moment等库

测试

# npm run test

# production编译,产出到dist
npm run build

发布npm包

### 1. lint and build
git pull origin master --rebase
rm -fr dist && npm run lint && npm run build && npm run test
git commit -m "fix/feature: xxx"

### 2. 增加版本号,生成commit和tag ,示例是小版本, 请按照当时具体情况修改版本号,如果版本修改不符合预期,那就人工修改
npm version patch

### 3. 先git commit 本次提交
git add .
version=`node -e "console.log(require('./package.json').version)"`
git commit -m "release ${version}"
git tag "v${version}"

### 4. 构建产出到dist目录,并发布到npm
rm -fr dist && npm run build && npm publish

### 5. 发起CR评审
git push origin HEAD:refs/for/master
git clone

git branch -b new_feature

git commit -m "icafe ID + feature描述"

git push origin HEAD:refs/for/master
1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.12

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.3

1 year ago

1.0.0-beta2

1 year ago

1.0.0-beta3

1 year ago

1.0.0-beta

1 year ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.9

2 years ago

0.0.1

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.1-beta.30

3 years ago

0.0.1-beta.29

3 years ago

0.0.1-beta.28

3 years ago

0.0.1-beta.25

3 years ago

0.0.1-beta.24

3 years ago

0.0.1-beta.27

3 years ago

0.0.1-beta.26

3 years ago

0.0.1-beta.21

3 years ago

0.0.1-beta.20

3 years ago

0.0.1-beta.23

3 years ago

0.0.1-beta.22

3 years ago

0.0.1-beta.19

3 years ago

0.0.1-beta.18

3 years ago

0.0.1-beta.17

3 years ago

0.0.1-beta.16

3 years ago

0.0.1-beta.15

3 years ago

0.0.1-beta.14

3 years ago

0.0.1-beta.13

3 years ago

0.0.1-beta.12

3 years ago

0.0.1-beta.11

3 years ago

0.0.1-beta.7

3 years ago

0.0.1-beta.9

3 years ago

0.0.1-beta.8

3 years ago

0.0.1-beta.10

3 years ago

0.0.1-beta.6

3 years ago

0.0.1-beta.5

3 years ago

0.0.1-beta.4

3 years ago

0.0.1-beta.3

3 years ago

0.0.1-beta.2

3 years ago

0.0.1-beta.1

3 years ago

0.0.1-beta.0

3 years ago