@learnpack/learnpack 5.0.298 → 5.0.301
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/logout.js +3 -3
- package/lib/commands/serve.js +32 -13
- package/lib/creatorDist/assets/{index-D25zkBaN.js → index-DoYRptnk.js} +11875 -11992
- package/lib/creatorDist/index.html +1 -1
- package/lib/managers/config/index.js +77 -77
- package/lib/utils/creatorUtilities.js +14 -14
- package/lib/utils/templates/isolated/exercises/01-hello-world/README.es.md +26 -26
- package/lib/utils/templates/isolated/exercises/01-hello-world/README.md +26 -26
- package/lib/utils/templates/scorm/adlcp_rootv1p2.xsd +110 -110
- package/lib/utils/templates/scorm/config/index.html +209 -209
- package/lib/utils/templates/scorm/ims_xml.xsd +1 -1
- package/lib/utils/templates/scorm/imscp_rootv1p1p2.xsd +345 -345
- package/lib/utils/templates/scorm/imsmanifest.xml +38 -38
- package/lib/utils/templates/scorm/imsmd_rootv1p2p1.xsd +573 -573
- package/package.json +1 -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/logout.ts +38 -38
- package/src/commands/serve.ts +49 -27
- package/src/commands/start.ts +333 -333
- package/src/commands/translate.ts +123 -123
- package/src/creator/README.md +54 -54
- package/src/creator/package-lock.json +6621 -6621
- package/src/creator/package.json +55 -55
- package/src/creator/src/App.tsx +569 -569
- package/src/creator/src/components/FileUploader.tsx +302 -302
- package/src/creator/src/components/Icon.tsx +18 -18
- package/src/creator/src/components/LessonItem.tsx +152 -152
- package/src/creator/src/components/Login.tsx +259 -259
- package/src/creator/src/components/syllabus/ContentIndex.tsx +323 -323
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +337 -337
- package/src/creator/src/i18n.ts +28 -28
- package/src/creator/src/locales/en.json +127 -127
- package/src/creator/src/locales/es.json +127 -127
- 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/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-D25zkBaN.js → index-DoYRptnk.js} +11875 -11992
- package/src/creatorDist/index.html +1 -1
- 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/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/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 +768 -768
- package/src/ui/_app/learnpack.svg +7 -7
- package/src/ui/_app/sw.js +59 -59
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/BaseCommand.ts +56 -56
- package/src/utils/audit.ts +392 -392
- package/src/utils/checkNotInstalled.ts +267 -267
- package/src/utils/convertCreds.js +34 -34
- package/src/utils/creatorUtilities.ts +504 -504
- package/src/utils/export/README.md +178 -178
- package/src/utils/incrementVersion.js +74 -74
- package/src/utils/misc.ts +58 -58
- package/src/utils/sidebarGenerator.ts +195 -195
- 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 -110
- package/src/utils/templates/scorm/config/index.html +209 -209
- package/src/utils/templates/scorm/ims_xml.xsd +1 -1
- package/src/utils/templates/scorm/imscp_rootv1p1p2.xsd +345 -345
- package/src/utils/templates/scorm/imsmanifest.xml +38 -38
- package/src/utils/templates/scorm/imsmd_rootv1p2p1.xsd +573 -573
package/lib/commands/audit.js
CHANGED
@@ -369,21 +369,21 @@ class AuditCommand extends SessionCommand_1.default {
|
|
369
369
|
}
|
370
370
|
}
|
371
371
|
}
|
372
|
-
AuditCommand.description = `learnpack audit is the command in charge of creating an auditory of the repository
|
373
|
-
...
|
374
|
-
learnpack audit checks for the following information in a repository:
|
375
|
-
1. The configuration object has slug, repository and description. (Error)
|
376
|
-
2. The command learnpack clean has been run. (Error)
|
377
|
-
3. If a markdown or test file doesn't have any content. (Error)
|
378
|
-
4. The links are accessing to valid servers. (Error)
|
379
|
-
5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)
|
380
|
-
6. The external images are working (If they are pointing to a valid server). (Error)
|
381
|
-
7. The exercises directory names are valid. (Error)
|
382
|
-
8. If an exercise doesn't have a README file. (Error)
|
383
|
-
9. The exercises array (Of the config file) has content. (Error)
|
384
|
-
10. The exercses have the same translations. (Warning)
|
385
|
-
11. The .gitignore file exists. (Warning)
|
386
|
-
12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
|
372
|
+
AuditCommand.description = `learnpack audit is the command in charge of creating an auditory of the repository
|
373
|
+
...
|
374
|
+
learnpack audit checks for the following information in a repository:
|
375
|
+
1. The configuration object has slug, repository and description. (Error)
|
376
|
+
2. The command learnpack clean has been run. (Error)
|
377
|
+
3. If a markdown or test file doesn't have any content. (Error)
|
378
|
+
4. The links are accessing to valid servers. (Error)
|
379
|
+
5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)
|
380
|
+
6. The external images are working (If they are pointing to a valid server). (Error)
|
381
|
+
7. The exercises directory names are valid. (Error)
|
382
|
+
8. If an exercise doesn't have a README file. (Error)
|
383
|
+
9. The exercises array (Of the config file) has content. (Error)
|
384
|
+
10. The exercses have the same translations. (Warning)
|
385
|
+
11. The .gitignore file exists. (Warning)
|
386
|
+
12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
|
387
387
|
`;
|
388
388
|
AuditCommand.flags = {
|
389
389
|
strict: command_1.flags.boolean({
|
@@ -4,25 +4,25 @@ const command_1 = require("@oclif/command");
|
|
4
4
|
const BaseCommand_1 = require("../utils/BaseCommand");
|
5
5
|
const console_1 = require("../utils/console");
|
6
6
|
const creatorUtilities_1 = require("../utils/creatorUtilities");
|
7
|
-
const exampleMd = `# How to Install Node.js
|
8
|
-
|
9
|
-
Node.js lets you run JavaScript outside a web browser.
|
10
|
-
|
11
|
-
## Step 1: Download Node.js
|
12
|
-
|
13
|
-
Get the Node.js installer from the [official site](https://nodejs.org/en/download/).
|
14
|
-
|
15
|
-
## Step 2: Install Node.js
|
16
|
-
|
17
|
-
Open the installer and follow the steps to finish.
|
18
|
-
|
19
|
-
## Step 3: Verify the Installation
|
20
|
-
|
21
|
-
Open a terminal and type:
|
22
|
-
|
23
|
-
\`\`\`bash
|
24
|
-
node -v
|
25
|
-
\`\`\`
|
7
|
+
const exampleMd = `# How to Install Node.js
|
8
|
+
|
9
|
+
Node.js lets you run JavaScript outside a web browser.
|
10
|
+
|
11
|
+
## Step 1: Download Node.js
|
12
|
+
|
13
|
+
Get the Node.js installer from the [official site](https://nodejs.org/en/download/).
|
14
|
+
|
15
|
+
## Step 2: Install Node.js
|
16
|
+
|
17
|
+
Open the installer and follow the steps to finish.
|
18
|
+
|
19
|
+
## Step 3: Verify the Installation
|
20
|
+
|
21
|
+
Open a terminal and type:
|
22
|
+
|
23
|
+
\`\`\`bash
|
24
|
+
node -v
|
25
|
+
\`\`\`
|
26
26
|
`;
|
27
27
|
class BreakTokenCommand extends BaseCommand_1.default {
|
28
28
|
async run() {
|
package/lib/commands/clean.js
CHANGED
@@ -16,9 +16,9 @@ class CleanCommand extends SessionCommand_1.default {
|
|
16
16
|
console_1.default.success("Package cleaned successfully, ready to publish");
|
17
17
|
}
|
18
18
|
}
|
19
|
-
CleanCommand.description = `Clean the configuration object
|
20
|
-
...
|
21
|
-
Extra documentation goes here
|
19
|
+
CleanCommand.description = `Clean the configuration object
|
20
|
+
...
|
21
|
+
Extra documentation goes here
|
22
22
|
`;
|
23
23
|
CleanCommand.flags = {
|
24
24
|
// name: flags.string({char: 'n', description: 'name to print'}),
|
package/lib/commands/logout.js
CHANGED
@@ -14,9 +14,9 @@ class LogoutCommand extends SessionCommand_1.default {
|
|
14
14
|
session_1.default.destroy();
|
15
15
|
}
|
16
16
|
}
|
17
|
-
LogoutCommand.description = `Describe the command here
|
18
|
-
...
|
19
|
-
Extra documentation goes here
|
17
|
+
LogoutCommand.description = `Describe the command here
|
18
|
+
...
|
19
|
+
Extra documentation goes here
|
20
20
|
`;
|
21
21
|
LogoutCommand.flags = {
|
22
22
|
// name: flags.string({char: 'n', description: 'name to print'}),
|
package/lib/commands/serve.js
CHANGED
@@ -189,7 +189,7 @@ async function startExerciseGeneration(rigoToken, steps, packageContext, exercis
|
|
189
189
|
return res.id;
|
190
190
|
}
|
191
191
|
const lessonCleaner = (lesson) => {
|
192
|
-
return Object.assign(Object.assign({}, lesson), {
|
192
|
+
return Object.assign(Object.assign({}, lesson), { duration: undefined, generated: undefined, status: undefined, translations: undefined, uid: undefined, initialContent: undefined, locked: undefined });
|
193
193
|
};
|
194
194
|
async function startInitialContentGeneration(rigoToken, steps, packageContext, exercise, courseSlug, purposeSlug, lastLesson = "") {
|
195
195
|
const exSlug = (0, creatorUtilities_2.slugify)(exercise.id + "-" + exercise.title);
|
@@ -204,7 +204,6 @@ async function startInitialContentGeneration(rigoToken, steps, packageContext, e
|
|
204
204
|
const fullSyllabus = {
|
205
205
|
steps: [steps.map(lessonCleaner)],
|
206
206
|
courseInfo: cleanFormStateForSyllabus(packageContext),
|
207
|
-
purpose: purposeSlug,
|
208
207
|
};
|
209
208
|
// Add random 6-digit number to avoid cache issues
|
210
209
|
// eslint-disable-next-line no-mixed-operators
|
@@ -643,15 +642,15 @@ class ServeCommand extends SessionCommand_1.default {
|
|
643
642
|
console.log("📁 Files received:", files);
|
644
643
|
if (files && Array.isArray(files)) {
|
645
644
|
console.log("✅ Processing files for coding challenge...");
|
646
|
-
|
647
|
-
const
|
648
|
-
const
|
645
|
+
const configFile = await bucket.file(`courses/${courseSlug}/.learn/config.json`);
|
646
|
+
const [configContent] = await configFile.download();
|
647
|
+
const { exercises } = JSON.parse(configContent.toString());
|
648
|
+
const exercise = exercises[parseInt(exercisePosition)];
|
649
649
|
if (!exercise) {
|
650
650
|
console.error(`❌ Exercise not found at position ${exercisePosition}`);
|
651
651
|
return res.status(404).json({ error: "Exercise not found" });
|
652
652
|
}
|
653
|
-
const
|
654
|
-
const exerciseDir = `courses/${courseSlug}/exercises/${exSlug}`;
|
653
|
+
const exerciseDir = `courses/${courseSlug}/exercises/${exercise.slug}`;
|
655
654
|
for (const fileStr of files) {
|
656
655
|
try {
|
657
656
|
const fileObj = JSON.parse(fileStr);
|
@@ -1795,6 +1794,30 @@ class ServeCommand extends SessionCommand_1.default {
|
|
1795
1794
|
});
|
1796
1795
|
}
|
1797
1796
|
});
|
1797
|
+
app.delete("/courses/:courseSlug/exercises/:exerciseSlug/file/:filename", async (req, res) => {
|
1798
|
+
console.log("DELETE /courses/:courseSlug/exercises/:exerciseSlug/file/:filename", req.params);
|
1799
|
+
const { courseSlug, exerciseSlug, filename } = req.params;
|
1800
|
+
try {
|
1801
|
+
const filePath = `courses/${courseSlug}/exercises/${exerciseSlug}/${filename}`;
|
1802
|
+
const file = bucket.file(filePath);
|
1803
|
+
const [exists] = await file.exists();
|
1804
|
+
if (!exists) {
|
1805
|
+
return res.status(404).json({ error: "File not found" });
|
1806
|
+
}
|
1807
|
+
await file.delete();
|
1808
|
+
console.log(`✅ Deleted file: ${filePath}`);
|
1809
|
+
return res.json({
|
1810
|
+
success: true,
|
1811
|
+
message: "File deleted successfully",
|
1812
|
+
});
|
1813
|
+
}
|
1814
|
+
catch (error) {
|
1815
|
+
console.error("❌ Error deleting file:", error);
|
1816
|
+
return res.status(500).json({
|
1817
|
+
error: error.message || "Unable to delete file",
|
1818
|
+
});
|
1819
|
+
}
|
1820
|
+
});
|
1798
1821
|
const YT_REGEX = /(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]{11})/;
|
1799
1822
|
app.get("/actions/fetch/:link", async (req, res) => {
|
1800
1823
|
const { link } = req.params;
|
@@ -1830,9 +1853,7 @@ class ServeCommand extends SessionCommand_1.default {
|
|
1830
1853
|
}
|
1831
1854
|
catch (error) {
|
1832
1855
|
console.error("❌ /actions/fetch error:", error.message || error);
|
1833
|
-
res
|
1834
|
-
.status(500)
|
1835
|
-
.json({ error: error.message || "Failed to fetch link" });
|
1856
|
+
res.status(500).json({ error: error.message || "Failed to fetch link" });
|
1836
1857
|
}
|
1837
1858
|
});
|
1838
1859
|
app.delete("/packages/:slug", async (req, res) => {
|
@@ -2016,9 +2037,7 @@ class ServeCommand extends SessionCommand_1.default {
|
|
2016
2037
|
}
|
2017
2038
|
catch (error) {
|
2018
2039
|
console.error("Export error:", error);
|
2019
|
-
res
|
2020
|
-
.status(500)
|
2021
|
-
.json({ error: "Export failed", details: error.message });
|
2040
|
+
res.status(500).json({ error: "Export failed", details: error.message });
|
2022
2041
|
}
|
2023
2042
|
});
|
2024
2043
|
server.listen(PORT, () => {
|