@dotinc/ogre-react 0.3.0-canary.5167e57.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,40 @@
1
+ # v0.4.0 (Sat Feb 17 2024)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - refactor: move formatgit2json to core lib [#130](https://github.com/dotindustries/ogre/pull/130) ([@nadilas](https://github.com/nadilas))
6
+ - refactor: move formatgit2json to core lib ([@nadilas](https://github.com/nadilas))
7
+ - chore(deps-dev): bump typescript from 4.6.2 to 4.7.4 ([@dependabot[bot]](https://github.com/dependabot[bot]))
8
+
9
+ #### 🔩 Dependency Updates
10
+
11
+ - chore(deps): bump next-plausible from 3.1.6 to 3.2.0 [#51](https://github.com/dotindustries/ogre/pull/51) ([@dependabot[bot]](https://github.com/dependabot[bot]))
12
+ - chore(deps-dev): bump typescript from 4.6.2 to 4.7.4 [#54](https://github.com/dotindustries/ogre/pull/54) ([@dependabot[bot]](https://github.com/dependabot[bot]))
13
+
14
+ #### Authors: 2
15
+
16
+ - [@dependabot[bot]](https://github.com/dependabot[bot])
17
+ - [@nadilas](https://github.com/nadilas)
18
+
19
+ ---
20
+
21
+ # v0.3.0 (Sun Mar 13 2022)
22
+
23
+ #### 🐛 Bug Fix
24
+
25
+ - Bump independent versions \[skip ci\] ([@nadilas](https://github.com/nadilas))
26
+ - Update CHANGELOG.md \[skip ci\] ([@nadilas](https://github.com/nadilas))
27
+
28
+ #### ⚠️ Pushed to `main`
29
+
30
+ - npm release of ogre-react ([@nadilas](https://github.com/nadilas))
31
+
32
+ #### Authors: 1
33
+
34
+ - [@nadilas](https://github.com/nadilas)
35
+
36
+ ---
37
+
1
38
  # v0.2.1 (Sun Mar 13 2022)
2
39
 
3
40
  #### ⚠️ Pushed to `main`
package/OgreGraph.tsx CHANGED
@@ -1,29 +1,27 @@
1
- import React, {useEffect, useState} from 'react'
2
- import {Gitgraph} from '@gitgraph/react'
3
- import {RepositoryObject} from '@dotinc/ogre'
4
- import {formatGit2Json} from './git2json'
1
+ import React, { useEffect, useState } from "react";
2
+
3
+ import { formatGit2Json, RepositoryObject } from "@dotinc/ogre";
4
+ import { Gitgraph } from "@gitgraph/react";
5
5
 
6
6
  export interface OgreGraphProps {
7
- repository: RepositoryObject<any>
7
+ repository: RepositoryObject<any>;
8
8
  }
9
9
 
10
- export const OgreGraph: React.FC<OgreGraphProps> = ({repository}) => {
11
- const [graphData, setGraphData] = useState<any[] | undefined>(undefined)
10
+ export const OgreGraph: React.FC<OgreGraphProps> = ({ repository }) => {
11
+ const [graphData, setGraphData] = useState<any[] | undefined>(undefined);
12
12
 
13
13
  useEffect(() => {
14
14
  if (!graphData) {
15
- const history = repository.getHistory()
16
- setGraphData(formatGit2Json(history))
15
+ const history = repository.getHistory();
16
+ setGraphData(formatGit2Json(history));
17
17
  }
18
- }, [repository])
18
+ }, [repository]);
19
19
 
20
- return !graphData
21
- ? null
22
- : (
23
- <Gitgraph>
24
- {(gitgraph) => {
25
- gitgraph.import(graphData)
26
- }}
27
- </Gitgraph>
28
- )
29
- }
20
+ return !graphData ? null : (
21
+ <Gitgraph>
22
+ {(gitgraph) => {
23
+ gitgraph.import(graphData);
24
+ }}
25
+ </Gitgraph>
26
+ );
27
+ };
package/index.tsx CHANGED
@@ -1,2 +1,2 @@
1
- export * from './OgreGraph'
2
- export {formatGit2Json} from './git2json'
1
+ export * from "./OgreGraph";
2
+ export { formatGit2Json } from "@dotinc/ogre";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotinc/ogre-react",
3
- "version": "0.3.0-canary.5167e57.0",
3
+ "version": "0.4.0",
4
4
  "main": "./index.tsx",
5
5
  "types": "./index.tsx",
6
6
  "license": "MIT",
@@ -9,7 +9,7 @@
9
9
  "url": "https://github.com/dotindustries/ogre.git"
10
10
  },
11
11
  "dependencies": {
12
- "@dotinc/ogre": "0.3.0-canary.5167e57.0",
12
+ "@dotinc/ogre": "^0.4.0",
13
13
  "@gitgraph/react": "^1.6.0"
14
14
  },
15
15
  "devDependencies": {
@@ -17,11 +17,11 @@
17
17
  "@types/react-dom": "^17.0.13",
18
18
  "config": "^0.1.1",
19
19
  "tsconfig": "^0.1.1",
20
- "typescript": "^4.5.3"
20
+ "typescript": "^4.7.4"
21
21
  },
22
22
  "publishConfig": {
23
23
  "registry": "https://registry.npmjs.org/",
24
24
  "access": "public"
25
25
  },
26
- "gitHead": "5167e57e90c50aa18c536856b29ebffff6061bd9"
26
+ "gitHead": "f95719f3f9a333c332fed909e82de60715076a4f"
27
27
  }
package/git2json.tsx DELETED
@@ -1,53 +0,0 @@
1
- import {cleanAuthor, Commit, createHeadRefValue, History, isTagRef, Reference, REFS_HEAD_KEY} from '@dotinc/ogre'
2
-
3
- const findRefs = (commit: Commit, refs: Map<string, Reference>) => {
4
- const list = []
5
- const headRef = refs.get(REFS_HEAD_KEY)
6
- for (const [key, ref] of refs.entries()) {
7
- if (ref.value === commit.hash) {
8
- if (isTagRef(key)) {
9
- list.push(`tag: ${ref.name}`)
10
- } else {
11
- list.push(ref.name)
12
- }
13
- // also check if HEAD is pointing to this ref
14
- if (headRef && headRef.value === createHeadRefValue(key)) {
15
- list.push(headRef.name)
16
- }
17
- }
18
- }
19
- return list
20
- }
21
- // format
22
- export const formatGit2Json = (history: History) => {
23
- const {commits, refs} = history
24
- return commits.reverse().map(c => {
25
- const [name, email] = cleanAuthor(c.author)
26
-
27
- return {
28
- 'refs': findRefs(c, refs),
29
- 'hash': c.hash,
30
- 'hashAbbrev': c.hash.substring(0, 8),
31
- 'tree': c.tree,
32
- 'treeAbbrev': c.tree.substring(0, 8),
33
- // FIXME there is only one parent at the moment on ogre
34
- 'parents': c.parent ? [c.parent] : [],
35
- 'parentsAbbrev': c.parent ? [c.parent.substring(0, 8)] : [],
36
- committer: {
37
- name,
38
- email,
39
- date: c.timestamp.getMilliseconds()
40
- },
41
- author: {
42
- name,
43
- email,
44
- timestamp: c.timestamp.getMilliseconds()
45
- },
46
- 'subject': c.message,
47
- 'body': '',
48
- 'notes': '',
49
- // MAYBE? map changes to {additions: number, deletions: number, file: string}
50
- 'stats': []
51
- }
52
- })
53
- }