@procamp/cli 0.0.1 → 0.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procamp/cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Procamp CLI",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -22,7 +22,8 @@
22
22
  },
23
23
  "keywords": [
24
24
  "typescript",
25
- "tsc"
25
+ "tsc",
26
+ "camp"
26
27
  ],
27
28
  "author": "Afrointelligence",
28
29
  "license": "ISC",
@@ -30,6 +31,7 @@
30
31
  "@types/adm-zip": "^0.5.0",
31
32
  "@types/fs-extra": "^11.0.1",
32
33
  "@types/inquirer": "^9.0.3",
34
+ "@types/jest": "^29.5.1",
33
35
  "@types/js-yaml": "^4.0.5",
34
36
  "@types/node": "^18.16.4",
35
37
  "@types/rimraf": "^4.0.5",
@@ -41,18 +43,13 @@
41
43
  },
42
44
  "dependencies": {
43
45
  "@procamp/course-validator": "^1.0.2",
44
- "@types/jest": "^29.5.1",
45
46
  "adm-zip": "^0.5.10",
46
47
  "axios": "^1.4.0",
47
48
  "commander": "^10.0.1",
48
- "ejs": "^3.1.9",
49
49
  "form-data": "^4.0.0",
50
50
  "fs-extra": "^11.1.1",
51
- "glob-promise": "^6.0.2",
52
- "globby": "^11.1.0",
53
51
  "inquirer": "^8.2.5",
54
52
  "js-yaml": "^4.1.0",
55
- "path": "^0.12.7",
56
53
  "ts-jest": "^29.1.0"
57
54
  }
58
55
  }
package/readme.md CHANGED
@@ -1,32 +1,296 @@
1
- # Getting started with Cmp cli
1
+ # Camp CLI - Init Command
2
2
 
