@learnpack/learnpack 5.0.275 → 5.0.277
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 +409 -409
- package/lib/commands/audit.js +15 -15
- package/lib/commands/breakToken.js +19 -19
- package/lib/commands/clean.js +3 -3
- package/lib/commands/init.js +41 -41
- package/lib/commands/logout.js +3 -3
- package/lib/commands/publish.js +5 -10
- package/lib/commands/serve.js +55 -2
- package/lib/creatorDist/assets/index-BfLyIQVh.js +10343 -10224
- package/lib/managers/config/index.js +77 -77
- package/lib/utils/api.d.ts +1 -1
- package/lib/utils/api.js +12 -9
- package/lib/utils/creatorUtilities.js +14 -14
- package/lib/utils/export/epub.d.ts +2 -0
- package/lib/utils/export/epub.js +298 -0
- package/lib/utils/export/index.d.ts +3 -0
- package/lib/utils/export/index.js +7 -0
- package/lib/utils/export/scorm.d.ts +2 -0
- package/lib/utils/export/scorm.js +84 -0
- package/lib/utils/export/shared.d.ts +4 -0
- package/lib/utils/export/shared.js +61 -0
- package/lib/utils/export/types.d.ts +15 -0
- package/lib/utils/export/types.js +2 -0
- package/package.json +2 -1
- package/src/commands/audit.ts +487 -487
- package/src/commands/breakToken.ts +67 -67
- package/src/commands/clean.ts +30 -30
- package/src/commands/init.ts +650 -650
- package/src/commands/logout.ts +38 -38
- package/src/commands/publish.ts +20 -25
- package/src/commands/serve.ts +69 -4
- package/src/commands/start.ts +333 -333
- package/src/commands/translate.ts +123 -123
- package/src/creator/README.md +54 -54
- package/src/creator/eslint.config.js +7 -7
- package/src/creator/src/components/syllabus/ContentIndex.tsx +312 -312
- package/src/creator/src/i18n.ts +28 -28
- package/src/creator/src/index.css +217 -217
- package/src/creator/src/locales/en.json +126 -126
- package/src/creator/src/locales/es.json +126 -126
- package/src/creator/src/utils/configTypes.ts +122 -122
- package/src/creator/src/utils/constants.ts +13 -13
- package/src/creator/src/utils/creatorUtils.ts +46 -46
- package/src/creator/src/utils/eventBus.ts +2 -2
- package/src/creator/src/utils/lib.ts +468 -468
- package/src/creator/src/utils/socket.ts +61 -61
- package/src/creator/src/utils/store.ts +222 -222
- package/src/creator/src/vite-env.d.ts +1 -1
- package/src/creator/vite.config.ts +13 -13
- package/src/creatorDist/assets/index-BfLyIQVh.js +10343 -10224
- package/src/managers/config/defaults.ts +49 -49
- package/src/managers/config/exercise.ts +364 -364
- package/src/managers/config/index.ts +775 -775
- package/src/managers/file.ts +236 -236
- package/src/managers/server/routes.ts +554 -554
- package/src/managers/session.ts +182 -182
- package/src/managers/telemetry.ts +188 -188
- package/src/models/action.ts +13 -13
- package/src/models/config-manager.ts +28 -28
- package/src/models/config.ts +106 -106
- package/src/models/creator.ts +47 -47
- package/src/models/exercise-obj.ts +30 -30
- package/src/models/session.ts +39 -39
- package/src/models/socket.ts +61 -61
- package/src/models/status.ts +16 -16
- package/src/ui/_app/app.css +1 -1
- package/src/ui/_app/app.js +400 -397
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/BaseCommand.ts +56 -56
- package/src/utils/api.ts +53 -39
- package/src/utils/audit.ts +392 -392
- package/src/utils/checkNotInstalled.ts +267 -267
- package/src/utils/configBuilder.ts +82 -82
- package/src/utils/convertCreds.js +34 -34
- package/src/utils/creatorUtilities.ts +504 -504
- package/src/utils/export/README.md +178 -0
- package/src/utils/export/epub.ts +400 -0
- package/src/utils/export/index.ts +3 -0
- package/src/utils/export/scorm.ts +121 -0
- package/src/utils/export/shared.ts +61 -0
- package/src/utils/export/types.ts +17 -0
- package/src/utils/incrementVersion.js +74 -74
- package/src/utils/misc.ts +58 -58
- package/src/utils/rigoActions.ts +500 -500
- package/src/utils/sidebarGenerator.ts +195 -195
- package/src/utils/templates/epub/epub.css +133 -0
- package/src/utils/templates/isolated/exercises/01-hello-world/README.es.md +26 -26
- package/src/utils/templates/isolated/exercises/01-hello-world/README.md +26 -26
- package/src/utils/templates/scorm/adlcp_rootv1p2.xsd +110 -0
- package/src/utils/templates/scorm/config/api.js +175 -0
- package/src/utils/templates/scorm/config/index.html +210 -0
- package/src/utils/templates/scorm/ims_xml.xsd +1 -0
- package/src/utils/templates/scorm/imscp_rootv1p1p2.xsd +345 -0
- package/src/utils/templates/scorm/imsmanifest.xml +38 -0
- package/src/utils/templates/scorm/imsmd_rootv1p2p1.xsd +573 -0
package/src/ui/app.tar.gz
CHANGED
Binary file
|
package/src/utils/BaseCommand.ts
CHANGED
@@ -1,56 +1,56 @@
|
|
1
|
-
import { Command, flags } from "@oclif/command"
|
2
|
-
import Console from "./console"
|
3
|
-
import { createInterface } from "readline"
|
4
|
-
// import SessionManager from '../managers/session'
|
5
|
-
|
6
|
-
class BaseCommand extends Command {
|
7
|
-
async catch(err: any) {
|
8
|
-
Console.debug("COMMAND CATCH", err)
|
9
|
-
|
10
|
-
throw err
|
11
|
-
}
|
12
|
-
|
13
|
-
async init() {
|
14
|
-
const { flags, args } = this.parse(BaseCommand)
|
15
|
-
Console.debug("COMMAND INIT")
|
16
|
-
Console.debug("These are your flags: ", flags)
|
17
|
-
Console.debug("These are your args: ", args)
|
18
|
-
|
19
|
-
// quick fix for listening to the process termination on windows
|
20
|
-
if (process.platform === "win32") {
|
21
|
-
const rl = createInterface({
|
22
|
-
input: process.stdin,
|
23
|
-
output: process.stdout,
|
24
|
-
})
|
25
|
-
|
26
|
-
rl.on("SIGINT", function () {
|
27
|
-
// process.emit('SIGINT')
|
28
|
-
// process.emit('SIGINT')
|
29
|
-
})
|
30
|
-
}
|
31
|
-
|
32
|
-
process.on("SIGINT", function () {
|
33
|
-
Console.debug("Terminated (SIGINT)")
|
34
|
-
process.exit()
|
35
|
-
})
|
36
|
-
}
|
37
|
-
|
38
|
-
async finally() {
|
39
|
-
Console.debug("COMMAND FINALLY")
|
40
|
-
// called after run and catch regardless of whether or not the command errored
|
41
|
-
}
|
42
|
-
|
43
|
-
static flags = {
|
44
|
-
yes: flags.boolean({
|
45
|
-
char: "y",
|
46
|
-
description: "Skip all prompts and initialize an empty project",
|
47
|
-
default: false,
|
48
|
-
}),
|
49
|
-
}
|
50
|
-
|
51
|
-
async run() {
|
52
|
-
// console.log('running my command')
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
export default BaseCommand
|
1
|
+
import { Command, flags } from "@oclif/command"
|
2
|
+
import Console from "./console"
|
3
|
+
import { createInterface } from "readline"
|
4
|
+
// import SessionManager from '../managers/session'
|
5
|
+
|
6
|
+
class BaseCommand extends Command {
|
7
|
+
async catch(err: any) {
|
8
|
+
Console.debug("COMMAND CATCH", err)
|
9
|
+
|
10
|
+
throw err
|
11
|
+
}
|
12
|
+
|
13
|
+
async init() {
|
14
|
+
const { flags, args } = this.parse(BaseCommand)
|
15
|
+
Console.debug("COMMAND INIT")
|
16
|
+
Console.debug("These are your flags: ", flags)
|
17
|
+
Console.debug("These are your args: ", args)
|
18
|
+
|
19
|
+
// quick fix for listening to the process termination on windows
|
20
|
+
if (process.platform === "win32") {
|
21
|
+
const rl = createInterface({
|
22
|
+
input: process.stdin,
|
23
|
+
output: process.stdout,
|
24
|
+
})
|
25
|
+
|
26
|
+
rl.on("SIGINT", function () {
|
27
|
+
// process.emit('SIGINT')
|
28
|
+
// process.emit('SIGINT')
|
29
|
+
})
|
30
|
+
}
|
31
|
+
|
32
|
+
process.on("SIGINT", function () {
|
33
|
+
Console.debug("Terminated (SIGINT)")
|
34
|
+
process.exit()
|
35
|
+
})
|
36
|
+
}
|
37
|
+
|
38
|
+
async finally() {
|
39
|
+
Console.debug("COMMAND FINALLY")
|
40
|
+
// called after run and catch regardless of whether or not the command errored
|
41
|
+
}
|
42
|
+
|
43
|
+
static flags = {
|
44
|
+
yes: flags.boolean({
|
45
|
+
char: "y",
|
46
|
+
description: "Skip all prompts and initialize an empty project",
|
47
|
+
default: false,
|
48
|
+
}),
|
49
|
+
}
|
50
|
+
|
51
|
+
async run() {
|
52
|
+
// console.log('running my command')
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
export default BaseCommand
|
package/src/utils/api.ts
CHANGED
@@ -14,17 +14,17 @@ export const RIGOBOT_REALTIME_HOST = "https://chat.4geeks.com"
|
|
14
14
|
// "https://8000-charlytoc-rigobot-bmwdeam7cev.ws-us118.gitpod.io"
|
15
15
|
|
16
16
|
// eslint-disable-next-line
|
17
|
-
const _fetch = require("node-fetch")
|
17
|
+
const _fetch = require("node-fetch");
|
18
18
|
|
19
19
|
interface IHeaders {
|
20
|
-
"Content-Type"?: string
|
21
|
-
Authorization?: string
|
20
|
+
"Content-Type"?: string;
|
21
|
+
Authorization?: string;
|
22
22
|
}
|
23
23
|
|
24
24
|
interface IOptions {
|
25
|
-
headers?: IHeaders
|
26
|
-
method?: string
|
27
|
-
body?: string
|
25
|
+
headers?: IHeaders;
|
26
|
+
method?: string;
|
27
|
+
body?: string;
|
28
28
|
}
|
29
29
|
|
30
30
|
const fetch = async (
|
@@ -206,8 +206,8 @@ const getAllPackages = async ({
|
|
206
206
|
lang = "",
|
207
207
|
slug = "",
|
208
208
|
}: {
|
209
|
-
lang?: string
|
210
|
-
slug?: string
|
209
|
+
lang?: string;
|
210
|
+
slug?: string;
|
211
211
|
}) => {
|
212
212
|
try {
|
213
213
|
cli.action.start("Downloading packages...")
|
@@ -306,7 +306,7 @@ type TConsumableSlug =
|
|
306
306
|
| "ai-compilation"
|
307
307
|
| "ai-tutorial-generation"
|
308
308
|
| "ai-generation"
|
309
|
-
| "learnpack-publish"
|
309
|
+
| "learnpack-publish";
|
310
310
|
|
311
311
|
export const countConsumables = (
|
312
312
|
consumables: any,
|
@@ -345,10 +345,10 @@ export const getConsumable = async (
|
|
345
345
|
}
|
346
346
|
|
347
347
|
export interface TAcademy {
|
348
|
-
id: number
|
349
|
-
name: string
|
350
|
-
slug: string
|
351
|
-
timezone: string
|
348
|
+
id: number;
|
349
|
+
name: string;
|
350
|
+
slug: string;
|
351
|
+
timezone: string;
|
352
352
|
}
|
353
353
|
|
354
354
|
const neededPermissions = [
|
@@ -416,20 +416,20 @@ export const validateToken = async (token: string) => {
|
|
416
416
|
}
|
417
417
|
|
418
418
|
type TAssetMissing = {
|
419
|
-
slug: string
|
420
|
-
title: string
|
421
|
-
lang: string
|
422
|
-
url: string
|
423
|
-
description: string
|
424
|
-
learnpack_deploy_url: string
|
425
|
-
technologies: string[]
|
426
|
-
category: number
|
427
|
-
owner: number
|
428
|
-
author: number
|
429
|
-
preview: string
|
430
|
-
readme_raw: string
|
431
|
-
all_translations: string[]
|
432
|
-
}
|
419
|
+
slug: string;
|
420
|
+
title: string;
|
421
|
+
lang: string;
|
422
|
+
url: string;
|
423
|
+
description: string;
|
424
|
+
learnpack_deploy_url: string;
|
425
|
+
technologies: string[];
|
426
|
+
category: number | string;
|
427
|
+
owner: number;
|
428
|
+
author: number;
|
429
|
+
preview: string;
|
430
|
+
readme_raw: string;
|
431
|
+
all_translations: string[];
|
432
|
+
};
|
433
433
|
|
434
434
|
export const createAsset = async (token: string, asset: TAssetMissing) => {
|
435
435
|
const body = {
|
@@ -536,13 +536,20 @@ const updateRigoAssetID = async (
|
|
536
536
|
slug: string,
|
537
537
|
asset_id: number
|
538
538
|
) => {
|
539
|
+
const cleanToken = token.replace(/[\n\r]/g, "")
|
540
|
+
|
539
541
|
const url = `${RIGOBOT_HOST}/v1/learnpack/package/${slug}/`
|
540
|
-
|
541
|
-
Authorization: "Token " + token.trim(),
|
542
|
-
}
|
543
|
-
console.log("HEADERS", headers)
|
542
|
+
|
544
543
|
try {
|
545
|
-
const response = await axios.put(
|
544
|
+
const response = await axios.put(
|
545
|
+
url,
|
546
|
+
{ asset_id },
|
547
|
+
{
|
548
|
+
headers: {
|
549
|
+
Authorization: "Token " + cleanToken,
|
550
|
+
},
|
551
|
+
}
|
552
|
+
)
|
546
553
|
return response.data
|
547
554
|
} catch (error) {
|
548
555
|
console.error("Failed to update Rigo package:", error)
|
@@ -552,11 +559,18 @@ const updateRigoAssetID = async (
|
|
552
559
|
|
553
560
|
const createRigoPackage = async (token: string, slug: string, config: any) => {
|
554
561
|
const url = `${RIGOBOT_HOST}/v1/learnpack/package`
|
555
|
-
const
|
556
|
-
|
557
|
-
}
|
562
|
+
const cleanToken = token.replace(/[\n\r]/g, "")
|
563
|
+
|
558
564
|
try {
|
559
|
-
const response = await axios.post(
|
565
|
+
const response = await axios.post(
|
566
|
+
url,
|
567
|
+
{ slug, config },
|
568
|
+
{
|
569
|
+
headers: {
|
570
|
+
Authorization: "Token " + cleanToken,
|
571
|
+
},
|
572
|
+
}
|
573
|
+
)
|
560
574
|
return response.data
|
561
575
|
} catch (error) {
|
562
576
|
console.error("Failed to create Rigo package:", error)
|
@@ -565,9 +579,9 @@ const createRigoPackage = async (token: string, slug: string, config: any) => {
|
|
565
579
|
}
|
566
580
|
|
567
581
|
type TTechnology = {
|
568
|
-
slug: string
|
569
|
-
lang: string
|
570
|
-
}
|
582
|
+
slug: string;
|
583
|
+
lang: string;
|
584
|
+
};
|
571
585
|
|
572
586
|
let technologiesCache: TTechnology[] = []
|
573
587
|
|