@memberjunction/cli 2.43.0 → 2.45.0

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
@@ -1,188 +1,237 @@
1
- MemberJunction CLI
2
- ==================
3
-
4
- <!-- toc -->
5
- * [Usage](#usage)
6
- * [Commands](#commands)
7
- <!-- tocstop -->
8
- # Usage
9
- <!-- usage -->
10
- ```sh-session
11
- $ npm install -g @memberjunction/cli
12
- $ mj COMMAND
13
- running command...
14
- $ mj (--version)
15
- @memberjunction/cli/2.43.0 linux-x64 node-v20.19.1
16
- $ mj --help [COMMAND]
17
- USAGE
18
- $ mj COMMAND
19
- ...
20
- ```
21
- <!-- usagestop -->
22
- # Commands
23
- <!-- commands -->
24
- * [`mj bump`](#mj-bump)
25
- * [`mj clean`](#mj-clean)
26
- * [`mj codegen`](#mj-codegen)
27
- * [`mj help [COMMAND]`](#mj-help-command)
28
- * [`mj install`](#mj-install)
29
- * [`mj migrate`](#mj-migrate)
30
- * [`mj version`](#mj-version)
1
+ # @memberjunction/cli
31
2
 
32
- ## `mj bump`
3
+ The official command-line interface (CLI) for MemberJunction, providing essential tools for installation, database management, code generation, and dependency management.
33
4
 
34
- Bumps MemberJunction dependency versions
5
+ ## Overview
35
6
 
36
- ```
37
- USAGE
38
- $ mj bump [-v] [-r] [-t <value>] [-q] [-d]
7
+ The MemberJunction CLI (`mj`) is a comprehensive toolset designed to streamline the development and maintenance of MemberJunction applications. It handles everything from initial installation to ongoing database migrations and code generation.
39
8
 
40
- FLAGS
41
- -d, --dry Dry run, do not write changes to package.json files
42
- -q, --quiet Only output paths for updated packages
43
- -r, --recursive Bump version in current directory and all subdirectories
44
- -t, --tag=<value> Version tag to bump target for bump (e.g. v2.10.0), defaults to the CLI version
45
- -v, --verbose Enable additional logging
9
+ ## Installation
46
10
 
47
- DESCRIPTION
48
- Bumps MemberJunction dependency versions
11
+ ### Global Installation (Recommended)
12
+ ```bash
13
+ npm install -g @memberjunction/cli
14
+ ```
49
15
 
50
- EXAMPLES
51
- Bump all @memberjunction/* dependencies in the current directory's package.json to the CLI version
16
+ ### Local Installation
17
+ ```bash
18
+ npm install --save-dev @memberjunction/cli
19
+ ```
52
20
 
53
- $ mj bump
21
+ ## Prerequisites
22
+
23
+ - **Node.js**: Version 20.0.0 or higher
24
+ - **SQL Server**: Access to a SQL Server instance for database operations
25
+ - **Disk Space**: At least 2GB of free disk space for installation
26
+
27
+ ## Configuration
28
+
29
+ The CLI uses a configuration file system powered by [cosmiconfig](https://github.com/davidtheclark/cosmiconfig). It searches for configuration in the following locations:
30
+
31
+ - `.mjrc`
32
+ - `.mjrc.json`
33
+ - `.mjrc.yaml`
34
+ - `.mjrc.yml`
35
+ - `.mjrc.js`
36
+ - `.mjrc.cjs`
37
+ - `mj.config.js`
38
+ - `mj.config.cjs`
39
+ - `package.json` (in a `"mj"` property)
40
+
41
+ ### Configuration Schema
42
+
43
+ ```typescript
44
+ interface MJConfig {
45
+ dbHost: string; // Database server hostname (default: 'localhost')
46
+ dbDatabase: string; // Database name
47
+ dbPort: number; // Database port (default: 1433)
48
+ codeGenLogin: string; // Database login for CodeGen operations
49
+ codeGenPassword: string; // Database password for CodeGen operations
50
+ migrationsLocation?: string; // Location of migration files (default: 'filesystem:./migrations')
51
+ dbTrustServerCertificate?: boolean; // Trust server certificate (default: false)
52
+ coreSchema?: string; // Core schema name (default: '__mj')
53
+ cleanDisabled?: boolean; // Disable database cleaning (default: true)
54
+ mjRepoUrl?: string; // MemberJunction repository URL
55
+ }
56
+ ```
54
57
 
55
- Preview all recursive packages bumps without writing any changes.
58
+ ### Example Configuration
59
+
60
+ ```javascript
61
+ // mj.config.cjs
62
+ module.exports = {
63
+ dbHost: 'localhost',
64
+ dbDatabase: 'MemberJunction',
65
+ dbPort: 1433,
66
+ codeGenLogin: 'sa',
67
+ codeGenPassword: 'YourPassword123!',
68
+ dbTrustServerCertificate: true,
69
+ coreSchema: '__mj'
70
+ };
71
+ ```
56
72
 
57
- $ mj bump -rdv
73
+ ## Commands
58
74
 
59
- Recursively bump all @memberjunction/* dependencies in all packages to version v2.10.0 and output only the paths
60
- containing the updated package.json files. Pipe the output to xargs to run npm install in each directory and update
61
- the package-lock.json files as well.
75
+ ### `mj install`
62
76
 
63
- $ mj bump -rqt v2.10.0 | xargs -n1 -I{} npm install --prefix {}
77
+ Performs a complete installation of MemberJunction, including:
78
+ - Database setup
79
+ - Generated entities configuration
80
+ - API server configuration
81
+ - Explorer UI configuration
82
+
83
+ ```bash
84
+ mj install [--verbose]
64
85
  ```
65
86
 
66
- _See code: [src/commands/bump/index.ts](https://github.com/MemberJunction/MJ/blob/v2.43.0/src/commands/bump/index.ts)_
87
+ The install command will:
88
+ 1. Verify Node.js version and disk space requirements
89
+ 2. Check for required directories (GeneratedEntities, SQL Scripts, MJAPI, MJExplorer)
90
+ 3. Prompt for configuration values or read from `install.config.json`
91
+ 4. Create `.env` files with database and authentication settings
92
+ 5. Run npm installations and link packages
93
+ 6. Execute CodeGen to generate initial code
67
94
 
68
- ## `mj clean`
95
+ ### `mj codegen`
69
96
 
70
- Resets the MemberJunction database to a pre-installation state
97
+ Runs the MemberJunction code generation process to create TypeScript entities and metadata from your database schema.
71
98
 
99
+ ```bash
100
+ mj codegen [--skipdb]
72
101
  ```
73
- USAGE
74
- $ mj clean [-v]
75
102
 
76
- FLAGS
77
- -v, --verbose Enable additional logging
103
+ Options:
104
+ - `--skipdb`: Skip database migration before running code generation
105
+
106
+ ### `mj migrate`
78
107
 
79
- DESCRIPTION
80
- Resets the MemberJunction database to a pre-installation state
108
+ Applies database migrations to update your MemberJunction schema to the latest version.
81
109
 
82
- EXAMPLES
83
- $ mj clean
110
+ ```bash
111
+ mj migrate [--verbose] [--tag <version>]
84
112
  ```
85
113
 
86
- _See code: [src/commands/clean/index.ts](https://github.com/MemberJunction/MJ/blob/v2.43.0/src/commands/clean/index.ts)_
114
+ Options:
115
+ - `--verbose`: Enable detailed logging
116
+ - `--tag <version>`: Specify a version tag for migrations (e.g., 'v2.10.0')
117
+
118
+ ### `mj bump`
87
119
 
88
- ## `mj codegen`
120
+ Updates all @memberjunction/* package dependencies to a specified version.
121
+
122
+ ```bash
123
+ mj bump [--recursive] [--dry] [--quiet] [--tag <version>] [--verbose]
124
+ ```
89
125
 
90
- Run CodeGen to generate code and update metadata for MemberJunction
126
+ Options:
127
+ - `-r, --recursive`: Update dependencies in all subdirectories
128
+ - `-d, --dry`: Preview changes without writing to files
129
+ - `-q, --quiet`: Only output paths of updated packages
130
+ - `-t, --tag <version>`: Target version (defaults to CLI version)
131
+ - `-v, --verbose`: Enable detailed logging
91
132
 
133
+ Example - Update all packages recursively and run npm install:
134
+ ```bash
135
+ mj bump -rqt v2.10.0 | xargs -n1 -I{} npm install --prefix {}
92
136
  ```
93
- USAGE
94
- $ mj codegen [--skipdb]
95
137
 
96
- FLAGS
97
- --skipdb Skip database migration
138
+ ### `mj clean`
98
139
 
99
- DESCRIPTION
100
- Run CodeGen to generate code and update metadata for MemberJunction
140
+ Resets the MemberJunction database to a pre-installation state. **Use with caution!**
101
141
 
102
- EXAMPLES
103
- $ mj codegen
142
+ ```bash
143
+ mj clean [--verbose]
104
144
  ```
105
145
 
106
- _See code: [src/commands/codegen/index.ts](https://github.com/MemberJunction/MJ/blob/v2.43.0/src/commands/codegen/index.ts)_
146
+ Note: This command is disabled by default. Set `cleanDisabled: false` in your configuration to enable it.
107
147
 
108
- ## `mj help [COMMAND]`
148
+ ### `mj help`
109
149
 
110
- Display help for mj.
150
+ Display help information for any command.
111
151
 
152
+ ```bash
153
+ mj help [COMMAND]
112
154
  ```
113
- USAGE
114
- $ mj help [COMMAND...] [-n]
115
155
 
116
- ARGUMENTS
117
- COMMAND... Command to show help for.
156
+ ### `mj version`
118
157
 
119
- FLAGS
120
- -n, --nested-commands Include all nested commands in the output.
158
+ Display the CLI version and additional system information.
121
159
 
122
- DESCRIPTION
123
- Display help for mj.
160
+ ```bash
161
+ mj version [--verbose] [--json]
124
162
  ```
125
163
 
126
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.3/src/commands/help.ts)_
164
+ ## Environment Variables
127
165
 
128
- ## `mj install`
166
+ The CLI respects the following environment variables:
129
167
 
130
- Install MemberJunction
168
+ - Standard Node.js environment variables
169
+ - Database connection variables set in `.env` files
170
+ - Authentication provider settings (MSAL, Auth0)
131
171
 
132
- ```
133
- USAGE
134
- $ mj install [-v]
172
+ ## Integration with MemberJunction Packages
135
173
 
136
- FLAGS
137
- -v, --verbose Enable additional logging
174
+ The CLI integrates seamlessly with other MemberJunction packages:
138
175
 
139
- DESCRIPTION
140
- Install MemberJunction
176
+ - **@memberjunction/codegen-lib**: Powers the code generation functionality
177
+ - **Generated Entities**: Automatically linked during installation
178
+ - **MJAPI**: Configured and linked during installation
179
+ - **MJExplorer**: UI configuration handled during installation
141
180
 
142
- EXAMPLES
143
- $ mj install
144
- ```
181
+ ## Hooks
182
+
183
+ The CLI implements the following hooks:
145
184
 
146
- _See code: [src/commands/install/index.ts](https://github.com/MemberJunction/MJ/blob/v2.43.0/src/commands/install/index.ts)_
185
+ - **prerun**: Displays the MemberJunction ASCII banner and version information
147
186
 
148
- ## `mj migrate`
187
+ ## Development
149
188
 
150
- Migrate MemberJunction database to latest version
189
+ ### Building from Source
151
190
 
191
+ ```bash
192
+ npm run build
152
193
  ```
153
- USAGE
154
- $ mj migrate [-v] [-t <value>]
155
194
 
156
- FLAGS
157
- -t, --tag=<value> Version tag to use for running remote migrations
158
- -v, --verbose Enable additional logging
195
+ ### Scripts
159
196
 
160
- DESCRIPTION
161
- Migrate MemberJunction database to latest version
197
+ - `build`: Compile TypeScript to JavaScript
198
+ - `prepack`: Build and generate oclif manifest
199
+ - `postpack`: Clean up generated files
162
200
 
163
- EXAMPLES
164
- $ mj migrate
165
- ```
201
+ ## Technical Details
166
202
 
167
- _See code: [src/commands/migrate/index.ts](https://github.com/MemberJunction/MJ/blob/v2.43.0/src/commands/migrate/index.ts)_
203
+ - Built with [oclif](https://oclif.io/) framework
204
+ - Uses TypeScript for type safety
205
+ - Implements Flyway for database migrations
206
+ - Supports both global and project-specific configurations
207
+ - Includes comprehensive error handling and validation
168
208
 
169
- ## `mj version`
209
+ ## Troubleshooting
170
210
 
171
- ```
172
- USAGE
173
- $ mj version [--json] [--verbose]
211
+ ### Common Issues
174
212
 
175
- FLAGS
176
- --verbose Show additional information about the CLI.
213
+ 1. **Node Version Error**: Ensure you're using Node.js 20 or higher
214
+ 2. **Database Connection**: Verify your database credentials and network access
215
+ 3. **Disk Space**: The installation requires at least 2GB of free space
216
+ 4. **Configuration Not Found**: Check that your config file is in a supported location
177
217
 
178
- GLOBAL FLAGS
179
- --json Format output as json.
218
+ ### Debug Mode
180
219
 
181
- FLAG DESCRIPTIONS
182
- --verbose Show additional information about the CLI.
220
+ Run any command with the `--verbose` flag for detailed logging:
183
221
 
184
- Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
222
+ ```bash
223
+ mj install --verbose
224
+ mj codegen --verbose
185
225
  ```
186
226
 
187
- _See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.2.4/src/commands/version.ts)_
188
- <!-- commandsstop -->
227
+ ## License
228
+
229
+ ISC License - see the [LICENSE](https://github.com/MemberJunction/MJ/blob/main/LICENSE) file for details.
230
+
231
+ ## Repository
232
+
233
+ [https://github.com/MemberJunction/MJ](https://github.com/MemberJunction/MJ)
234
+
235
+ ## Support
236
+
237
+ For issues and feature requests, please visit the [GitHub Issues](https://github.com/MemberJunction/MJ/issues) page.
@@ -208,5 +208,5 @@
208
208
  ]
209
209
  }
210
210
  },
211
- "version": "2.43.0"
211
+ "version": "2.45.0"
212
212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/cli",
3
- "version": "2.43.0",
3
+ "version": "2.45.0",
4
4
  "description": "MemberJunction command line tools",
5
5
  "keywords": [
6
6
  "oclif"
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@inquirer/prompts": "^5.0.1",
53
- "@memberjunction/codegen-lib": "2.43.0",
53
+ "@memberjunction/codegen-lib": "2.45.0",
54
54
  "@oclif/core": "^3",
55
55
  "@oclif/plugin-help": "^6",
56
56
  "@oclif/plugin-version": "^2.0.17",