@moltium/world-cli 0.1.13 → 0.1.15

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 +24 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -45,7 +45,8 @@ function generateWorldConfig(options) {
45
45
  port: options.dbConfig.port,
46
46
  database: options.dbConfig.database,
47
47
  user: options.dbConfig.user,
48
- password: options.dbConfig.password
48
+ password: options.dbConfig.password,
49
+ ...options.dbConfig.ssl && { ssl: true }
49
50
  }
50
51
  },
51
52
  ...options.persistenceType === "redis" && options.dbConfig && {
@@ -64,7 +65,7 @@ function generateWorldConfig(options) {
64
65
  },
65
66
  ...options.persistenceType === "leveldb" && options.dbConfig && {
66
67
  leveldb: {
67
- path: options.dbConfig.path
68
+ location: options.dbConfig.path || options.dbConfig.location || "./data/leveldb"
68
69
  }
69
70
  }
70
71
  },
@@ -121,6 +122,7 @@ DB_PORT=${options.dbConfig?.port || "5432"}
121
122
  DB_NAME=${options.dbConfig?.database || "moltium_world"}
122
123
  DB_USER=${options.dbConfig?.user || "postgres"}
123
124
  DB_PASSWORD=${options.dbConfig?.password || ""}
125
+ DB_SSL=${options.dbConfig?.ssl ? "true" : "false"}
124
126
  `;
125
127
  } else if (options.persistenceType === "redis") {
126
128
  env += `
@@ -135,6 +137,11 @@ DB_NAME=${options.dbConfig?.db || "0"}
135
137
  # MongoDB Configuration
136
138
  DB_URL=${options.dbConfig?.url || "mongodb://localhost:27017"}
137
139
  DB_NAME=${options.dbConfig?.database || "moltium_world"}
140
+ `;
141
+ } else if (options.persistenceType === "leveldb") {
142
+ env += `
143
+ # LevelDB Configuration
144
+ DB_PATH=${options.dbConfig?.path || "./data/leveldb"}
138
145
  `;
139
146
  }
140
147
  return env;
@@ -165,20 +172,27 @@ async function main() {
165
172
  }
166
173
 
167
174
  if (config.persistence) {
168
- if (config.persistence.type === 'postgres' && config.persistence.postgres) {
175
+ if (config.persistence.type === 'postgres') {
176
+ if (!config.persistence.postgres) config.persistence.postgres = { host: 'localhost', port: 5432, database: 'moltium_world', user: 'postgres', password: '' };
169
177
  if (process.env.DB_HOST) config.persistence.postgres.host = process.env.DB_HOST;
170
178
  if (process.env.DB_PORT) config.persistence.postgres.port = parseInt(process.env.DB_PORT);
171
179
  if (process.env.DB_NAME) config.persistence.postgres.database = process.env.DB_NAME;
172
180
  if (process.env.DB_USER) config.persistence.postgres.user = process.env.DB_USER;
173
181
  if (process.env.DB_PASSWORD) config.persistence.postgres.password = process.env.DB_PASSWORD;
174
- } else if (config.persistence.type === 'redis' && config.persistence.redis) {
182
+ if (process.env.DB_SSL === 'true') config.persistence.postgres.ssl = true;
183
+ } else if (config.persistence.type === 'redis') {
184
+ if (!config.persistence.redis) config.persistence.redis = { host: 'localhost', port: 6379 };
175
185
  if (process.env.DB_HOST) config.persistence.redis.host = process.env.DB_HOST;
176
186
  if (process.env.DB_PORT) config.persistence.redis.port = parseInt(process.env.DB_PORT);
177
187
  if (process.env.DB_PASSWORD) config.persistence.redis.password = process.env.DB_PASSWORD;
178
188
  if (process.env.DB_NAME) config.persistence.redis.db = parseInt(process.env.DB_NAME);
179
- } else if (config.persistence.type === 'mongodb' && config.persistence.mongodb) {
189
+ } else if (config.persistence.type === 'mongodb') {
190
+ if (!config.persistence.mongodb) config.persistence.mongodb = { url: 'mongodb://localhost:27017', database: 'moltium_world' };
180
191
  if (process.env.DB_URL) config.persistence.mongodb.url = process.env.DB_URL;
181
192
  if (process.env.DB_NAME) config.persistence.mongodb.database = process.env.DB_NAME;
193
+ } else if (config.persistence.type === 'leveldb') {
194
+ if (!config.persistence.leveldb) config.persistence.leveldb = { location: './data/leveldb' };
195
+ if (process.env.DB_PATH) config.persistence.leveldb.location = process.env.DB_PATH;
182
196
  }
183
197
  }
184
198
 
@@ -424,7 +438,8 @@ var initCommand = new Command("init").description("Initialize a new world projec
424
438
  { type: "input", name: "port", message: "PostgreSQL port:", default: "5432", validate: (v) => !isNaN(Number(v)) || "Must be a number" },
425
439
  { type: "input", name: "database", message: "Database name:", default: "moltium_world" },
426
440
  { type: "input", name: "user", message: "Database user:", default: "postgres" },
427
- { type: "password", name: "password", message: "Database password:", mask: "*" }
441
+ { type: "password", name: "password", message: "Database password:", mask: "*" },
442
+ { type: "confirm", name: "ssl", message: "Enable SSL? (required for Neon, Supabase, etc.):", default: (answers2) => answers2.host !== "localhost" && answers2.host !== "127.0.0.1" }
428
443
  ]);
429
444
  dbConfig.port = parseInt(dbConfig.port);
430
445
  } else if (persistenceAnswers.persistenceType === "redis") {
@@ -511,12 +526,12 @@ var initCommand = new Command("init").description("Initialize a new world projec
511
526
  "deploy:contracts": "moltium-world deploy"
512
527
  },
513
528
  dependencies: {
514
- "@moltium/world-core": "^0.1.13",
529
+ "@moltium/world-core": "^0.1.15",
515
530
  dotenv: "^16.4.0",
516
531
  ...persistenceAnswers.persistenceType === "sqlite" ? { "better-sqlite3": "^11.0.0" } : {},
517
532
  ...persistenceAnswers.persistenceType === "redis" ? { "ioredis": "^5.3.0" } : {},
518
533
  ...persistenceAnswers.persistenceType === "postgres" ? { "pg": "^8.12.0" } : {},
519
- ...persistenceAnswers.persistenceType === "mongo" ? { "mongodb": "^6.3.0" } : {},
534
+ ...persistenceAnswers.persistenceType === "mongodb" ? { "mongodb": "^6.3.0" } : {},
520
535
  ...persistenceAnswers.persistenceType === "leveldb" ? { "level": "^8.0.0" } : {}
521
536
  },
522
537
  devDependencies: {
@@ -930,7 +945,7 @@ var deployCommand = new Command4("deploy").description("Deploy smart contracts t
930
945
 
931
946
  // src/index.ts
932
947
  var program = new Command5();
933
- program.name("moltium-world").description("CLI tool for creating and managing Moltium World SDK projects").version("0.1.13");
948
+ program.name("moltium-world").description("CLI tool for creating and managing Moltium World SDK projects").version("0.1.15");
934
949
  program.addCommand(initCommand);
935
950
  program.addCommand(tokenCommand);
936
951
  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.15",
4
4
  "description": "CLI tool for creating and managing Moltium World SDK projects",
5
5
  "license": "MIT",
6
6
  "keywords": [