@learnpack/learnpack 5.0.16 → 5.0.18
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 +11 -11
- package/lib/commands/init.js +3 -5
- package/lib/commands/publish.js +2 -1
- package/lib/utils/api.d.ts +2 -2
- package/lib/utils/api.js +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/init.ts +6 -5
- package/src/commands/publish.ts +3 -1
- package/src/utils/api.ts +6 -2
package/README.md
CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @learnpack/learnpack
|
|
21
21
|
$ learnpack COMMAND
|
22
22
|
running command...
|
23
23
|
$ learnpack (-v|--version|version)
|
24
|
-
@learnpack/learnpack/5.0.
|
24
|
+
@learnpack/learnpack/5.0.18 win32-x64 node-v20.16.0
|
25
25
|
$ learnpack --help [COMMAND]
|
26
26
|
USAGE
|
27
27
|
$ learnpack COMMAND
|
@@ -75,7 +75,7 @@ DESCRIPTION
|
|
75
75
|
12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
|
76
76
|
```
|
77
77
|
|
78
|
-
_See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
78
|
+
_See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.18/src\commands\audit.ts)_
|
79
79
|
|
80
80
|
## `learnpack clean`
|
81
81
|
|
@@ -90,7 +90,7 @@ DESCRIPTION
|
|
90
90
|
Extra documentation goes here
|
91
91
|
```
|
92
92
|
|
93
|
-
_See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
93
|
+
_See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.18/src\commands\clean.ts)_
|
94
94
|
|
95
95
|
## `learnpack download [PACKAGE]`
|
96
96
|
|
@@ -108,7 +108,7 @@ DESCRIPTION
|
|
108
108
|
Extra documentation goes here
|
109
109
|
```
|
110
110
|
|
111
|
-
_See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
111
|
+
_See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.18/src\commands\download.ts)_
|
112
112
|
|
113
113
|
## `learnpack help [COMMAND]`
|
114
114
|
|
@@ -140,7 +140,7 @@ OPTIONS
|
|
140
140
|
-y, --yes Skip all prompts and initialize an empty project
|
141
141
|
```
|
142
142
|
|
143
|
-
_See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
143
|
+
_See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.18/src\commands\init.ts)_
|
144
144
|
|
145
145
|
## `learnpack login [PACKAGE]`
|
146
146
|
|
@@ -158,7 +158,7 @@ DESCRIPTION
|
|
158
158
|
Extra documentation goes here
|
159
159
|
```
|
160
160
|
|
161
|
-
_See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
161
|
+
_See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.18/src\commands\login.ts)_
|
162
162
|
|
163
163
|
## `learnpack logout [PACKAGE]`
|
164
164
|
|
@@ -176,7 +176,7 @@ DESCRIPTION
|
|
176
176
|
Extra documentation goes here
|
177
177
|
```
|
178
178
|
|
179
|
-
_See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
179
|
+
_See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.18/src\commands\logout.ts)_
|
180
180
|
|
181
181
|
## `learnpack plugins`
|
182
182
|
|
@@ -307,7 +307,7 @@ OPTIONS
|
|
307
307
|
-h, --help show CLI help
|
308
308
|
```
|
309
309
|
|
310
|
-
_See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
310
|
+
_See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.18/src\commands\publish.ts)_
|
311
311
|
|
312
312
|
## `learnpack start`
|
313
313
|
|
@@ -329,7 +329,7 @@ OPTIONS
|
|
329
329
|
-y, --yes Skip all prompts and initialize an empty project
|
330
330
|
```
|
331
331
|
|
332
|
-
_See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
332
|
+
_See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.18/src\commands\start.ts)_
|
333
333
|
|
334
334
|
## `learnpack test [EXERCISESLUG]`
|
335
335
|
|
@@ -346,7 +346,7 @@ OPTIONS
|
|
346
346
|
-y, --yes Skip all prompts and initialize an empty project
|
347
347
|
```
|
348
348
|
|
349
|
-
_See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
349
|
+
_See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.18/src\commands\test.ts)_
|
350
350
|
|
351
351
|
## `learnpack translate`
|
352
352
|
|
@@ -360,7 +360,7 @@ OPTIONS
|
|
360
360
|
-y, --yes Skip all prompts and initialize an empty project
|
361
361
|
```
|
362
362
|
|
363
|
-
_See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
363
|
+
_See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.18/src\commands\translate.ts)_
|
364
364
|
<!-- commandsstop -->
|
365
365
|
|
366
366
|
> > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
|
package/lib/commands/init.js
CHANGED
@@ -97,11 +97,9 @@ const handleAILogic = async (tutorialDir, packageInfo) => {
|
|
97
97
|
return;
|
98
98
|
}
|
99
99
|
const rigoToken = sessionPayload.rigobot.key;
|
100
|
-
const consumables = await (0, api_2.getConsumables)(sessionPayload.token);
|
101
|
-
if (consumables.
|
102
|
-
console_1.default.error("It seems you cannot generate tutorials with AI. Make sure you creator subscription is up to date here: https://4geeks.com/profile/subscriptions?
|
103
|
-
sessionPayload.token +
|
104
|
-
". If you believe there is an issue you can always contact support@4geeks.com");
|
100
|
+
const consumables = await (0, api_2.getConsumables)(sessionPayload.token, "ai-generation");
|
101
|
+
if (consumables.ai_generation === 0) {
|
102
|
+
console_1.default.error("It seems you cannot generate tutorials with AI. Make sure you creator subscription is up to date here: https://4geeks.com/profile/subscriptions? . If you believe there is an issue you can always contact support@4geeks.com");
|
105
103
|
process.exit(1);
|
106
104
|
}
|
107
105
|
const isCreator = await (0, rigoActions_1.hasCreatorPermission)(rigoToken);
|
package/lib/commands/publish.js
CHANGED
@@ -134,7 +134,6 @@ class BuildCommand extends SessionCommand_1.default {
|
|
134
134
|
output.on("close", async () => {
|
135
135
|
this.log(`Build completed: ${zipFilePath} (${archive.pointer()} total bytes)`);
|
136
136
|
// Remove build directory after zip is created
|
137
|
-
// this.removeDirectory(buildDir)
|
138
137
|
console_1.default.debug("Zip file saved in project root");
|
139
138
|
const formData = new FormData();
|
140
139
|
formData.append("file", fs.createReadStream(zipFilePath));
|
@@ -146,6 +145,7 @@ class BuildCommand extends SessionCommand_1.default {
|
|
146
145
|
console.log(res.data);
|
147
146
|
// Remove the zip file after uploading
|
148
147
|
fs.unlinkSync(zipFilePath);
|
148
|
+
this.removeDirectory(buildDir);
|
149
149
|
}
|
150
150
|
catch (error) {
|
151
151
|
if (axios_1.default.isAxiosError(error)) {
|
@@ -163,6 +163,7 @@ class BuildCommand extends SessionCommand_1.default {
|
|
163
163
|
console.error("Error uploading file:", error);
|
164
164
|
}
|
165
165
|
fs.unlinkSync(zipFilePath);
|
166
|
+
this.removeDirectory(buildDir);
|
166
167
|
}
|
167
168
|
});
|
168
169
|
archive.on("error", (err) => {
|
package/lib/utils/api.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
type TConsumableSlug = "ai-conversation-message" | "ai-compilation" | "ai-tutorial-generation";
|
1
|
+
type TConsumableSlug = "ai-conversation-message" | "ai-compilation" | "ai-tutorial-generation" | "ai-generation";
|
2
2
|
export declare const countConsumables: (consumables: any, consumableSlug?: TConsumableSlug) => any;
|
3
|
-
export declare const getConsumables: (token: string) => Promise<any>;
|
3
|
+
export declare const getConsumables: (token: string, consumableSlug?: TConsumableSlug) => Promise<any>;
|
4
4
|
declare const _default: {
|
5
5
|
login: (identification: string, password: string) => Promise<any>;
|
6
6
|
publish: (config: any) => Promise<any>;
|
package/lib/utils/api.js
CHANGED
@@ -258,14 +258,14 @@ const countConsumables = (consumables, consumableSlug = "ai-tutorial-generation"
|
|
258
258
|
return consumable ? consumable.balance.unit : 0;
|
259
259
|
};
|
260
260
|
exports.countConsumables = countConsumables;
|
261
|
-
const getConsumables = async (token) => {
|
261
|
+
const getConsumables = async (token, consumableSlug = "ai-generation") => {
|
262
262
|
const url = `${HOST}/v1/payments/me/service/consumable?virtual=true`;
|
263
263
|
const headers = {
|
264
264
|
Authorization: `Token ${token}`,
|
265
265
|
};
|
266
266
|
try {
|
267
267
|
const response = await axios_1.default.get(url, { headers });
|
268
|
-
const ai_tutorial_generation = (0, exports.countConsumables)(response.data,
|
268
|
+
const ai_tutorial_generation = (0, exports.countConsumables)(response.data, consumableSlug);
|
269
269
|
return { ai_tutorial_generation };
|
270
270
|
}
|
271
271
|
catch (error) {
|
package/oclif.manifest.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":"5.0.
|
1
|
+
{"version":"5.0.18","commands":{"audit":{"id":"audit","description":"learnpack audit is the command in charge of creating an auditory of the repository\n...\nlearnpack audit checks for the following information in a repository:\n 1. The configuration object has slug, repository and description. (Error)\n 2. The command learnpack clean has been run. (Error)\n 3. If a markdown or test file doesn't have any content. (Error)\n 4. The links are accessing to valid servers. (Error)\n 5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)\n 6. The external images are working (If they are pointing to a valid server). (Error)\n 7. The exercises directory names are valid. (Error)\n 8. If an exercise doesn't have a README file. (Error)\n 9. The exercises array (Of the config file) has content. (Error)\n 10. The exercses have the same translations. (Warning)\n 11. The .gitignore file exists. (Warning)\n 12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"clean":{"id":"clean","description":"Clean the configuration object\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"download":{"id":"download","description":"Describe the command here\n...\nExtra documentation goes here\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"init":{"id":"init","description":"Create a new learning package: Book, Tutorial or Exercise","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"login":{"id":"login","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"logout":{"id":"logout","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"publish":{"id":"publish","description":"Builds the project by copying necessary files and directories into a zip file","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"start":{"id":"start","description":"Runs a small server with all the exercise instructions","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"disableGrading":{"name":"disableGrading","type":"boolean","char":"D","description":"disble grading functionality","allowNo":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Watch for file changes","allowNo":false},"editor":{"name":"editor","type":"option","char":"e","description":"[preview, extension]","options":["extension","preview"]},"version":{"name":"version","type":"option","char":"v","description":"E.g: 1.0.1"},"grading":{"name":"grading","type":"option","char":"g","description":"[isolated, incremental]","options":["isolated","incremental"]},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"test":{"id":"test","description":"Test exercises","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"args":[{"name":"exerciseSlug","description":"The name of the exercise to test","required":false,"hidden":false}]},"translate":{"id":"translate","description":"List all the lessons, the user is able of select many of them to translate to the given languages","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"args":[]}}}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@learnpack/learnpack",
|
3
3
|
"description": "Seamlessly build, sell and/or take interactive & auto-graded tutorials, start learning now or build a new tutorial to your audience.",
|
4
|
-
"version": "5.0.
|
4
|
+
"version": "5.0.18",
|
5
5
|
"author": "Alejandro Sanchez @alesanchezr",
|
6
6
|
"contributors": [
|
7
7
|
{
|
package/src/commands/init.ts
CHANGED
@@ -136,13 +136,14 @@ const handleAILogic = async (tutorialDir: string, packageInfo: PackageInfo) => {
|
|
136
136
|
|
137
137
|
const rigoToken = sessionPayload.rigobot.key
|
138
138
|
|
139
|
-
const consumables = await getConsumables(
|
139
|
+
const consumables = await getConsumables(
|
140
|
+
sessionPayload.token,
|
141
|
+
"ai-generation"
|
142
|
+
)
|
140
143
|
|
141
|
-
if (consumables.
|
144
|
+
if (consumables.ai_generation === 0) {
|
142
145
|
Console.error(
|
143
|
-
"It seems you cannot generate tutorials with AI. Make sure you creator subscription is up to date here: https://4geeks.com/profile/subscriptions?
|
144
|
-
sessionPayload.token +
|
145
|
-
". If you believe there is an issue you can always contact support@4geeks.com"
|
146
|
+
"It seems you cannot generate tutorials with AI. Make sure you creator subscription is up to date here: https://4geeks.com/profile/subscriptions? . If you believe there is an issue you can always contact support@4geeks.com"
|
146
147
|
)
|
147
148
|
process.exit(1)
|
148
149
|
}
|
package/src/commands/publish.ts
CHANGED
@@ -173,7 +173,7 @@ export default class BuildCommand extends SessionCommand {
|
|
173
173
|
`Build completed: ${zipFilePath} (${archive.pointer()} total bytes)`
|
174
174
|
)
|
175
175
|
// Remove build directory after zip is created
|
176
|
-
|
176
|
+
|
177
177
|
Console.debug("Zip file saved in project root")
|
178
178
|
|
179
179
|
const formData = new FormData()
|
@@ -190,6 +190,7 @@ export default class BuildCommand extends SessionCommand {
|
|
190
190
|
console.log(res.data)
|
191
191
|
// Remove the zip file after uploading
|
192
192
|
fs.unlinkSync(zipFilePath)
|
193
|
+
this.removeDirectory(buildDir)
|
193
194
|
} catch (error) {
|
194
195
|
if (axios.isAxiosError(error)) {
|
195
196
|
if (error.response && error.response.status === 403) {
|
@@ -204,6 +205,7 @@ export default class BuildCommand extends SessionCommand {
|
|
204
205
|
}
|
205
206
|
|
206
207
|
fs.unlinkSync(zipFilePath)
|
208
|
+
this.removeDirectory(buildDir)
|
207
209
|
}
|
208
210
|
})
|
209
211
|
|
package/src/utils/api.ts
CHANGED
@@ -304,6 +304,7 @@ type TConsumableSlug =
|
|
304
304
|
| "ai-conversation-message"
|
305
305
|
| "ai-compilation"
|
306
306
|
| "ai-tutorial-generation"
|
307
|
+
| "ai-generation"
|
307
308
|
|
308
309
|
export const countConsumables = (
|
309
310
|
consumables: any,
|
@@ -319,7 +320,10 @@ export const countConsumables = (
|
|
319
320
|
return consumable ? consumable.balance.unit : 0
|
320
321
|
}
|
321
322
|
|
322
|
-
export const getConsumables = async (
|
323
|
+
export const getConsumables = async (
|
324
|
+
token: string,
|
325
|
+
consumableSlug: TConsumableSlug = "ai-generation"
|
326
|
+
): Promise<any> => {
|
323
327
|
const url = `${HOST}/v1/payments/me/service/consumable?virtual=true`
|
324
328
|
|
325
329
|
const headers = {
|
@@ -331,7 +335,7 @@ export const getConsumables = async (token: string): Promise<any> => {
|
|
331
335
|
|
332
336
|
const ai_tutorial_generation = countConsumables(
|
333
337
|
response.data,
|
334
|
-
|
338
|
+
consumableSlug
|
335
339
|
)
|
336
340
|
|
337
341
|
return { ai_tutorial_generation }
|