Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions nodesource_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/bin/bash

# Logger Function
log() {
local message="$1"
local type="$2"
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
local color
local endcolor="\033[0m"

case "$type" in
"info") color="\033[38;5;79m" ;;
"success") color="\033[1;32m" ;;
"error") color="\033[1;31m" ;;
*) color="\033[1;34m" ;;
esac

echo -e "${color}${timestamp} - ${message}${endcolor}"
}

# Error handler function
handle_error() {
local exit_code=$1
local error_message="$2"
log "Error: $error_message (Exit Code: $exit_code)" "error"
exit $exit_code
}

# Function to check for command availability
command_exists() {
command -v "$1" &> /dev/null
}

check_os() {
if ! [ -f "/etc/debian_version" ]; then
echo "Error: This script is only supported on Debian-based systems."
exit 1
fi
}

# Function to Install the script pre-requisites
install_pre_reqs() {
log "Installing pre-requisites" "info"

# Run 'apt update'
if ! apt update -y; then
handle_error "$?" "Failed to run 'apt update'"
fi

# Run 'apt install'
if ! apt install -y apt-transport-https ca-certificates curl gnupg; then
handle_error "$?" "Failed to install packages"
fi

if ! mkdir -p /usr/share/keyrings; then
handle_error "$?" "Makes sure the path /usr/share/keyrings exist or run ' mkdir -p /usr/share/keyrings' with sudo"
fi

rm -f /usr/share/keyrings/nodesource.gpg || true
rm -f /etc/apt/sources.list.d/nodesource.list || true

# Run 'curl' and 'gpg' to download and import the NodeSource signing key
if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then
handle_error "$?" "Failed to download and import the NodeSource signing key"
fi

# Explicitly set the permissions to ensure the file is readable by all
if ! chmod 644 /usr/share/keyrings/nodesource.gpg; then
handle_error "$?" "Failed to set correct permissions on /usr/share/keyrings/nodesource.gpg"
fi
}

# Function to configure the Repo
configure_repo() {
local node_version=$1

arch=$(dpkg --print-architecture)
if [ "$arch" != "amd64" ] && [ "$arch" != "arm64" ] && [ "$arch" != "armhf" ]; then
handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported."
fi

echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null

# N|solid Config
echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nsolid > /dev/null
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nsolid > /dev/null

# Nodejs Config
echo "Package: nodejs" | tee /etc/apt/preferences.d/nodejs > /dev/null
echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null
echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null

# Run 'apt update'
if ! apt update -y; then
handle_error "$?" "Failed to run 'apt update'"
else
log "Repository configured successfully."
log "To install Node.js, run: apt install nodejs -y" "info"
log "You can use N|solid Runtime as a node.js alternative" "info"
log "To install N|solid Runtime, run: apt install nsolid -y \n" "success"
fi
}

# Define Node.js version
NODE_VERSION="22.x"

# Check OS
check_os

