@jutge.org/toolkit 4.2.10 → 4.2.12
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 +37 -4
- package/assets/latex/root-text-short.tpl.tex +2 -1
- package/assets/problems/demo/demo.pbm/problem.en.tex +1 -1
- package/dist/index.js +583 -562
- package/docs/problem-anatomy.md +5 -1
- package/package.json +4 -2
- package/toolkit/index.ts +7 -3
- package/toolkit/make.ts +5 -2
- package/toolkit/stage.ts +13 -0
- package/toolkit/upload.ts +2 -0
- /package/assets/latex/{root-text.tpl.tex → root-text-full.tpl.tex} +0 -0
package/docs/problem-anatomy.md
CHANGED
|
@@ -116,7 +116,7 @@ This optional section describes the output of the problem.
|
|
|
116
116
|
|
|
117
117
|
The `\Sample` section will contain the sample test cases. It is possible to adjust the formatting of the sample test cases: `\SampleOneCol` places input and output test cases one below the other, while `\SampleTwoCol` places them side by side.
|
|
118
118
|
|
|
119
|
-
`RunPython` users should use `\SampleSession` to get their sample test cases properly formatted as interactive Python sessions using `sample.dt`. [
|
|
119
|
+
`RunPython` users should use `\SampleSession` to get their sample test cases properly formatted as interactive Python sessions using `sample.dt`. The `sample.dt` file should contain the sample test cases using the [doctest](https://docs.python.org/3/library/doctest.html) format and currently must be generated by hand.
|
|
120
120
|
|
|
121
121
|
The title inside the `\Problem{}` macro should match the title in the metadata given in the `problem.lang.yml` file, but the title in the LaTeX file can contain math or LaTeX macros whereas the title in the YAML file should be plain text.
|
|
122
122
|
|
|
@@ -386,6 +386,10 @@ Python solutions should have all their executable code inside an `if __name__ ==
|
|
|
386
386
|
|
|
387
387
|
Java solutions must have their `main` function placed in a `Main` class. See https://jutge.org/documentation/compilers/JDK for some examples.
|
|
388
388
|
|
|
389
|
+
## Code templates
|
|
390
|
+
|
|
391
|
+
Some problems may provide a code template where users can fill in with their own implementation. Code templates are named `code.ext`, where `ext` is the standard extension that corresponds to the selected programming language. For instance, a problem may contain `code.cc` and `code.py` in order to provide code templates in C++ and Python3.
|
|
392
|
+
|
|
389
393
|
## Scores
|
|
390
394
|
|
|
391
395
|
In order to score submissions according to the correct test cases they pass, the file `scores.yml` must exist. `scores.yml` describes the scoring of a problem using YAML syntax. The scores are given through a list of partial scores. Each partial score contains the following fields:
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jutge.org/toolkit",
|
|
3
3
|
"description": "Toolkit to prepare problems for Jutge.org",
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.12",
|
|
5
5
|
"homepage": "https://jutge.org",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Jutge.org",
|
|
@@ -53,6 +53,8 @@
|
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@commander-js/extra-typings": "^14.0.0",
|
|
56
|
+
"@dicebear/collection": "^9.3.1",
|
|
57
|
+
"@dicebear/core": "^9.3.1",
|
|
56
58
|
"@eslint/js": "^9.39.2",
|
|
57
59
|
"@inquirer/prompts": "^8.2.0",
|
|
58
60
|
"archiver": "^7.0.1",
|
|
@@ -61,10 +63,10 @@
|
|
|
61
63
|
"chalk": "^5.6.2",
|
|
62
64
|
"cli-highlight": "^2.1.11",
|
|
63
65
|
"commander": "^14.0.2",
|
|
66
|
+
"dayjs": "^1.11.19",
|
|
64
67
|
"env-paths": "^3.0.0",
|
|
65
68
|
"eslint": "^9.39.2",
|
|
66
69
|
"execa": "^9.6.1",
|
|
67
|
-
"extract-zip": "^2.0.1",
|
|
68
70
|
"gpt-tokenizer": "^3.4.0",
|
|
69
71
|
"handlebars": "^4.7.8",
|
|
70
72
|
"image-size": "^2.0.2",
|
package/toolkit/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { upgradeCmd } from './upgrade'
|
|
|
20
20
|
import { uploadCmd } from './upload'
|
|
21
21
|
import { askCmd } from './ask'
|
|
22
22
|
import { convertCmd } from './convert'
|
|
23
|
+
import { stageCmd } from './stage'
|
|
23
24
|
|
|
24
25
|
program.name(Object.keys(packageJson.bin as Record<string, string>)[0] as string)
|
|
25
26
|
program.alias(Object.keys(packageJson.bin as Record<string, string>)[1] as string)
|
|
@@ -28,26 +29,28 @@ program.description(packageJson.description!)
|
|
|
28
29
|
program.helpCommand('help [command]', 'Display help for command') // To get the message with uppercase :-)
|
|
29
30
|
program.addHelpText('after', '\nMore documentation:\n https://github.com/jutge-org/new-jutge-toolkit/tree/main/docs')
|
|
30
31
|
|
|
31
|
-
program.addCommand(configCmd)
|
|
32
|
-
program.addCommand(cloneCmd)
|
|
33
|
-
program.addCommand(generateCmd)
|
|
34
32
|
program.addCommand(makeCmd)
|
|
35
33
|
program.addCommand(uploadCmd)
|
|
36
34
|
program.addCommand(cleanCmd)
|
|
35
|
+
program.addCommand(cloneCmd)
|
|
36
|
+
program.addCommand(generateCmd)
|
|
37
37
|
program.addCommand(verifyCmd)
|
|
38
38
|
program.addCommand(convertCmd)
|
|
39
|
+
program.addCommand(stageCmd)
|
|
39
40
|
program.addCommand(doctorCmd)
|
|
40
41
|
if (settings.developer) {
|
|
41
42
|
program.addCommand(quizCmd)
|
|
42
43
|
program.addCommand(compilersCmd)
|
|
43
44
|
program.addCommand(aiCmd)
|
|
44
45
|
}
|
|
46
|
+
program.addCommand(configCmd)
|
|
45
47
|
program.addCommand(upgradeCmd)
|
|
46
48
|
program.addCommand(aboutCmd)
|
|
47
49
|
program.addCommand(askCmd)
|
|
48
50
|
|
|
49
51
|
try {
|
|
50
52
|
await program.parseAsync()
|
|
53
|
+
process.exit(0)
|
|
51
54
|
} catch (error) {
|
|
52
55
|
console.log()
|
|
53
56
|
console.error('An error occurred:')
|
|
@@ -63,4 +66,5 @@ try {
|
|
|
63
66
|
} else {
|
|
64
67
|
console.error(error)
|
|
65
68
|
}
|
|
69
|
+
process.exit(1)
|
|
66
70
|
}
|
package/toolkit/make.ts
CHANGED
|
@@ -6,7 +6,7 @@ import tui from '../lib/tui'
|
|
|
6
6
|
import { nothing, projectDir } from '../lib/utils'
|
|
7
7
|
|
|
8
8
|
export const makeCmd = new Command('make')
|
|
9
|
-
.description('Make problem
|
|
9
|
+
.description('Make problem')
|
|
10
10
|
|
|
11
11
|
.argument('[tasks...]', 'tasks to make: all|info|exe|cor|pdf|txt|md|html', ['all'])
|
|
12
12
|
.option('-d, --directories <directories...>', 'problem directories', ['.'])
|
|
@@ -56,7 +56,10 @@ export const makeCmd = new Command('make')
|
|
|
56
56
|
await maker.makePdfStatements()
|
|
57
57
|
}
|
|
58
58
|
if (tasks.includes('txt') || tasks.includes('html') || tasks.includes('md')) {
|
|
59
|
-
await maker.
|
|
59
|
+
await maker.makeFullTextualStatements(
|
|
60
|
+
tasks.filter((t) => ['txt', 'html', 'md'].includes(t)) as Array<'txt' | 'html' | 'md'>,
|
|
61
|
+
)
|
|
62
|
+
await maker.makeShortTextualStatements(
|
|
60
63
|
tasks.filter((t) => ['txt', 'html', 'md'].includes(t)) as Array<'txt' | 'html' | 'md'>,
|
|
61
64
|
)
|
|
62
65
|
}
|
package/toolkit/stage.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@commander-js/extra-typings'
|
|
2
|
+
import { Stager } from '../lib/stager'
|
|
3
|
+
|
|
4
|
+
export const stageCmd = new Command('stage')
|
|
5
|
+
.summary('Stage problem')
|
|
6
|
+
|
|
7
|
+
.option('-d, --directory <directory>', 'problem directory', '.')
|
|
8
|
+
.option('-p, --problem_nm <problem_nm>', 'problem_nm', 'DRAFT')
|
|
9
|
+
|
|
10
|
+
.action(async ({ directory, problem_nm }) => {
|
|
11
|
+
const stager = new Stager(directory, problem_nm)
|
|
12
|
+
await stager.stage()
|
|
13
|
+
})
|
package/toolkit/upload.ts
CHANGED
|
@@ -8,6 +8,8 @@ export const uploadCmd = new Command('upload')
|
|
|
8
8
|
|
|
9
9
|
If problem.yml exists, the problem will be updated at Jutge.org using that information (which includes its problem id).
|
|
10
10
|
If problem.yml does not exist, a new problem will be created at Jutge.org and problem.yml will be generated.
|
|
11
|
+
|
|
12
|
+
Please clean the problem directory before uploading to avoid uploading unnecessary files.
|
|
11
13
|
`,
|
|
12
14
|
)
|
|
13
15
|
|
|
File without changes
|