mirror of
				https://github.com/theoludwig/programming-challenges.git
				synced 2025-09-11 23:11:21 +02:00 
			
		
		
		
	refactor: usage of node: for builtin modules
				
					
				
			This commit is contained in:
		| @@ -44,8 +44,8 @@ Gitpod will automatically setup an environment for you. | ||||
|  | ||||
| #### Prerequisites | ||||
|  | ||||
| - [Node.js](https://nodejs.org/) >= 16 | ||||
| - [npm](https://npmjs.com/) >= 7 | ||||
| - [Node.js](https://nodejs.org/) >= 16.0.0 | ||||
| - [npm](https://npmjs.com/) >= 7.0.0 | ||||
| - [Docker](https://www.docker.com/) | ||||
|  | ||||
| #### Installation | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const input = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const input: string[] = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const input = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const input = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const input: string[] = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const input = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const input: string[] = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const input = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const numbers = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const numbers = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const numbers = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const numbers = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const removeByIndex = <T = any>(array: T[], index: number): T[] => { | ||||
|   const result = [...array] | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| import { Command, Option } from 'clipanion' | ||||
| import * as typanion from 'typanion' | ||||
|  | ||||
| import chalk from 'chalk' | ||||
|  | ||||
| import { Challenge } from '../../services/Challenge' | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| import { Command, Option } from 'clipanion' | ||||
| import * as typanion from 'typanion' | ||||
|  | ||||
| import chalk from 'chalk' | ||||
|  | ||||
| import { Solution } from '../../services/Solution' | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| import { Command, Option } from 'clipanion' | ||||
| import * as typanion from 'typanion' | ||||
|  | ||||
| import chalk from 'chalk' | ||||
|  | ||||
| import { Solution } from '../../services/Solution' | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import path from 'path' | ||||
| import fs from 'fs' | ||||
| import path from 'node:path' | ||||
| import fs from 'node:fs' | ||||
|  | ||||
| import validateProjectName from 'validate-npm-package-name' | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import path from 'path' | ||||
| import path from 'node:path' | ||||
|  | ||||
| import { | ||||
|   createTemporaryEmptyFolder, | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import path from 'path' | ||||
| import fs from 'fs' | ||||
| import path from 'node:path' | ||||
| import fs from 'node:fs' | ||||
|  | ||||
| import { replaceInFile } from 'replace-in-file' | ||||
| import date from 'date-and-time' | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import fs from 'fs' | ||||
| import path from 'path' | ||||
| import { performance } from 'perf_hooks' | ||||
| import fs from 'node:fs' | ||||
| import path from 'node:path' | ||||
| import { performance } from 'node:perf_hooks' | ||||
|  | ||||
| import ora from 'ora' | ||||
| import chalk from 'chalk' | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| import fs from 'node:fs' | ||||
|  | ||||
| import fsMock from 'mock-fs' | ||||
| import fs from 'fs' | ||||
|  | ||||
| import { copyDirectory } from '../copyDirectory' | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| import fs from 'node:fs' | ||||
|  | ||||
| import fsMock from 'mock-fs' | ||||
| import fs from 'fs' | ||||
|  | ||||
| import { | ||||
|   TEMPORARY_PATH, | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import fs from 'fs' | ||||
| import path from 'path' | ||||
| import fs from 'node:fs' | ||||
| import path from 'node:path' | ||||
|  | ||||
| export async function copyDirectory ( | ||||
|   source: string, | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import path from 'path' | ||||
| import fs from 'fs' | ||||
| import path from 'node:path' | ||||
| import fs from 'node:fs' | ||||
|  | ||||
| import { isExistingPath } from '../utils/isExistingPath' | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import fs from 'fs' | ||||
| import fs from 'node:fs' | ||||
|  | ||||
| export const isExistingPath = async (path: string): Promise<boolean> => { | ||||
|   try { | ||||
|   | ||||
| @@ -1,10 +0,0 @@ | ||||
| module.exports = { | ||||
|   preset: 'ts-jest', | ||||
|   testEnvironment: 'node', | ||||
|   rootDir: './cli', | ||||
|   testPathIgnorePatterns: [ | ||||
|     '<rootDir>/commands/run/test.ts', | ||||
|     '<rootDir>/services/Test.ts', | ||||
|     '<rootDir>/node_modules' | ||||
|   ] | ||||
| } | ||||
							
								
								
									
										10
									
								
								jest.config.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								jest.config.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| { | ||||
|   "preset": "ts-jest", | ||||
|   "testEnvironment": "node", | ||||
|   "rootDir": "./cli", | ||||
|   "testPathIgnorePatterns": [ | ||||
|     "<rootDir>/commands/run/test.ts", | ||||
|     "<rootDir>/services/Test.ts", | ||||
|     "<rootDir>/node_modules" | ||||
|   ] | ||||
| } | ||||
							
								
								
									
										2565
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2565
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										12
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								package.json
									
									
									
									
									
								
							| @@ -8,7 +8,7 @@ | ||||
|     "url": "git+https://github.com/Divlo/programming-challenges" | ||||
|   }, | ||||
|   "engines": { | ||||
|     "node": ">=14.0.0", | ||||
|     "node": ">=16.0.0", | ||||
|     "npm": ">=7.0.0" | ||||
|   }, | ||||
|   "ts-standard": { | ||||
| @@ -40,7 +40,7 @@ | ||||
|     "clipanion": "3.0.0-rc.12", | ||||
|     "date-and-time": "1.0.1", | ||||
|     "execa": "5.1.1", | ||||
|     "ora": "5.4.0", | ||||
|     "ora": "5.4.1", | ||||
|     "replace-in-file": "6.2.0", | ||||
|     "table": "6.7.1", | ||||
|     "typanion": "3.3.1", | ||||
| @@ -52,15 +52,15 @@ | ||||
|     "@types/date-and-time": "0.13.0", | ||||
|     "@types/jest": "26.0.23", | ||||
|     "@types/mock-fs": "4.13.0", | ||||
|     "@types/node": "15.12.2", | ||||
|     "@types/validate-npm-package-name": "3.0.2", | ||||
|     "@types/node": "16.0.0", | ||||
|     "@types/validate-npm-package-name": "3.0.3", | ||||
|     "editorconfig-checker": "4.0.2", | ||||
|     "jest": "27.0.4", | ||||
|     "jest": "27.0.6", | ||||
|     "markdownlint-cli": "0.27.1", | ||||
|     "mock-fs": "5.0.0", | ||||
|     "rimraf": "3.0.2", | ||||
|     "ts-jest": "27.0.3", | ||||
|     "ts-standard": "10.0.0", | ||||
|     "typescript": "4.3.2" | ||||
|     "typescript": "4.3.5" | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const input = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import readline from 'readline' | ||||
| import readline from 'node:readline' | ||||
|  | ||||
| const input: string[] = [] | ||||
| const readlineInterface = readline.createInterface({ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user