Skip to content

Commit

Permalink
feat: update @ddn/node-sdk for ddnrc.default.js erroo and jest config…
Browse files Browse the repository at this point in the history
… for pro-packages
  • Loading branch information
imfly committed Aug 4, 2024
1 parent 3d647a1 commit 46eb734
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 56 deletions.
24 changes: 13 additions & 11 deletions docs/development/dev-install.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $ docker pull ubuntu:22.04
这里我们使用的是 ubuntu 22.04 版本,如果你是其他版本的,自行修改镜像名称。另外,一定要使用 -it 选项,否则无法进入交互模式。同时,-v 选项挂载本地 ddn 代码到容器内,方便后续操作。

```bash
$ docker run -d -it --name ddn-mainnet -v /Users/imfly/projects/DDN/ddn:/root/ddn ubuntu:22.04
$ docker run -d -it -p 8001:8001 -p 8000:8000 --name ddn-starter -v /path/to/ddn:/ddn/mainnet -v /path/to/ddn-starter:/ddn/starter ubuntu:22.04
```

这样,一个 ubuntu 运行环境就搭建起来了。
Expand All @@ -40,7 +40,7 @@ $ docker run -d -it --name ddn-mainnet -v /Users/imfly/projects/DDN/ddn:/root/dd
当然,你也可以使用下面的命令,进入容器:

```bash
$ docker exec -it ddn-mainnet /bin/bash
$ docker exec -it ddn-starter /bin/bash
```

这样,在不离开 IDE 编辑器的情况下,就能执行命令了,就行在本地电脑操作 ubuntu 的体验一样。
Expand All @@ -60,6 +60,17 @@ $ yarn install

网上有人提供了解决方法,使用 echo 命令向/etc/apt/sources.list添加更新源:


在更新源之前,先备份一下:

```shell
# 备份
$ cp /etc/apt/sources.list /etc/apt/sources.list.bak

# 执行更新
$ apt update
```

```shell
# 向/etc/apt/sources.list添加清华的源
echo 'deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse' >> /etc/apt/sources.list && \
Expand All @@ -78,15 +89,6 @@ echo 'deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted univ
echo 'deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse' >> /etc/apt/sources.list
```

在更新源之前,先备份一下:

```shell
# 备份
$ cp /etc/apt/sources.list /etc/apt/sources.list.bak

# 执行更新
$ apt update
```

**特别注意**:这里遇到过一个非常奇葩的问题,在更新源的过程中,千万不要开启代理,否则会找不到地址,出现“没有签名”、“无法访问”等错误。我就因为这个问题,折腾了很久。

Expand Down
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {
bail: 1,
verbose: true,
testMatch: ['<rootDir>/packages/**/*/test/**/*.test.(t|j)s(x)?'],
testMatch: ['<rootDir>/**/*/test/**/*.test.(t|j)s(x)?', '<rootDir>/**/*/tests/**/*.test.(t|j)s(x)?'],
modulePathIgnorePatterns: ['<rootDir>/packages/.+/compiled', '<rootDir>/packages/.+/fixtures'],
transformIgnorePatterns: ['/node_modules/', '/compiled/'],
collectCoverageFrom: [
Expand Down
88 changes: 44 additions & 44 deletions packages/node-sdk/src/ddnrc.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Copyright (c) 2019 DDN FOUNDATION. All rights reserved.
* Licensed under the AGPL 3.0 License. See License.txt in the project root for license information.
*-------------------------------------------------------------------------------------------- */
const Sequelize = require('sequelize')
const Op = Sequelize.Op
// const Sequelize = require('sequelize')
// const Op = Sequelize.Op

module.exports = {
/**
Expand Down Expand Up @@ -168,54 +168,54 @@ module.exports = {
* Database options
* https://sequelize.org/master/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor
* */
database: {
database: process.env.DBNAME || 'ddn',
username: process.env.DBUSERNAME || 'root',
password: process.env.DBPASSWORD || 'root', // Please use process.env.DBPASSWORD
// database: {
// database: process.env.DBNAME || 'ddn',
// username: process.env.DBUSERNAME || 'root',
// password: process.env.DBPASSWORD || 'root', // Please use process.env.DBPASSWORD

options: {
// the sql dialect of the database
// currently supported: 'mysql', 'sqlite', 'postgres', 'mssql'
dialect: 'sqlite',
// options: {
// // the sql dialect of the database
// // currently supported: 'mysql', 'sqlite', 'postgres', 'mssql'
// dialect: 'sqlite',

// custom host; default: localhost
host: '127.0.0.1',
// // custom host; default: localhost
// host: '127.0.0.1',

// custom port; default: dialect default
// port: 12345,
// // custom port; default: dialect default
// // port: 12345,

pool: {
maxactive: 1,
max: 5,
min: 0,
idle: 20000,
acquire: 20000
},
logging: console.log,
// pool: {
// maxactive: 1,
// max: 5,
// min: 0,
// idle: 20000,
// acquire: 20000
// },
// logging: console.log,

// SQLite only
storage: 'db/blockchain.db',
transactionType: 'IMMEDIATE',
// // SQLite only
// storage: 'db/blockchain.db',
// transactionType: 'IMMEDIATE',

// Sequelize will warn you if you're using the default aliases and not limiting them
// https://sequelize.org/master/manual/querying.html#operators-aliases
operatorsAliases: {
$and: Op.and,
$or: Op.or,
$eq: Op.eq,
$gt: Op.gt,
$lt: Op.lt,
$lte: Op.lte,
$like: Op.like,
$in: Op.in,
$is: Op.is,
$gte: Op.gte,
$between: Op.between,
$not: Op.not,
$contains: Op.contains
}
}
},
// // Sequelize will warn you if you're using the default aliases and not limiting them
// // https://sequelize.org/master/manual/querying.html#operators-aliases
// operatorsAliases: {
// $and: Op.and,
// $or: Op.or,
// $eq: Op.eq,
// $gt: Op.gt,
// $lt: Op.lt,
// $lte: Op.lte,
// $like: Op.like,
// $in: Op.in,
// $is: Op.is,
// $gte: Op.gte,
// $between: Op.between,
// $not: Op.not,
// $contains: Op.contains
// }
// }
// },

/**
* 扩展资产插件,对于区块链而言就是资产包,所以使用 assets
Expand Down

0 comments on commit 46eb734

Please sign in to comment.