1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2025-05-13 23:22:49 +02:00

build(deps): update latest

This commit is contained in:
Théo LUDWIG 2025-05-13 23:04:47 +02:00
parent 2b6669bf4a
commit 643989cc44
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B
27 changed files with 3259 additions and 1393 deletions

View File

@ -10,7 +10,7 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{py,cs,rs,java}]
[*.{py,cs,rs,java,md}]
indent_size = 4
[*.txt]

View File

@ -21,7 +21,7 @@ jobs:
SKIP_LOGIN: true
- name: "Setup Node.js"
uses: "actions/setup-node@v4.1.0"
uses: "actions/setup-node@v4.4.0"
with:
node-version: "lts/*"
cache: "npm"

View File

@ -13,7 +13,7 @@ jobs:
- uses: "actions/checkout@v4.2.2"
- name: "Setup Node.js"
uses: "actions/setup-node@v4.1.0"
uses: "actions/setup-node@v4.4.0"
with:
node-version: "lts/*"
cache: "npm"
@ -32,7 +32,7 @@ jobs:
- uses: "actions/checkout@v4.2.2"
- name: "Setup Node.js"
uses: "actions/setup-node@v4.1.0"
uses: "actions/setup-node@v4.4.0"
with:
node-version: "lts/*"
cache: "npm"
@ -56,7 +56,7 @@ jobs:
SKIP_LOGIN: true
- name: "Setup Node.js"
uses: "actions/setup-node@v4.1.0"
uses: "actions/setup-node@v4.4.0"
with:
node-version: "lts/*"
cache: "npm"

3
.gitignore vendored
View File

@ -28,3 +28,6 @@ coverage
.DS_Store
temp
tmp
# typescript
*.tsbuildinfo

View File

@ -1,12 +0,0 @@
{
"config": {
"extends": "markdownlint/style/prettier",
"default": true,
"relative-links": true,
"no-duplicate-heading": false,
"no-inline-html": false,
},
"globs": ["**/*.md"],
"ignores": ["**/node_modules"],
"customRules": ["markdownlint-rule-relative-links"],
}

19
.markdownlint-cli2.mjs Normal file
View File

@ -0,0 +1,19 @@
import relativeLinksRule, { markdownIt } from "markdownlint-rule-relative-links"
const config = {
config: {
extends: "markdownlint/style/prettier",
default: true,
"relative-links": true,
"no-duplicate-heading": false,
"no-inline-html": false,
},
globs: ["**/*.md"],
ignores: ["**/node_modules"],
customRules: [relativeLinksRule],
markdownItFactory: () => {
return markdownIt
},
}
export default config

1
.npmrc
View File

@ -1 +0,0 @@
save-exact = true

View File

@ -20,21 +20,16 @@ community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the
overall community
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
- Publishing others' private information, such as a physical or email address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
## Enforcement Responsibilities

View File

@ -80,17 +80,20 @@ programming-challenges --help
# Generate a new challenge
programming-challenges generate challenge --github-user="YourGitHubName" --challenge="hello-world"
# Search for a challenge not yet solved in a specific programming language
programming-challenges search --language="rust"
# Generate a new solution
programming-challenges generate solution --github-user="YourGitHubName" --challenge="hello-world" --solution="function" --language="python"
# Test a solution
programming-challenges run test --challenge="hello-world" --solution="function" --language="python"
# Run a solution with specific `input.txt` file
programming-challenges run solution --challenge="hello-world" --solution="function" --language="python" --input-path="./challenges/hello-world/test/1/input.txt" --output
# Search for a challenge not yet solved in a specific programming language
programming-challenges search --language="rust"
# Test a solution
programming-challenges run test --challenge="hello-world" --solution="function" --language="python"
# Test all the solutions in all the challenges
programming-challenges run test --all
```
## 💡 Contributing

View File

@ -16,9 +16,7 @@ make?
### Input
- **Line 1:** Single integer `N` for the number of ingredients.
- **`N` next lines:** One for each ingredient. Each of these lines contains two positive integers:
the first one is the required quantity of this ingredient per cake, the second one is the quantity of
this ingredient you have in your kitchen.
- **`N` next lines:** One for each ingredient. Each of these lines contains two positive integers: the first one is the required quantity of this ingredient per cake, the second one is the quantity of this ingredient you have in your kitchen.
### Output
@ -32,7 +30,7 @@ available ingredients.
## Source
[SWERC 20202021 - Problem E: Cake](https://swerc.eu/2020/problems/)
[SWERC 2020-2021 - Problem E: Cake](https://swerc.eu/2020/problems/)
## Examples

View File

@ -21,6 +21,7 @@ This data is comprised of lines, each of which represents a defibrillator. Each
- Contact Phone number
- Longitude (degrees)
- Latitude (degrees)
These fields are separated by a semicolon (`;`).
**Beware:** the decimal numbers use the comma (,) as decimal separator. Remember to turn the comma (,) into dot (.) if necessary in order to use the data in your program.

View File

@ -14,37 +14,3 @@ Display a pyramid of stars (`*`) whose height is given and in the right order (`
## Examples
See the `test` folder for examples of input/output.
### Example 1
#### Input
```txt
normal
3
```
#### Output
```txt
*
***
*****
```
### Example 2
#### Input
```txt
reverse
3
```
#### Output
```txt
*****
***
*
```

