@memberjunction/cli 1.1.0 → 1.1.1

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.
package/README.md CHANGED
@@ -12,7 +12,7 @@ $ npm install -g @memberjunction/cli
12
12
  $ mj COMMAND
13
13
  running command...
14
14
  $ mj (--version)
15
- @memberjunction/cli/1.1.0 linux-x64 node-v20.12.2
15
+ @memberjunction/cli/1.1.1 linux-x64 node-v20.12.2
16
16
  $ mj --help [COMMAND]
17
17
  USAGE
18
18
  $ mj COMMAND
@@ -63,7 +63,7 @@ EXAMPLES
63
63
  $ mj install
64
64
  ```
65
65
 
66
- _See code: [src/commands/install/index.ts](https://github.com/MemberJunction/MJ/blob/v1.1.0/src/commands/install/index.ts)_
66
+ _See code: [src/commands/install/index.ts](https://github.com/MemberJunction/MJ/blob/v1.1.1/src/commands/install/index.ts)_
67
67
 
68
68
  ## `mj version`
69
69
 
@@ -118,6 +118,7 @@ export default class Install extends Command {
118
118
  * @param {...string} dirs - The directories to check.
119
119
  */
120
120
  verifyDirs(...dirs: string[]): void;
121
+ checkNodeVersion(): void;
121
122
  /**
122
123
  * Checks if there is at least `numGB` GB of free disk space.
123
124
  * @param {number} numGB - The number of GB to check for.
@@ -81,6 +81,7 @@ class Install extends core_1.Command {
81
81
  async run() {
82
82
  const parsed = await this.parse(Install);
83
83
  this.flags = parsed.flags;
84
+ this.checkNodeVersion();
84
85
  this.checkAvailableDiskSpace(2);
85
86
  this.verifyDirs(CODEGEN_DIR, GENERATED_ENTITIES_DIR, SQL_SCRIPTS_DIR, MJAPI_DIR, MJEXPLORER_DIR);
86
87
  this.userConfig = await this.getUserConfiguration();
@@ -130,16 +131,14 @@ AI_VENDOR_API_KEY__AnthropicLLM='${this.userConfig.anthropicAPIKey}'
130
131
  CONFIG_FILE='config.json'
131
132
  `;
132
133
  fs.writeFileSync(node_path_1.default.join(CODEGEN_DIR, '.env'), codeGenENV);
133
- this.log(' Running npm install...');
134
- (0, node_child_process_1.execSync)('npm install', { stdio: 'inherit', cwd: CODEGEN_DIR });
135
134
  this.log(' Running npm link for GeneratedEntities...');
136
135
  (0, node_child_process_1.execSync)('npm link ../GeneratedEntities', { stdio: 'inherit', cwd: CODEGEN_DIR });
137
136
  //*******************************************************************
138
137
  // Process MJAPI
139
138
  //*******************************************************************
140
139
  this.log('\n\nBootstrapping MJAPI...');
141
- this.log(' Running npm install...');
142
- (0, node_child_process_1.execSync)('npm install', { stdio: 'inherit', cwd: MJAPI_DIR });
140
+ this.log(' Running npm link for GeneratedEntities...');
141
+ (0, node_child_process_1.execSync)('npm link ../GeneratedEntities', { stdio: 'inherit', cwd: MJAPI_DIR });
143
142
  this.log(' Setting up MJAPI .env file...');
144
143
  const mjAPIENV = `#Database Setup
145
144
  DB_HOST='${this.userConfig.dbUrl}'
@@ -182,13 +181,11 @@ ASK_SKIP_ORGANIZATION_ID = 1
182
181
  CONFIG_FILE='config.json'
183
182
  `;
184
183
  fs.writeFileSync(node_path_1.default.join(MJAPI_DIR, '.env'), mjAPIENV);
185
- this.log(' Running npm link for GeneratedEntities...');
186
- (0, node_child_process_1.execSync)('npm link ../GeneratedEntities', { stdio: 'inherit', cwd: MJAPI_DIR });
187
184
  this.log('Running CodeGen...');
188
185
  this.renameFolderToMJ_BASE(this.userConfig.dbDatabase);
189
186
  // next, run CodeGen
190
187
  // We do not manually run the compilation for GeneratedEntities because CodeGen handles that, but notice above that we did npm install for GeneratedEntities otherwise when CodeGen attempts to compile it, it will fail.
191
- (0, node_child_process_1.execSync)('npx tsx src/index.ts', { stdio: 'inherit', cwd: CODEGEN_DIR });
188
+ (0, node_child_process_1.execSync)('npx ts-node src/index.ts', { stdio: 'inherit', cwd: CODEGEN_DIR });
192
189
  // Process MJExplorer
193
190
  this.log('\nProcessing MJExplorer...');
194
191
  this.log('\n Updating environment files...');
@@ -201,8 +198,6 @@ CONFIG_FILE='config.json'
201
198
  };
202
199
  await this.updateEnvironmentFiles(MJEXPLORER_DIR, config);
203
200
  // keep on going with MJ Explorer - do the rest of the stuff
204
- this.log(' Running npm install...');
205
- (0, node_child_process_1.execSync)('npm install', { stdio: 'inherit', cwd: MJEXPLORER_DIR });
206
201
  this.log(' Running npm link for GeneratedEntities...');
207
202
  (0, node_child_process_1.execSync)('npm link ../GeneratedEntities', { stdio: 'inherit', cwd: MJEXPLORER_DIR });
208
203
  this.log('Installation complete!');
@@ -322,6 +317,12 @@ CONFIG_FILE='config.json'
322
317
  }
323
318
  });
324
319
  }
320
+ checkNodeVersion() {
321
+ const validNodeVersion = Number(process.version.replace(/^v(\d+).*/, '$1')) >= 20;
322
+ if (!validNodeVersion) {
323
+ this.error('MemberJunction requires Node.js version 20 or higher.', { exit: 1 });
324
+ }
325
+ }
325
326
  /**
326
327
  * Checks if there is at least `numGB` GB of free disk space.
327
328
  * @param {number} numGB - The number of GB to check for.
@@ -397,6 +398,10 @@ CONFIG_FILE='config.json'
397
398
  // rename the MJ_BASE set of SQL Scripts to our new dbname
398
399
  const oldFolderPath = node_path_1.default.join(SQL_SCRIPTS_DIR, GENERATED_DIR, MJ_BASE_DIR);
399
400
  const newFolderPath = node_path_1.default.join(SQL_SCRIPTS_DIR, GENERATED_DIR, dbDatabase); // Assuming dbDatabase holds the new name
401
+ if (!fs.existsSync(oldFolderPath)) {
402
+ this.warn(`SQL scripts not found at '${oldFolderPath}', skipping rename`);
403
+ return;
404
+ }
400
405
  try {
401
406
  fs.moveSync(oldFolderPath, newFolderPath);
402
407
  this.log(`Renamed ${oldFolderPath} to ${newFolderPath} successfully.`);
@@ -33,5 +33,5 @@
33
33
  ]
34
34
  }
35
35
  },
36
- "version": "1.1.0"
36
+ "version": "1.1.1"
37
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "MemberJunction command line tools",
5
5
  "keywords": [
6
6
  "oclif"