@learnpack/learnpack 5.0.312 → 5.0.313
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/lib/commands/serve.js +25 -19
- package/package.json +1 -1
- package/src/commands/serve.ts +3195 -3179
package/lib/commands/serve.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processImage = exports.createLearnJson = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
require("newrelic");
|
|
6
5
|
const command_1 = require("@oclif/command");
|
|
7
6
|
const buffer_1 = require("buffer");
|
|
8
7
|
const express = require("express");
|
|
@@ -34,6 +33,9 @@ const sidebarGenerator_1 = require("../utils/sidebarGenerator");
|
|
|
34
33
|
const publish_1 = require("./publish");
|
|
35
34
|
const export_1 = require("../utils/export");
|
|
36
35
|
const frontMatter = require("front-matter");
|
|
36
|
+
if (process.env.NEW_RELIC_ENABLED === "true") {
|
|
37
|
+
require("newrelic");
|
|
38
|
+
}
|
|
37
39
|
dotenv.config();
|
|
38
40
|
const createLearnJson = (courseInfo) => {
|
|
39
41
|
// console.log("courseInfo to create learn json", courseInfo)
|
|
@@ -75,18 +77,18 @@ async function fetchComponentsYml() {
|
|
|
75
77
|
axios_1.default.get("https://raw.githubusercontent.com/learnpack/ide/refs/heads/master/docs/assessment_components.yml"),
|
|
76
78
|
axios_1.default.get("https://raw.githubusercontent.com/learnpack/ide/refs/heads/master/docs/explanatory_components.yml"),
|
|
77
79
|
]);
|
|
78
|
-
const combinedContent = `
|
|
79
|
-
# ASSESSMENT COMPONENTS
|
|
80
|
-
These components are designed for evaluation and knowledge assessment:
|
|
81
|
-
|
|
82
|
-
${assessmentResponse.data}
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
# EXPLANATORY COMPONENTS
|
|
87
|
-
These components are designed for explanation and learning support:
|
|
88
|
-
|
|
89
|
-
${explanatoryResponse.data}
|
|
80
|
+
const combinedContent = `
|
|
81
|
+
# ASSESSMENT COMPONENTS
|
|
82
|
+
These components are designed for evaluation and knowledge assessment:
|
|
83
|
+
|
|
84
|
+
${assessmentResponse.data}
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
# EXPLANATORY COMPONENTS
|
|
89
|
+
These components are designed for explanation and learning support:
|
|
90
|
+
|
|
91
|
+
${explanatoryResponse.data}
|
|
90
92
|
`;
|
|
91
93
|
return combinedContent;
|
|
92
94
|
}
|
|
@@ -120,10 +122,10 @@ const createInitialSidebar = async (slugs, initialLanguage = "en") => {
|
|
|
120
122
|
return sidebar;
|
|
121
123
|
};
|
|
122
124
|
const uploadInitialReadme = async (bucket, exSlug, targetDir, packageContext) => {
|
|
123
|
-
const isGeneratingText = `
|
|
124
|
-
\`\`\`loader slug="${exSlug}"
|
|
125
|
-
:rigo
|
|
126
|
-
\`\`\`
|
|
125
|
+
const isGeneratingText = `
|
|
126
|
+
\`\`\`loader slug="${exSlug}"
|
|
127
|
+
:rigo
|
|
128
|
+
\`\`\`
|
|
127
129
|
`;
|
|
128
130
|
const readmeFilename = `README${(0, creatorUtilities_1.getReadmeExtension)(packageContext.language || "en")}`;
|
|
129
131
|
await uploadFileToBucket(bucket, isGeneratingText, `${targetDir}/${readmeFilename}`);
|
|
@@ -1844,7 +1846,9 @@ class ServeCommand extends SessionCommand_1.default {
|
|
|
1844
1846
|
}
|
|
1845
1847
|
catch (error) {
|
|
1846
1848
|
console.error("❌ /actions/fetch error:", error.message || error);
|
|
1847
|
-
res
|
|
1849
|
+
res
|
|
1850
|
+
.status(500)
|
|
1851
|
+
.json({ error: error.message || "Failed to fetch link" });
|
|
1848
1852
|
}
|
|
1849
1853
|
});
|
|
1850
1854
|
app.delete("/packages/:slug", async (req, res) => {
|
|
@@ -2118,7 +2122,9 @@ class ServeCommand extends SessionCommand_1.default {
|
|
|
2118
2122
|
}
|
|
2119
2123
|
catch (error) {
|
|
2120
2124
|
console.error("Export error:", error);
|
|
2121
|
-
res
|
|
2125
|
+
res
|
|
2126
|
+
.status(500)
|
|
2127
|
+
.json({ error: "Export failed", details: error.message });
|
|
2122
2128
|
}
|
|
2123
2129
|
});
|
|
2124
2130
|
server.listen(PORT, () => {
|
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.313",
|
|
5
5
|
"author": "Alejandro Sanchez @alesanchezr",
|
|
6
6
|
"contributors": [
|
|
7
7
|
{
|