@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.
@@ -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,