@foss.global/codefeed 1.6.0 → 1.6.1

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.
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@foss.global/codefeed',
6
- version: '1.6.0',
7
- description: 'a module for creating feeds for code development'
6
+ version: '1.6.1',
7
+ description: 'The @foss.global/codefeed module is designed for generating feeds from Gitea repositories, enhancing development workflows by processing commit data and repository activities.'
8
8
  };
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx1QkFBdUI7SUFDN0IsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLGtEQUFrRDtDQUNoRSxDQUFBIn0=
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx1QkFBdUI7SUFDN0IsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLGlMQUFpTDtDQUMvTCxDQUFBIn0=
package/npmextra.json CHANGED
@@ -5,10 +5,23 @@
5
5
  "githost": "code.foss.global",
6
6
  "gitscope": "foss.global",
7
7
  "gitrepo": "codefeed",
8
- "description": "a module for creating feeds for code development",
8
+ "description": "The @foss.global/codefeed module is designed for generating feeds from Gitea repositories, enhancing development workflows by processing commit data and repository activities.",
9
9
  "npmPackagename": "@foss.global/codefeed",
10
10
  "license": "MIT",
11
- "projectDomain": "foss.global"
11
+ "projectDomain": "foss.global",
12
+ "keywords": [
13
+ "codefeed",
14
+ "Gitea",
15
+ "commits",
16
+ "changelog",
17
+ "repository",
18
+ "development tools",
19
+ "npm",
20
+ "module",
21
+ "code analysis",
22
+ "activity feed",
23
+ "version control"
24
+ ]
12
25
  }
13
26
  },
