1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2025-05-18 12:02:53 +02:00

chore: maintenance

This commit is contained in:
Divlo
2022-02-19 18:30:29 +01:00
parent bc1d34f126
commit 696de1580d
35 changed files with 3421 additions and 4107 deletions

View File

@ -3,8 +3,8 @@ import fs from 'node:fs'
import validateProjectName from 'validate-npm-package-name'
import { isExistingPath } from '../utils/isExistingPath'
import { template } from './Template'
import { isExistingPath } from '../utils/isExistingPath.js'
import { template } from './Template.js'
export interface ChallengeOptions {
name: string

View File

@ -1,13 +1,13 @@
import execa from 'execa'
import { Challenge } from './Challenge'
import { Solution } from './Solution'
import { Challenge } from './Challenge.js'
import { Solution } from './Solution.js'
const solutionsRegex = /challenges\/[\s\S]*\/solutions\/(c|cpp|cs|dart|java|javascript|python|rust|typescript)\/[\s\S]*\/(.*).(c|cpp|cs|dart|java|js|py|rs|ts)/
const solutionsRegex = /challenges\/[\S\s]*\/solutions\/(c|cpp|cs|dart|java|javascript|python|rust|typescript)\/[\S\s]*\/(.*).(c|cpp|cs|dart|java|js|py|rs|ts)/
const dockerRegex = /templates\/docker\/(c|cpp|cs|dart|java|javascript|python|rust|typescript)\/(.*)/
const inputOutputRegex = /challenges\/[\s\S]*\/test\/(.*)\/(input.txt|output.txt)/
const inputOutputRegex = /challenges\/[\S\s]*\/test\/(.*)\/(input.txt|output.txt)/
export interface GitAffectedOptions {
isContinuousIntegration: boolean

View File

@ -4,13 +4,13 @@ import fs from 'node:fs'
import {
createTemporaryEmptyFolder,
TEMPORARY_PATH
} from '../utils/createTemporaryEmptyFolder'
import { isExistingPath } from '../utils/isExistingPath'
import { Challenge } from './Challenge'
import { copyDirectory } from '../utils/copyDirectory'
import { template } from './Template'
import { docker } from './Docker'
import { Test } from './Test'
} from '../utils/createTemporaryEmptyFolder.js'
import { isExistingPath } from '../utils/isExistingPath.js'
import { Challenge } from './Challenge.js'
import { copyDirectory } from '../utils/copyDirectory.js'
import { template } from './Template.js'
import { docker } from './Docker.js'
import { Test } from './Test.js'
export interface GetSolutionOptions {
programmingLanguageName: string

View File

@ -4,7 +4,7 @@ import fs from 'node:fs'
import { replaceInFile } from 'replace-in-file'
import date from 'date-and-time'
import { copyDirectory } from '../utils/copyDirectory'
import { copyDirectory } from '../utils/copyDirectory.js'
const TEMPLATE_PATH = path.join(__dirname, '..', '..', 'templates')
const TEMPLATE_DOCKER_PATH = path.join(TEMPLATE_PATH, 'docker')
@ -87,7 +87,7 @@ class Template {
const { destination, githubUser, name } = options
await copyDirectory(TEMPLATE_CHALLENGE_PATH, destination)
await this.replaceInDestination({
name: name,
name,
description: this.getDescription(githubUser),
destination
})

View File

@ -6,8 +6,8 @@ import ora from 'ora'
import chalk from 'chalk'
import { table } from 'table'
import { Solution } from './Solution'
import { docker } from './Docker'
import { Solution } from './Solution.js'
import { docker } from './Docker.js'
export interface InputOutput {
input: string
@ -49,7 +49,7 @@ export class Test implements TestOptions {
this.elapsedTimeMilliseconds = options.elapsedTimeMilliseconds
}
static async printResult (tests: Test[]): Promise<void> {
static printResult (tests: Test[]): void {
const tableResult = [
[
chalk.bold('N°'),
@ -120,7 +120,7 @@ export class Test implements TestOptions {
throw error
}
}
await Test.printResult(tests)
Test.printResult(tests)
}
static async getInputOutput (testPath: string): Promise<InputOutput> {

View File

@ -1,6 +1,6 @@
import { Challenge } from '../Challenge'
import { GitAffected } from '../GitAffected'
import { Solution } from '../Solution'
import { Challenge } from '../Challenge.js'
import { GitAffected } from '../GitAffected.js'
import { Solution } from '../Solution.js'
const gitAffected = new GitAffected({ isContinuousIntegration: false })