-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
5,740 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
insert_final_newline = false | ||
trim_trailing_whitespace = false | ||
|
||
[*.{js,json,ts,mts,yml,yaml}] | ||
indent_size = 2 | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/**/*.js | ||
dist/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"env": { | ||
"browser": false, | ||
"es6": true, | ||
"node": true | ||
}, | ||
"ignorePatterns": [ | ||
"example.ts" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "tsconfig.json", | ||
"sourceType": "module", | ||
"ecmaVersion": 2020 | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"jest" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:jest/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
// The following rule is enabled only to supplement the inline suppression | ||
// examples, and because it is not a recommended rule, you should either | ||
// disable it, or understand what it enforces. | ||
// https://typescript-eslint.io/rules/explicit-function-return-type/ | ||
"@typescript-eslint/explicit-function-return-type": "warn", | ||
"@typescript-eslint/no-unused-vars": "warn" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [datagutt] | ||
patreon: # Replace with a single Patreon username | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Node.js CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: volta-cli/action@v4 | ||
- uses: pnpm/action-setup@v4 | ||
name: Install pnpm | ||
with: | ||
version: 9 | ||
run_install: false | ||
- run: pnpm i | ||
- run: pnpm run lint | ||
- run: pnpm test | ||
- run: pnpm run build | ||
env: | ||
CI: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Release package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: volta-cli/action@v4 | ||
|
||
- uses: pnpm/action-setup@v4 | ||
name: Install pnpm | ||
with: | ||
version: 9 | ||
run_install: false | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: pnpm | ||
registry-url: https://registry.npmjs.org | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Build 🏗 | ||
run: pnpm build | ||
|
||
- name: Publish 🚀 | ||
shell: bash | ||
run: pnpm publish --access public --no-git-checks | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.mts"], | ||
"options": { | ||
"parser": "typescript" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import Kanpla from './src/kanpla' | ||
import Kanpla from './src/kanpla'; | ||
import dotenv from 'dotenv'; | ||
dotenv.config(); | ||
const kanpla = new Kanpla({ | ||
FIREBASE_API_KEY: process.env.FIREBASE_API_KEY as string, | ||
FIREBASE_USERNAME: process.env.FIREBASE_USERNAME as string, | ||
FIREBASE_PASSWORD: process.env.FIREBASE_PASSWORD as string, | ||
SUPPLIER: process.env.SUPPLIER as string, | ||
MODULE_ID: process.env.MODULE_ID as string, | ||
LANGUAGE: 'no', | ||
}) | ||
FIREBASE_API_KEY: process.env.FIREBASE_API_KEY as string, | ||
FIREBASE_USERNAME: process.env.FIREBASE_USERNAME as string, | ||
FIREBASE_PASSWORD: process.env.FIREBASE_PASSWORD as string, | ||
SUPPLIER: process.env.SUPPLIER as string, | ||
MODULE_ID: process.env.MODULE_ID as string, | ||
LANGUAGE: 'no', | ||
}); | ||
|
||
async function main() { | ||
const allMenus = await kanpla.getAllMenus() | ||
/// console.log(`All menus:`, allMenus) | ||
const allMenus = await kanpla.getAllMenus(); | ||
/// console.log(`All menus:`, allMenus) | ||
|
||
const menu = await kanpla.getMenusForToday() | ||
console.log(`Today's menu:`, menu) | ||
const menu = await kanpla.getMenusForToday(); | ||
console.log(`Today's menu:`, menu); | ||
} | ||
|
||
main() | ||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,47 @@ | ||
{ | ||
"name": "@datagutt/kanpla", | ||
"private": true, | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"description": "Kanpla canteena app api", | ||
"type": "module", | ||
"source": "./src", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"start": "node dist/index.js", | ||
"build": "tsc" | ||
"start": "tsx example.ts", | ||
"clean": "rimraf coverage build tmp", | ||
"prebuild": "npm run lint", | ||
"build": "tsc -p tsconfig.json", | ||
"build:watch": "tsc -w -p tsconfig.json", | ||
"build:release": "npm run clean && tsc -p tsconfig.release.json", | ||
"lint": "eslint . --ext .ts --ext .mts", | ||
"test": "jest --coverage --passWithNoTests", | ||
"prettier": "prettier --config .prettierrc --write .", | ||
"test:watch": "jest --watch --passWithNoTests" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"author": "Thomas Lekanger <mail@datagutt.no>", | ||
"files": [ | ||
"dist", | ||
"README.md" | ||
], | ||
"license": "MIT", | ||
"dependencies": { | ||
"typescript": "^5.5.4", | ||
"axios": "^1.7.4", | ||
"axios-cache-interceptor": "^1", | ||
"dotenv": "^16.4.5" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20" | ||
"@types/jest": "~29.5", | ||
"@types/node": "~20", | ||
"@typescript-eslint/eslint-plugin": "~7.6", | ||
"@typescript-eslint/parser": "~7.6", | ||
"eslint": "~8.56", | ||
"eslint-config-prettier": "~9.1", | ||
"eslint-plugin-jest": "~28.2", | ||
"jest": "~29.7", | ||
"prettier": "~3.2", | ||
"rimraf": "~5.0", | ||
"ts-jest": "~29.1", | ||
"typescript": "^5.5.4", | ||
"tsx": "^4.17.0" | ||
} | ||
} |
Oops, something went wrong.