@learnpack/learnpack 5.0.202 → 5.0.209
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/init.js +1 -0
- package/lib/commands/serve.d.ts +1 -1
- package/lib/commands/serve.js +244 -85
- package/lib/creatorDist/assets/{index-C_HbkVCg.js → index-DzQGLCWt.js} +14398 -14397
- package/lib/creatorDist/index.html +1 -1
- package/lib/models/creator.d.ts +1 -1
- package/lib/utils/creatorUtilities.js +6 -5
- package/lib/utils/rigoActions.d.ts +9 -6
- package/lib/utils/rigoActions.js +14 -10
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/init.ts +2 -2
- package/src/commands/serve.ts +460 -138
- package/src/creator/src/App.tsx +2 -3
- package/src/creator/src/components/syllabus/ContentIndex.tsx +2 -1
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +44 -23
- package/src/creator/src/locales/en.json +4 -1
- package/src/creator/src/locales/es.json +4 -1
- package/src/creator/src/utils/creatorUtils.ts +7 -5
- package/src/creatorDist/assets/{index-C_HbkVCg.js → index-DzQGLCWt.js} +14398 -14397
- package/src/creatorDist/index.html +1 -1
- package/src/models/creator.ts +2 -1
- package/src/ui/_app/app.css +1 -1
- package/src/ui/_app/app.js +315 -315
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/creatorUtilities.ts +6 -5
- package/src/utils/rigoActions.ts +25 -15
@@ -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-DzQGLCWt.js"></script>
|
14
14
|
<link rel="stylesheet" crossorigin href="/creator/assets/index-Bnq3eZ3T.css">
|
15
15
|
</head>
|
16
16
|
<body>
|
package/lib/models/creator.d.ts
CHANGED
@@ -5,6 +5,7 @@ export interface Lesson {
|
|
5
5
|
type: "READ" | "CODE" | "QUIZ";
|
6
6
|
description: string;
|
7
7
|
duration?: number;
|
8
|
+
generated?: boolean;
|
8
9
|
}
|
9
10
|
export interface ParsedLink {
|
10
11
|
name: string;
|
@@ -26,5 +27,4 @@ export type FormState = {
|
|
26
27
|
export type Syllabus = {
|
27
28
|
lessons: Lesson[];
|
28
29
|
courseInfo: FormState;
|
29
|
-
sources: ParsedLink[];
|
30
30
|
};
|
@@ -86,13 +86,14 @@ function checkReadability(markdown, wordsPerMinute = 200, maxMinutes = 1) {
|
|
86
86
|
const slugify = (text) => {
|
87
87
|
return text
|
88
88
|
.toString()
|
89
|
-
.normalize("NFD")
|
90
|
-
.replace(/[\u0300-\u036F]/g, "") //
|
89
|
+
.normalize("NFD") // Remove accents
|
90
|
+
.replace(/[\u0300-\u036F]/g, "") // Remove diacritics
|
91
91
|
.toLowerCase()
|
92
92
|
.trim()
|
93
|
-
.replace(
|
94
|
-
.replace(
|
95
|
-
.replace(/-+/g, "-")
|
93
|
+
.replace(/[^\d\s._a-z-]/g, "") // Hyphen at the end, no escape needed
|
94
|
+
.replace(/\s+/g, "-") // Replace spaces with hyphens
|
95
|
+
.replace(/-+/g, "-") // Remove duplicate hyphens
|
96
|
+
.replace(/^-+|-+$/g, ""); // Trim hyphens from start/end
|
96
97
|
};
|
97
98
|
exports.slugify = slugify;
|
98
99
|
const getExInfo = (title) => {
|
@@ -6,8 +6,9 @@ type TCreateReadmeInputs = {
|
|
6
6
|
tutorial_description: string;
|
7
7
|
include_quiz: string;
|
8
8
|
lesson_description: string;
|
9
|
+
prev_lesson: string;
|
9
10
|
};
|
10
|
-
export declare const createReadme: (token: string, inputs: TCreateReadmeInputs, purpose: string) => Promise<any>;
|
11
|
+
export declare const createReadme: (token: string, inputs: TCreateReadmeInputs, purpose: string, webhookUrl?: string) => Promise<any>;
|
11
12
|
export declare const hasCreatorPermission: (token: string) => Promise<boolean>;
|
12
13
|
type TGenerateImageParams = {
|
13
14
|
prompt: string;
|
@@ -36,13 +37,14 @@ type TCreateCodeFileInputs = {
|
|
36
37
|
};
|
37
38
|
export declare const createCodeFile: (token: string, inputs: TCreateCodeFileInputs) => Promise<any>;
|
38
39
|
type TCreateCodingReadmeInputs = {
|
39
|
-
tutorial_description: string;
|
40
|
-
list_of_exercises: string;
|
41
|
-
output_lang: string;
|
42
40
|
title: string;
|
41
|
+
output_lang: string;
|
42
|
+
prev_lesson: string;
|
43
|
+
tutorial_info: string;
|
44
|
+
list_of_exercises: string;
|
43
45
|
lesson_description: string;
|
44
46
|
};
|
45
|
-
export declare const createCodingReadme: (token: string, inputs: TCreateCodingReadmeInputs, purpose: string) => Promise<any>;
|
47
|
+
export declare const createCodingReadme: (token: string, inputs: TCreateCodingReadmeInputs, purpose: string, webhookUrl?: string) => Promise<any>;
|
46
48
|
type TReadmeCreatorInputs = {
|
47
49
|
tutorial_description: string;
|
48
50
|
list_of_exercises: string;
|
@@ -50,8 +52,9 @@ type TReadmeCreatorInputs = {
|
|
50
52
|
title: string;
|
51
53
|
lesson_description: string;
|
52
54
|
kind: string;
|
55
|
+
last_lesson: string;
|
53
56
|
};
|
54
|
-
export declare const readmeCreator: (token: string, inputs: TReadmeCreatorInputs, purpose: string) => Promise<any>;
|
57
|
+
export declare const readmeCreator: (token: string, inputs: TReadmeCreatorInputs, purpose: string, webhookUrl?: string) => Promise<any>;
|
55
58
|
export declare function createPreviewReadme(tutorialDir: string, packageInfo: PackageInfo, rigoToken: string, readmeContents: string[]): Promise<void>;
|
56
59
|
type TReduceReadmeInputs = {
|
57
60
|
lesson: string;
|
package/lib/utils/rigoActions.js
CHANGED
@@ -10,13 +10,14 @@ const console_1 = require("../utils/console");
|
|
10
10
|
const fs = require("fs");
|
11
11
|
const path = require("path");
|
12
12
|
const api_1 = require("./api");
|
13
|
-
const createReadme = async (token, inputs, purpose) => {
|
13
|
+
const createReadme = async (token, inputs, purpose, webhookUrl) => {
|
14
14
|
try {
|
15
|
-
const response = await axios_1.default.post(`${api_1.RIGOBOT_HOST}/v1/prompting/completion/
|
15
|
+
const response = await axios_1.default.post(`${api_1.RIGOBOT_HOST}/v1/prompting/completion/create-sequencial-readme/`, {
|
16
16
|
inputs,
|
17
17
|
include_purpose_objective: true,
|
18
|
-
execute_async:
|
18
|
+
execute_async: !!webhookUrl,
|
19
19
|
purpose_slug: purpose,
|
20
|
+
webhook_url: webhookUrl,
|
20
21
|
}, {
|
21
22
|
headers: {
|
22
23
|
"Content-Type": "application/json",
|
@@ -131,12 +132,13 @@ const createCodeFile = async (token, inputs) => {
|
|
131
132
|
return response.data;
|
132
133
|
};
|
133
134
|
exports.createCodeFile = createCodeFile;
|
134
|
-
const createCodingReadme = async (token, inputs, purpose) => {
|
135
|
-
const response = await axios_1.default.post(`${api_1.RIGOBOT_HOST}/v1/prompting/completion/
|
135
|
+
const createCodingReadme = async (token, inputs, purpose, webhookUrl) => {
|
136
|
+
const response = await axios_1.default.post(`${api_1.RIGOBOT_HOST}/v1/prompting/completion/create-coding-exercise/`, {
|
136
137
|
inputs,
|
137
138
|
include_purpose_objective: true,
|
138
139
|
purpose_slug: purpose,
|
139
|
-
execute_async:
|
140
|
+
execute_async: !!webhookUrl,
|
141
|
+
webhook_url: webhookUrl,
|
140
142
|
}, {
|
141
143
|
headers: {
|
142
144
|
"Content-Type": "application/json",
|
@@ -146,7 +148,7 @@ const createCodingReadme = async (token, inputs, purpose) => {
|
|
146
148
|
return response.data;
|
147
149
|
};
|
148
150
|
exports.createCodingReadme = createCodingReadme;
|
149
|
-
const readmeCreator = async (token, inputs, purpose) => {
|
151
|
+
const readmeCreator = async (token, inputs, purpose, webhookUrl) => {
|
150
152
|
if (inputs.kind === "quiz" || inputs.kind === "read") {
|
151
153
|
const createReadmeInputs = {
|
152
154
|
title: inputs.title,
|
@@ -155,17 +157,19 @@ const readmeCreator = async (token, inputs, purpose) => {
|
|
155
157
|
tutorial_description: inputs.tutorial_description,
|
156
158
|
include_quiz: inputs.kind === "quiz" ? "true" : "false",
|
157
159
|
lesson_description: inputs.lesson_description,
|
160
|
+
prev_lesson: inputs.last_lesson,
|
158
161
|
};
|
159
|
-
return (0, exports.createReadme)(token, createReadmeInputs, purpose);
|
162
|
+
return (0, exports.createReadme)(token, createReadmeInputs, purpose, webhookUrl);
|
160
163
|
}
|
161
164
|
if (inputs.kind === "code") {
|
162
165
|
return (0, exports.createCodingReadme)(token, {
|
163
166
|
title: inputs.title,
|
164
167
|
output_lang: inputs.output_lang,
|
165
168
|
list_of_exercises: inputs.list_of_exercises,
|
166
|
-
|
169
|
+
tutorial_info: inputs.tutorial_description,
|
167
170
|
lesson_description: inputs.lesson_description,
|
168
|
-
|
171
|
+
prev_lesson: inputs.last_lesson,
|
172
|
+
}, purpose, webhookUrl);
|
169
173
|
}
|
170
174
|
throw new Error("Invalid kind of lesson");
|
171
175
|
};
|
package/oclif.manifest.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":"5.0.
|
1
|
+
{"version":"5.0.209","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.209",
|
5
5
|
"author": "Alejandro Sanchez @alesanchezr",
|
6
6
|
"contributors": [
|
7
7
|
{
|
package/src/commands/init.ts
CHANGED
@@ -100,6 +100,7 @@ async function processExercise(
|
|
100
100
|
tutorial_description: packageContext,
|
101
101
|
lesson_description: description,
|
102
102
|
kind: kind.toLowerCase(),
|
103
|
+
last_lesson: "",
|
103
104
|
},
|
104
105
|
"learnpack-lesson-writer"
|
105
106
|
)
|
@@ -135,8 +136,7 @@ async function processExercise(
|
|
135
136
|
|
136
137
|
// console.log("REDUCED README START", reducedReadme, "REDUCED README END")
|
137
138
|
|
138
|
-
if (!reducedReadme)
|
139
|
-
break
|
139
|
+
if (!reducedReadme) break
|
140
140
|
|
141
141
|
readability = checkReadability(
|
142
142
|
reducedReadme.parsed.content,
|