@learnpack/learnpack 5.0.72 → 5.0.77
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 +13 -13
- package/lib/commands/publish.js +9 -6
- package/lib/creatorDist/assets/{index-CKBeex0S.js → index-CQqD51ws.js} +3 -3
- package/lib/creatorDist/index.html +1 -1
- package/lib/utils/api.js +18 -7
- package/lib/utils/creatorUtilities.d.ts +3 -0
- package/lib/utils/creatorUtilities.js +3 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/init.ts +1 -0
- package/src/commands/publish.ts +13 -6
- package/src/creator/src/App.tsx +1 -1
- package/src/creator/src/components/Message.tsx +1 -1
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +1 -1
- package/src/creatorDist/assets/{index-CKBeex0S.js → index-CQqD51ws.js} +3 -3
- package/src/creatorDist/index.html +1 -1
- package/src/utils/api.ts +25 -7
- package/src/utils/creatorUtilities.ts +3 -0
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.77 win32-x64 node-v22.15.0
|
25
25
|
$ learnpack --help [COMMAND]
|
26
26
|
USAGE
|
27
27
|
$ learnpack COMMAND
|
@@ -80,7 +80,7 @@ DESCRIPTION
|
|
80
80
|
12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
|
81
81
|
```
|
82
82
|
|
83
|
-
_See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
83
|
+
_See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.77/src\commands\audit.ts)_
|
84
84
|
|
85
85
|
## `learnpack breakToken`
|
86
86
|
|
@@ -95,7 +95,7 @@ OPTIONS
|
|
95
95
|
-y, --yes Skip all prompts and initialize an empty project
|
96
96
|
```
|
97
97
|
|
98
|
-
_See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
98
|
+
_See code: [src\commands\breakToken.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.77/src\commands\breakToken.ts)_
|
99
99
|
|
100
100
|
## `learnpack clean`
|
101
101
|
|
@@ -110,7 +110,7 @@ DESCRIPTION
|
|
110
110
|
Extra documentation goes here
|
111
111
|
```
|
112
112
|
|
113
|
-
_See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
113
|
+
_See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.77/src\commands\clean.ts)_
|
114
114
|
|
115
115
|
## `learnpack download [PACKAGE]`
|
116
116
|
|
@@ -128,7 +128,7 @@ DESCRIPTION
|
|
128
128
|
Extra documentation goes here
|
129
129
|
```
|
130
130
|
|
131
|
-
_See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
131
|
+
_See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.77/src\commands\download.ts)_
|
132
132
|
|
133
133
|
## `learnpack help [COMMAND]`
|
134
134
|
|
@@ -160,7 +160,7 @@ OPTIONS
|
|
160
160
|
-y, --yes Skip all prompts and initialize an empty project
|
161
161
|
```
|
162
162
|
|
163
|
-
_See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
163
|
+
_See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.77/src\commands\init.ts)_
|
164
164
|
|
165
165
|
## `learnpack login [PACKAGE]`
|
166
166
|
|
@@ -178,7 +178,7 @@ DESCRIPTION
|
|
178
178
|
Extra documentation goes here
|
179
179
|
```
|
180
180
|
|
181
|
-
_See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
181
|
+
_See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.77/src\commands\login.ts)_
|
182
182
|
|
183
183
|
## `learnpack logout [PACKAGE]`
|
184
184
|
|
@@ -196,7 +196,7 @@ DESCRIPTION
|
|
196
196
|
Extra documentation goes here
|
197
197
|
```
|
198
198
|
|
199
|
-
_See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
199
|
+
_See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.77/src\commands\logout.ts)_
|
200
200
|
|
201
201
|
## `learnpack plugins`
|
202
202
|
|
@@ -328,7 +328,7 @@ OPTIONS
|
|
328
328
|
-s, --strict strict mode
|
329
329
|
```
|
330
330
|
|
331
|
-
_See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
331
|
+
_See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.77/src\commands\publish.ts)_
|
332
332
|
|
333
333
|
## `learnpack serve`
|
334
334
|
|
@@ -345,7 +345,7 @@ OPTIONS
|
|
345
345
|
-y, --yes Skip all prompts and initialize an empty project
|
346
346
|
```
|
347
347
|
|
348
|
-
_See code: [src\commands\serve.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
348
|
+
_See code: [src\commands\serve.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.77/src\commands\serve.ts)_
|
349
349
|
|
350
350
|
## `learnpack start`
|
351
351
|
|
@@ -367,7 +367,7 @@ OPTIONS
|
|
367
367
|
-y, --yes Skip all prompts and initialize an empty project
|
368
368
|
```
|
369
369
|
|
370
|
-
_See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
370
|
+
_See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.77/src\commands\start.ts)_
|
371
371
|
|
372
372
|
## `learnpack test [EXERCISESLUG]`
|
373
373
|
|
@@ -384,7 +384,7 @@ OPTIONS
|
|
384
384
|
-y, --yes Skip all prompts and initialize an empty project
|
385
385
|
```
|
386
386
|
|
387
|
-
_See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
387
|
+
_See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.77/src\commands\test.ts)_
|
388
388
|
|
389
389
|
## `learnpack translate`
|
390
390
|
|
@@ -398,7 +398,7 @@ OPTIONS
|
|
398
398
|
-y, --yes Skip all prompts and initialize an empty project
|
399
399
|
```
|
400
400
|
|
401
|
-
_See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.
|
401
|
+
_See code: [src\commands\translate.ts](https://github.com/learnpack/learnpack-cli/blob/v5.0.77/src\commands\translate.ts)_
|
402
402
|
<!-- commandsstop -->
|
403
403
|
|
404
404
|
> > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
|
package/lib/commands/publish.js
CHANGED
@@ -132,7 +132,7 @@ class BuildCommand extends SessionCommand_1.default {
|
|
132
132
|
await api_1.default.validateToken(sessionPayload.token) :
|
133
133
|
false;
|
134
134
|
if (!sessionExists || !isValidBreathecodeToken || !isValidToken) {
|
135
|
-
console_1.default.info("Almost there! First you need to login with 4Geeks.com to use AI Generation tool for creators. You can create a new account here: https://4geeks.com/
|
135
|
+
console_1.default.info("Almost there! First you need to login with 4Geeks.com to use AI Generation tool for creators. You can create a new account here: https://4geeks.com/checkout?plan=4geeks-creator");
|
136
136
|
try {
|
137
137
|
sessionPayload = await session_1.default.login();
|
138
138
|
}
|
@@ -156,9 +156,11 @@ class BuildCommand extends SessionCommand_1.default {
|
|
156
156
|
(_c = this.configManager) === null || _c === void 0 ? void 0 : _c.buildIndex();
|
157
157
|
}
|
158
158
|
const academies = await api_1.default.listUserAcademies(sessionPayload.token);
|
159
|
-
|
159
|
+
if (academies.length === 0) {
|
160
|
+
console_1.default.error("It seems you cannot publish tutorials. 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");
|
161
|
+
process.exit(1);
|
162
|
+
}
|
160
163
|
const { academy, category } = await selectAcademy(academies, sessionPayload.token);
|
161
|
-
// Read learn.json to get the slug
|
162
164
|
const learnJsonPath = path.join(process.cwd(), "learn.json");
|
163
165
|
if (!fs.existsSync(learnJsonPath)) {
|
164
166
|
this.error("learn.json not found");
|
@@ -231,9 +233,10 @@ class BuildCommand extends SessionCommand_1.default {
|
|
231
233
|
if (fs.existsSync(manifestPWA)) {
|
232
234
|
let manifestPWAContent = fs.readFileSync(manifestPWA, "utf-8");
|
233
235
|
manifestPWAContent = manifestPWAContent.replace("{{course_title}}", learnJson.title.us);
|
234
|
-
const courseShortName =
|
235
|
-
|
236
|
-
|
236
|
+
const courseShortName = { answer: "testing-tutorial" };
|
237
|
+
// const courseShortName = await generateCourseShortName(rigoToken, {
|
238
|
+
// learnJSON: JSON.stringify(learnJson),
|
239
|
+
// })
|
237
240
|
manifestPWAContent = manifestPWAContent.replace("{{course_app_name}}", courseShortName.answer);
|
238
241
|
fs.writeFileSync(buildManifestPWA, manifestPWAContent);
|
239
242
|
}
|
@@ -73861,7 +73861,7 @@ function NY() {
|
|
73861
73861
|
? ve.jsx(zT, {
|
73862
73862
|
text: "Learnpack is setting up your tutorial. It may take a moment...",
|
73863
73863
|
icon: ve.jsx("img", {
|
73864
|
-
src: "rigo-float.gif",
|
73864
|
+
src: "/rigo-float.gif",
|
73865
73865
|
alt: "rigo",
|
73866
73866
|
className: "w-20 h-20",
|
73867
73867
|
}),
|
@@ -81144,7 +81144,7 @@ const dte = (i, e) =>
|
|
81144
81144
|
r
|
81145
81145
|
? ve.jsx(yte, {
|
81146
81146
|
text: "Thinking...",
|
81147
|
-
svg: ve.jsx("img", { src: "rigo-float.gif" }),
|
81147
|
+
svg: ve.jsx("img", { src: "/rigo-float.gif" }),
|
81148
81148
|
})
|
81149
81149
|
: ve.jsxs("div", {
|
81150
81150
|
className: `flex items-start space-x-2 p-3 rounded-md border ${
|
@@ -81539,7 +81539,7 @@ USER: ${x}`,
|
|
81539
81539
|
? ve.jsx(zT, {
|
81540
81540
|
listeningTo: "course-generation",
|
81541
81541
|
icon: ve.jsx("img", {
|
81542
|
-
src: "rigo-float.gif",
|
81542
|
+
src: "/rigo-float.gif",
|
81543
81543
|
alt: "rigo",
|
81544
81544
|
className: "w-20 h-20",
|
81545
81545
|
}),
|
@@ -10,7 +10,7 @@
|
|
10
10
|
/>
|
11
11
|
|
12
12
|
<title>Learnpack Creator: Craft tutorials in seconds!</title>
|
13
|
-
<script type="module" crossorigin src="/creator/assets/index-
|
13
|
+
<script type="module" crossorigin src="/creator/assets/index-CQqD51ws.js"></script>
|
14
14
|
<link rel="stylesheet" crossorigin href="/creator/assets/index-BJ2JJzVC.css">
|
15
15
|
</head>
|
16
16
|
<body>
|
package/lib/utils/api.js
CHANGED
@@ -7,7 +7,8 @@ const cli_ux_1 = require("cli-ux");
|
|
7
7
|
const axios_1 = require("axios");
|
8
8
|
const HOST = "https://breathecode.herokuapp.com";
|
9
9
|
exports.RIGOBOT_HOST = "https://rigobot.herokuapp.com";
|
10
|
-
// const RIGOBOT_HOST =
|
10
|
+
// export const RIGOBOT_HOST =
|
11
|
+
// "https://8000-charlytoc-rigobot-bmwdeam7cev.ws-us118.gitpod.io"
|
11
12
|
// eslint-disable-next-line
|
12
13
|
const _fetch = require("node-fetch");
|
13
14
|
const fetch = async (url, options = {}, returnAsJson = true) => {
|
@@ -280,6 +281,12 @@ const with_crud_asset_roles = new Set([
|
|
280
281
|
"admin",
|
281
282
|
"student",
|
282
283
|
]);
|
284
|
+
const neededPermissions = [
|
285
|
+
"add_asset",
|
286
|
+
"change_asset",
|
287
|
+
"view_asset",
|
288
|
+
"delete_asset",
|
289
|
+
];
|
283
290
|
const listUserAcademies = async (breathecodeToken) => {
|
284
291
|
const url = "https://breathecode.herokuapp.com/v1/auth/user/me";
|
285
292
|
try {
|
@@ -291,14 +298,18 @@ const listUserAcademies = async (breathecodeToken) => {
|
|
291
298
|
const data = response.data;
|
292
299
|
const academiesMap = new Map();
|
293
300
|
for (const role of data.roles) {
|
294
|
-
|
295
|
-
if (
|
296
|
-
|
297
|
-
if (!academiesMap.has(academy.id)) {
|
298
|
-
academiesMap.set(academy.id, academy);
|
299
|
-
}
|
301
|
+
const academy = role.academy;
|
302
|
+
if (!academiesMap.has(academy.id)) {
|
303
|
+
academiesMap.set(academy.id, academy);
|
300
304
|
}
|
301
305
|
}
|
306
|
+
const permissions = new Set(data.permissions.map((p) => p.codename));
|
307
|
+
// Validate if the user has ALL the needed permissions
|
308
|
+
const hasAllPermissions = neededPermissions.every(permission => permissions.has(permission));
|
309
|
+
if (!hasAllPermissions) {
|
310
|
+
// The user does not have all the needed permissions
|
311
|
+
return [];
|
312
|
+
}
|
302
313
|
return [...academiesMap.values()];
|
303
314
|
}
|
304
315
|
catch (error) {
|
@@ -47,6 +47,9 @@ export declare const makePackageInfo: (choices: any) => {
|
|
47
47
|
us: any;
|
48
48
|
};
|
49
49
|
slug: any;
|
50
|
+
telemetry: {
|
51
|
+
batch: string;
|
52
|
+
};
|
50
53
|
};
|
51
54
|
export declare function estimateDuration(listOfSteps: string[]): number;
|
52
55
|
export declare function createFileOnDesktop(fileName: string, content: string): Promise<void>;
|
package/oclif.manifest.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":"5.0.
|
1
|
+
{"version":"5.0.77","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":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false}},"args":[]},"breakToken":{"id":"breakToken","description":"Break the token","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":[]},"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":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"serve":{"id":"serve","description":"Runs a small server to build tutorials","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"},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","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.77",
|
5
5
|
"author": "Alejandro Sanchez @alesanchezr",
|
6
6
|
"contributors": [
|
7
7
|
{
|
package/src/commands/init.ts
CHANGED
@@ -585,6 +585,7 @@ class InitComand extends BaseCommand {
|
|
585
585
|
path.resolve(__dirname, "../../src/utils/templates/gitignore.txt"),
|
586
586
|
path.join(tutorialDir, ".gitignore")
|
587
587
|
)
|
588
|
+
|
588
589
|
fs.writeFileSync(
|
589
590
|
path.join(tutorialDir, "learn.json"),
|
590
591
|
JSON.stringify(packageInfo, null, 2)
|
package/src/commands/publish.ts
CHANGED
@@ -207,7 +207,7 @@ class BuildCommand extends SessionCommand {
|
|
207
207
|
|
208
208
|
if (!sessionExists || !isValidBreathecodeToken || !isValidToken) {
|
209
209
|
Console.info(
|
210
|
-
"Almost there! First you need to login with 4Geeks.com to use AI Generation tool for creators. You can create a new account here: https://4geeks.com/
|
210
|
+
"Almost there! First you need to login with 4Geeks.com to use AI Generation tool for creators. You can create a new account here: https://4geeks.com/checkout?plan=4geeks-creator"
|
211
211
|
)
|
212
212
|
try {
|
213
213
|
sessionPayload = await SessionManager.login()
|
@@ -242,13 +242,19 @@ class BuildCommand extends SessionCommand {
|
|
242
242
|
}
|
243
243
|
|
244
244
|
const academies = await api.listUserAcademies(sessionPayload.token)
|
245
|
-
|
245
|
+
|
246
|
+
if (academies.length === 0) {
|
247
|
+
Console.error(
|
248
|
+
"It seems you cannot publish tutorials. 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"
|
249
|
+
)
|
250
|
+
process.exit(1)
|
251
|
+
}
|
252
|
+
|
246
253
|
const { academy, category } = await selectAcademy(
|
247
254
|
academies,
|
248
255
|
sessionPayload.token
|
249
256
|
)
|
250
257
|
|
251
|
-
// Read learn.json to get the slug
|
252
258
|
const learnJsonPath = path.join(process.cwd(), "learn.json")
|
253
259
|
if (!fs.existsSync(learnJsonPath)) {
|
254
260
|
this.error("learn.json not found")
|
@@ -344,9 +350,10 @@ class BuildCommand extends SessionCommand {
|
|
344
350
|
learnJson.title.us
|
345
351
|
)
|
346
352
|
|
347
|
-
const courseShortName =
|
348
|
-
|
349
|
-
|
353
|
+
const courseShortName = { answer: "testing-tutorial" }
|
354
|
+
// const courseShortName = await generateCourseShortName(rigoToken, {
|
355
|
+
// learnJSON: JSON.stringify(learnJson),
|
356
|
+
// })
|
350
357
|
|
351
358
|
manifestPWAContent = manifestPWAContent.replace(
|
352
359
|
"{{course_app_name}}",
|
package/src/creator/src/App.tsx
CHANGED
@@ -16,7 +16,7 @@ export const Message: React.FC<TMessage> = ({ type, content }) => {
|
|
16
16
|
|
17
17
|
console.log("user", user)
|
18
18
|
return isLoading ? (
|
19
|
-
<RigoLoader text="Thinking..." svg={<img src="rigo-float.gif" />} />
|
19
|
+
<RigoLoader text="Thinking..." svg={<img src="/rigo-float.gif" />} />
|
20
20
|
) : (
|
21
21
|
<div
|
22
22
|
className={`flex items-start space-x-2 p-3 rounded-md border ${
|
@@ -152,7 +152,7 @@ const SyllabusEditor: React.FC = () => {
|
|
152
152
|
return isGenerating ? (
|
153
153
|
<Loader
|
154
154
|
listeningTo="course-generation"
|
155
|
-
icon={<img src={"rigo-float.gif"} alt="rigo" className="w-20 h-20" />}
|
155
|
+
icon={<img src={"creator/rigo-float.gif"} alt="rigo" className="w-20 h-20" />}
|
156
156
|
initialBuffer="🚀 Starting course generation..."
|
157
157
|
text="Learnpack is setting up your tutorial.
|
158
158
|
It may take a moment..."
|
@@ -73861,7 +73861,7 @@ function NY() {
|
|
73861
73861
|
? ve.jsx(zT, {
|
73862
73862
|
text: "Learnpack is setting up your tutorial. It may take a moment...",
|
73863
73863
|
icon: ve.jsx("img", {
|
73864
|
-
src: "rigo-float.gif",
|
73864
|
+
src: "/rigo-float.gif",
|
73865
73865
|
alt: "rigo",
|
73866
73866
|
className: "w-20 h-20",
|
73867
73867
|
}),
|
@@ -81144,7 +81144,7 @@ const dte = (i, e) =>
|
|
81144
81144
|
r
|
81145
81145
|
? ve.jsx(yte, {
|
81146
81146
|
text: "Thinking...",
|
81147
|
-
svg: ve.jsx("img", { src: "rigo-float.gif" }),
|
81147
|
+
svg: ve.jsx("img", { src: "/rigo-float.gif" }),
|
81148
81148
|
})
|
81149
81149
|
: ve.jsxs("div", {
|
81150
81150
|
className: `flex items-start space-x-2 p-3 rounded-md border ${
|
@@ -81539,7 +81539,7 @@ USER: ${x}`,
|
|
81539
81539
|
? ve.jsx(zT, {
|
81540
81540
|
listeningTo: "course-generation",
|
81541
81541
|
icon: ve.jsx("img", {
|
81542
|
-
src: "rigo-float.gif",
|
81542
|
+
src: "/rigo-float.gif",
|
81543
81543
|
alt: "rigo",
|
81544
81544
|
className: "w-20 h-20",
|
81545
81545
|
}),
|
@@ -10,7 +10,7 @@
|
|
10
10
|
/>
|
11
11
|
|
12
12
|
<title>Learnpack Creator: Craft tutorials in seconds!</title>
|
13
|
-
<script type="module" crossorigin src="/creator/assets/index-
|
13
|
+
<script type="module" crossorigin src="/creator/assets/index-CQqD51ws.js"></script>
|
14
14
|
<link rel="stylesheet" crossorigin href="/creator/assets/index-BJ2JJzVC.css">
|
15
15
|
</head>
|
16
16
|
<body>
|
package/src/utils/api.ts
CHANGED
@@ -4,7 +4,8 @@ import cli from "cli-ux"
|
|
4
4
|
import axios from "axios"
|
5
5
|
const HOST = "https://breathecode.herokuapp.com"
|
6
6
|
export const RIGOBOT_HOST = "https://rigobot.herokuapp.com"
|
7
|
-
// const RIGOBOT_HOST =
|
7
|
+
// export const RIGOBOT_HOST =
|
8
|
+
// "https://8000-charlytoc-rigobot-bmwdeam7cev.ws-us118.gitpod.io"
|
8
9
|
|
9
10
|
// eslint-disable-next-line
|
10
11
|
const _fetch = require("node-fetch")
|
@@ -358,6 +359,13 @@ const with_crud_asset_roles = new Set([
|
|
358
359
|
"student",
|
359
360
|
])
|
360
361
|
|
362
|
+
const neededPermissions = [
|
363
|
+
"add_asset",
|
364
|
+
"change_asset",
|
365
|
+
"view_asset",
|
366
|
+
"delete_asset",
|
367
|
+
]
|
368
|
+
|
361
369
|
export const listUserAcademies = async (
|
362
370
|
breathecodeToken: string
|
363
371
|
): Promise<TAcademy[]> => {
|
@@ -375,15 +383,25 @@ export const listUserAcademies = async (
|
|
375
383
|
const academiesMap = new Map<number, TAcademy>()
|
376
384
|
|
377
385
|
for (const role of data.roles) {
|
378
|
-
|
379
|
-
if (
|
380
|
-
|
381
|
-
if (!academiesMap.has(academy.id)) {
|
382
|
-
academiesMap.set(academy.id, academy)
|
383
|
-
}
|
386
|
+
const academy = role.academy
|
387
|
+
if (!academiesMap.has(academy.id)) {
|
388
|
+
academiesMap.set(academy.id, academy)
|
384
389
|
}
|
385
390
|
}
|
386
391
|
|
392
|
+
const permissions = new Set(data.permissions.map((p: any) => p.codename))
|
393
|
+
|
394
|
+
// Validate if the user has ALL the needed permissions
|
395
|
+
const hasAllPermissions = neededPermissions.every(permission =>
|
396
|
+
permissions.has(permission)
|
397
|
+
)
|
398
|
+
|
399
|
+
if (!hasAllPermissions) {
|
400
|
+
// The user does not have all the needed permissions
|
401
|
+
|
402
|
+
return []
|
403
|
+
}
|
404
|
+
|
387
405
|
return [...academiesMap.values()]
|
388
406
|
} catch (error) {
|
389
407
|
console.error("Failed to fetch user academies:", error)
|
@@ -185,6 +185,9 @@ export const makePackageInfo = (choices: any) => {
|
|
185
185
|
.toLowerCase()
|
186
186
|
.replace(/ /g, "-")
|
187
187
|
.replace(/[^\w-]+/g, ""),
|
188
|
+
telemetry: {
|
189
|
+
batch: "https://breathecode.herokuapp.com/v1/assignment/me/telemetry",
|
190
|
+
},
|
188
191
|
}
|
189
192
|
return packageInfo
|
190
193
|
}
|