3
- This project was bootstrapped with [Cmp CLI](https://github.com/facebook/create-react-app)
3
+ The `init` command allows you to initialize the project configuration for your camp.
4
4
 
5
- ### ENV
5
+ ## Usage
6
6
 
7
- Copy content from .example.env to .env
8
- ## Available Scripts
7
+ ```bash
8
+ camp init [options]
9
+ ```
9
10
 
10
- You can create the course directory with:
11
- ### `cmp new`
11
+ ## Description
12
12
 
13
- In the course directory, you can run:
13
+ The `init` command initializes the project configuration by prompting you to provide information about the camp. It creates a `meta.json` file with the provided details in the specified directory.
14
14
 
15
- ### `cmp init`
15
+ ## Options
16
16
 
17
- This command allows you to create a meta.json file that
18
- contains race configurations such as the title, id .
17
+ - `-d, --directory <directory>`: The directory to initialize the project. If not specified, the current working directory will be used.
19
18
 
20
- ### `cmp pack`
19
+ ## Prompts
21
20
 
22
- Archive the course, by default it archives
23
- the current folder. The -d or --directory option
24
- adds the path of the archived folder
21
+ During the initialization process, the following prompts will be presented:
25
22
 
26
- ### `cmp publish`
27
- Publishes the course on the course manager platform. It uses the id in the meta.json
28
- file for publishing the course
23
+ 1. **title**: The title of the folder. This will be used as the default if not provided.
24
+ 2. **author**: The author of the camp. Leave it empty if not applicable.
25
+ 3. **description**: The description of the camp. Leave it empty if not applicable.
26
+ 4. **version**: The version of the camp. Defaults to "1.0" if not provided.
27
+ 5. **courseId**: The ID of the course. This field is mandatory and must not be left empty.
29
28
 
30
- ### `cmp g course`
31
- Create course with blueprint.yaml
29
+ ## Example
32
30
 
31
+ To initialize the project configuration for your camp, run the following command:
32
+
33
+ ```bash
34
+ camp init -d /path/to/project
35
+ ```
36
+
37
+ This will prompt you to provide the required information and create a `meta.json` file in the specified directory.
38
+
39
+ ---
40
+
41
+ # Camp CLI - New Command
42
+
43
+ The `new` command generates a new course project with the specified name.
44
+
45
+ ## Usage
46
+
47
+ ```bash
48
+ camp new <projectName>
49
+ ```
50
+
51
+ ## Description
52
+
53
+ The `new` command generates a new course project with the given `<projectName>`. It creates a new directory with the project name and prompts for confirmation before proceeding.
54
+
55
+ ## Arguments
56
+
57
+ - `<projectName>`: The name of the project to generate. This will be used as the directory name for the project.
58
+
59
+ ## Example
60
+
61
+ To generate a new course project with the name "myproject", run the following command:
62
+
63
+ ```bash
64
+ camp new myproject
65
+ ```
66
+
67
+ This will create a new directory named "myproject" and initialize the project configuration within it using the `init` command.
68
+
69
+ ---
70
+
71
+ # Camp CLI - Pack Command
72
+
73
+ The `pack` command compresses files in the specified directory.
74
+
75
+ ## Usage
76
+
77
+ ```bash
78
+ camp pack [options]
79
+ ```
80
+
81
+ ## Description
82
+
83
+ The `pack` command compresses the files in the specified directory using the ZIP format. It excludes certain files and directories from compression, such as "_MACOSX" and "node_modules".
84
+
85
+ ## Options
86
+
87
+ - `-d, --directory <directory>`: The directory to compress. If not specified, the current working directory will be used.
88
+
89
+ ## Example
90
+
91
+ To compress files in the current working directory, run the following command:
92
+
93
+ ```bash
94
+ camp pack
95
+ ```
96
+
97
+ This will create a compressed ZIP file named ".output.zip" in the same directory.
98
+
99
+ To compress files in a specific directory, provide the directory path using the `-d` or `--directory` option:
100
+
101
+ ```bash
102
+ camp pack -d /path/to/directory
103
+ ```
104
+
105
+ This will create a compressed ZIP file named ".output.zip" in the specified directory.
106
+
107
+ ---
108
+
109
+ # Camp CLI - Login Command
110
+
111
+ The `login` command allows you to log in to Procamp.
112
+
113
+ ## Usage
114
+
115
+ ```bash
116
+ camp login
117
+ ```
118
+
119
+ ## Description
120
+
121
+ The `login` command prompts you to enter your email and password to log in to Procamp. It then retrieves the access token and stores it securely in the config file.
122
+
123
+ ## Example
124
+
125
+ To log in to Procamp, run the following command:
126
+
127
+ ```bash
128
+ camp login
129
+ ```
130
+
131
+ This command performs the following steps:
132
+
133
+ 1. Prompts you to enter your email and password.
134
+ 2. Sends a request to the Procamp authentication server to retrieve the access token.
135
+ 3. Stores the access token, client ID, and other necessary information securely in the config file.
136
+ 4. Displays a success message indicating that you are logged in.
137
+
138
+ ---
139
+
140
+ # Camp CLI - Publish Command
141
+
142
+ The `publish` command publishes the files to the service.
143
+
144
+ ## Usage
145
+
146
+ ```bash
147
+ camp publish
148
+ ```
149
+
150
+ ## Description
151
+
152
+ The `publish` command publishes the files to the service by compressing the files, validating the course, and then sending the compressed file to the service endpoint.
153
+
154
+ ## Prerequisites
155
+
156
+ Before running the `publish` command, make sure you have completed the following steps:
157
+
158
+ 1. Ensure that the `meta.json` file exists in the current directory.
159
+ 2. Make sure you are logged in by setting up the config file with your credentials.
160
+
161
+ ## Example
162
+
163
+ To publish the course files to the service, run the following command:
164
+
165
+ ```bash
166
+ camp publish
167
+ ```
168
+
169
+ This command performs the following steps:
170
+
171
+ 1. Checks if the `meta.json` file exists in the current directory.
172
+ 2. Validates the course files in the directory.
173
+ 3. Compresses the files into a ZIP file.
174
+ 4. Sends the ZIP file to the service endpoint using the course ID specified in the `meta.json` file.
175
+ 5. Displays the response from the service.
176
+
177
+ Note: Make sure you are logged in by setting up the config file with your credentials before running the `publish` command.
178
+
179
+ ---
180
+
181
+ # Camp CLI - Validate Command
182
+
183
+ The `validate` command validates the course folder structure.
184
+
185
+ ## Usage
186
+
187
+ ```bash
188
+ camp validate
189
+ ```
190
+
191
+ ## Description
192
+
193
+ The `validate` command validates the course folder structure to ensure it meets the required format and structure. It checks for any missing or incorrectly organized files and directories.
194
+
195
+ ## Example
196
+
197
+ To validate the course folder structure, run the following command:
198
+
199
+ ```bash
200
+ camp validate
201
+ ```
202
+
203
+ This command performs the following steps:
204
+
205
+ 1. Validates the course folder structure in the current directory.
206
+ 2. Checks for any missing or incorrectly organized files and directories.
207
+ 3. Displays the validation results.
208
+
209
+ ---
210
+
211
+ # Camp CLI - Generate Command
212
+
213
+ The `generate` command generates a course based on the provided blueprint.yaml file.
214
+
215
+ ## Usage
216
+
217
+ ```bash
218
+ camp generate <key> <value>
219
+ ```
220
+
221
+ ## Description
222
+
223
+ The `generate` command generates a course with the specified structure using the blueprint.yaml file. It creates directories and files based on the blueprint configuration.
224
+
225
+ ## Arguments
226
+
227
+ - `<key>`: The key to specify the type of generation. Currently supported key: `course`.
228
+ - `<value>`: The value associated with the key.
229
+
230
+ ## Example
231
+
232
+ To generate a course structure based on the blueprint.yaml file, run the following command:
233
+
234
+ ```bash
235
+ camp generate course .
236
+ ```
237
+
238
+ This command performs the following steps:
239
+
240
+ 1. Reads the `blueprint.yaml` file in the current directory.
241
+ 2. Creates directories and files based on the blueprint configuration.
242
+ 3. Sets the course title, author, description, version, and courseId in the `meta.json` file.
243
+ 4. Creates `README.md` files in each directory.
244
+ 5. Generates the folder structure for chapters, lessons, and assessments based on the blueprint configuration.
245
+
246
+ Note: Make sure you have the `blueprint.yaml` file in the current directory before running the `generate` command.
247
+
248
+ ---
249
+
250
+ # Camp CLI - Set Command
251
+
252
+ The `set` command allows you to set values for specific keys.
253
+
254
+ ## Usage
255
+
256
+ ```bash
257
+ camp set <key> <value>
258
+ ```
259
+
260
+ ## Description
261
+
262
+ The `set` command sets values for specific keys in the configuration files.
263
+
264
+ ## Available Keys
265
+
266
+ - `courseId`: Sets the course ID in the `meta.json` file.
267
+ - `clientId`: Sets the client ID in the config file.
268
+ - `clientSecret`: Sets the client secret in the config file.
269
+
270
+ ## Examples
271
+
272
+ To set the course ID, run the following command:
273
+
274
+ ```bash
275
+ camp set courseId <courseId>
276
+ ```
277
+
278
+ This command sets the provided `<courseId>` in the `meta.json` file.
279
+
280
+ To set the client ID, run the following command:
281
+
282
+ ```bash
283
+ camp set clientId <clientId>
284
+ ```
285
+
286
+ This command sets the provided `<clientId>` in the config file.
287
+
288
+ To set the client secret, run the following command:
289
+
290
+ ```bash
291
+ camp set clientSecret <clientSecret>
292
+ ```
293
+
294
+ This command sets the provided `<clientSecret>` in the config file.
295
+
296
+ ---
@@ -1 +0,0 @@
1
- export declare function error(err: string): void;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.error = void 0;
4
- function error(err) {
5
- console.error('cmp \x1b[31m%s\x1b[0m', 'ERR!', err);
6
- }
7
- exports.error = error;
8
- //# sourceMappingURL=error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":";;;AAAA,SAAgB,KAAK,CAAC,GAAW;IAC/B,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;AACtD,CAAC;AAFD,sBAEC","sourcesContent":["export function error(err: string) {\n console.error('cmp \\x1b[31m%s\\x1b[0m', 'ERR!', err);\n}\n"]}