@learnpack/learnpack 1.0.0
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 +695 -0
- package/bin/run +5 -0
- package/bin/run.cmd +3 -0
- package/oclif.manifest.json +1 -0
- package/package.json +111 -0
- package/plugin/command/compile.js +17 -0
- package/plugin/command/test.js +29 -0
- package/plugin/index.js +6 -0
- package/plugin/plugin.js +71 -0
- package/plugin/utils.js +78 -0
- package/src/commands/audit.js +243 -0
- package/src/commands/clean.js +27 -0
- package/src/commands/download.js +52 -0
- package/src/commands/hello.js +20 -0
- package/src/commands/init.js +133 -0
- package/src/commands/login.js +45 -0
- package/src/commands/logout.js +39 -0
- package/src/commands/publish.js +78 -0
- package/src/commands/start.js +169 -0
- package/src/commands/test.js +85 -0
- package/src/index.js +1 -0
- package/src/managers/config/allowed_files.js +12 -0
- package/src/managers/config/defaults.js +32 -0
- package/src/managers/config/exercise.js +212 -0
- package/src/managers/config/index.js +342 -0
- package/src/managers/file.js +137 -0
- package/src/managers/server/index.js +62 -0
- package/src/managers/server/routes.js +151 -0
- package/src/managers/session.js +83 -0
- package/src/managers/socket.js +185 -0
- package/src/managers/test.js +77 -0
- package/src/ui/download.js +48 -0
- package/src/utils/BaseCommand.js +34 -0
- package/src/utils/SessionCommand.js +46 -0
- package/src/utils/api.js +164 -0
- package/src/utils/audit.js +114 -0
- package/src/utils/console.js +16 -0
- package/src/utils/errors.js +90 -0
- package/src/utils/exercisesQueue.js +45 -0
- package/src/utils/fileQueue.js +194 -0
- package/src/utils/misc.js +26 -0
- package/src/utils/templates/gitignore.txt +20 -0
- package/src/utils/templates/incremental/.learn/exercises/01-hello-world/README.es.md +26 -0
- package/src/utils/templates/incremental/.learn/exercises/01-hello-world/README.md +25 -0
- package/src/utils/templates/incremental/README.ejs +5 -0
- package/src/utils/templates/incremental/README.es.ejs +5 -0
- package/src/utils/templates/isolated/01-hello-world/README.es.md +27 -0
- package/src/utils/templates/isolated/01-hello-world/README.md +27 -0
- package/src/utils/templates/isolated/README.ejs +5 -0
- package/src/utils/templates/isolated/README.es.ejs +5 -0
- package/src/utils/templates/no-grading/README.ejs +5 -0
- package/src/utils/templates/no-grading/README.es.ejs +5 -0
- package/src/utils/validators.js +15 -0
- package/src/utils/watcher.js +24 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
# `01` Hello World
|
2
|
+
|
3
|
+
You can have just a README file and it will be like a page in a book, no code files.
|
4
|
+
|
5
|
+
You can also add a `README.[lang].md` file for translations, for example: `README.es.md` for spanish.
|
6
|
+
|
7
|
+
## Video compatibility
|
8
|
+
|
9
|
+
If you want to include some video introduction for each exercise, add a `intro` property in the markdown frontmatter of the README.md for that particular exercise:
|
10
|
+
|
11
|
+
```markdown
|
12
|
+
---
|
13
|
+
intro: "https://www.youtube.com/watch?v=YkgkThdzX-8"
|
14
|
+
---
|
15
|
+
```
|
16
|
+
|
17
|
+
You can also add a video solution for each exercise by adding a `tutorial` property on the markdown frontmatter of it's README.md:
|
18
|
+
|
19
|
+
|
20
|
+
```markdown
|
21
|
+
---
|
22
|
+
intro: "https://www.youtube.com/watch?v=YkgkThdzX-8"
|
23
|
+
tutorial: "https://www.youtube.com/watch?v=YkgkThdzX-8"
|
24
|
+
---
|
25
|
+
```
|
@@ -0,0 +1,5 @@
|
|
1
|
+
# Welcome to <%= it.title %>
|
2
|
+
|
3
|
+
You have initialized the exercises with grading=`incremental`; meaning that your students will complete one single tutorial with clear and autograded steps from beginning to end.
|
4
|
+
|
5
|
+
Type `$ learnpack start` in your terminal to start the exercises.
|
@@ -0,0 +1,5 @@
|
|
1
|
+
# Bienvenido a <%= it.title %>
|
2
|
+
|
3
|
+
Has inicializado los ejercicios con grading=`incremental`; esto signigica que tus estudiantes completarán un solo tutorial con pasos claros e incrementales, desde el comienzo hasta el final.
|
4
|
+
|
5
|
+
Ejecuta `$ learnpack start` en la terminal para comenzar con los ejercicios.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# `01` Primer Ejercicio
|
2
|
+
|
3
|
+
Hemos creado este primer ejercicio como ejemplo. Lo puedes ubicar en la carpeta `./01-hello-world`.
|
4
|
+
|
5
|
+
1. Cada ejercicio debe estar ubicado en carpetas separadas y debe tener un archivo README.md con las instrucciones del ejercicio escrito en markdown.
|
6
|
+
2. Puedes tener un archivo README el cual será como una página de un libro, sin archivos de código.
|
7
|
+
3. También puedes agregar un archivo `README.[lenguaje].md` para traducciones, por ejemplo `README.es.md` para español.
|
8
|
+
|
9
|
+
## Inserta videos
|
10
|
+
|
11
|
+
Si quieres incluir algún video introductorio para cada ejercicio, agrega la propiedad `intro` en el inicio del README.md para ese ejercicio en particular:
|
12
|
+
|
13
|
+
```markdown
|
14
|
+
---
|
15
|
+
intro: "https://www.youtube.com/watch?v=YkgkThdzX-8"
|
16
|
+
---
|
17
|
+
```
|
18
|
+
|
19
|
+
Tambien puedes agregar un video explicando la solución para cada ejercicio agregando la propiedad `tutorial` al inicio del markdown del README.md correspondiente:
|
20
|
+
|
21
|
+
|
22
|
+
```markdown
|
23
|
+
---
|
24
|
+
intro: "https://www.youtube.com/watch?v=YkgkThdzX-8"
|
25
|
+
tutorial: "https://www.youtube.com/watch?v=YkgkThdzX-8"
|
26
|
+
---
|
27
|
+
```
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# `01` First Exercise
|
2
|
+
|
3
|
+
We created this first exercise as an example, you can find it located in the folder `./01-hello-world`.
|
4
|
+
|
5
|
+
1. Every exercise must be located on a separate folder and it must have a README.md file inside with the exercise instructions written in markdown.
|
6
|
+
2. You can have just a README file and it will be like a page in a book, no code files.
|
7
|
+
3. You can also add a `README.[lang].md` file for translations, for example: `README.es.md` for spanish.
|
8
|
+
|
9
|
+
## Video compatibility
|
10
|
+
|
11
|
+
If you want to include some video introduction for each exercise, add a `intro` property in the markdown frontmatter of the README.md for that particular exercise:
|
12
|
+
|
13
|
+
```markdown
|
14
|
+
---
|
15
|
+
intro: "https://www.youtube.com/watch?v=YkgkThdzX-8"
|
16
|
+
---
|
17
|
+
```
|
18
|
+
|
19
|
+
You can also add a video solution for each exercise by adding a `tutorial` property on the markdown frontmatter of it's README.md:
|
20
|
+
|
21
|
+
|
22
|
+
```markdown
|
23
|
+
---
|
24
|
+
intro: "https://www.youtube.com/watch?v=YkgkThdzX-8"
|
25
|
+
tutorial: "https://www.youtube.com/watch?v=YkgkThdzX-8"
|
26
|
+
---
|
27
|
+
```
|
@@ -0,0 +1,5 @@
|
|
1
|
+
# Welcome to <%= it.title %>
|
2
|
+
|
3
|
+
You have initialized the exercises with grading=`isolated`, that basically means that your students will completed one exercise after the other with new files every time.
|
4
|
+
|
5
|
+
Type `$ learnpack start` in your terminal to start the exercises.
|
@@ -0,0 +1,5 @@
|
|
1
|
+
# Bienvenido a <%= it.title %>
|
2
|
+
|
3
|
+
Has inicializado los ejercicios con grading=`isolated`; lo que signigica que tus estudiantes completarán un ejercicio tras otro, en archivos nuevos cada vez.
|
4
|
+
|
5
|
+
Ejecuta `$ learnpack start` en la terminal para comenzar con los ejercicios.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
function validURL(str) {
|
3
|
+
|
4
|
+
if(!str || !str.includes("github.com")) return false;
|
5
|
+
|
6
|
+
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
|
7
|
+
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
|
8
|
+
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
|
9
|
+
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
|
10
|
+
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
|
11
|
+
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator
|
12
|
+
return !!pattern.test(str);
|
13
|
+
}
|
14
|
+
|
15
|
+
module.exports = { validURL }
|
@@ -0,0 +1,24 @@
|
|
1
|
+
const chokidar = require('chokidar');
|
2
|
+
const debounce = require('debounce');
|
3
|
+
|
4
|
+
module.exports = (path) => new Promise((resolve, reject) => {
|
5
|
+
const watcher = chokidar.watch(path, {
|
6
|
+
ignored: (_path, _stats) => {
|
7
|
+
return _stats && !_stats.isDirectory();
|
8
|
+
},
|
9
|
+
persistent: true,
|
10
|
+
depth: 1,
|
11
|
+
ignoreInitial: true
|
12
|
+
});
|
13
|
+
|
14
|
+
const onChange = (eventname, filename) =>{
|
15
|
+
resolve(eventname, filename);
|
16
|
+
}
|
17
|
+
watcher.on('all', debounce(onChange, 500, true));
|
18
|
+
// watcher.on('all', onChange);
|
19
|
+
|
20
|
+
process.on('SIGINT', function() {
|
21
|
+
watcher.close();
|
22
|
+
process.exit();
|
23
|
+
});
|
24
|
+
});
|