Skip to content

Commit

Permalink
feat: release
Browse files Browse the repository at this point in the history
  • Loading branch information
datagutt committed Aug 19, 2024
1 parent 7ae6683 commit 50ffc0c
Show file tree
Hide file tree
Showing 18 changed files with 5,740 additions and 413 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/**/*.js
dist/**
34 changes: 34 additions & 0 deletions .eslintrc.json
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"
}
}
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
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']
22 changes: 22 additions & 0 deletions .github/workflows/nodejs.yml
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
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
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 }}
12 changes: 12 additions & 0 deletions .prettierrc
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"
}
}
]
}
Empty file added README.md
Empty file.
26 changes: 13 additions & 13 deletions example.ts
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();
45 changes: 34 additions & 11 deletions package.json
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"
}
}
Loading

0 comments on commit 50ffc0c

Please sign in to comment.