Skip to content
This repository has been archived by the owner on Feb 14, 2025. It is now read-only.

Commit

Permalink
Prepare and fixes for v0.3.0 (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimdalen authored Dec 30, 2021
1 parent 1241ae5 commit 4a11f6d
Show file tree
Hide file tree
Showing 9 changed files with 269 additions and 116 deletions.
82 changes: 34 additions & 48 deletions .azext/changelog.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"publishDate": "2021-12-XX",
"publishDate": "2021-12-30",
"version": "0.3.0",
"changes": [
{
Expand Down Expand Up @@ -102,24 +102,40 @@
{
"publishDate": "2021-12-25",
"version": "0.2.1",
"modules": [
"changes": [
{
"name": "core",
"version": "0.2.1",
"changes": [
{
"type": "docs",
"description": "Updated NPM readme",
"pullRequest": 20
}
]
"type": "docs",
"description": "Updated NPM readme",
"pullRequest": 20
}
]
},
{
"publishDate": "2021-12-22",
"version": "0.2.0",
"notes": "This release introduces a new command (`azext readme`) to manage documentation. See [GitHub Documentation](https://github.com/joachimdalen/azext/blob/master/docs/readme/index.md) for more information.",
"changes": [
{
"type": "maint",
"description": "Split CLI and implementation in preparation for Node API",
"pullRequest": 6
},
{
"description": "Added more detailed documentation",
"type": "docs",
"pullRequest": 7
},
{
"type": "feature",
"description": "Add support for global options",
"pullRequest": 7
},
{
"type": "maint",
"description": "Forced path of configuration files to be in folder `.azext/`",
"pullRequest": 12
}
],
"modules": [
{
"name": "readme",
Expand Down Expand Up @@ -175,32 +191,6 @@
}
]
},
{
"name": "core",
"version": "0.2.0",
"changes": [
{
"type": "maint",
"description": "Split CLI and implementation in preparation for Node API",
"pullRequest": 6
},
{
"description": "Added more detailed documentation",
"type": "docs",
"pullRequest": 7
},
{
"type": "feature",
"description": "Add support for global options",
"pullRequest": 7
},
{
"type": "maint",
"description": "Forced path of configuration files to be in folder `.azext/`",
"pullRequest": 12
}
]
},
{
"name": "init",
"version": "0.2.0",
Expand All @@ -224,6 +214,13 @@
"publishDate": "2021-12-13",
"version": "0.0.1",
"summary": "Initial release of AzExt",
"changes": [
{
"type": "maint",
"description": "Setup CI and CD",
"pullRequest": 1
}
],
"modules": [
{
"name": "changelog",
Expand Down Expand Up @@ -254,17 +251,6 @@
"type": "feature"
}
]
},
{
"name": "core",
"version": "0.0.1",
"changes": [
{
"type": "maint",
"description": "Setup CI and CD",
"pullRequest": 1
}
]
}
]
}
Expand Down
84 changes: 40 additions & 44 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 0.3.0 (2021-12-XX)
## 0.3.0 (2021-12-30)

### 💬 Other (1)

Expand Down Expand Up @@ -37,6 +37,18 @@

## 0.2.2 (2021-12-26)

### 💬 Other (2)

#### `[email protected]`

- Refactor how cli parameters are set in the cli definition
- Pull Request: [GH#25 - Fix wrong option names being passed from cli to handler](https://github.com/joachimdalen/azext/pull/25)

#### `[email protected]`

- Refactor how cli parameters are set in the cli definition
- Pull Request: [GH#25 - Fix wrong option names being passed from cli to handler](https://github.com/joachimdalen/azext/pull/25)

### 🐛 Fixes (3)

#### `[email protected]`
Expand All @@ -54,26 +66,12 @@
- Issue: [GH#21 - Can not initialize in a new project](https://github.com/joachimdalen/azext/issues/21)
- Pull Request: [GH#26 - Fix not being able to initialize in a new project](https://github.com/joachimdalen/azext/pull/26)

### 💬 Other (2)

#### `[email protected]`

- Refactor how cli parameters are set in the cli definition
- Pull Request: [GH#25 - Fix wrong option names being passed from cli to handler](https://github.com/joachimdalen/azext/pull/25)

#### `[email protected]`

- Refactor how cli parameters are set in the cli definition
- Pull Request: [GH#25 - Fix wrong option names being passed from cli to handler](https://github.com/joachimdalen/azext/pull/25)

---

## 0.2.1 (2021-12-25)

### 📝 Documentation (1)

#### `[email protected]`

- Updated NPM readme
- Pull Request: [GH#20 - Fix readme for Npm](https://github.com/joachimdalen/azext/pull/20)

Expand All @@ -83,7 +81,26 @@

> This release introduces a new command (`azext readme`) to manage documentation. See [GitHub Documentation](https://github.com/joachimdalen/azext/blob/master/docs/readme/index.md) for more information.
### 🚀 Features (9)
### 🚀 Features (1)

- Add support for global options
- Pull Request: [GH#7 - Update documentation](https://github.com/joachimdalen/azext/pull/7)

### 📝 Documentation (1)

- Added more detailed documentation
- Pull Request: [GH#7 - Update documentation](https://github.com/joachimdalen/azext/pull/7)

### 🛠️ Maintenance (2)

- Split CLI and implementation in preparation for Node API
- Pull Request: [GH#6 - Refactor to support for usage from node](https://github.com/joachimdalen/azext/pull/6)
- Forced path of configuration files to be in folder `.azext/`
- Pull Request: [GH#12 - Refactoring and docs generation](https://github.com/joachimdalen/azext/pull/12)

## 📦 Module changes

### 🚀 Features (8)

#### `[email protected]`

Expand All @@ -107,11 +124,6 @@
- Issue: [GH#13 - Add command to populate changelog cache without generating it](https://github.com/joachimdalen/azext/issues/13)
- Pull Request: [GH#16 - Add command for refresh of changelog cache](https://github.com/joachimdalen/azext/pull/16)

#### `[email protected]`

- Add support for global options
- Pull Request: [GH#7 - Update documentation](https://github.com/joachimdalen/azext/pull/7)

#### `[email protected]`

- Add new command to create mapping file
Expand All @@ -130,28 +142,19 @@
- Issue: [GH#2 - Init command does not respect --root option](https://github.com/joachimdalen/azext/issues/2)
- Pull Request: [GH#6 - Refactor to support for usage from node](https://github.com/joachimdalen/azext/pull/6)

### 📝 Documentation (1)

#### `[email protected]`

- Added more detailed documentation
- Pull Request: [GH#7 - Update documentation](https://github.com/joachimdalen/azext/pull/7)

### 🛠️ Maintenance (2)

#### `[email protected]`

- Split CLI and implementation in preparation for Node API
- Pull Request: [GH#6 - Refactor to support for usage from node](https://github.com/joachimdalen/azext/pull/6)
- Forced path of configuration files to be in folder `.azext/`
- Pull Request: [GH#12 - Refactoring and docs generation](https://github.com/joachimdalen/azext/pull/12)

---

## 0.0.1 (2021-12-13)

Initial release of AzExt

### 🛠️ Maintenance (1)

- Setup CI and CD
- Pull Request: [GH#1 - Setup build and deployment pipeline](https://github.com/joachimdalen/azext/pull/1)

## 📦 Module changes

### 🚀 Features (3)

#### `[email protected]`
Expand All @@ -166,11 +169,4 @@ Initial release of AzExt

- Added config command

### 🛠️ Maintenance (1)

#### `[email protected]`

- Setup CI and CD
- Pull Request: [GH#1 - Setup build and deployment pipeline](https://github.com/joachimdalen/azext/pull/1)

---
11 changes: 10 additions & 1 deletion schemas/v1/changelog-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@
"description": "An explanation about the purpose of this instance.",
"default": {},
"additionalProperties": false,
"required": ["publishDate", "version", "modules"],

"required": ["publishDate", "version"],
"anyOf": [
{
"required": ["changes"]
},
{
"required": ["modules"]
}
],
"properties": {
"publishDate": {
"type": "string",
Expand Down
18 changes: 18 additions & 0 deletions src/core/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import ChangelogDefinition from '../modules/changelog/models/changelog-definition';
import GitHubIssue from '../modules/changelog/models/github-issue';
import GitHubPullRequest from '../modules/changelog/models/github-pull-request';

export const isNumber = (item: number | undefined): item is number => {
return !!item;
};

export const isIssue = (item: GitHubIssue | undefined): item is GitHubIssue => {
return !!item;
};
Expand All @@ -17,3 +19,19 @@ export const isPullRequest = (
): item is GitHubPullRequest => {
return !!item;
};

export const getChangesForDefinition = (def: ChangelogDefinition) => {
const moduleChanges = def.modules?.flatMap((x) => x.changes);

if (def.changes) {
if (moduleChanges) return [...def.changes, ...moduleChanges];
return [...def.changes];
}

if (moduleChanges !== undefined) return moduleChanges;

return [];
};
export const getChangesForAllDefinition = (def: ChangelogDefinition[]) => {
return def.flatMap((x) => getChangesForDefinition(x));
};
21 changes: 14 additions & 7 deletions src/modules/changelog/changelog-service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import chalk from 'chalk';

import { ActionResult } from '../../constants';
import { distinct, isIssue, isNumber, isPullRequest } from '../../core';
import {
distinct,
getChangesForAllDefinition,
isIssue,
isNumber,
isPullRequest
} from '../../core';
import ConfigProvider from '../../data-providers/config-provider';
import GitHub from '../../data-providers/github';
import {
Expand Down Expand Up @@ -133,8 +139,9 @@ class ChangelogService {
}

if (cache.issues) {
const issueIds = changelog
.flatMap((x) => x.modules.flatMap((x) => x.changes.map((x) => x.issue)))
const allModules = getChangesForAllDefinition(changelog);
const issueIds = allModules
.map((x) => x.issue)
.filter(isNumber)
.filter(distinct)
.filter((y) => !cache.issues?.some((x) => x.number === y));
Expand All @@ -154,10 +161,10 @@ class ChangelogService {
}

if (cache.pullRequests) {
const prIds = changelog
.flatMap((x) =>
x.modules.flatMap((x) => x.changes.map((x) => x.pullRequest))
)
const allModules = getChangesForAllDefinition(changelog);

const prIds = allModules
.map((x) => x.pullRequest)
.filter(isNumber)
.filter(distinct)
.filter((y) => !cache.pullRequests?.some((x) => x.number === y));
Expand Down
Loading

0 comments on commit 4a11f6d

Please sign in to comment.