@learnpack/learnpack 5.0.244 → 5.0.250
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 +4 -9
- package/lib/creatorDist/assets/{index-BWHp9KF3.js → index-CZYzWk3G.js} +1094 -1100
- package/lib/creatorDist/index.html +1 -1
- package/lib/utils/api.d.ts +2 -0
- package/lib/utils/api.js +2 -2
- package/package.json +1 -1
- package/src/commands/serve.ts +5 -10
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +2 -4
- package/src/creator/src/utils/rigo.ts +3 -2
- package/src/creatorDist/assets/{index-BWHp9KF3.js → index-CZYzWk3G.js} +1094 -1100
- package/src/creatorDist/index.html +1 -1
- package/src/ui/_app/app.css +1 -1
- package/src/ui/_app/app.js +347 -347
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/api.ts +2 -3
package/lib/commands/serve.js
CHANGED
@@ -132,15 +132,9 @@ const createMultiLangAsset = async (bucket, rigoToken, bcToken, courseSlug, cour
|
|
132
132
|
const indexReadmeString = indexReadmeContent.toString();
|
133
133
|
const b64IndexReadme = Buffer.from(indexReadmeString).toString("base64");
|
134
134
|
// eslint-disable-next-line no-await-in-loop
|
135
|
-
const asset = await (0, publish_1.handleAssetCreation)({ token: bcToken, rigobotToken: rigoToken }, courseJson, lang, deployUrl, b64IndexReadme, all_translations);
|
135
|
+
const asset = await (0, publish_1.handleAssetCreation)({ token: bcToken, rigobotToken: rigoToken.trim() }, courseJson, lang, deployUrl, b64IndexReadme, all_translations);
|
136
136
|
all_translations.push(asset.slug);
|
137
137
|
}
|
138
|
-
// const languageCodes = new Set(languageCodes)
|
139
|
-
// const asset = await api.createAsset(rigoToken, {
|
140
|
-
// slug: courseSlug,
|
141
|
-
// title: courseJson.title,
|
142
|
-
// description: courseJson.description,
|
143
|
-
// })
|
144
138
|
};
|
145
139
|
async function startExerciseGeneration(bucket, rigoToken, steps, packageContext, exercise, tutorialDir, courseSlug, purposeSlug, lastLesson = "") {
|
146
140
|
const exSlug = (0, creatorUtilities_2.slugify)(exercise.id + "-" + exercise.title);
|
@@ -197,6 +191,7 @@ class ServeCommand extends SessionCommand_1.default {
|
|
197
191
|
console.log("GCP_CREDENTIALS_JSON is not set");
|
198
192
|
process.exit(1);
|
199
193
|
}
|
194
|
+
await api_1.default.updateTechnologiesPeriodically();
|
200
195
|
const credentials = JSON.parse(crendsEnv);
|
201
196
|
const bucketStorage = new storage_1.Storage({
|
202
197
|
credentials,
|
@@ -892,6 +887,7 @@ class ServeCommand extends SessionCommand_1.default {
|
|
892
887
|
app.post("/actions/publish/:slug", async (req, res) => {
|
893
888
|
try {
|
894
889
|
const { slug } = req.params;
|
890
|
+
const { currentLanguage } = req.body;
|
895
891
|
const rigoToken = req.header("x-rigo-token");
|
896
892
|
const bcToken = req.header("x-breathecode-token");
|
897
893
|
// const { academyId, categoryId } = req.body
|
@@ -901,7 +897,6 @@ class ServeCommand extends SessionCommand_1.default {
|
|
901
897
|
.json({ error: "Authentication failed, missing tokens" });
|
902
898
|
}
|
903
899
|
const { config, exercises } = await (0, configBuilder_1.buildConfig)(bucket, slug);
|
904
|
-
// const fixedSlug = fixSlugLength(slug)
|
905
900
|
const prefix = `courses/${slug}/`;
|
906
901
|
const tmpRoot = path.join(os.tmpdir(), `learnpack-${slug}`);
|
907
902
|
const buildRoot = path.join(tmpRoot, "build");
|
@@ -976,7 +971,7 @@ class ServeCommand extends SessionCommand_1.default {
|
|
976
971
|
form.append("file", fs.createReadStream(zipPath));
|
977
972
|
form.append("config", JSON.stringify(config));
|
978
973
|
const rigoRes = await axios_1.default.post(`${api_1.RIGOBOT_HOST}/v1/learnpack/upload`, form, {
|
979
|
-
headers: Object.assign(Object.assign({}, form.getHeaders()), { Authorization:
|
974
|
+
headers: Object.assign(Object.assign({}, form.getHeaders()), { Authorization: "Token " + rigoToken.trim() }),
|
980
975
|
});
|
981
976
|
await createMultiLangAsset(bucket, rigoToken, bcToken, slug, fullConfig.config, rigoRes.data.url);
|
982
977
|
rimraf.sync(tmpRoot);
|