@learnpack/learnpack 5.0.29 → 5.0.31
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 +12 -12
- package/lib/commands/audit.js +15 -15
- package/lib/commands/init.js +39 -15
- package/lib/commands/logout.js +6 -11
- package/lib/commands/start.js +0 -3
- package/lib/commands/translate.js +2 -10
- package/lib/managers/config/index.js +102 -77
- package/lib/managers/file.js +1 -1
- package/lib/managers/server/routes.js +68 -0
- package/lib/managers/session.js +3 -0
- package/lib/models/config-manager.d.ts +2 -0
- package/lib/utils/creatorUtilities.d.ts +2 -0
- package/lib/utils/creatorUtilities.js +48 -7
- package/lib/utils/rigoActions.d.ts +1 -0
- package/lib/utils/rigoActions.js +13 -2
- package/oclif.manifest.json +1 -1
- package/package.json +3 -2
- package/src/commands/audit.ts +449 -449
- package/src/commands/breakToken.ts +36 -36
- package/src/commands/init.ts +48 -17
- package/src/commands/logout.ts +38 -43
- package/src/commands/publish.ts +312 -312
- package/src/commands/start.ts +0 -3
- package/src/commands/translate.ts +1 -20
- package/src/managers/config/index.ts +742 -715
- package/src/managers/file.ts +1 -1
- package/src/managers/server/routes.ts +103 -1
- package/src/managers/session.ts +4 -0
- package/src/models/config-manager.ts +25 -23
- package/src/utils/console.ts +24 -24
- package/src/utils/creatorUtilities.ts +66 -6
- package/src/utils/rigoActions.ts +13 -1
- package/src/utils/templates/incremental/.github/workflows/learnpack-audit.yml +29 -0
- package/src/utils/templates/isolated/.github/workflows/learnpack-audit.yml +29 -0
@@ -5,6 +5,7 @@ import * as prompts from "prompts"
|
|
5
5
|
import { translateExercise } from "../utils/rigoActions"
|
6
6
|
import SessionManager from "../managers/session"
|
7
7
|
import Console from "../utils/console"
|
8
|
+
import { saveTranslatedReadme } from "../utils/creatorUtilities"
|
8
9
|
|
9
10
|
// This function list the names of the exercise directories inside the ./exercises folder, if the exercises folder doesn't exist, it will look for the ./.learn/exercises folder
|
10
11
|
const listExercises = async () => {
|
@@ -24,11 +25,6 @@ const listExercises = async () => {
|
|
24
25
|
})
|
25
26
|
}
|
26
27
|
|
27
|
-
const cleanReadme = (readme: string) => {
|
28
|
-
// Replace <text> and </text> with nothing
|
29
|
-
return readme.replace(/<text>/g, "").replace(/<\/text>/g, "")
|
30
|
-
}
|
31
|
-
|
32
28
|
const getReadmeForExercise = async (exercise: string) => {
|
33
29
|
const readmePath = path.join(
|
34
30
|
process.cwd(),
|
@@ -39,20 +35,6 @@ const getReadmeForExercise = async (exercise: string) => {
|
|
39
35
|
return fs.readFileSync(readmePath, "utf8")
|
40
36
|
}
|
41
37
|
|
42
|
-
const saveTranslatedReadme = async (
|
43
|
-
exercise: string,
|
44
|
-
languageCode: string,
|
45
|
-
readme: string
|
46
|
-
) => {
|
47
|
-
const readmePath = path.join(
|
48
|
-
process.cwd(),
|
49
|
-
"exercises",
|
50
|
-
exercise,
|
51
|
-
`README.${languageCode}.md`
|
52
|
-
)
|
53
|
-
fs.writeFileSync(readmePath, cleanReadme(readme))
|
54
|
-
}
|
55
|
-
|
56
38
|
export default class BuildCommand extends SessionCommand {
|
57
39
|
static description =
|
58
40
|
"List all the lessons, the user is able of select many of them to translate to the given languages"
|
@@ -118,7 +100,6 @@ export default class BuildCommand extends SessionCommand {
|
|
118
100
|
text_to_translate: readme,
|
119
101
|
output_language: language,
|
120
102
|
})
|
121
|
-
console.log(response, "RESPONSE")
|
122
103
|
|
123
104
|
await saveTranslatedReadme(
|
124
105
|
exercise,
|