@learnpack/learnpack 5.0.7 → 5.0.8
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 +17 -17
- package/bin/run +17 -17
- package/bin/run.cmd +3 -3
- package/lib/commands/audit.js +30 -21
- package/lib/commands/clean.js +3 -3
- package/lib/commands/download.js +3 -3
- package/lib/commands/login.js +3 -3
- package/lib/commands/logout.js +3 -3
- package/oclif.manifest.json +1 -1
- package/package.json +152 -152
- package/src/commands/audit.ts +449 -443
- package/src/commands/clean.ts +29 -29
- package/src/commands/download.ts +61 -61
- package/src/commands/login.ts +42 -42
- package/src/commands/logout.ts +43 -43
- package/src/commands/publish.ts +249 -249
- package/src/commands/test.ts +85 -85
- package/src/index.ts +1 -1
- package/src/managers/config/allowed_files.ts +29 -29
- package/src/managers/gitpod.ts +84 -84
- package/src/managers/server/index.ts +78 -78
- package/src/managers/telemetry.ts +353 -353
- package/src/managers/test.ts +83 -83
- package/src/models/audit.ts +16 -16
- package/src/models/config-manager.ts +23 -23
- package/src/models/counter.ts +11 -11
- package/src/models/errors.ts +22 -22
- package/src/models/exercise-obj.ts +29 -29
- package/src/models/file.ts +5 -5
- package/src/models/findings.ts +18 -18
- package/src/models/flags.ts +10 -10
- package/src/models/front-matter.ts +11 -11
- package/src/models/gitpod-data.ts +19 -19
- package/src/models/language.ts +4 -4
- package/src/models/package.ts +7 -7
- package/src/models/plugin-config.ts +17 -17
- package/src/models/success-types.ts +1 -1
- package/src/plugin/command/compile.ts +17 -17
- package/src/plugin/command/test.ts +30 -30
- package/src/plugin/index.ts +6 -6
- package/src/plugin/plugin.ts +94 -94
- package/src/plugin/utils.ts +87 -87
- package/src/types/node-fetch.d.ts +1 -1
- package/src/ui/download.ts +71 -71
- package/src/utils/BaseCommand.ts +48 -48
- package/src/utils/SessionCommand.ts +43 -43
- package/src/utils/audit.ts +393 -393
- package/src/utils/errors.ts +117 -117
- package/src/utils/exercisesQueue.ts +51 -51
- package/src/utils/fileQueue.ts +199 -199
- package/src/utils/misc.ts +23 -23
- package/src/utils/osOperations.ts +79 -79
- package/src/utils/templates/gitignore.txt +19 -19
- package/src/utils/templates/incremental/.learn/exercises/01-hello-world/README.es.md +24 -24
- package/src/utils/templates/incremental/.learn/exercises/01-hello-world/README.md +24 -24
- package/src/utils/templates/incremental/.vscode/schema.json +121 -121
- package/src/utils/templates/incremental/.vscode/settings.json +13 -13
- package/src/utils/templates/incremental/README.ejs +4 -4
- package/src/utils/templates/incremental/README.es.ejs +4 -4
- package/src/utils/templates/isolated/.vscode/schema.json +121 -121
- package/src/utils/templates/isolated/.vscode/settings.json +13 -13
- package/src/utils/templates/isolated/README.ejs +4 -4
- package/src/utils/templates/isolated/README.es.ejs +4 -4
- package/src/utils/templates/no-grading/README.ejs +4 -4
- package/src/utils/templates/no-grading/README.es.ejs +4 -4
- package/src/utils/validators.ts +18 -18
- package/src/utils/watcher.ts +27 -27
package/src/commands/clean.ts
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
// import {flags} from '@oclif/command'
|
2
|
-
import Console from "../utils/console"
|
3
|
-
import SessionCommand from "../utils/SessionCommand"
|
4
|
-
|
5
|
-
class CleanCommand extends SessionCommand {
|
6
|
-
static description = `Clean the configuration object
|
7
|
-
...
|
8
|
-
Extra documentation goes here
|
9
|
-
`
|
10
|
-
|
11
|
-
static flags: any = {
|
12
|
-
// name: flags.string({char: 'n', description: 'name to print'}),
|
13
|
-
}
|
14
|
-
|
15
|
-
async init() {
|
16
|
-
const { flags } = this.parse(CleanCommand)
|
17
|
-
await this.initSession(flags)
|
18
|
-
}
|
19
|
-
|
20
|
-
async run() {
|
21
|
-
const { flags } = this.parse(CleanCommand)
|
22
|
-
|
23
|
-
this.configManager?.clean()
|
24
|
-
|
25
|
-
Console.success("Package cleaned successfully, ready to publish")
|
26
|
-
}
|
27
|
-
}
|
28
|
-
|
29
|
-
export default CleanCommand
|
1
|
+
// import {flags} from '@oclif/command'
|
2
|
+
import Console from "../utils/console"
|
3
|
+
import SessionCommand from "../utils/SessionCommand"
|
4
|
+
|
5
|
+
class CleanCommand extends SessionCommand {
|
6
|
+
static description = `Clean the configuration object
|
7
|
+
...
|
8
|
+
Extra documentation goes here
|
9
|
+
`
|
10
|
+
|
11
|
+
static flags: any = {
|
12
|
+
// name: flags.string({char: 'n', description: 'name to print'}),
|
13
|
+
}
|
14
|
+
|
15
|
+
async init() {
|
16
|
+
const { flags } = this.parse(CleanCommand)
|
17
|
+
await this.initSession(flags)
|
18
|
+
}
|
19
|
+
|
20
|
+
async run() {
|
21
|
+
const { flags } = this.parse(CleanCommand)
|
22
|
+
|
23
|
+
this.configManager?.clean()
|
24
|
+
|
25
|
+
Console.success("Package cleaned successfully, ready to publish")
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
export default CleanCommand
|
package/src/commands/download.ts
CHANGED
@@ -1,61 +1,61 @@
|
|
1
|
-
import { Command /* , flags */ } from "@oclif/command"
|
2
|
-
// import fetch from 'node-fetch'
|
3
|
-
import { clone } from "../managers/file"
|
4
|
-
import Console from "../utils/console"
|
5
|
-
import api from "../utils/api"
|
6
|
-
import { askPackage } from "../ui/download"
|
7
|
-
// const BaseCommand = require('../utils/BaseCommand');
|
8
|
-
|
9
|
-
class DownloadCommand extends Command {
|
10
|
-
static description = `Describe the command here
|
11
|
-
...
|
12
|
-
Extra documentation goes here
|
13
|
-
`
|
14
|
-
static flags: any = {
|
15
|
-
// name: flags.string({char: 'n', description: 'name to print'}),
|
16
|
-
}
|
17
|
-
|
18
|
-
static args = [
|
19
|
-
{
|
20
|
-
name: "package", // name of arg to show in help and reference with args[name]
|
21
|
-
required: false, // make the arg required with `required: true`
|
22
|
-
description:
|
23
|
-
"The unique string that identifies this package on learnpack", // help description
|
24
|
-
hidden: false, // hide this arg from help
|
25
|
-
},
|
26
|
-
]
|
27
|
-
// async init() {
|
28
|
-
// const {flags} = this.parse(DownloadCommand)
|
29
|
-
// await this.initSession(flags)
|
30
|
-
// }
|
31
|
-
|
32
|
-
async run() {
|
33
|
-
const { /* flags, */ args } = this.parse(DownloadCommand)
|
34
|
-
// start watching for file changes
|
35
|
-
let _package: string = args.package
|
36
|
-
if (!_package) {
|
37
|
-
_package = (await askPackage()) as string
|
38
|
-
}
|
39
|
-
|
40
|
-
if (!_package) {
|
41
|
-
return null
|
42
|
-
}
|
43
|
-
|
44
|
-
try {
|
45
|
-
const packageInfo = await api.getAllPackages({ slug: _package })
|
46
|
-
if (packageInfo.results.length === 0)
|
47
|
-
Console.error(`Package ${_package} not found`)
|
48
|
-
else
|
49
|
-
clone(packageInfo.results[0].repository)
|
50
|
-
.then(_result => {
|
51
|
-
Console.success("Successfully downloaded")
|
52
|
-
Console.info(
|
53
|
-
`You can now CD into the folder like this: $ cd ${_package}`
|
54
|
-
)
|
55
|
-
})
|
56
|
-
.catch(error => Console.error(error.message || error))
|
57
|
-
} catch {}
|
58
|
-
}
|
59
|
-
}
|
60
|
-
|
61
|
-
export default DownloadCommand
|
1
|
+
import { Command /* , flags */ } from "@oclif/command"
|
2
|
+
// import fetch from 'node-fetch'
|
3
|
+
import { clone } from "../managers/file"
|
4
|
+
import Console from "../utils/console"
|
5
|
+
import api from "../utils/api"
|
6
|
+
import { askPackage } from "../ui/download"
|
7
|
+
// const BaseCommand = require('../utils/BaseCommand');
|
8
|
+
|
9
|
+
class DownloadCommand extends Command {
|
10
|
+
static description = `Describe the command here
|
11
|
+
...
|
12
|
+
Extra documentation goes here
|
13
|
+
`
|
14
|
+
static flags: any = {
|
15
|
+
// name: flags.string({char: 'n', description: 'name to print'}),
|
16
|
+
}
|
17
|
+
|
18
|
+
static args = [
|
19
|
+
{
|
20
|
+
name: "package", // name of arg to show in help and reference with args[name]
|
21
|
+
required: false, // make the arg required with `required: true`
|
22
|
+
description:
|
23
|
+
"The unique string that identifies this package on learnpack", // help description
|
24
|
+
hidden: false, // hide this arg from help
|
25
|
+
},
|
26
|
+
]
|
27
|
+
// async init() {
|
28
|
+
// const {flags} = this.parse(DownloadCommand)
|
29
|
+
// await this.initSession(flags)
|
30
|
+
// }
|
31
|
+
|
32
|
+
async run() {
|
33
|
+
const { /* flags, */ args } = this.parse(DownloadCommand)
|
34
|
+
// start watching for file changes
|
35
|
+
let _package: string = args.package
|
36
|
+
if (!_package) {
|
37
|
+
_package = (await askPackage()) as string
|
38
|
+
}
|
39
|
+
|
40
|
+
if (!_package) {
|
41
|
+
return null
|
42
|
+
}
|
43
|
+
|
44
|
+
try {
|
45
|
+
const packageInfo = await api.getAllPackages({ slug: _package })
|
46
|
+
if (packageInfo.results.length === 0)
|
47
|
+
Console.error(`Package ${_package} not found`)
|
48
|
+
else
|
49
|
+
clone(packageInfo.results[0].repository)
|
50
|
+
.then(_result => {
|
51
|
+
Console.success("Successfully downloaded")
|
52
|
+
Console.info(
|
53
|
+
`You can now CD into the folder like this: $ cd ${_package}`
|
54
|
+
)
|
55
|
+
})
|
56
|
+
.catch(error => Console.error(error.message || error))
|
57
|
+
} catch {}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
export default DownloadCommand
|
package/src/commands/login.ts
CHANGED
@@ -1,42 +1,42 @@
|
|
1
|
-
import SessionCommand from "../utils/SessionCommand"
|
2
|
-
import SessionManager from "../managers/session"
|
3
|
-
import Console from "../utils/console"
|
4
|
-
|
5
|
-
class LoginCommand extends SessionCommand {
|
6
|
-
static description = `Describe the command here
|
7
|
-
...
|
8
|
-
Extra documentation goes here
|
9
|
-
`
|
10
|
-
|
11
|
-
static flags: any = {
|
12
|
-
// name: flags.string({char: 'n', description: 'name to print'}),
|
13
|
-
}
|
14
|
-
|
15
|
-
static args = [
|
16
|
-
{
|
17
|
-
name: "package", // name of arg to show in help and reference with args[name]
|
18
|
-
required: false, // make the arg required with `required: true`
|
19
|
-
description:
|
20
|
-
"The unique string that identifies this package on learnpack", // help description
|
21
|
-
hidden: false, // hide this arg from help
|
22
|
-
},
|
23
|
-
]
|
24
|
-
|
25
|
-
async init() {
|
26
|
-
const { flags } = this.parse(LoginCommand)
|
27
|
-
await this.initSession(flags)
|
28
|
-
}
|
29
|
-
|
30
|
-
async run() {
|
31
|
-
/* const {flags, args} = */ this.parse(LoginCommand)
|
32
|
-
|
33
|
-
try {
|
34
|
-
await SessionManager.login()
|
35
|
-
} catch (error) {
|
36
|
-
Console.error("Error trying to authenticate")
|
37
|
-
Console.error((error as TypeError).message || (error as string))
|
38
|
-
}
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
export default LoginCommand
|
1
|
+
import SessionCommand from "../utils/SessionCommand"
|
2
|
+
import SessionManager from "../managers/session"
|
3
|
+
import Console from "../utils/console"
|
4
|
+
|
5
|
+
class LoginCommand extends SessionCommand {
|
6
|
+
static description = `Describe the command here
|
7
|
+
...
|
8
|
+
Extra documentation goes here
|
9
|
+
`
|
10
|
+
|
11
|
+
static flags: any = {
|
12
|
+
// name: flags.string({char: 'n', description: 'name to print'}),
|
13
|
+
}
|
14
|
+
|
15
|
+
static args = [
|
16
|
+
{
|
17
|
+
name: "package", // name of arg to show in help and reference with args[name]
|
18
|
+
required: false, // make the arg required with `required: true`
|
19
|
+
description:
|
20
|
+
"The unique string that identifies this package on learnpack", // help description
|
21
|
+
hidden: false, // hide this arg from help
|
22
|
+
},
|
23
|
+
]
|
24
|
+
|
25
|
+
async init() {
|
26
|
+
const { flags } = this.parse(LoginCommand)
|
27
|
+
await this.initSession(flags)
|
28
|
+
}
|
29
|
+
|
30
|
+
async run() {
|
31
|
+
/* const {flags, args} = */ this.parse(LoginCommand)
|
32
|
+
|
33
|
+
try {
|
34
|
+
await SessionManager.login()
|
35
|
+
} catch (error) {
|
36
|
+
Console.error("Error trying to authenticate")
|
37
|
+
Console.error((error as TypeError).message || (error as string))
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
export default LoginCommand
|
package/src/commands/logout.ts
CHANGED
@@ -1,43 +1,43 @@
|
|
1
|
-
// import {Command, flags} from '@oclif/command'
|
2
|
-
// import { prompt } from "enquirer"
|
3
|
-
// import fetch from 'node-fetch'
|
4
|
-
import SessionCommand from "../utils/SessionCommand"
|
5
|
-
import SessionManager from "../managers/session"
|
6
|
-
// import Console from '../utils/console'
|
7
|
-
// import { replace } from 'node-emoji'
|
8
|
-
// import { validURL } from "../utils/validators"
|
9
|
-
// const BaseCommand from '../utils/BaseCommand');
|
10
|
-
|
11
|
-
class LogoutCommand extends SessionCommand {
|
12
|
-
static description = `Describe the command here
|
13
|
-
...
|
14
|
-
Extra documentation goes here
|
15
|
-
`
|
16
|
-
|
17
|
-
static flags: any = {
|
18
|
-
// name: flags.string({char: 'n', description: 'name to print'}),
|
19
|
-
}
|
20
|
-
|
21
|
-
static args = [
|
22
|
-
{
|
23
|
-
name: "package", // name of arg to show in help and reference with args[name]
|
24
|
-
required: false, // make the arg required with `required: true`
|
25
|
-
description:
|
26
|
-
"The unique string that identifies this package on learnpack", // help description
|
27
|
-
hidden: false, // hide this arg from help
|
28
|
-
},
|
29
|
-
]
|
30
|
-
|
31
|
-
async init() {
|
32
|
-
const { flags } = this.parse(LogoutCommand)
|
33
|
-
await this.initSession(flags)
|
34
|
-
}
|
35
|
-
|
36
|
-
async run() {
|
37
|
-
// const {flags, args} = this.parse(LogoutCommand)
|
38
|
-
|
39
|
-
SessionManager.destroy()
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
export default LogoutCommand
|
1
|
+
// import {Command, flags} from '@oclif/command'
|
2
|
+
// import { prompt } from "enquirer"
|
3
|
+
// import fetch from 'node-fetch'
|
4
|
+
import SessionCommand from "../utils/SessionCommand"
|
5
|
+
import SessionManager from "../managers/session"
|
6
|
+
// import Console from '../utils/console'
|
7
|
+
// import { replace } from 'node-emoji'
|
8
|
+
// import { validURL } from "../utils/validators"
|
9
|
+
// const BaseCommand from '../utils/BaseCommand');
|
10
|
+
|
11
|
+
class LogoutCommand extends SessionCommand {
|
12
|
+
static description = `Describe the command here
|
13
|
+
...
|
14
|
+
Extra documentation goes here
|
15
|
+
`
|
16
|
+
|
17
|
+
static flags: any = {
|
18
|
+
// name: flags.string({char: 'n', description: 'name to print'}),
|
19
|
+
}
|
20
|
+
|
21
|
+
static args = [
|
22
|
+
{
|
23
|
+
name: "package", // name of arg to show in help and reference with args[name]
|
24
|
+
required: false, // make the arg required with `required: true`
|
25
|
+
description:
|
26
|
+
"The unique string that identifies this package on learnpack", // help description
|
27
|
+
hidden: false, // hide this arg from help
|
28
|
+
},
|
29
|
+
]
|
30
|
+
|
31
|
+
async init() {
|
32
|
+
const { flags } = this.parse(LogoutCommand)
|
33
|
+
await this.initSession(flags)
|
34
|
+
}
|
35
|
+
|
36
|
+
async run() {
|
37
|
+
// const {flags, args} = this.parse(LogoutCommand)
|
38
|
+
|
39
|
+
SessionManager.destroy()
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
export default LogoutCommand
|