14
27
  "npmci": {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@foss.global/codefeed",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "private": false,
5
- "description": "a module for creating feeds for code development",
5
+ "description": "The @foss.global/codefeed module is designed for generating feeds from Gitea repositories, enhancing development workflows by processing commit data and repository activities.",
6
6
  "exports": {
7
7
  ".": "./dist_ts/index.js",
8
8
  "./interfaces": "./dist_ts/interfaces/index.js"
@@ -44,6 +44,19 @@
44
44
  "npmextra.json",
45
45
  "readme.md"
46
46
  ],
47
+ "keywords": [
48
+ "codefeed",
49
+ "Gitea",
50
+ "commits",
51
+ "changelog",
52
+ "repository",
53
+ "development tools",
54
+ "npm",
55
+ "module",
56
+ "code analysis",
57
+ "activity feed",
58
+ "version control"
59
+ ],
47
60
  "scripts": {
48
61
  "test": "(tstest test/ --web)",
49
62
  "build": "(tsbuild tsfolders --web --allowimplicitany)",
package/readme.md CHANGED
@@ -1,7 +1,130 @@
1
+ ```markdown
1
2
  # @foss.global/codefeed
2
3
 
3
- a module for creating feeds for code development
4
+ A module for creating feeds for code development.
4
5
 
5
- ## How to create the docs
6
+ ## Install
6
7
 
7
- To create docs run gitzone aidoc.
8
+ To install the `@foss.global/codefeed` package, you can run the following npm command in your project directory:
9
+
10
+ ```bash
11
+ npm install @foss.global/codefeed
12
+ ```
13
+
14
+ Ensure that you have a compatible version of Node.js installed and that your project is set up to support ECMAScript modules. The `@foss.global/codefeed` module uses ESM syntax.
15
+
16
+ ## Usage
17
+
18
+ The `@foss.global/codefeed` package is designed to help developers generate feeds for code developments, specifically targeting Gitea repositories. It fetches and processes commit data, changelogs, and repository activities for further analysis or visualization. Here, we'll delve into how you can utilize the different features of the `CodeFeed` class.
19
+
20
+ ### Setting Up CodeFeed
21
+
22
+ To get started, import the `CodeFeed` class from the module:
23
+
24
+ ```typescript
25
+ import { CodeFeed } from '@foss.global/codefeed';
26
+ ```
27
+
28
+ Then, create an instance of `CodeFeed`. You'll need the base URL of your Gitea instance and optionally an API token if your repositories require authentication:
29
+
30
+ ```typescript
31
+ const codeFeed = new CodeFeed('https://your-gitea-instance-url.com', 'your-api-token');
32
+ ```
33
+
34
+ The constructor can also accept a `lastRunTimestamp` which indicates the last time a sync was performed. If not provided, it defaults to 24 hours prior to the current time.
35
+
36
+ ### Fetching Commits
37
+
38
+ One of the core functionalities of CodeFeed is fetching commits from a Gitea instance. By calling `fetchAllCommitsFromInstance`, you can retrieve commits across multiple repositories:
39
+
40
+ ```typescript
41
+ (async () => {
42
+ try {
43
+ const commits = await codeFeed.fetchAllCommitsFromInstance();
44
+ console.log(commits);
45
+ } catch (error) {
46
+ console.error('An error occurred while fetching commits:', error);
47
+ }
48
+ })();
49
+ ```
50
+
51
+ This method scans all organizations and repositories, filters commits tagged within the last 24 hours, and enriches them with metadata like changelogs or npm publication status.
52
+
53
+ Each commit object in the resulting array conforms to the `ICommitResult` interface, containing details such as:
54
+ - `baseUrl`
55
+ - `org`
56
+ - `repo`
57
+ - `timestamp`
58
+ - `hash`
59
+ - `commitMessage`
60
+ - `tagged` (boolean)
61
+ - `publishedOnNpm` (boolean)
62
+ - `prettyAgoTime` (human-readable relative time)
63
+ - `changelog` (text from the `changelog.md` associated with a commit)
64
+
65
+ ### Understanding the Data Fetch Process
66
+
67
+ #### Fetching Organizations
68
+
69
+ The `fetchAllOrganizations` method collects all organizations within the Gitea instance:
70
+
71
+ ```typescript
72
+ const organizations = await codeFeed.fetchAllOrganizations();
73
+ console.log('Organizations:', organizations);
74
+ ```
75
+
76
+ This method interacts with the Gitea API to pull organization names, aiding further requests that require organization context.
77
+
78
+ #### Fetching Repositories
79
+
80
+ Repositories under these organizations can be retrieved using `fetchAllRepositories`:
81
+
82
+ ```typescript
83
+ const repositories = await codeFeed.fetchAllRepositories();
84
+ console.log('Repositories:', repositories);
85
+ ```
86
+
87
+ Here, filtering by organization can help narrow down the scope further when dealing with large instances.
88
+
89
+ #### Fetching Tags and Commits
90
+
91
+ To handle repository-specific details, use:
92
+
93
+ - `fetchTags(owner: string, repo: string)`: Appropriately handles paginated tag data within a repository.
94
+
95
+ - `fetchRecentCommitsForRepo(owner: string, repo: string)`: Gathers commit data specific to the past 24 hours for a given repository.
96
+
97
+ ```typescript
98
+ const tags = await codeFeed.fetchTags('orgName', 'repoName');
99
+ const recentCommits = await codeFeed.fetchRecentCommitsForRepo('orgName', 'repoName');
100
+
101
+ console.log('Tags:', tags);
102
+ console.log('Recent Commits:', recentCommits);
103
+ ```
104
+
105
+ ### Changelog Integration
106
+
107
+ Loading changelog content from a repository is integrated into the flow with `loadChangelogFromRepo`. This can be accessed when processing specific commits:
108
+
109
+ ```typescript
110
+ await codeFeed.loadChangelogFromRepo('org', 'repo');
111
+ const changelog = codeFeed.getChangelogForVersion('1.0.0');
112
+ console.log('Changelog for version 1.0.0:', changelog);
113
+ ```
114
+
115
+ ### Reacting to Repository Activity
116
+
117
+ The method `hasNewActivity` checks for recent changes within an organization or a repository. This is particularly useful for setting up alerting systems or continuous integration triggers:
118
+
119
+ ```typescript
120
+ const hasActivity = await codeFeed.hasNewActivity({ orgName: 'orgName', repoName: 'repoName' });
121
+ console.log('New activity detected:', hasActivity);
122
+ ```
123
+
124
+ ### Conclusion
125
+
126
+ The `@foss.global/codefeed` module provides robust capabilities for extracting and managing feed data related to code developments in Gitea environments. Through systematic setup and leveraging API-driven methods, it becomes a valuable tool for developers aiming to keep track of software progress and changes efficiently. The integration hooks like changelog and npm verification further enrich its utility, offering consolidated insights into each commit's journey from codebase to published package.
127
+
128
+ Explore integrating these capabilities into your development workflows to enhance tracking, deployment pipelines, or analytics systems within your projects. Remember to always handle API tokens securely and adhere to best practices when managing access to repository resources. Stay updated on any changes or enhancements to this module for further feature exposures or bug fixes. Happy coding!
129
+ ```
130
+ undefined
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@foss.global/codefeed',
6
- version: '1.6.0',
7
- description: 'a module for creating feeds for code development'
6
+ version: '1.6.1',
7
+ description: 'The @foss.global/codefeed module is designed for generating feeds from Gitea repositories, enhancing development workflows by processing commit data and repository activities.'
8
8
  }