View File

@ -19,7 +19,7 @@ export class Challenge implements ChallengeOptions {
public name: string
public path: string
constructor(options: ChallengeOptions) {
public constructor(options: ChallengeOptions) {
const { name } = options
this.name = name
this.path = fileURLToPath(new URL(`./${name}`, Challenge.BASE_URL))

View File

@ -20,7 +20,7 @@ export interface GitAffectedOptions {
export class GitAffected implements GitAffectedOptions {
public base?: string
constructor(options: GitAffectedOptions = {}) {
public constructor(options: GitAffectedOptions = {}) {
this.base = options.base
}

View File

@ -38,7 +38,7 @@ export class Solution implements SolutionOptions {
public path: string
public temporaryFolder: TemporaryFolder
constructor(options: SolutionOptions) {
public constructor(options: SolutionOptions) {
const { programmingLanguageName, challenge, name } = options
this.programmingLanguageName = programmingLanguageName
this.challenge = challenge
@ -92,7 +92,9 @@ export class Solution implements SolutionOptions {
}
}
static async generate(options: GenerateSolutionOptions): Promise<Solution> {
public static async generate(
options: GenerateSolutionOptions,
): Promise<Solution> {
const { name, challengeName, programmingLanguageName, githubUser } = options
const challenge = new Challenge({ name: challengeName })
if (!(await isExistingPath(challenge.path))) {
@ -116,7 +118,7 @@ export class Solution implements SolutionOptions {
return solution
}
static async get(options: GetSolutionOptions): Promise<Solution> {
public static async get(options: GetSolutionOptions): Promise<Solution> {
const { name, challengeName, programmingLanguageName } = options
const challenge = new Challenge({
name: challengeName,
@ -132,7 +134,9 @@ export class Solution implements SolutionOptions {
return solution
}
static async getManyByChallenge(challenge: Challenge): Promise<Solution[]> {
public static async getManyByChallenge(
challenge: Challenge,
): Promise<Solution[]> {
const solutionsPath = path.join(challenge.path, "solutions")
const languagesSolution = (await fs.promises.readdir(solutionsPath)).filter(
(name) => {
@ -151,7 +155,7 @@ export class Solution implements SolutionOptions {
return await Solution.getManyByPaths(paths)
}
static async getManyByProgrammingLanguages(
public static async getManyByProgrammingLanguages(
programmingLanguages?: string[],
): Promise<Solution[]> {
const languages =
@ -185,7 +189,7 @@ export class Solution implements SolutionOptions {
* @param paths relative to `challenges` (e.g: `challenges/hello-world/solutions/c/function`)
* @returns
*/
static async getManyByPaths(paths: string[]): Promise<Solution[]> {
public static async getManyByPaths(paths: string[]): Promise<Solution[]> {
const solutions: string[] = []
for (const path of paths) {
if (await isExistingPath(path)) {

View File

@ -25,7 +25,7 @@ export class SolutionTestsResult implements SolutionTestsResultOptions {
"Success:",
)} Tests passed! 🎉`
constructor(options: SolutionTestsResultOptions) {
public constructor(options: SolutionTestsResultOptions) {
this.tests = options.tests.sort((a, b) => {
return a.testNumber - b.testNumber
})

View File

@ -35,7 +35,7 @@ export class Test implements TestOptions {
public output: string
public stdout: string
constructor(options: TestOptions) {
public constructor(options: TestOptions) {
this.testNumber = options.testNumber
this.path = options.path
this.isSuccess = options.isSuccess
@ -44,7 +44,7 @@ export class Test implements TestOptions {
this.stdout = options.stdout
}
static async runAll(solution: Solution): Promise<SolutionTestsResult> {
public static async runAll(solution: Solution): Promise<SolutionTestsResult> {
const testsPath = path.join(solution.challenge.path, "test")
const testsFolders = await fs.promises.readdir(testsPath)
const testsNumbers = testsFolders.map((test) => {
@ -62,7 +62,7 @@ export class Test implements TestOptions {
return new SolutionTestsResult({ solution, tests, elapsedTimeMilliseconds })
}
static async getInputOutput(testPath: string): Promise<InputOutput> {
public static async getInputOutput(testPath: string): Promise<InputOutput> {
const inputPath = path.join(testPath, "input.txt")
const outputPath = path.join(testPath, "output.txt")
const input = await fs.promises.readFile(inputPath, { encoding: "utf-8" })
@ -72,7 +72,9 @@ export class Test implements TestOptions {
return { input, output }
}
static async runManyWithSolutions(solutions: Solution[]): Promise<number> {
public static async runManyWithSolutions(
solutions: Solution[],
): Promise<number> {
const solutionTestsResultsPromises: Array<Promise<SolutionTestsResult>> = []
let isSolutionSuccess = true
for (const solution of solutions) {
@ -98,7 +100,7 @@ export class Test implements TestOptions {
return 1
}
static async run(options: TestRunOptions): Promise<Test> {
public static async run(options: TestRunOptions): Promise<Test> {
const { input, output } = await Test.getInputOutput(options.path)
try {
const { stdout } = await docker.run(

4369
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -27,42 +27,41 @@
"test": "cross-env NODE_ENV=test node --enable-source-maps --test \"build/**/*.test.js\""
},
"dependencies": {
"chalk": "5.3.0",
"chalk": "5.4.1",
"clipanion": "3.2.1",
"date-and-time": "3.6.0",
"execa": "9.5.1",
"log-symbols": "6.0.0",
"ora": "8.1.1",
"replace-in-file": "8.2.0",
"table": "6.8.2",
"execa": "9.5.3",
"log-symbols": "7.0.0",
"ora": "8.2.0",
"replace-in-file": "8.3.0",
"table": "6.9.0",
"typanion": "3.14.0",
"validate-npm-package-name": "6.0.0"
},
"devDependencies": {
"@swc/cli": "0.5.0",
"@swc/core": "1.9.2",
"@tsconfig/strictest": "2.0.5",
"@swc/cli": "0.7.7",
"@swc/core": "1.11.24",
"@types/mock-fs": "4.13.4",
"@types/ms": "0.7.34",
"@types/node": "22.9.0",
"@types/sinon": "17.0.3",
"@types/ms": "2.1.0",
"@types/node": "22.15.17",
"@types/sinon": "17.0.4",
"@types/validate-npm-package-name": "4.0.2",
"cross-env": "7.0.3",
"editorconfig-checker": "6.0.0",
"eslint": "9.15.0",
"eslint-config-conventions": "17.0.1",
"eslint-plugin-import-x": "4.4.2",
"eslint-plugin-promise": "7.1.0",
"eslint-plugin-unicorn": "56.0.0",
"editorconfig-checker": "6.0.1",
"eslint": "9.26.0",
"eslint-config-conventions": "19.2.0",
"eslint-plugin-import-x": "4.11.1",
"eslint-plugin-promise": "7.2.1",
"eslint-plugin-unicorn": "59.0.1",
"get-stream": "9.0.1",
"globals": "15.12.0",
"markdownlint-cli2": "0.15.0",
"markdownlint-rule-relative-links": "3.0.0",
"mock-fs": "5.4.1",
"globals": "16.1.0",
"markdownlint-cli2": "0.18.0",
"markdownlint-rule-relative-links": "4.1.0",
"mock-fs": "5.5.0",
"ms": "2.1.3",
"prettier": "3.3.3",
"sinon": "19.0.2",
"typescript": "5.6.3",
"typescript-eslint": "8.14.0"
"prettier": "3.5.3",
"sinon": "20.0.0",
"typescript": "5.8.3",
"typescript-eslint": "8.32.1"
}
}

View File

@ -1,4 +1,4 @@
FROM dart:3.5.4 AS builder
FROM dart:3.7.3 AS builder
WORKDIR /usr/src/application
COPY ./ ./
RUN dart compile exe solution.dart -o solution

View File

@ -1,4 +1,4 @@
FROM pypy:3.10-bookworm
FROM pypy:3.11-bookworm
WORKDIR /usr/src/application
COPY ./ ./
CMD ["python", "solution.py"]

View File

@ -1,4 +1,4 @@
FROM rust:1.82.0 AS builder
FROM rust:1.86.0 AS builder
WORKDIR /usr/src/rust_application
# Cache dependencies

View File

@ -1,9 +1,9 @@
FROM node:22.11.0 AS builder-dependencies
FROM node:22.15.0 AS builder-dependencies
WORKDIR /usr/src/application
COPY ./package*.json ./
RUN npm install
FROM node:22.11.0 AS builder
FROM node:22.15.0 AS builder
WORKDIR /usr/src/application
COPY --from=builder-dependencies /usr/src/application/node_modules ./node_modules
COPY ./ ./

View File

@ -1,15 +1,37 @@
{
"extends": "@tsconfig/strictest/tsconfig.json",
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"lib": ["ESNext"],
"moduleResolution": "NodeNext",
"outDir": "./build",
"rootDir": "./cli",
"noEmit": true,
"checkJs": false,
"exactOptionalPropertyTypes": false
"exactOptionalPropertyTypes": false,
"strict": true,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"verbatimModuleSyntax": true,
"isolatedModules": true,
"esModuleInterop": true,
"allowImportingTsExtensions": false,
"skipLibCheck": true,
"jsx": "preserve",
"incremental": true,
"noEmit": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"resolveJsonModule": true
},
"exclude": ["node_modules", "challenges", "templates", "temp", "tmp"]
}