update
This commit is contained in:
parent
5ecf7c5b65
commit
ff88494585
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -1,3 +1,3 @@
|
||||
{
|
||||
"deno.enable": true
|
||||
"deno.enable": false
|
||||
}
|
||||
|
||||
BIN
robo-readme.pdf
Normal file
BIN
robo-readme.pdf
Normal file
Binary file not shown.
10
src/08-code-organisation/deno.json
Normal file
10
src/08-code-organisation/deno.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"tasks": {
|
||||
"dev": "deno run --watch ./src/main.ts"
|
||||
},
|
||||
"imports": {
|
||||
"@std/assert": "jsr:@std/assert@1",
|
||||
"date-fns": "npm:date-fns"
|
||||
}
|
||||
}
|
||||
|
||||
30
src/08-code-organisation/deno.lock
generated
Normal file
30
src/08-code-organisation/deno.lock
generated
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"version": "5",
|
||||
"specifiers": {
|
||||
"jsr:@std/assert@1": "1.0.11",
|
||||
"jsr:@std/internal@^1.0.5": "1.0.5",
|
||||
"npm:date-fns@*": "4.1.0"
|
||||
},
|
||||
"jsr": {
|
||||
"@std/assert@1.0.11": {
|
||||
"integrity": "2461ef3c368fe88bc60e186e7744a93112f16fd110022e113a0849e94d1c83c1",
|
||||
"dependencies": [
|
||||
"jsr:@std/internal"
|
||||
]
|
||||
},
|
||||
"@std/internal@1.0.5": {
|
||||
"integrity": "54a546004f769c1ac9e025abd15a76b6671ddc9687e2313b67376125650dc7ba"
|
||||
}
|
||||
},
|
||||
"npm": {
|
||||
"date-fns@4.1.0": {
|
||||
"integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg=="
|
||||
}
|
||||
},
|
||||
"workspace": {
|
||||
"dependencies": [
|
||||
"jsr:@std/assert@1",
|
||||
"npm:date-fns@*"
|
||||
]
|
||||
}
|
||||
}
|
||||
6
src/08-code-organisation/src/main.ts
Normal file
6
src/08-code-organisation/src/main.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { add, log as alternativLog, log } from '@utils';
|
||||
|
||||
const today = new Date();
|
||||
console.log('Addition: ', add(5, 3));
|
||||
log('Hello from Log');
|
||||
alternativLog('Hello from alternativ log');
|
||||
11
src/08-code-organisation/src/utils/dateUtils.ts
Normal file
11
src/08-code-organisation/src/utils/dateUtils.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { addDays, format } from 'date-fns';
|
||||
|
||||
const today = new Date();
|
||||
// console.log('Heute ist: ', format(today, 'yyyy-MM-dd'));
|
||||
|
||||
const nextWeek = addDays(today, 7);
|
||||
// console.log('Nächste Woche: ', format(nextWeek, 'yyyy-MM-dd'));
|
||||
|
||||
export const formatDate = (date: Date, formatString = 'yyyy-MM-dd') => {
|
||||
return format(date, formatString);
|
||||
};
|
||||
3
src/08-code-organisation/src/utils/index.ts
Normal file
3
src/08-code-organisation/src/utils/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './dateUtils.ts';
|
||||
export { default as log } from './logger.ts';
|
||||
export * from './mathUtils.ts';
|
||||
3
src/08-code-organisation/src/utils/logger.ts
Normal file
3
src/08-code-organisation/src/utils/logger.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export default function log(message: string) {
|
||||
console.log(`Log: ${message}`);
|
||||
}
|
||||
7
src/08-code-organisation/src/utils/mathUtils.ts
Normal file
7
src/08-code-organisation/src/utils/mathUtils.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export function add(a: number, b: number): number {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
export function sub(a: number, b: number): number {
|
||||
return a - b;
|
||||
}
|
||||
18
src/08-code-organisation/tsconfig.json
Normal file
18
src/08-code-organisation/tsconfig.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src"],
|
||||
"@utils": ["./src/utils/index.ts"]
|
||||
},
|
||||
|
||||
"target": "es2016",
|
||||
|
||||
"module": "ESNext",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
|
||||
"strict": true,
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user