Skip to content

Commit b1ab8f8

Browse files
committed
chore: Add BB id to logo file name to assure uniqueness
1 parent 35ff598 commit b1ab8f8

13 files changed

+44
-31
lines changed

index.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ function findBuildingBlockLogo(buildingBlockDir) {
9595

9696
files.forEach((file) => {
9797
if (file.endsWith(".png") || file.endsWith(".svg")) {
98+
const { id, platform } = getIdAndPlatform(buildingBlockDir);
9899
const sourcePath = path.join(buildingBlockDir, file);
99-
const destinationPath = path.join(assetsDir, path.basename(file));
100+
const destinationPath = path.join(assetsDir, `${id}${path.extname(file)}`);
100101

101102
fs.mkdirSync(assetsDir, { recursive: true });
102103
fs.copyFileSync(sourcePath, destinationPath);
@@ -112,12 +113,10 @@ function findBuildingBlockLogo(buildingBlockDir) {
112113
* Parse README.md and extract relevant data
113114
*/
114115
function parseReadme(filePath) {
116+
const buildingBlockDir = path.dirname(filePath);
115117
const content = fs.readFileSync(filePath, "utf-8");
116118
const { data, content: body } = matter(content);
117-
const relativePath = filePath.replace(process.cwd(), "").replace(/\\/g, "/");
118-
const pathParts = relativePath.split(path.sep).filter(Boolean);
119-
const id = pathParts.slice(1, pathParts.length - 2).join("-");
120-
const platform = pathParts.length > 1 ? pathParts[1] : "unknown";
119+
const { id, platform } = getIdAndPlatform(buildingBlockDir);
121120
const howToMatch = body.match(/## How to Use([\s\S]*?)(##|$)/);
122121
const resourcesMatch = body.match(/## Resources([\s\S]*)/);
123122
const inputsMatch = body.match(/## Inputs([\s\S]*?)## Outputs/);
@@ -140,8 +139,9 @@ function parseReadme(filePath) {
140139
const githubUrls = getGithubRemoteUrls(filePath);
141140
console.log(`🔗 GitHub remote URLs: ${JSON.stringify(githubUrls)}`);
142141
console.log(`🔗 File path: ${filePath}`);
142+
console.log('ID=' + id);
143143

144-
const buildingBlockLogoPath = findBuildingBlockLogo(path.dirname(filePath));
144+
const buildingBlockLogoPath = findBuildingBlockLogo(buildingBlockDir);
145145

146146
return {
147147
id: id,
@@ -156,6 +156,21 @@ function parseReadme(filePath) {
156156
};
157157
}
158158

159+
/**
160+
* This returns the id and platform type from the file path.
161+
*
162+
* @param filePath The buildingblock directory
163+
*/
164+
function getIdAndPlatform(filePath) {
165+
const relativePath = filePath.replace(process.cwd(), "").replace(/\\/g, "/");
166+
const pathParts = relativePath.split(path.sep).filter(Boolean);
167+
// pathParts = [modules, <platform>, <module-name>, buildingblock]
168+
const id = pathParts.slice(1, pathParts.length - 1).join("-");
169+
const platform = pathParts.length > 1 ? pathParts[1] : "unknown";
170+
171+
return { id, platform };
172+
}
173+
159174
const repoRoot = path.resolve(__dirname, 'modules');
160175
const platformLogos = findPlatformLogos();
161176
const readmeFiles = findReadmes(repoRoot);

website/angular.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
"cli": {
119119
"schematicCollections": [
120120
"@angular-eslint/schematics"
121-
]
121+
],
122+
"analytics": false
122123
}
123124
}
Binary file not shown.
Binary file not shown.

website/public/assets/building-block-logos/git-repo.svg

Lines changed: 0 additions & 2 deletions
This file was deleted.
Binary file not shown.

website/public/assets/building-block-logos/key-vault.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

website/public/assets/templates.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
{
44
"id": "aks-github-connector",
55
"platformType": "aks",
6-
"logo": "assets/building-block-logos/gc-aks.png",
6+
"logo": "assets/building-block-logos/aks-github-connector.png",
77
"githubUrls": {
8-
"ssh": "https://github.com/meshcloud/meshstack-hub.git",
8+
"ssh": "git@github.com:meshcloud/meshstack-hub.git",
99
"https": "https://github.com/meshcloud/meshstack-hub/tree/main/modules/aks/github-connector/buildingblock"
1010
},
1111
"name": "GitHub Actions Integration with AKS",
1212
"supportedPlatforms": [
1313
"aks"
1414
],
15-
"description": "Provides an automated CI/CD pipeline using GitHub Actions to deploy applications to Azure Kubernetes Service (AKS). It enables application teams to build, test, and deploy containerized applications seamlessly while following best practices for security and scalability.\n",
15+
"description": "CI/CD pipeline using GitHub Actions for secure, scalable AKS deployment.\n",
1616
"howToUse": null,
1717
"resources": [
1818
{
@@ -47,16 +47,16 @@
4747
{
4848
"id": "aks-postgresql",
4949
"platformType": "aks",
50-
"logo": "assets/building-block-logos/postgresql_logo.png",
50+
"logo": "assets/building-block-logos/aks-postgresql.png",
5151
"githubUrls": {
52-
"ssh": "https://github.com/meshcloud/meshstack-hub.git",
52+
"ssh": "git@github.com:meshcloud/meshstack-hub.git",
5353
"https": "https://github.com/meshcloud/meshstack-hub/tree/main/modules/aks/postgresql/buildingblock"
5454
},
5555
"name": "PostgreSQL Integration with AKS",
5656
"supportedPlatforms": [
5757
"aks"
5858
],
59-
"description": "Provides an Azure Database for PostgreSQL instance integrated with Azure Kubernetes Service (AKS). It enables application teams to use a fully managed PostgreSQL database while ensuring seamless connectivity and security with their AKS workloads.\n",
59+
"description": "Provides managed PostgreSQL with direct integration to AKS for secure access.\n",
6060
"howToUse": null,
6161
"resources": [
6262
{
@@ -128,16 +128,16 @@
128128
{
129129
"id": "aws-s3_bucket",
130130
"platformType": "aws",
131-
"logo": "assets/building-block-logos/s3_bucket.png",
131+
"logo": "assets/building-block-logos/aws-s3_bucket.png",
132132
"githubUrls": {
133-
"ssh": "https://github.com/meshcloud/meshstack-hub.git",
133+
"ssh": "git@github.com:meshcloud/meshstack-hub.git",
134134
"https": "https://github.com/meshcloud/meshstack-hub/tree/main/modules/aws/s3_bucket/buildingblock"
135135
},
136136
"name": "AWS S3 Bucket",
137137
"supportedPlatforms": [
138138
"aws"
139139
],
140-
"description": "Provides an AWS S3 bucket for object storage. It enables application teams to store and retrieve data securely with configurable access controls, lifecycle policies, and encryption.\n",
140+
"description": "Provides an AWS S3 bucket for object storage with access controls, lifecycle policies, and encryption.\n",
141141
"howToUse": null,
142142
"resources": [
143143
{
@@ -233,16 +233,16 @@
233233
{
234234
"id": "azure-budget-alert",
235235
"platformType": "azure",
236-
"logo": "assets/building-block-logos/budget_logo.png",
236+
"logo": "assets/building-block-logos/azure-budget-alert.png",
237237
"githubUrls": {
238-
"ssh": "https://github.com/meshcloud/meshstack-hub.git",
238+
"ssh": "git@github.com:meshcloud/meshstack-hub.git",
239239
"https": "https://github.com/meshcloud/meshstack-hub/tree/main/modules/azure/budget-alert/buildingblock"
240240
},
241241
"name": "Azure Subscription Budget Alert",
242242
"supportedPlatforms": [
243243
"azure"
244244
],
245-
"description": "Provides a budget alert for an Azure subscription. This module helps teams monitor cloud spending and avoid unexpected cost overruns by setting up automated budget alerts.\n",
245+
"description": "Sets up budget alerts for an Azure subscription to monitor spending and prevent cost overruns.\n",
246246
"howToUse": null,
247247
"resources": [
248248
{
@@ -338,16 +338,16 @@
338338
{
339339
"id": "azure-key-vault",
340340
"platformType": "azure",
341-
"logo": "assets/building-block-logos/key-vault.svg",
341+
"logo": "assets/building-block-logos/azure-key-vault.png",
342342
"githubUrls": {
343-
"ssh": "https://github.com/meshcloud/meshstack-hub.git",
343+
"ssh": "git@github.com:meshcloud/meshstack-hub.git",
344344
"https": "https://github.com/meshcloud/meshstack-hub/tree/main/modules/azure/key-vault/buildingblock"
345345
},
346346
"name": "Azure Key Vault",
347347
"supportedPlatforms": [
348348
"azure"
349349
],
350-
"description": "Provides an Azure Key Vault for secure storage and management of secrets, keys, and certificates. It helps application teams protect sensitive data, manage access control, and integrate securely with their applications.\n",
350+
"description": "Provides an Azure Key Vault to securely store and manage secrets, keys, and certificates with access control.\n",
351351
"howToUse": null,
352352
"resources": [
353353
{
@@ -467,16 +467,16 @@
467467
{
468468
"id": "azure-postgresql",
469469
"platformType": "azure",
470-
"logo": "assets/building-block-logos/postgres_logo.png",
470+
"logo": "assets/building-block-logos/azure-postgresql.png",
471471
"githubUrls": {
472-
"ssh": "https://github.com/meshcloud/meshstack-hub.git",
472+
"ssh": "git@github.com:meshcloud/meshstack-hub.git",
473473
"https": "https://github.com/meshcloud/meshstack-hub/tree/main/modules/azure/postgresql/buildingblock"
474474
},
475475
"name": "Azure PostgreSQL Deployment",
476476
"supportedPlatforms": [
477477
"azure"
478478
],
479-
"description": "Provides an Azure Database for PostgreSQL instance, offering a fully managed, scalable, and secure relational database service. It supports enterprise-grade PostgreSQL workloads with automated maintenance, high availability, and built-in security features.\n",
479+
"description": "Provides a managed Azure PostgreSQL database with scalability, security, and high availability.\n",
480480
"howToUse": null,
481481
"resources": [
482482
{
@@ -728,16 +728,16 @@
728728
{
729729
"id": "github-repository",
730730
"platformType": "github",
731-
"logo": "assets/building-block-logos/git-repo.svg",
731+
"logo": "assets/building-block-logos/github-repository.png",
732732
"githubUrls": {
733-
"ssh": "https://github.com/meshcloud/meshstack-hub.git",
733+
"ssh": "git@github.com:meshcloud/meshstack-hub.git",
734734
"https": "https://github.com/meshcloud/meshstack-hub/tree/main/modules/github/repository/buildingblock"
735735
},
736736
"name": "GitHub Repository Creation",
737737
"supportedPlatforms": [
738738
"github"
739739
],
740-
"description": "Provides an automated way to create and manage GitHub repositories for application teams. It ensures repositories are set up with predefined configurations, including access control, branch protection rules, and compliance settings.\n",
740+
"description": "Automates GitHub repository setup with predefined configurations and access control.\n",
741741
"howToUse": null,
742742
"resources": [
743743
{

0 commit comments

Comments
 (0)