@moltium/world-cli 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +18 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -64,7 +64,7 @@ function generateWorldConfig(options) {
64
64
  },
65
65
  ...options.persistenceType === "leveldb" && options.dbConfig && {
66
66
  leveldb: {
67
- path: options.dbConfig.path
67
+ location: options.dbConfig.path || options.dbConfig.location || "./data/leveldb"
68
68
  }
69
69
  }
70
70
  },
@@ -135,6 +135,11 @@ DB_NAME=${options.dbConfig?.db || "0"}
135
135
  # MongoDB Configuration
136
136
  DB_URL=${options.dbConfig?.url || "mongodb://localhost:27017"}
137
137
  DB_NAME=${options.dbConfig?.database || "moltium_world"}
138
+ `;
139
+ } else if (options.persistenceType === "leveldb") {
140
+ env += `
141
+ # LevelDB Configuration
142
+ DB_PATH=${options.dbConfig?.path || "./data/leveldb"}
138
143
  `;
139
144
  }
140
145
  return env;
@@ -165,20 +170,26 @@ async function main() {
165
170
  }
166
171
 
167
172
  if (config.persistence) {
168
- if (config.persistence.type === 'postgres' && config.persistence.postgres) {
173
+ if (config.persistence.type === 'postgres') {
174
+ if (!config.persistence.postgres) config.persistence.postgres = { host: 'localhost', port: 5432, database: 'moltium_world', user: 'postgres', password: '' };
169
175
  if (process.env.DB_HOST) config.persistence.postgres.host = process.env.DB_HOST;
170
176
  if (process.env.DB_PORT) config.persistence.postgres.port = parseInt(process.env.DB_PORT);
171
177
  if (process.env.DB_NAME) config.persistence.postgres.database = process.env.DB_NAME;
172
178
  if (process.env.DB_USER) config.persistence.postgres.user = process.env.DB_USER;
173
179
  if (process.env.DB_PASSWORD) config.persistence.postgres.password = process.env.DB_PASSWORD;
174
- } else if (config.persistence.type === 'redis' && config.persistence.redis) {
180
+ } else if (config.persistence.type === 'redis') {
181
+ if (!config.persistence.redis) config.persistence.redis = { host: 'localhost', port: 6379 };
175
182
  if (process.env.DB_HOST) config.persistence.redis.host = process.env.DB_HOST;
176
183
  if (process.env.DB_PORT) config.persistence.redis.port = parseInt(process.env.DB_PORT);
177
184
  if (process.env.DB_PASSWORD) config.persistence.redis.password = process.env.DB_PASSWORD;
178
185
  if (process.env.DB_NAME) config.persistence.redis.db = parseInt(process.env.DB_NAME);
179
- } else if (config.persistence.type === 'mongodb' && config.persistence.mongodb) {
186
+ } else if (config.persistence.type === 'mongodb') {
187
+ if (!config.persistence.mongodb) config.persistence.mongodb = { url: 'mongodb://localhost:27017', database: 'moltium_world' };
180
188
  if (process.env.DB_URL) config.persistence.mongodb.url = process.env.DB_URL;
181
189
  if (process.env.DB_NAME) config.persistence.mongodb.database = process.env.DB_NAME;
190
+ } else if (config.persistence.type === 'leveldb') {
191
+ if (!config.persistence.leveldb) config.persistence.leveldb = { location: './data/leveldb' };
192
+ if (process.env.DB_PATH) config.persistence.leveldb.location = process.env.DB_PATH;
182
193
  }
183
194
  }
184
195
 
@@ -511,12 +522,12 @@ var initCommand = new Command("init").description("Initialize a new world projec
511
522
  "deploy:contracts": "moltium-world deploy"
512
523
  },
513
524
  dependencies: {
514
- "@moltium/world-core": "^0.1.13",
525
+ "@moltium/world-core": "^0.1.14",
515
526
  dotenv: "^16.4.0",
516
527
  ...persistenceAnswers.persistenceType === "sqlite" ? { "better-sqlite3": "^11.0.0" } : {},
517
528
  ...persistenceAnswers.persistenceType === "redis" ? { "ioredis": "^5.3.0" } : {},
518
529
  ...persistenceAnswers.persistenceType === "postgres" ? { "pg": "^8.12.0" } : {},
519
- ...persistenceAnswers.persistenceType === "mongo" ? { "mongodb": "^6.3.0" } : {},
530
+ ...persistenceAnswers.persistenceType === "mongodb" ? { "mongodb": "^6.3.0" } : {},
520
531
  ...persistenceAnswers.persistenceType === "leveldb" ? { "level": "^8.0.0" } : {}
521
532
  },
522
533
  devDependencies: {
@@ -930,7 +941,7 @@ var deployCommand = new Command4("deploy").description("Deploy smart contracts t
930
941
 
931
942
  // src/index.ts
932
943
  var program = new Command5();
933
- program.name("moltium-world").description("CLI tool for creating and managing Moltium World SDK projects").version("0.1.13");
944
+ program.name("moltium-world").description("CLI tool for creating and managing Moltium World SDK projects").version("0.1.14");
934
945
  program.addCommand(initCommand);
935
946
  program.addCommand(tokenCommand);
936
947
  program.addCommand(startCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moltium/world-cli",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "CLI tool for creating and managing Moltium World SDK projects",
5
5
  "license": "MIT",
6
6
  "keywords": [