@jpetit/toolkit 3.0.16 → 3.0.18
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/lib/cleaner.ts +1 -1
- package/lib/compilers/base.ts +3 -3
- package/lib/compilers/clojure.ts +2 -2
- package/lib/compilers/gcc.ts +2 -2
- package/lib/compilers/ghc.ts +2 -2
- package/lib/compilers/gxx.ts +5 -6
- package/lib/compilers/index.ts +1 -1
- package/lib/compilers/python3.ts +3 -3
- package/lib/compilers/run-haskell.ts +3 -3
- package/lib/compilers/run-python.ts +3 -3
- package/lib/doctor.ts +1 -1
- package/lib/generate.ts +2 -2
- package/lib/maker.ts +4 -2
- package/package.json +2 -3
- package/toolkit/ai.ts +1 -1
- package/toolkit/clean.ts +2 -2
- package/toolkit/compilers.ts +1 -1
- package/toolkit/create-jutge-ai.ts +3 -3
- package/toolkit/create-template.ts +2 -2
- package/toolkit/create-wizard.ts +1 -1
- package/toolkit/create.ts +1 -1
- package/toolkit/doctor.ts +2 -2
- package/toolkit/generate.ts +6 -6
- package/toolkit/init.ts +3 -3
- package/toolkit/make.ts +9 -6
- package/toolkit/verify.ts +1 -1
package/lib/cleaner.ts
CHANGED
package/lib/compilers/base.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import tui from '
|
|
1
|
+
import tui from '..//tui'
|
|
2
2
|
import { execa } from 'execa'
|
|
3
3
|
import { exists, rm } from 'fs/promises'
|
|
4
4
|
import { join, sep } from 'path'
|
|
5
|
-
import { readText } from '
|
|
6
|
-
import type { Handler } from '
|
|
5
|
+
import { readText } from '..//utils'
|
|
6
|
+
import type { Handler } from '..//types'
|
|
7
7
|
|
|
8
8
|
export type CompilerInfo = {
|
|
9
9
|
compiler_id: string
|
package/lib/compilers/clojure.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// TODO: all!
|
|
2
2
|
|
|
3
|
-
import { type Handler } from '
|
|
4
|
-
import { nothing } from '
|
|
3
|
+
import { type Handler } from '..//types'
|
|
4
|
+
import { nothing } from '..//utils'
|
|
5
5
|
import { Compiler } from './base'
|
|
6
6
|
|
|
7
7
|
export class Clojure_Compiler extends Compiler {
|
package/lib/compilers/gcc.ts
CHANGED
package/lib/compilers/ghc.ts
CHANGED
package/lib/compilers/gxx.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { rm, exists } from 'fs/promises'
|
|
2
|
-
import { Compiler } from './base'
|
|
3
|
-
import tui from '@/lib/tui'
|
|
4
|
-
import { join } from 'path'
|
|
5
1
|
import { execa } from 'execa'
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { exists, rm } from 'fs/promises'
|
|
3
|
+
import { join } from 'path'
|
|
4
|
+
import tui from '../tui'
|
|
5
|
+
import { type Handler } from '../types'
|
|
6
|
+
import { Compiler } from './base'
|
|
8
7
|
|
|
9
8
|
export class GXX_Compiler extends Compiler {
|
|
10
9
|
id(): string {
|
package/lib/compilers/index.ts
CHANGED
package/lib/compilers/python3.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import tui from '
|
|
1
|
+
import tui from '../tui'
|
|
2
2
|
import { execa } from 'execa'
|
|
3
3
|
import { cp, exists, rm } from 'fs/promises'
|
|
4
4
|
import { join } from 'path'
|
|
5
|
-
import { readText, writeText } from '
|
|
5
|
+
import { readText, writeText } from '../utils'
|
|
6
6
|
import { Compiler } from './base'
|
|
7
|
-
import type { Handler } from '
|
|
7
|
+
import type { Handler } from '../types'
|
|
8
8
|
|
|
9
9
|
export class Python3_Compiler extends Compiler {
|
|
10
10
|
id(): string {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import tui from '
|
|
1
|
+
import tui from '../tui'
|
|
2
2
|
import { execa } from 'execa'
|
|
3
3
|
import { cp, exists, rm } from 'fs/promises'
|
|
4
4
|
import { join } from 'path'
|
|
5
|
-
import { readText, writeText } from '
|
|
5
|
+
import { readText, writeText } from '../utils'
|
|
6
6
|
import { Compiler } from './base'
|
|
7
|
-
import type { Handler } from '
|
|
7
|
+
import type { Handler } from '../types'
|
|
8
8
|
|
|
9
9
|
export class RunHaskell_Compiler extends Compiler {
|
|
10
10
|
id(): string {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import tui from '
|
|
1
|
+
import tui from '../tui'
|
|
2
2
|
import { execa } from 'execa'
|
|
3
3
|
import { cp, exists, rm } from 'fs/promises'
|
|
4
4
|
import { join } from 'path'
|
|
5
|
-
import { readText, writeText } from '
|
|
5
|
+
import { readText, writeText } from '../utils'
|
|
6
6
|
import { Compiler } from './base'
|
|
7
|
-
import type { Handler } from '
|
|
7
|
+
import type { Handler } from '../types'
|
|
8
8
|
|
|
9
9
|
export class RunPython_Compiler extends Compiler {
|
|
10
10
|
id(): string {
|
package/lib/doctor.ts
CHANGED
package/lib/generate.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChatBot, cleanMardownCodeString, estimatePowerConsumption } from '
|
|
2
|
-
import tui from '
|
|
1
|
+
import { ChatBot, cleanMardownCodeString, estimatePowerConsumption } from './ai'
|
|
2
|
+
import tui from './tui'
|
|
3
3
|
import chalk from 'chalk'
|
|
4
4
|
import { appendFile, mkdir } from 'fs/promises'
|
|
5
5
|
import { oraPromise } from 'ora'
|
package/lib/maker.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import tui from '
|
|
2
|
-
import { filesAreEqual, fileSize, nothing, projectDir, readText, readYaml, writeText } from '
|
|
1
|
+
import tui from '../lib/tui'
|
|
2
|
+
import { filesAreEqual, fileSize, nothing, projectDir, readText, readYaml, writeText } from '../lib/utils'
|
|
3
3
|
import chalk from 'chalk'
|
|
4
4
|
import { execa } from 'execa'
|
|
5
5
|
import { cp, exists, glob, mkdir, mkdtemp, rename } from 'fs/promises'
|
|
@@ -126,6 +126,8 @@ export class Maker {
|
|
|
126
126
|
tui.yaml(this.problemYmls[language])
|
|
127
127
|
})
|
|
128
128
|
}
|
|
129
|
+
|
|
130
|
+
this.language = basename(this.directory)
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
private async loadHandler() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jpetit/toolkit",
|
|
3
3
|
"description": "Toolkit to prepare problems for Jutge.org",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.18",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -14,9 +14,8 @@
|
|
|
14
14
|
"depcheck": "bunx depcheck"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"dist",
|
|
18
|
-
"toolkit",
|
|
19
17
|
"lib",
|
|
18
|
+
"toolkit",
|
|
20
19
|
"assets"
|
|
21
20
|
],
|
|
22
21
|
"dependencies": {
|
package/toolkit/ai.ts
CHANGED
package/toolkit/clean.ts
CHANGED
package/toolkit/compilers.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAvailableCompilers, getCompilersInfo, getDefinedCompilerIds } from '
|
|
1
|
+
import { getAvailableCompilers, getCompilersInfo, getDefinedCompilerIds } from '../lib/compilers'
|
|
2
2
|
import { Command } from '@commander-js/extra-typings'
|
|
3
3
|
|
|
4
4
|
export const compilers = new Command('compilers')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { generateProblemWithJutgeAI, type ProblemData } from '
|
|
2
|
-
import { guessUserEmail, guessUserName } from '
|
|
1
|
+
import { generateProblemWithJutgeAI, type ProblemData } from '../lib/generate'
|
|
2
|
+
import { guessUserEmail, guessUserName } from '../lib/utils'
|
|
3
3
|
import { checkbox, input, select } from '@inquirer/prompts'
|
|
4
|
-
import tui from '
|
|
4
|
+
import tui from '../lib/tui'
|
|
5
5
|
import humanId from 'human-id'
|
|
6
6
|
import slug from 'slug'
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import tui from '
|
|
2
|
-
import { isDirectory, projectDir, readText } from '
|
|
1
|
+
import tui from '../lib/tui'
|
|
2
|
+
import { isDirectory, projectDir, readText } from '../lib/utils'
|
|
3
3
|
import { confirm, select, Separator } from '@inquirer/prompts'
|
|
4
4
|
import { cp, glob } from 'fs/promises'
|
|
5
5
|
import { join } from 'path'
|
package/toolkit/create-wizard.ts
CHANGED
package/toolkit/create.ts
CHANGED
package/toolkit/doctor.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as doc from '
|
|
1
|
+
import * as doc from '../lib/doctor'
|
|
2
2
|
import { Command } from '@commander-js/extra-typings'
|
|
3
|
-
import tui from '
|
|
3
|
+
import tui from '../lib/tui'
|
|
4
4
|
|
|
5
5
|
export const doctor = new Command('doctor')
|
|
6
6
|
.description('Diagnose and fix common issues with the project setup')
|
package/toolkit/generate.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import tui from '
|
|
2
|
-
import { Maker, newMaker, type MakerOptions } from '
|
|
3
|
-
import { guessUserEmail, guessUserName, nothing, readText, writeText, writeYaml } from '
|
|
1
|
+
import tui from '../lib/tui'
|
|
2
|
+
import { Maker, newMaker, type MakerOptions } from '../lib/maker'
|
|
3
|
+
import { guessUserEmail, guessUserName, nothing, readText, writeText, writeYaml } from '../lib/utils'
|
|
4
4
|
import { Command } from '@commander-js/extra-typings'
|
|
5
|
-
import { languageNames } from '
|
|
5
|
+
import { languageNames } from '../lib/data'
|
|
6
6
|
import { join } from 'path'
|
|
7
|
-
import { cleanMardownCodeString, complete } from '
|
|
8
|
-
import { getTitleFromStatement } from '
|
|
7
|
+
import { cleanMardownCodeString, complete } from '../lib/ai'
|
|
8
|
+
import { getTitleFromStatement } from '../lib/generate'
|
|
9
9
|
import { writeFile } from 'fs/promises'
|
|
10
10
|
import * as jdenticon from 'jdenticon'
|
|
11
11
|
|
package/toolkit/init.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { initializePaths, loadSettings, paths, saveSettings, settingsExist } from '
|
|
2
|
-
import tui from '
|
|
3
|
-
import { guessUserEmail, guessUserName, nothing } from '
|
|
1
|
+
import { initializePaths, loadSettings, paths, saveSettings, settingsExist } from '../lib/settings'
|
|
2
|
+
import tui from '../lib/tui'
|
|
3
|
+
import { guessUserEmail, guessUserName, nothing } from '../lib/utils'
|
|
4
4
|
import { Command } from '@commander-js/extra-typings'
|
|
5
5
|
import { confirm, input } from '@inquirer/prompts'
|
|
6
6
|
import chalk from 'chalk'
|
package/toolkit/make.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import tui from '
|
|
2
|
-
import { newMaker, type MakerOptions } from '
|
|
3
|
-
import { nothing, projectDir } from '
|
|
1
|
+
import tui from '../lib/tui'
|
|
2
|
+
import { newMaker, type MakerOptions } from '../lib/maker'
|
|
3
|
+
import { nothing, projectDir } from '../lib/utils'
|
|
4
4
|
import { Command } from '@commander-js/extra-typings'
|
|
5
|
-
import { join, resolve } from 'path'
|
|
6
|
-
import { languageNames } from '
|
|
5
|
+
import { join, normalize, resolve } from 'path'
|
|
6
|
+
import { languageNames } from '../lib/data'
|
|
7
7
|
import { exists } from 'fs/promises'
|
|
8
8
|
|
|
9
9
|
/*
|
|
@@ -13,7 +13,10 @@ import { exists } from 'fs/promises'
|
|
|
13
13
|
*/
|
|
14
14
|
async function findRealDirectories(directories: string[]): Promise<string[]> {
|
|
15
15
|
const realDirectories: string[] = []
|
|
16
|
-
for (
|
|
16
|
+
for (let dir of directories) {
|
|
17
|
+
if (dir === '.') {
|
|
18
|
+
dir = normalize(resolve(process.cwd()))
|
|
19
|
+
}
|
|
17
20
|
if (await exists(join(dir, 'handler.yml'))) {
|
|
18
21
|
realDirectories.push(dir)
|
|
19
22
|
} else {
|
package/toolkit/verify.ts
CHANGED