# Main execution
install_pre_reqs || handle_error $? "Failed installing pre-requisites"
configure_repo "$NODE_VERSION" || handle_error $? "Failed configuring repository"
9 changes: 7 additions & 2 deletions src/api/article/content-types/article/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
},
"site": {
"type": "enumeration",
"enum": ["dotnet", "cloud"],
"enum": [
"dotnet",
"cloud"
],
"required": true,
"default": "dotnet",
"pluginOptions": {
Expand All @@ -68,7 +71,9 @@
"type": "media",
"multiple": false,
"required": true,
"allowedTypes": ["images"],
"allowedTypes": [
"images"
],
"pluginOptions": {
"i18n": {
"localized": true
Expand Down
39 changes: 20 additions & 19 deletions src/api/page/content-types/page/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,60 +18,61 @@
"attributes": {
"title_website": {
"type": "string",
"required": true,
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"required": true
},
"description": {
"type": "text",
"required": true,
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"required": true
},
"components": {
"type": "dynamiczone",
"pluginOptions": {
"i18n": {
"localized": true
}
},
"components": [
"ui.text",
"ui.opsomming",
"ui.titel",
"ui.quote",
"ui.page-image",
"ui.artikelen",
"ui.directeuren"
],
"pluginOptions": {
"i18n": {
"localized": true
}
}
"ui.directeuren",
"ui.technology-radar"
]
},
"site": {
"type": "enumeration",
"enum": [
"cloud",
"dotnet"
],
"required": true,
"default": "dotnet",
"pluginOptions": {
"i18n": {
"localized": false
}
}
},
"required": true,
"default": "dotnet",
"enum": [
"cloud",
"dotnet"
]
},
"title_cms": {
"type": "string",
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string",
"required": true
},
"slug": {
Expand Down
3 changes: 3 additions & 0 deletions src/api/page/middlewares/page-populate.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ const populate = {
},
},
},
'ui.technology-radar': {
fields: ['title'],
},
},
},
};
Expand Down
67 changes: 67 additions & 0 deletions src/api/radar-item/content-types/radar-item/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"kind": "collectionType",
"collectionName": "radar_items",
"info": {
"singularName": "radar-item",
"pluralName": "radar-items",
"displayName": "Radar Item"
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"slug": {
"type": "uid",
"targetField": "title",
"required": true
},
"quadrant": {
"type": "enumeration",
"required": true,
"enum": [
"Technieken",
"Tools",
"Platformen",
"Talen & Frameworks"
]
},
"ring": {
"type": "enumeration",
"required": true,
"enum": [
"Adopt",
"Trial",
"Assess",
"Hold"
]
},
"title": {
"type": "string",
"required": true
},
"description": {
"type": "richtext",
"required": true
},
"pros": {
"type": "component",
"component": "elements.list-item",
"repeatable": true
},
"cons": {
"type": "component",
"component": "elements.list-item",
"repeatable": true
},
"conclusion": {
"type": "richtext"
},
"tags": {
"type": "relation",
"relation": "manyToMany",
"target": "api::tag.tag",
"inversedBy": "radar_items"
}
}
}
9 changes: 9 additions & 0 deletions src/api/radar-item/controllers/radar-item.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

/**
* radar-item controller
*/

const { createCoreController } = require('@strapi/strapi').factories;

module.exports = createCoreController('api::radar-item.radar-item');
9 changes: 9 additions & 0 deletions src/api/radar-item/routes/radar-item.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

/**
* radar-item router
*/

const { createCoreRouter } = require('@strapi/strapi').factories;

module.exports = createCoreRouter('api::radar-item.radar-item');
9 changes: 9 additions & 0 deletions src/api/radar-item/services/radar-item.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

/**
* radar-item service
*/

const { createCoreService } = require('@strapi/strapi').factories;

module.exports = createCoreService('api::radar-item.radar-item');
10 changes: 8 additions & 2 deletions src/api/tag/content-types/tag/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"description": ""
},
"options": {
"draftAndPublish": true,
"populateCreatorFields": true
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"title": {
"type": "string",
Expand All @@ -21,6 +21,12 @@
"relation": "manyToMany",
"target": "api::article.article",
"mappedBy": "tags"
},
"radar_items": {
"type": "relation",
"relation": "manyToMany",
"target": "api::radar-item.radar-item",
"mappedBy": "tags"
}
}
}
15 changes: 15 additions & 0 deletions src/components/ui/technology-radar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"collectionName": "components_ui_technology_radars",
"info": {
"displayName": "Technology Radar",
"icon": "globe"
},
"options": {},
"attributes": {
"title": {
"type": "string",
"required": true
}
},
"config": {}
}
12 changes: 12 additions & 0 deletions types/generated/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,17 @@ export interface UiTeam extends Struct.ComponentSchema {
};
}

export interface UiTechnologyRadar extends Struct.ComponentSchema {
collectionName: 'components_ui_technology_radars';
info: {
displayName: 'Technology Radar';
icon: 'globe';
};
attributes: {
title: Schema.Attribute.String & Schema.Attribute.Required;
};
}

export interface UiText extends Struct.ComponentSchema {
collectionName: 'components_ui_texts';
info: {
Expand Down Expand Up @@ -313,6 +324,7 @@ declare module '@strapi/strapi' {
'ui.page-image': UiPageImage;
'ui.quote': UiQuote;
'ui.team': UiTeam;
'ui.technology-radar': UiTechnologyRadar;
'ui.text': UiText;
'ui.titel': UiTitel;
}
Expand Down
Loading