Skip to content

Commit

Permalink
Merge pull request #427 from klein0r/master
Browse files Browse the repository at this point in the history
Allow custom theme, fixed scoped packages
  • Loading branch information
Apollon77 authored Dec 25, 2023
2 parents 7545333 + c934f05 commit c265f6c
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 28 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ Instantiate the server with Node-RED
### **WORK IN PROGRESS**
-->
## Changelog
### **WORK IN PROGRESS**

- (klein0r) Allow custom themes
- (klein0r) Fixed scoped node-red packages

### 5.0.2 (2023-12-14)

- (TheRealArthurDent) Fixed a fatal error when getting a non-existent value
Expand Down
4 changes: 3 additions & 1 deletion admin/i18n/de/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
"Appearance": "Darstellung",
"Editor type": "Editor-Typ",
"Environment": "Umgebung",
"Environment variables": "Umgebungsvariablen"
"Environment variables": "Umgebungsvariablen",
"Theme": "Thema",
"Apply a custom theme (if installed)": "Anwenden eines benutzerdefinierten Designs (falls installiert)"
}
4 changes: 3 additions & 1 deletion admin/i18n/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
"Appearance": "Appearance",
"Editor type": "Editor type",
"Environment": "Environment",
"Environment variables": "Environment variables"
"Environment variables": "Environment variables",
"Theme": "Theme",
"Apply a custom theme (if installed)": "Apply a custom theme (if installed)"
}
4 changes: 3 additions & 1 deletion admin/i18n/es/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
"Appearance": "Apariencia",
"Editor type": "Tipo de editor",
"Environment": "Ambiente",
"Environment variables": "Variables de entorno"
"Environment variables": "Variables de entorno",
"Theme": "Tema",
"Apply a custom theme (if installed)": "Aplicar un tema personalizado (si está instalado)"
}
4 changes: 3 additions & 1 deletion admin/i18n/fr/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
"Appearance": "Apparence",
"Editor type": "Type d'éditeur",
"Environment": "Environnement",
"Environment variables": "Variables d'environnement"
"Environment variables": "Variables d'environnement",
"Theme": "Thème",
"Apply a custom theme (if installed)": "Appliquer un thème personnalisé (si installé)"
}
4 changes: 3 additions & 1 deletion admin/i18n/it/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
"Appearance": "Aspetto",
"Editor type": "Tipo di editore",
"Environment": "Ambiente",
"Environment variables": "Variabili ambientali"
"Environment variables": "Variabili ambientali",
"Theme": "Tema",
"Apply a custom theme (if installed)": "Applicare un tema personalizzato (se installato)"
}
4 changes: 3 additions & 1 deletion admin/i18n/nl/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
"Appearance": "Verschijning",
"Editor type": "Editor-type",
"Environment": "Omgeving",
"Environment variables": "Omgevingsvariabelen"
"Environment variables": "Omgevingsvariabelen",
"Theme": "Thema",
"Apply a custom theme (if installed)": "Een aangepast thema toepassen (indien geïnstalleerd)"
}
4 changes: 3 additions & 1 deletion admin/i18n/pl/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
"Appearance": "Wygląd",
"Editor type": "Typ edytora",
"Environment": "Środowisko",
"Environment variables": "Zmienne środowiska"
"Environment variables": "Zmienne środowiska",
"Theme": "Temat",
"Apply a custom theme (if installed)": "Zastosuj niestandardowy motyw (jeśli jest zainstalowany)"
}
4 changes: 3 additions & 1 deletion admin/i18n/pt/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
"Appearance": "Aparência",
"Editor type": "Tipo de editor",
"Environment": "Ambiente",
"Environment variables": "Variáveis ​​ambientais"
"Environment variables": "Variáveis ​​ambientais",
"Theme": "Tema",
"Apply a custom theme (if installed)": "Aplicar um tema personalizado (se instalado)"
}
4 changes: 3 additions & 1 deletion admin/i18n/ru/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
"Appearance": "Появление",
"Editor type": "Тип редактора",
"Environment": "Среда",
"Environment variables": "Переменные среды"
"Environment variables": "Переменные среды",
"Theme": "Тема",
"Apply a custom theme (if installed)": "Применить собственную тему (если она установлена)"
}
4 changes: 3 additions & 1 deletion admin/i18n/uk/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
"Appearance": "Зовнішній вигляд",
"Editor type": "Тип редактора",
"Environment": "Навколишнє середовище",
"Environment variables": "Змінні середовища"
"Environment variables": "Змінні середовища",
"Theme": "Тема",
"Apply a custom theme (if installed)": "Застосувати спеціальну тему (якщо встановлено)"
}
4 changes: 3 additions & 1 deletion admin/i18n/zh-cn/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
"Appearance": "外貌",
"Editor type": "编辑器类型",
"Environment": "环境",
"Environment variables": "环境变量"
"Environment variables": "环境变量",
"Theme": "主题",
"Apply a custom theme (if installed)": "应用自定义主题(如果已安装)"
}
10 changes: 10 additions & 0 deletions admin/jsonConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,16 @@
"md": 4,
"lg": 4,
"label": "Editor type"
},
"theme": {
"newLine": true,
"type": "text",
"sm": 12,
"md": 4,
"lg": 4,
"label": "Theme",
"help": "Apply a custom theme (if installed)",
"helpLink": "https://github.com/node-red-contrib-themes/theme-collection"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"defaultPermissions": "",
"authExt": [],
"editor": "monaco",
"theme": "",
"envVars": []
},
"objects": [],
Expand Down
7 changes: 5 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class NodeRed extends utils.Adapter {

const envVars = {
...process.env,
...this.config.envVars.reduce((acc, v) => ({...acc, [v.name]: v.value || null}), {})
...this.config.envVars.reduce((acc, v) => ({ ...acc, [v.name]: v.value || null }), {})
};

this.redProcess = spawn('node', args, { env: envVars });
Expand All @@ -272,6 +272,8 @@ class NodeRed extends utils.Adapter {
} else if (data.includes('[warn]')) {
this.log.warn(`Node-RED: ${data}`);
} else if (data.includes('[info] [debug:')) {
this.log.debug(`Node-RED: ${data}`);
} else if (data.includes('[info]')) {
this.log.info(`Node-RED: ${data}`);
} else {
this.log.debug(`Node-RED: ${data}`);
Expand Down Expand Up @@ -448,7 +450,7 @@ class NodeRed extends utils.Adapter {
const hStatic = this.config.httpStatic ? '' : '// ';

const npms = this.additional
.filter(pack => !pack.startsWith('node-red-'))
.filter(pack => !pack.startsWith('node-red-') && !pack.startsWith('@node-red-'))
.map(pack => ` "${pack}": require('${dir}${pack}')`)
.join(',\n');

Expand Down Expand Up @@ -500,6 +502,7 @@ class NodeRed extends utils.Adapter {
lines[i] = this.setOption(lines[i], 'palletmanagerEnabled', this.config.palletmanagerEnabled);
lines[i] = this.setOption(lines[i], 'allowCreationOfForeignObjects', this.config.allowCreationOfForeignObjects);
lines[i] = this.setOption(lines[i], 'editor');
lines[i] = this.setOption(lines[i], 'theme');
}

const settingsPath = path.join(this.userDataDir, 'settings.js');
Expand Down
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@
"@types/chai": "^4.3.11",
"@types/chai-as-promised": "^7.1.8",
"@types/mocha": "^10.0.6",
"@types/node": "^20.10.4",
"@types/node": "^20.10.5",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^17.0.2",
"@types/sinon-chai": "^3.2.12",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"eslint": "^8.55.0",
"eslint": "^8.56.0",
"mocha": "^10.2.0",
"proxyquire": "^2.1.3",
"sinon": "^17.0.1",
Expand Down
2 changes: 1 addition & 1 deletion settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ module.exports = {
* See https://github.com/node-red-contrib-themes/theme-collection for
* a collection of themes to chose from.
*/
//theme: "",
theme: "'%%theme%%'",
palette: {
/** The following property can be used to order the categories in the editor
* palette. If a node's category is not in the list, the category will get
Expand Down

0 comments on commit c265f6c

Please sign in to comment.