Skip to content

Commit

Permalink
Merge remote into local
Browse files Browse the repository at this point in the history
  • Loading branch information
redbeard0091 committed Jul 15, 2024
2 parents 553aa52 + ddd6112 commit 4fe3a69
Show file tree
Hide file tree
Showing 16 changed files with 154 additions and 46 deletions.
33 changes: 33 additions & 0 deletions .github/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Check PR'main

on:
pull_request_target:
types:
- opened
- synchronize
- reopened

jobs:
check-code:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Lint code
run: npm run lint
- name: Build library code
run: npm run build
check-versioning:
runs-on: ubuntu-latest
steps:
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 28 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Create release'

on: [workflow_dispatch]

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Lint code
run: npm run lint
- name: Build library code
run: npm run build
- name: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules

src/*
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/node_modules
/dist
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "all",
"endOfLine": "auto"
}
9 changes: 9 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"branches": ["master"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
"@semantic-release/npm"
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Wertarbyte and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
14 changes: 7 additions & 7 deletions lib/changelog.hook.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { useEffect, useState } from "react";
import { useEffect, useState } from 'react';
import {
Changelog,
UpdateHiveConfig,
UpdateHiveHookResult,
} from "./changelog.types.ts";
} from './changelog.types.ts';

const DEFAULT_API_URL = "https://updatehive.wertarbyte.com/api";
const DEFAULT_API_URL = 'https://updatehive.wertarbyte.com/api';

const buildRequestURL = (config: UpdateHiveConfig): string => {
const API_URL = `${config.connection.url ?? DEFAULT_API_URL}`;
const API_ENDPOINT = config.changelogs.onlyLast
? "/changelogs/latest?"
: "/changelogs?";
? '/changelogs/latest?'
: '/changelogs?';
const searchParams = new URLSearchParams({
product: config.changelogs.product,
});
Expand All @@ -36,7 +36,7 @@ export function useChangelogs(config: UpdateHiveConfig): UpdateHiveHookResult {
const result = await fetch(requestURL, {
headers: {
Authorization: `Bearer ${config.connection.API_KEY}`,
Accept: "application/vnd.wertarbyte.changelog.v1+json",
Accept: 'application/vnd.wertarbyte.changelog.v1+json',
},
});

Expand All @@ -45,7 +45,7 @@ export function useChangelogs(config: UpdateHiveConfig): UpdateHiveHookResult {
if (error instanceof Error) {
setError(error.message);
} else {
setError("An unknown error occurred.");
setError('An unknown error occurred.');
}
}

Expand Down
18 changes: 9 additions & 9 deletions lib/changelog.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ export type UpdateHiveHookResult = {
};

export enum VariantType {
TEXT_ONLY = "TEXT_ONLY",
IMAGE_AND_TEXT = "IMAGE_AND_TEXT",
TEXT_ONLY = 'TEXT_ONLY',
IMAGE_AND_TEXT = 'IMAGE_AND_TEXT',
}

export enum ChangeType {
FEATURE = "FEATURE",
FIX = "FIX",
IMPROVEMENT = "IMPROVEMENT",
KNOWNISSUE = "KNOWNISSUE",
BREAKING = "BREAKING",
REMOVED = "REMOVED",
NOTE = "NOTE",
FEATURE = 'FEATURE',
FIX = 'FIX',
IMPROVEMENT = 'IMPROVEMENT',
KNOWNISSUE = 'KNOWNISSUE',
BREAKING = 'BREAKING',
REMOVED = 'REMOVED',
NOTE = 'NOTE',
}

export type ChangelogEntryInterface = {
Expand Down
6 changes: 3 additions & 3 deletions lib/components/ChangelogContainer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";
import { useChangelogs } from "../../changelog.hook.ts";
import { ChangelogContext } from "../ChangelogContext";
import * as React from 'react';
import { useChangelogs } from '../../changelog.hook.ts';
import { ChangelogContext } from '../ChangelogContext';

interface Props {
API_KEY: string;
Expand Down
28 changes: 14 additions & 14 deletions lib/components/MinimalChangelogList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { Box, CircularProgress, List, ListItem, Typography } from "@mui/joy";
import { ChangeType } from "../../changelog.types.ts";

const ChangeTypeMap: Record<ChangeType, string> = {
[ChangeType.FEATURE]: "[Neu]",
[ChangeType.IMPROVEMENT]: "[Angegepasst]",
[ChangeType.FIX]: "[Behoben]",
[ChangeType.NOTE]: "[Notiz]",
[ChangeType.BREAKING]: "[Geändertes Verhalten]",
[ChangeType.KNOWNISSUE]: "[Bekanntes Problem]",
[ChangeType.REMOVED]: "[Entfernt]",
[ChangeType.FEATURE]: '[Neu]',
[ChangeType.IMPROVEMENT]: '[Angegepasst]',
[ChangeType.FIX]: '[Behoben]',
[ChangeType.NOTE]: '[Notiz]',
[ChangeType.BREAKING]: '[Geändertes Verhalten]',
[ChangeType.KNOWNISSUE]: '[Bekanntes Problem]',
[ChangeType.REMOVED]: '[Entfernt]',
};

interface Props {
Expand All @@ -34,29 +34,29 @@ export const MinimalChangelogList: React.FC<Props> = ({
<div>
{data.map((changelog, index) => (
<div key={`changelog-${index}`}>
<Box sx={() => ({ marginBottom: "8px" })}>
<Typography level="h3" sx={() => ({ marginRight: "8px" })}>
<Box sx={() => ({ marginBottom: '8px' })}>
<Typography level="h3" sx={() => ({ marginRight: '8px' })}>
Version {changelog.version}
</Typography>
{changelog.description && (
<Typography>{changelog.description}</Typography>
)}
</Box>
<List
marker={"circle"}
sx={() => ({ "--ListItem-minHeight": 20 })}
marker={'circle'}
sx={() => ({ '--ListItem-minHeight': 20 })}
>
{changelog.entries.map((entry, entryIndex) => (
<ListItem
sx={() => ({
padding: "0px",
padding: '0px',
})}
key={`changelog-${index}-entry-${entryIndex}`}
>
<Box sx={() => ({ display: "flex", flexDirection: "row" })}>
<Box sx={() => ({ display: 'flex', flexDirection: 'row' })}>
<Typography
level="title-sm"
sx={() => ({ marginRight: "8px" })}
sx={() => ({ marginRight: '8px' })}
>
{changeTypeMapper[entry.changeType]}
</Typography>
Expand Down
4 changes: 2 additions & 2 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ export type {
ChangelogEntryInterface,
ChangeType,
VariantType,
} from "./changelog.types";
} from './changelog.types';

export { useChangelogs } from "./changelog.hook";
export { useChangelogs } from './changelog.hook';

export { ChangelogContainer } from "./components/ChangelogContainer";
export { useUpdateHiveContext } from "./components/ChangelogContext";
Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"name": "updatehive-react",
"description": "React components and hook for UpdateHive",
"description": "React hook and components for UpdateHive",
"author": "Wertarbyte <[email protected]> (https://wertarbyte.com)",
"license": "MIT",
"bugs": {
"url": "https://github.com/TeamWertarbyte/updatehive-react/issues"
},
"homepage": "https://www.wertarbyte.com/products/updateHive",
"private": false,
"version": "0.0.1",
"version": "1.0.0",
"type": "module",
"main": "dist/updatehive-react.umd.js",
"module": "dist/updatehive-react.es.js",
Expand All @@ -19,6 +25,7 @@
"dev": "vite",
"build": "tsc -p ./tsconfig-build.json && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"format": "prettier --write 'src/**/*.{ts,tsx}' 'lib/**/*.{ts,tsx}'",
"preview": "vite preview",
"prepublishOnly": "yarn build"
},
Expand Down
6 changes: 3 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {
ChangelogContainer,
MinimalChangelogList,
useChangelogs,
} from "../lib";
import * as React from "react";
} from '../lib';
import * as React from 'react';

export const App: React.FC = () => {
const API_KEY = import.meta.env.VITE_UPDATEHIVE_API_KEY;
Expand Down Expand Up @@ -33,7 +33,7 @@ export const App: React.FC = () => {
<div>Loading changelogs ...</div>
) : (
<div>
<div className="hook table" key={"header"}>
<div className="hook table" key={'header'}>
<div className="hook div">Version</div>
<div className="hook div">Description</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import { App } from "./App.tsx";
import * as React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { App } from './App.tsx';

ReactDOM.createRoot(document.getElementById("root")!).render(
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
Expand Down
3 changes: 2 additions & 1 deletion tsconfig-build.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["lib"]
"include": ["lib"],
"exclude": ["node_modules"]
}

0 comments on commit 4fe3a69

Please sign in to comment.