From 51f657d2c5353c8de6c70a4ffd09d40ef488ac11 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 2 Apr 2023 12:22:06 +1200 Subject: [PATCH 01/23] Add CM Themes to build folder --- scripts/buildHomebrew.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/buildHomebrew.js b/scripts/buildHomebrew.js index 96ce3fded..8646ab0ff 100644 --- a/scripts/buildHomebrew.js +++ b/scripts/buildHomebrew.js @@ -99,6 +99,10 @@ fs.emptyDirSync('./build'); await fs.copy('./themes/assets', './build/assets'); await fs.copy('./client/icons', './build/icons'); + //v==---------------------------MOVE CM EDITOR THEMES -----------------------------==v// + + await fs.copy('./node_modules/codemirror/theme', './build/homebrew/cm-themes'); + //v==----------------------------- BUNDLE PACKAGES --------------------------------==v// const bundles = await pack('./client/homebrew/homebrew.jsx', { From 7dd1368c09ec0339ab10004b7d2cee943414d812 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 2 Apr 2023 12:53:26 +1200 Subject: [PATCH 02/23] Add editorTheme to editor.jsx and downstream --- client/homebrew/editor/editor.jsx | 23 +++++++++++-- .../homebrew/editor/snippetbar/snippetbar.jsx | 32 +++++++++++++------ shared/naturalcrit/codeEditor/codeEditor.jsx | 8 ++++- 3 files changed, 49 insertions(+), 14 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 58e84e4fc..9cb8e0df9 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -34,12 +34,14 @@ const Editor = createClass({ onMetaChange : ()=>{}, reportError : ()=>{}, - renderer : 'legacy' + editorTheme : 'default', + renderer : 'legacy' }; }, getInitialState : function() { return { - view : 'text' //'text', 'style', 'meta' + editorTheme : this.props.editorTheme, + view : 'text' //'text', 'style', 'meta' }; }, @@ -255,25 +257,38 @@ const Editor = createClass({ this.refs.codeEditor?.updateSize(); }, + updateEditorTheme : function(newTheme){ + this.setState({ + editorTheme : newTheme + }); + }, + //Called by CodeEditor after document switch, so Snippetbar can refresh UndoHistory rerenderParent : function (){ this.forceUpdate(); }, + renderEditorCSSLink : function(){ + return ; + }, + renderEditor : function(){ if(this.isText()){ return <> + {this.renderEditorCSSLink()} ; } if(this.isStyle()){ return <> + {this.renderEditorCSSLink()} ; } @@ -323,7 +339,8 @@ const Editor = createClass({ theme={this.props.brew.theme} undo={this.undo} redo={this.redo} - historySize={this.historySize()} /> + historySize={this.historySize()} + updateEditorTheme={this.updateEditorTheme} /> {this.renderEditor()} diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index cfd2d5e91..b8a09b906 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -24,16 +24,17 @@ const Snippetbar = createClass({ displayName : 'SnippetBar', getDefaultProps : function() { return { - brew : {}, - view : 'text', - onViewChange : ()=>{}, - onInject : ()=>{}, - onToggle : ()=>{}, - showEditButtons : true, - renderer : 'legacy', - undo : ()=>{}, - redo : ()=>{}, - historySize : ()=>{} + brew : {}, + view : 'text', + onViewChange : ()=>{}, + onInject : ()=>{}, + onToggle : ()=>{}, + showEditButtons : true, + renderer : 'legacy', + undo : ()=>{}, + redo : ()=>{}, + historySize : ()=>{}, + updateEditorTheme : ()=>{} }; }, @@ -94,6 +95,13 @@ const Snippetbar = createClass({ this.props.onInject(injectedText); }, + selectTheme : function(){ + console.log('select theme'); + const editorTheme = window.prompt('Enter theme name:', 'default'); + if(!editorTheme) return; + this.props.updateEditorTheme(editorTheme); + }, + renderSnippetGroups : function(){ const snippets = this.state.snippets.filter((snippetGroup)=>snippetGroup.view === this.props.view); @@ -122,6 +130,10 @@ const Snippetbar = createClass({
+
+ +
this.props.onViewChange('text')}> diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 245317910..244784f8e 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -49,7 +49,8 @@ const CodeEditor = createClass({ value : '', wrap : true, onChange : ()=>{}, - enableFolding : true + enableFolding : true, + editorTheme : 'default' }; }, @@ -91,6 +92,10 @@ const CodeEditor = createClass({ } else { this.codeMirror.setOption('foldOptions', false); } + + if(prevProps.editorTheme !== this.props.editorTheme){ + this.codeMirror.setOption('theme', this.props.editorTheme); + } }, buildEditor : function() { @@ -156,6 +161,7 @@ const CodeEditor = createClass({ autoCloseTags : true, styleActiveLine : true, showTrailingSpace : false, + theme : this.props.editorTheme // specialChars : / /, // specialCharPlaceholder : function(char) { // const el = document.createElement('span'); From b2546d908ae6cafcd573e273b5664d74313c41f8 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 2 Apr 2023 13:19:43 +1200 Subject: [PATCH 03/23] Shift CSS link to CodeEditor render --- client/homebrew/editor/editor.jsx | 6 ------ shared/naturalcrit/codeEditor/codeEditor.jsx | 5 ++++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 9cb8e0df9..0e5676364 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -268,14 +268,9 @@ const Editor = createClass({ this.forceUpdate(); }, - renderEditorCSSLink : function(){ - return ; - }, - renderEditor : function(){ if(this.isText()){ return <> - {this.renderEditorCSSLink()} - {this.renderEditorCSSLink()} ; + return <> + +
+ ; } }); From da6fcb297a009d323a67ba5fbfb9dfb03a46ad43 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 2 Apr 2023 15:17:30 +1200 Subject: [PATCH 04/23] Compile list of available themes during build --- scripts/buildHomebrew.js | 14 ++++++ themes/codeMirror/editorThemes.json | 68 +++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 themes/codeMirror/editorThemes.json diff --git a/scripts/buildHomebrew.js b/scripts/buildHomebrew.js index 8646ab0ff..2255ca69e 100644 --- a/scripts/buildHomebrew.js +++ b/scripts/buildHomebrew.js @@ -101,7 +101,21 @@ fs.emptyDirSync('./build'); //v==---------------------------MOVE CM EDITOR THEMES -----------------------------==v// + editorThemeFiles = fs.readdirSync('./node_modules/codemirror/theme'); + + const editorThemeFile = './themes/codeMirror/editorThemes.json'; + if(fs.existsSync(editorThemeFile)) fs.rmSync(editorThemeFile); + const stream = fs.createWriteStream(editorThemeFile, { flags: 'a' }); + stream.write('[\n'); + + for (themeFile of editorThemeFiles) { + stream.write(`"${themeFile.slice(0, -4)}",\n`); + } + stream.write('"default"\n]\n'); + stream.end(); + await fs.copy('./node_modules/codemirror/theme', './build/homebrew/cm-themes'); + // await fs.copy('./themes/codeMirror', './build/themes/codeMirror'); //v==----------------------------- BUNDLE PACKAGES --------------------------------==v// diff --git a/themes/codeMirror/editorThemes.json b/themes/codeMirror/editorThemes.json new file mode 100644 index 000000000..c94cd29cf --- /dev/null +++ b/themes/codeMirror/editorThemes.json @@ -0,0 +1,68 @@ +[ +"3024-day", +"3024-night", +"abbott", +"abcdef", +"ambiance-mobile", +"ambiance", +"ayu-dark", +"ayu-mirage", +"base16-dark", +"base16-light", +"bespin", +"blackboard", +"cobalt", +"colorforth", +"darcula", +"dracula", +"duotone-dark", +"duotone-light", +"eclipse", +"elegant", +"erlang-dark", +"gruvbox-dark", +"hopscotch", +"icecoder", +"idea", +"isotope", +"juejin", +"lesser-dark", +"liquibyte", +"lucario", +"material-darker", +"material-ocean", +"material-palenight", +"material", +"mbo", +"mdn-like", +"midnight", +"monokai", +"moxer", +"neat", +"neo", +"night", +"nord", +"oceanic-next", +"panda-syntax", +"paraiso-dark", +"paraiso-light", +"pastel-on-dark", +"railscasts", +"rubyblue", +"seti", +"shadowfox", +"solarized", +"ssms", +"the-matrix", +"tomorrow-night-bright", +"tomorrow-night-eighties", +"ttcn", +"twilight", +"vibrant-ink", +"xq-dark", +"xq-light", +"yeti", +"yonce", +"zenburn", +"default" +] From 977cbeed43de60adbd3d4ea25cb849ed030b6e9c Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 2 Apr 2023 15:17:44 +1200 Subject: [PATCH 05/23] Load available CM themes to global config --- server/app.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/app.js b/server/app.js index 5b153d115..0f56ee52a 100644 --- a/server/app.js +++ b/server/app.js @@ -17,6 +17,8 @@ const asyncHandler = require('express-async-handler'); const { DEFAULT_BREW } = require('./brewDefaults.js'); +const codeMirrorThemes = require('../themes/codeMirror/editorThemes.json'); + const splitTextStyleAndMetadata = (brew)=>{ brew.text = brew.text.replaceAll('\r\n', '\n'); if(brew.text.startsWith('```metadata')) { @@ -419,9 +421,10 @@ app.use(asyncHandler(async (req, res, next)=>{ // Create configuration object const configuration = { - local : isLocalEnvironment, - publicUrl : config.get('publicUrl') ?? '', - environment : nodeEnv + local : isLocalEnvironment, + publicUrl : config.get('publicUrl') ?? '', + environment : nodeEnv, + codeMirrorThemes : codeMirrorThemes }; const props = { version : require('./../package.json').version, From 5e9b451e293cc5fa8ce1c16a5fa18983d47f192d Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 2 Apr 2023 16:17:50 +1200 Subject: [PATCH 06/23] Pass current editor theme to SnippetBar as prop --- client/homebrew/editor/editor.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 0e5676364..979e8f485 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -334,6 +334,7 @@ const Editor = createClass({ undo={this.undo} redo={this.redo} historySize={this.historySize()} + currentEditorTheme={this.state.editorTheme} updateEditorTheme={this.updateEditorTheme} /> {this.renderEditor()} From dc55880544dd9e3165727705127ecc1b2f43aa15 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 2 Apr 2023 16:42:45 +1200 Subject: [PATCH 07/23] Initial theme selector functionality --- .../homebrew/editor/snippetbar/snippetbar.jsx | 36 ++++++++++++++++--- .../editor/snippetbar/snippetbar.less | 21 +++++++++++ 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index b8a09b906..7e866cd5b 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -40,8 +40,9 @@ const Snippetbar = createClass({ getInitialState : function() { return { - renderer : this.props.renderer, - snippets : [] + renderer : this.props.renderer, + themeSelector : false, + snippets : [] }; }, @@ -95,13 +96,38 @@ const Snippetbar = createClass({ this.props.onInject(injectedText); }, + toggleThemeSelector : function(){ + this.setState({ + themeSelector : !this.state.themeSelector + }); + }, + selectTheme : function(){ console.log('select theme'); + console.log(global.config); const editorTheme = window.prompt('Enter theme name:', 'default'); if(!editorTheme) return; this.props.updateEditorTheme(editorTheme); }, + changeTheme : function(e){ + this.props.updateEditorTheme(e.target.value); + + this.setState({ + showThemeSelector : false, + }); + }, + + renderThemeSelector : function(){ + return
+ +
; + }, + renderSnippetGroups : function(){ const snippets = this.state.snippets.filter((snippetGroup)=>snippetGroup.view === this.props.view); @@ -130,10 +156,12 @@ const Snippetbar = createClass({
-
+
+ {this.state.themeSelector && this.renderThemeSelector()} +
this.props.onViewChange('text')}> diff --git a/client/homebrew/editor/snippetbar/snippetbar.less b/client/homebrew/editor/snippetbar/snippetbar.less index cb24da105..4fd38fc67 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.less +++ b/client/homebrew/editor/snippetbar/snippetbar.less @@ -46,6 +46,15 @@ color : black; } } + &.editorTheme{ + .tooltipLeft('Editor Themes'); + font-size : 0.75em; + color : black; + &.active{ + color : white; + background-color: black; + } + } &.divider { background: linear-gradient(#000, #000) no-repeat center/1px 100%; width: 5px; @@ -54,6 +63,18 @@ } } } + .themeSelector{ + position: absolute; + left: -65px; + top: 30px; + z-index: 999; + width: 170px; + background-color: black; + border-radius: 5px; + &>select{ + width: auto; + } + } } .snippetBarButton{ height : @menuHeight; From b28e183f95b0fbd17a0ddc155606fcfb6fab6eec Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 2 Apr 2023 16:53:30 +1200 Subject: [PATCH 08/23] Remove obsolete dev function --- client/homebrew/editor/snippetbar/snippetbar.jsx | 8 -------- 1 file changed, 8 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 7e866cd5b..d5c2e8c7a 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -102,14 +102,6 @@ const Snippetbar = createClass({ }); }, - selectTheme : function(){ - console.log('select theme'); - console.log(global.config); - const editorTheme = window.prompt('Enter theme name:', 'default'); - if(!editorTheme) return; - this.props.updateEditorTheme(editorTheme); - }, - changeTheme : function(e){ this.props.updateEditorTheme(e.target.value); From a86c7287104114141bc2281e839c8bb695d25ccb Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 2 Apr 2023 16:53:41 +1200 Subject: [PATCH 09/23] Remove obsolete styling --- client/homebrew/editor/snippetbar/snippetbar.less | 3 --- 1 file changed, 3 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.less b/client/homebrew/editor/snippetbar/snippetbar.less index 4fd38fc67..ed2dcebce 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.less +++ b/client/homebrew/editor/snippetbar/snippetbar.less @@ -71,9 +71,6 @@ width: 170px; background-color: black; border-radius: 5px; - &>select{ - width: auto; - } } } .snippetBarButton{ From c660f87dfff14af4d01fa9dafa9e0386ba43cc82 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 2 Apr 2023 17:57:11 +1200 Subject: [PATCH 10/23] Load from & save to local storage --- client/homebrew/editor/editor.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 979e8f485..f46b8f3ba 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -10,6 +10,8 @@ const CodeEditor = require('naturalcrit/codeEditor/codeEditor.jsx'); const SnippetBar = require('./snippetbar/snippetbar.jsx'); const MetadataEditor = require('./metadataEditor/metadataEditor.jsx'); +const EDITOR_THEME_KEY = 'HOMEBREWERY-EDITOR-THEME'; + const SNIPPETBAR_HEIGHT = 25; const DEFAULT_STYLE_TEXT = dedent` /*=======--- Example CSS styling ---=======*/ @@ -53,6 +55,13 @@ const Editor = createClass({ this.updateEditorSize(); this.highlightCustomMarkdown(); window.addEventListener('resize', this.updateEditorSize); + + const editorTheme = window.localStorage.getItem(EDITOR_THEME_KEY); + if(editorTheme) { + this.setState({ + editorTheme : editorTheme + }); + } }, componentWillUnmount : function() { @@ -258,6 +267,7 @@ const Editor = createClass({ }, updateEditorTheme : function(newTheme){ + window.localStorage.setItem(EDITOR_THEME_KEY, newTheme); this.setState({ editorTheme : newTheme }); From c8df449aac9ccd19818725d6aa516de4de28c3db Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 12 Jun 2023 19:52:13 +1200 Subject: [PATCH 11/23] Style custom blocks in editor on dark themes --- client/homebrew/editor/editor.less | 2 +- themes/codeMirror/customEditorStyles.less | 56 +++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 themes/codeMirror/customEditorStyles.less diff --git a/client/homebrew/editor/editor.less b/client/homebrew/editor/editor.less index 86e523a13..db88b5b0f 100644 --- a/client/homebrew/editor/editor.less +++ b/client/homebrew/editor/editor.less @@ -1,4 +1,4 @@ - +@import 'themes/codeMirror/customEditorStyles.less'; .editor{ position : relative; width : 100%; diff --git a/themes/codeMirror/customEditorStyles.less b/themes/codeMirror/customEditorStyles.less new file mode 100644 index 000000000..39bad9504 --- /dev/null +++ b/themes/codeMirror/customEditorStyles.less @@ -0,0 +1,56 @@ +.codeEditor .CodeMirror { + // Themes with dark backgrounds + &.cm-s-3024-night, + &.cm-s-abbott, + &.cm-s-abcdef, + &.cm-s-ambiance, + &.cm-s-ayu-dark, + &.cm-s-ayu-mirage, + &.cm-s-base16-dark, + &.cm-s-bespin, + &.cm-s-blackboard, + &.cm-s-cobalt, + &.cm-s-colorforth, + &.cm-s-darcula, + &.cm-s-dracula, + &.cm-s-duotone-dark, + &.cm-s-erlang-dark, + &.cm-s-gruvbox-dark, + &.cm-s-hopscotch, + &.cm-s-icecoder, + &.cm-s-isotope, + &.cm-s-lesser-dark, + &.cm-s-liquibyte, + &.cm-s-lucario, + &.cm-s-material, + &.cm-s-material-darker, + &.cm-s-material-ocean, + &.cm-s-material-palenight, + &.cm-s-mbo, + &.cm-s-midnight, + &.cm-s-monokai, + &.cm-s-moxer, + &.cm-s-night, + &.cm-s-nord, + &.cm-s-oceanic-next, + &.cm-s-panda-syntax, + &.cm-s-paraiso-dark, + &.cm-s-pastel-on-dark, + &.cm-s-railscasts, + &.cm-s-rubyblue, + &.cm-s-seti, + &.cm-s-shadowfox, + &.cm-s-the-matrix, + &.cm-s-tomorrow-night-bright, + &.cm-s-tomorrow-night-eighties, + &.cm-s-twilight, + &.cm-s-vibrant-ink, + &.cm-s-xq-dark, + &.cm-s-yonce, + &.cm-s-zenburn + { + .CodeMirror-code .block:not(.cm-comment) { + color: magenta; + } + } +} \ No newline at end of file From 7e660aad4528a99382a4d44576b51c66c8e9f81a Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 12 Jun 2023 20:49:15 +1200 Subject: [PATCH 12/23] Add styling for columnSplite and pageLine --- themes/codeMirror/customEditorStyles.less | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/themes/codeMirror/customEditorStyles.less b/themes/codeMirror/customEditorStyles.less index 39bad9504..4db332c20 100644 --- a/themes/codeMirror/customEditorStyles.less +++ b/themes/codeMirror/customEditorStyles.less @@ -1,4 +1,4 @@ -.codeEditor .CodeMirror { +.editor .codeEditor .CodeMirror { // Themes with dark backgrounds &.cm-s-3024-night, &.cm-s-abbott, @@ -49,8 +49,20 @@ &.cm-s-yonce, &.cm-s-zenburn { - .CodeMirror-code .block:not(.cm-comment) { - color: magenta; + .CodeMirror-code { + .block:not(.cm-comment) { + color: magenta; + } + .columnSplit { + color: black; + background-color: rgba(35,153,153,0.5); + } + .pageLine { + background-color: rgba(255,255,255,0.75); + & ~ pre.CodeMirror-line { + color: black; + } + } } } } \ No newline at end of file From 8c0ca988ae9d897ea2cb72bf08735480c5a344ca Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 17 Jun 2023 19:50:05 +1200 Subject: [PATCH 13/23] Trim brew.title on UserPage --- client/homebrew/pages/userPage/userPage.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/client/homebrew/pages/userPage/userPage.jsx b/client/homebrew/pages/userPage/userPage.jsx index 1e051987b..57fc5f457 100644 --- a/client/homebrew/pages/userPage/userPage.jsx +++ b/client/homebrew/pages/userPage/userPage.jsx @@ -28,6 +28,7 @@ const UserPage = createClass({ const usernameWithS = this.props.username + (this.props.username.endsWith('s') ? `’` : `’s`); const brews = _.groupBy(this.props.brews, (brew)=>{ + brew.title = brew.title.trim(); return (brew.published ? 'published' : 'private'); }); From 4ded080a582eb39642f1efa6cf9fb59bf82e2338 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 29 Jun 2023 16:30:06 +1200 Subject: [PATCH 14/23] Trim titles before alphabetical ListPage sorting --- client/homebrew/pages/basePages/listPage/listPage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/pages/basePages/listPage/listPage.jsx b/client/homebrew/pages/basePages/listPage/listPage.jsx index 86570ec46..2696d4e7a 100644 --- a/client/homebrew/pages/basePages/listPage/listPage.jsx +++ b/client/homebrew/pages/basePages/listPage/listPage.jsx @@ -89,7 +89,7 @@ const ListPage = createClass({ sortBrewOrder : function(brew){ if(!brew.title){brew.title = 'No Title';} const mapping = { - 'alpha' : _.deburr(brew.title.toLowerCase()), + 'alpha' : _.deburr(brew.title.trim().toLowerCase()), 'created' : moment(brew.createdAt).format(), 'updated' : moment(brew.updatedAt).format(), 'views' : brew.views, From 636f2f93729203fc1104aa73a80d18a8185e2b99 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 29 Jun 2023 16:35:26 +1200 Subject: [PATCH 15/23] Add title trim before new saves and updates --- server/homebrew.api.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index 60c86b6d4..434447ec9 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -143,6 +143,7 @@ const api = { if(!brew.title) { brew.title = api.getGoodBrewTitle(brew.text); } + brew.title = brew.title.trim(); brew.authors = (account) ? [account.username] : []; brew.text = api.mergeBrewText(brew); @@ -212,6 +213,7 @@ const api = { const { saveToGoogle, removeFromGoogle } = req.query; let afterSave = async ()=>true; + brew.title = brew.title.trim(); brew.text = api.mergeBrewText(brew); if(brew.googleId && removeFromGoogle) { From a41553637ac1335f260f7ed3a32dedf8664722ed Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 29 Jun 2023 16:43:30 +1200 Subject: [PATCH 16/23] Add trim to brew description --- server/homebrew.api.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index 434447ec9..1e754a5ea 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -143,12 +143,14 @@ const api = { if(!brew.title) { brew.title = api.getGoodBrewTitle(brew.text); } - brew.title = brew.title.trim(); brew.authors = (account) ? [account.username] : []; brew.text = api.mergeBrewText(brew); _.defaults(brew, DEFAULT_BREW); + + brew.title = brew.title.trim(); + brew.description = brew.description.trim(); }, newGoogleBrew : async (account, brew, res)=>{ const oAuth2Client = GoogleActions.authCheck(account, res); @@ -214,6 +216,7 @@ const api = { let afterSave = async ()=>true; brew.title = brew.title.trim(); + brew.description = brew.description.trim() || ''; brew.text = api.mergeBrewText(brew); if(brew.googleId && removeFromGoogle) { From 1806854969b1e39575582efc5386cc5ab8ad280a Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Wed, 12 Jul 2023 20:16:36 +1200 Subject: [PATCH 17/23] Add onMouseDown handler for Firefox functionality --- client/homebrew/editor/snippetbar/snippetbar.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 5a32ffab3..c14c3e8a2 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -104,6 +104,7 @@ const Snippetbar = createClass({ }, changeTheme : function(e){ + if(e.target.value == this.props.currentEditorTheme) return; this.props.updateEditorTheme(e.target.value); this.setState({ @@ -113,7 +114,7 @@ const Snippetbar = createClass({ renderThemeSelector : function(){ return
- {global.config.codeMirrorThemes.map((theme, key)=>{ return ; })} From 73b141d08cc695bc788c7c763e80c5c40b98c3df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Sep 2023 18:34:36 +0000 Subject: [PATCH 18/23] Bump npm from 9.8.1 to 10.0.0 Bumps [npm](https://github.com/npm/cli) from 9.8.1 to 10.0.0. - [Release notes](https://github.com/npm/cli/releases) - [Changelog](https://github.com/npm/cli/blob/latest/CHANGELOG.md) - [Commits](https://github.com/npm/cli/compare/v9.8.1...libnpmhook-v10.0.0) --- updated-dependencies: - dependency-name: npm dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 666 +++++++++++++++++++++++++++++----------------- package.json | 2 +- 2 files changed, 430 insertions(+), 238 deletions(-) diff --git a/package-lock.json b/package-lock.json index 44ff4eecc..4a7cd44b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,7 @@ "mongoose": "^7.5.0", "nanoid": "3.3.4", "nconf": "^0.12.0", - "npm": "^9.8.1", + "npm": "^10.0.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-frame-component": "^4.1.3", @@ -10796,9 +10796,9 @@ } }, "node_modules/npm": { - "version": "9.8.1", - "resolved": "https://registry.npmjs.org/npm/-/npm-9.8.1.tgz", - "integrity": "sha512-AfDvThQzsIXhYgk9zhbk5R+lh811lKkLAeQMMhSypf1BM7zUafeIIBzMzespeuVEJ0+LvY36oRQYf7IKLzU3rw==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/npm/-/npm-10.0.0.tgz", + "integrity": "sha512-15O/VIG6/zuZ8ui2YxHhcJcomoTKNqC8bC6hKlmazJooDbdWCoC5iZsNp9Jm8xqwVab60hiAkhDyAqh8W8yq/g==", "bundleDependencies": [ "@isaacs/string-locale-compare", "@npmcli/arborist", @@ -10808,6 +10808,7 @@ "@npmcli/package-json", "@npmcli/promise-spawn", "@npmcli/run-script", + "@sigstore/tuf", "abbrev", "archy", "cacache", @@ -10858,7 +10859,6 @@ "qrcode-terminal", "read", "semver", - "sigstore", "ssri", "supports-color", "tar", @@ -10871,72 +10871,72 @@ ], "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/arborist": "^6.3.0", - "@npmcli/config": "^6.2.1", + "@npmcli/arborist": "^7.0.0", + "@npmcli/config": "^7.1.0", "@npmcli/fs": "^3.1.0", "@npmcli/map-workspaces": "^3.0.4", - "@npmcli/package-json": "^4.0.1", - "@npmcli/promise-spawn": "^6.0.2", - "@npmcli/run-script": "^6.0.2", + "@npmcli/package-json": "^5.0.0", + "@npmcli/promise-spawn": "^7.0.0", + "@npmcli/run-script": "^7.0.1", + "@sigstore/tuf": "^2.1.0", "abbrev": "^2.0.0", "archy": "~1.0.0", - "cacache": "^17.1.3", + "cacache": "^18.0.0", "chalk": "^5.3.0", "ci-info": "^3.8.0", "cli-columns": "^4.0.0", "cli-table3": "^0.6.3", "columnify": "^1.6.0", "fastest-levenshtein": "^1.0.16", - "fs-minipass": "^3.0.2", - "glob": "^10.2.7", + "fs-minipass": "^3.0.3", + "glob": "^10.3.3", "graceful-fs": "^4.2.11", - "hosted-git-info": "^6.1.1", + "hosted-git-info": "^7.0.0", "ini": "^4.1.1", - "init-package-json": "^5.0.0", + "init-package-json": "^6.0.0", "is-cidr": "^4.0.2", "json-parse-even-better-errors": "^3.0.0", - "libnpmaccess": "^7.0.2", - "libnpmdiff": "^5.0.19", - "libnpmexec": "^6.0.3", - "libnpmfund": "^4.0.19", - "libnpmhook": "^9.0.3", - "libnpmorg": "^5.0.4", - "libnpmpack": "^5.0.19", - "libnpmpublish": "^7.5.0", - "libnpmsearch": "^6.0.2", - "libnpmteam": "^5.0.3", - "libnpmversion": "^4.0.2", - "make-fetch-happen": "^11.1.1", + "libnpmaccess": "^8.0.0", + "libnpmdiff": "^6.0.0", + "libnpmexec": "^7.0.0", + "libnpmfund": "^4.1.0", + "libnpmhook": "^10.0.0", + "libnpmorg": "^6.0.0", + "libnpmpack": "^6.0.0", + "libnpmpublish": "^9.0.0", + "libnpmsearch": "^7.0.0", + "libnpmteam": "^6.0.0", + "libnpmversion": "^5.0.0", + "make-fetch-happen": "^13.0.0", "minimatch": "^9.0.3", - "minipass": "^5.0.0", + "minipass": "^7.0.3", "minipass-pipeline": "^1.2.4", "ms": "^2.1.2", "node-gyp": "^9.4.0", "nopt": "^7.2.0", "npm-audit-report": "^5.0.0", - "npm-install-checks": "^6.1.1", - "npm-package-arg": "^10.1.0", - "npm-pick-manifest": "^8.0.1", - "npm-profile": "^7.0.1", - "npm-registry-fetch": "^14.0.5", + "npm-install-checks": "^6.2.0", + "npm-package-arg": "^11.0.0", + "npm-pick-manifest": "^9.0.0", + "npm-profile": "^9.0.0", + "npm-registry-fetch": "^16.0.0", "npm-user-validate": "^2.0.0", "npmlog": "^7.0.1", "p-map": "^4.0.0", - "pacote": "^15.2.0", + "pacote": "^17.0.4", "parse-conflict-json": "^3.0.1", "proc-log": "^3.0.0", "qrcode-terminal": "^0.12.0", "read": "^2.1.0", "semver": "^7.5.4", - "sigstore": "^1.7.0", - "ssri": "^10.0.4", + "ssri": "^10.0.5", "supports-color": "^9.4.0", "tar": "^6.1.15", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", "treeverse": "^3.0.0", "validate-npm-package-name": "^5.0.0", - "which": "^3.0.1", + "which": "^4.0.0", "write-file-atomic": "^5.0.1" }, "bin": { @@ -10944,7 +10944,7 @@ "npx": "bin/npx-cli.js" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" } }, "node_modules/npm-run-path": { @@ -11035,8 +11035,70 @@ "inBundle": true, "license": "ISC" }, + "node_modules/npm/node_modules/@npmcli/agent": { + "version": "2.1.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.1", + "lru-cache": "^10.0.1", + "socks-proxy-agent": "^8.0.1" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/agent/node_modules/agent-base": { + "version": "7.1.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/npm/node_modules/@npmcli/agent/node_modules/http-proxy-agent": { + "version": "7.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/npm/node_modules/@npmcli/agent/node_modules/https-proxy-agent": { + "version": "7.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/npm/node_modules/@npmcli/agent/node_modules/socks-proxy-agent": { + "version": "8.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.0.1", + "debug": "^4.3.4", + "socks": "^2.7.1" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/npm/node_modules/@npmcli/arborist": { - "version": "6.3.0", + "version": "7.0.0", "inBundle": true, "license": "ISC", "dependencies": { @@ -11044,33 +11106,33 @@ "@npmcli/fs": "^3.1.0", "@npmcli/installed-package-contents": "^2.0.2", "@npmcli/map-workspaces": "^3.0.2", - "@npmcli/metavuln-calculator": "^5.0.0", + "@npmcli/metavuln-calculator": "^7.0.0", "@npmcli/name-from-folder": "^2.0.0", "@npmcli/node-gyp": "^3.0.0", - "@npmcli/package-json": "^4.0.0", + "@npmcli/package-json": "^5.0.0", "@npmcli/query": "^3.0.0", - "@npmcli/run-script": "^6.0.0", + "@npmcli/run-script": "^7.0.1", "bin-links": "^4.0.1", - "cacache": "^17.0.4", + "cacache": "^18.0.0", "common-ancestor-path": "^1.0.1", - "hosted-git-info": "^6.1.1", + "hosted-git-info": "^7.0.0", "json-parse-even-better-errors": "^3.0.0", "json-stringify-nice": "^1.1.4", "minimatch": "^9.0.0", "nopt": "^7.0.0", - "npm-install-checks": "^6.0.0", - "npm-package-arg": "^10.1.0", - "npm-pick-manifest": "^8.0.1", - "npm-registry-fetch": "^14.0.3", + "npm-install-checks": "^6.2.0", + "npm-package-arg": "^11.0.0", + "npm-pick-manifest": "^9.0.0", + "npm-registry-fetch": "^16.0.0", "npmlog": "^7.0.1", - "pacote": "^15.0.8", + "pacote": "^17.0.4", "parse-conflict-json": "^3.0.0", "proc-log": "^3.0.0", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^1.0.2", "read-package-json-fast": "^3.0.2", "semver": "^7.3.7", - "ssri": "^10.0.1", + "ssri": "^10.0.5", "treeverse": "^3.0.0", "walk-up-path": "^3.0.1" }, @@ -11078,11 +11140,11 @@ "arborist": "bin/index.js" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/@npmcli/config": { - "version": "6.2.1", + "version": "7.1.0", "inBundle": true, "license": "ISC", "dependencies": { @@ -11122,21 +11184,21 @@ } }, "node_modules/npm/node_modules/@npmcli/git": { - "version": "4.1.0", + "version": "5.0.3", "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/promise-spawn": "^6.0.0", - "lru-cache": "^7.4.4", - "npm-pick-manifest": "^8.0.0", + "@npmcli/promise-spawn": "^7.0.0", + "lru-cache": "^10.0.1", + "npm-pick-manifest": "^9.0.0", "proc-log": "^3.0.0", "promise-inflight": "^1.0.1", "promise-retry": "^2.0.1", "semver": "^7.3.5", - "which": "^3.0.0" + "which": "^4.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/@npmcli/installed-package-contents": { @@ -11169,17 +11231,17 @@ } }, "node_modules/npm/node_modules/@npmcli/metavuln-calculator": { - "version": "5.0.1", + "version": "7.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "cacache": "^17.0.0", + "cacache": "^18.0.0", "json-parse-even-better-errors": "^3.0.0", - "pacote": "^15.0.0", + "pacote": "^17.0.0", "semver": "^7.3.5" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/@npmcli/name-from-folder": { @@ -11199,31 +11261,31 @@ } }, "node_modules/npm/node_modules/@npmcli/package-json": { - "version": "4.0.1", + "version": "5.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/git": "^4.1.0", + "@npmcli/git": "^5.0.0", "glob": "^10.2.2", - "hosted-git-info": "^6.1.1", + "hosted-git-info": "^7.0.0", "json-parse-even-better-errors": "^3.0.0", - "normalize-package-data": "^5.0.0", + "normalize-package-data": "^6.0.0", "proc-log": "^3.0.0", "semver": "^7.5.3" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/@npmcli/promise-spawn": { - "version": "6.0.2", + "version": "7.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "which": "^3.0.0" + "which": "^4.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/@npmcli/query": { @@ -11238,18 +11300,18 @@ } }, "node_modules/npm/node_modules/@npmcli/run-script": { - "version": "6.0.2", + "version": "7.0.1", "inBundle": true, "license": "ISC", "dependencies": { "@npmcli/node-gyp": "^3.0.0", - "@npmcli/promise-spawn": "^6.0.0", + "@npmcli/promise-spawn": "^7.0.0", "node-gyp": "^9.0.0", "read-package-json-fast": "^3.0.0", - "which": "^3.0.0" + "which": "^4.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/@pkgjs/parseargs": { @@ -11261,24 +11323,48 @@ "node": ">=14" } }, + "node_modules/npm/node_modules/@sigstore/bundle": { + "version": "2.1.0", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/protobuf-specs": "^0.2.1" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, "node_modules/npm/node_modules/@sigstore/protobuf-specs": { - "version": "0.1.0", + "version": "0.2.1", "inBundle": true, "license": "Apache-2.0", "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm/node_modules/@sigstore/tuf": { - "version": "1.0.2", + "node_modules/npm/node_modules/@sigstore/sign": { + "version": "2.1.0", "inBundle": true, "license": "Apache-2.0", "dependencies": { - "@sigstore/protobuf-specs": "^0.1.0", - "tuf-js": "^1.1.7" + "@sigstore/bundle": "^2.1.0", + "@sigstore/protobuf-specs": "^0.2.1", + "make-fetch-happen": "^13.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@sigstore/tuf": { + "version": "2.1.0", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/protobuf-specs": "^0.2.1", + "tuf-js": "^2.1.0" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/@tootallnate/once": { @@ -11290,23 +11376,23 @@ } }, "node_modules/npm/node_modules/@tufjs/canonical-json": { - "version": "1.0.0", + "version": "2.0.0", "inBundle": true, "license": "MIT", "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/@tufjs/models": { - "version": "1.0.4", + "version": "2.0.0", "inBundle": true, "license": "MIT", "dependencies": { - "@tufjs/canonical-json": "1.0.0", - "minimatch": "^9.0.0" + "@tufjs/canonical-json": "2.0.0", + "minimatch": "^9.0.3" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/abbrev": { @@ -11340,12 +11426,10 @@ } }, "node_modules/npm/node_modules/agentkeepalive": { - "version": "4.3.0", + "version": "4.5.0", "inBundle": true, "license": "MIT", "dependencies": { - "debug": "^4.1.0", - "depd": "^2.0.0", "humanize-ms": "^1.2.1" }, "engines": { @@ -11494,15 +11578,15 @@ } }, "node_modules/npm/node_modules/cacache": { - "version": "17.1.3", + "version": "18.0.0", "inBundle": true, "license": "ISC", "dependencies": { "@npmcli/fs": "^3.1.0", "fs-minipass": "^3.0.0", "glob": "^10.2.2", - "lru-cache": "^7.7.1", - "minipass": "^5.0.0", + "lru-cache": "^10.0.1", + "minipass": "^7.0.3", "minipass-collect": "^1.0.2", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", @@ -11512,7 +11596,7 @@ "unique-filename": "^3.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/chalk": { @@ -11735,14 +11819,6 @@ "inBundle": true, "license": "MIT" }, - "node_modules/npm/node_modules/depd": { - "version": "2.0.0", - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/npm/node_modules/diff": { "version": "5.1.0", "inBundle": true, @@ -11828,11 +11904,11 @@ } }, "node_modules/npm/node_modules/fs-minipass": { - "version": "3.0.2", + "version": "3.0.3", "inBundle": true, "license": "ISC", "dependencies": { - "minipass": "^5.0.0" + "minipass": "^7.0.3" }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" @@ -11867,15 +11943,15 @@ } }, "node_modules/npm/node_modules/glob": { - "version": "10.2.7", + "version": "10.3.3", "inBundle": true, "license": "ISC", "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^2.0.3", "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2", - "path-scurry": "^1.7.0" + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" }, "bin": { "glob": "dist/cjs/src/bin.js" @@ -11909,14 +11985,14 @@ "license": "ISC" }, "node_modules/npm/node_modules/hosted-git-info": { - "version": "6.1.1", + "version": "7.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "lru-cache": "^7.5.1" + "lru-cache": "^10.0.1" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/http-cache-semantics": { @@ -12038,20 +12114,20 @@ } }, "node_modules/npm/node_modules/init-package-json": { - "version": "5.0.0", + "version": "6.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "npm-package-arg": "^10.0.0", + "npm-package-arg": "^11.0.0", "promzard": "^1.0.0", "read": "^2.0.0", - "read-package-json": "^6.0.0", + "read-package-json": "^7.0.0", "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4", "validate-npm-package-name": "^5.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/ip": { @@ -12159,47 +12235,47 @@ "license": "MIT" }, "node_modules/npm/node_modules/libnpmaccess": { - "version": "7.0.2", + "version": "8.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "npm-package-arg": "^10.1.0", - "npm-registry-fetch": "^14.0.3" + "npm-package-arg": "^11.0.0", + "npm-registry-fetch": "^16.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmdiff": { - "version": "5.0.19", + "version": "6.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^6.3.0", + "@npmcli/arborist": "^7.0.0", "@npmcli/disparity-colors": "^3.0.0", "@npmcli/installed-package-contents": "^2.0.2", "binary-extensions": "^2.2.0", "diff": "^5.1.0", "minimatch": "^9.0.0", - "npm-package-arg": "^10.1.0", - "pacote": "^15.0.8", + "npm-package-arg": "^11.0.0", + "pacote": "^17.0.4", "tar": "^6.1.13" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmexec": { - "version": "6.0.3", + "version": "7.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^6.3.0", - "@npmcli/run-script": "^6.0.0", + "@npmcli/arborist": "^7.0.0", + "@npmcli/run-script": "^7.0.1", "ci-info": "^3.7.1", - "npm-package-arg": "^10.1.0", + "npm-package-arg": "^11.0.0", "npmlog": "^7.0.1", - "pacote": "^15.0.8", + "pacote": "^17.0.4", "proc-log": "^3.0.0", "read": "^2.0.0", "read-package-json-fast": "^3.0.2", @@ -12207,145 +12283,141 @@ "walk-up-path": "^3.0.1" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmfund": { - "version": "4.0.19", + "version": "4.1.0", "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^6.3.0" + "@npmcli/arborist": "^7.0.0" }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmhook": { - "version": "9.0.3", + "version": "10.0.0", "inBundle": true, "license": "ISC", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^14.0.3" + "npm-registry-fetch": "^16.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmorg": { - "version": "5.0.4", + "version": "6.0.0", "inBundle": true, "license": "ISC", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^14.0.3" + "npm-registry-fetch": "^16.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmpack": { - "version": "5.0.19", + "version": "6.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^6.3.0", - "@npmcli/run-script": "^6.0.0", - "npm-package-arg": "^10.1.0", - "pacote": "^15.0.8" + "@npmcli/arborist": "^7.0.0", + "@npmcli/run-script": "^7.0.1", + "npm-package-arg": "^11.0.0", + "pacote": "^17.0.4" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmpublish": { - "version": "7.5.0", + "version": "9.0.0", "inBundle": true, "license": "ISC", "dependencies": { "ci-info": "^3.6.1", - "normalize-package-data": "^5.0.0", - "npm-package-arg": "^10.1.0", - "npm-registry-fetch": "^14.0.3", + "normalize-package-data": "^6.0.0", + "npm-package-arg": "^11.0.0", + "npm-registry-fetch": "^16.0.0", "proc-log": "^3.0.0", "semver": "^7.3.7", - "sigstore": "^1.4.0", - "ssri": "^10.0.1" + "sigstore": "^2.1.0", + "ssri": "^10.0.5" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmsearch": { - "version": "6.0.2", + "version": "7.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "npm-registry-fetch": "^14.0.3" + "npm-registry-fetch": "^16.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmteam": { - "version": "5.0.3", + "version": "6.0.0", "inBundle": true, "license": "ISC", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^14.0.3" + "npm-registry-fetch": "^16.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmversion": { - "version": "4.0.2", + "version": "5.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/git": "^4.0.1", - "@npmcli/run-script": "^6.0.0", + "@npmcli/git": "^5.0.3", + "@npmcli/run-script": "^7.0.1", "json-parse-even-better-errors": "^3.0.0", "proc-log": "^3.0.0", "semver": "^7.3.7" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/lru-cache": { - "version": "7.18.3", + "version": "10.0.1", "inBundle": true, "license": "ISC", "engines": { - "node": ">=12" + "node": "14 || >=16.14" } }, "node_modules/npm/node_modules/make-fetch-happen": { - "version": "11.1.1", + "version": "13.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "agentkeepalive": "^4.2.1", - "cacache": "^17.0.0", + "@npmcli/agent": "^2.0.0", + "cacache": "^18.0.0", "http-cache-semantics": "^4.1.1", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.0", "is-lambda": "^1.0.1", - "lru-cache": "^7.7.1", - "minipass": "^5.0.0", + "minipass": "^7.0.2", "minipass-fetch": "^3.0.0", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "negotiator": "^0.6.3", "promise-retry": "^2.0.1", - "socks-proxy-agent": "^7.0.0", "ssri": "^10.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/minimatch": { @@ -12363,11 +12435,11 @@ } }, "node_modules/npm/node_modules/minipass": { - "version": "5.0.0", + "version": "7.0.3", "inBundle": true, "license": "ISC", "engines": { - "node": ">=8" + "node": ">=16 || 14 >=14.17" } }, "node_modules/npm/node_modules/minipass-collect": { @@ -12393,11 +12465,11 @@ } }, "node_modules/npm/node_modules/minipass-fetch": { - "version": "3.0.3", + "version": "3.0.4", "inBundle": true, "license": "MIT", "dependencies": { - "minipass": "^5.0.0", + "minipass": "^7.0.3", "minipass-sized": "^1.0.3", "minizlib": "^2.1.2" }, @@ -12599,6 +12671,79 @@ "concat-map": "0.0.1" } }, + "node_modules/npm/node_modules/node-gyp/node_modules/cacache": { + "version": "17.1.4", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/fs": "^3.1.0", + "fs-minipass": "^3.0.0", + "glob": "^10.2.2", + "lru-cache": "^7.7.1", + "minipass": "^7.0.3", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "p-map": "^4.0.0", + "ssri": "^10.0.0", + "tar": "^6.1.11", + "unique-filename": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/cacache/node_modules/brace-expansion": { + "version": "2.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/cacache/node_modules/glob": { + "version": "10.3.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch": { + "version": "9.0.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/cacache/node_modules/minipass": { + "version": "7.0.3", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/npm/node_modules/node-gyp/node_modules/gauge": { "version": "4.0.4", "inBundle": true, @@ -12636,6 +12781,39 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/npm/node_modules/node-gyp/node_modules/lru-cache": { + "version": "7.18.3", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/make-fetch-happen": { + "version": "11.1.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "agentkeepalive": "^4.2.1", + "cacache": "^17.0.0", + "http-cache-semantics": "^4.1.1", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^7.7.1", + "minipass": "^5.0.0", + "minipass-fetch": "^3.0.0", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.3", + "promise-retry": "^2.0.1", + "socks-proxy-agent": "^7.0.0", + "ssri": "^10.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/npm/node_modules/node-gyp/node_modules/minimatch": { "version": "3.1.2", "inBundle": true, @@ -12647,6 +12825,14 @@ "node": "*" } }, + "node_modules/npm/node_modules/node-gyp/node_modules/minipass": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, "node_modules/npm/node_modules/node-gyp/node_modules/nopt": { "version": "6.0.0", "inBundle": true, @@ -12722,17 +12908,17 @@ } }, "node_modules/npm/node_modules/normalize-package-data": { - "version": "5.0.0", + "version": "6.0.0", "inBundle": true, "license": "BSD-2-Clause", "dependencies": { - "hosted-git-info": "^6.0.0", + "hosted-git-info": "^7.0.0", "is-core-module": "^2.8.1", "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/npm-audit-report": { @@ -12755,7 +12941,7 @@ } }, "node_modules/npm/node_modules/npm-install-checks": { - "version": "6.1.1", + "version": "6.2.0", "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -12774,21 +12960,21 @@ } }, "node_modules/npm/node_modules/npm-package-arg": { - "version": "10.1.0", + "version": "11.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "hosted-git-info": "^6.0.0", + "hosted-git-info": "^7.0.0", "proc-log": "^3.0.0", "semver": "^7.3.5", "validate-npm-package-name": "^5.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/npm-packlist": { - "version": "7.0.4", + "version": "8.0.0", "inBundle": true, "license": "ISC", "dependencies": { @@ -12799,46 +12985,46 @@ } }, "node_modules/npm/node_modules/npm-pick-manifest": { - "version": "8.0.1", + "version": "9.0.0", "inBundle": true, "license": "ISC", "dependencies": { "npm-install-checks": "^6.0.0", "npm-normalize-package-bin": "^3.0.0", - "npm-package-arg": "^10.0.0", + "npm-package-arg": "^11.0.0", "semver": "^7.3.5" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/npm-profile": { - "version": "7.0.1", + "version": "9.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "npm-registry-fetch": "^14.0.0", + "npm-registry-fetch": "^16.0.0", "proc-log": "^3.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/npm-registry-fetch": { - "version": "14.0.5", + "version": "16.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "make-fetch-happen": "^11.0.0", - "minipass": "^5.0.0", + "make-fetch-happen": "^13.0.0", + "minipass": "^7.0.2", "minipass-fetch": "^3.0.0", "minipass-json-stream": "^1.0.1", "minizlib": "^2.1.2", - "npm-package-arg": "^10.0.0", + "npm-package-arg": "^11.0.0", "proc-log": "^3.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/npm-user-validate": { @@ -12886,26 +13072,26 @@ } }, "node_modules/npm/node_modules/pacote": { - "version": "15.2.0", + "version": "17.0.4", "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/git": "^4.0.0", + "@npmcli/git": "^5.0.0", "@npmcli/installed-package-contents": "^2.0.1", - "@npmcli/promise-spawn": "^6.0.1", - "@npmcli/run-script": "^6.0.0", - "cacache": "^17.0.0", + "@npmcli/promise-spawn": "^7.0.0", + "@npmcli/run-script": "^7.0.0", + "cacache": "^18.0.0", "fs-minipass": "^3.0.0", - "minipass": "^5.0.0", - "npm-package-arg": "^10.0.0", - "npm-packlist": "^7.0.0", - "npm-pick-manifest": "^8.0.0", - "npm-registry-fetch": "^14.0.0", + "minipass": "^7.0.2", + "npm-package-arg": "^11.0.0", + "npm-packlist": "^8.0.0", + "npm-pick-manifest": "^9.0.0", + "npm-registry-fetch": "^16.0.0", "proc-log": "^3.0.0", "promise-retry": "^2.0.1", - "read-package-json": "^6.0.0", + "read-package-json": "^7.0.0", "read-package-json-fast": "^3.0.0", - "sigstore": "^1.3.0", + "sigstore": "^2.0.0", "ssri": "^10.0.0", "tar": "^6.1.11" }, @@ -12913,7 +13099,7 @@ "pacote": "lib/bin.js" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/parse-conflict-json": { @@ -12946,12 +13132,12 @@ } }, "node_modules/npm/node_modules/path-scurry": { - "version": "1.9.2", + "version": "1.10.1", "inBundle": true, "license": "BlueOak-1.0.0", "dependencies": { - "lru-cache": "^9.1.1", - "minipass": "^5.0.0 || ^6.0.2" + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { "node": ">=16 || 14 >=14.17" @@ -12960,14 +13146,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/npm/node_modules/path-scurry/node_modules/lru-cache": { - "version": "9.1.1", - "inBundle": true, - "license": "ISC", - "engines": { - "node": "14 || >=16.14" - } - }, "node_modules/npm/node_modules/postcss-selector-parser": { "version": "6.0.13", "inBundle": true, @@ -13067,17 +13245,17 @@ } }, "node_modules/npm/node_modules/read-package-json": { - "version": "6.0.4", + "version": "7.0.0", "inBundle": true, "license": "ISC", "dependencies": { "glob": "^10.2.2", "json-parse-even-better-errors": "^3.0.0", - "normalize-package-data": "^5.0.0", + "normalize-package-data": "^6.0.0", "npm-normalize-package-bin": "^3.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/read-package-json-fast": { @@ -13253,19 +13431,17 @@ } }, "node_modules/npm/node_modules/sigstore": { - "version": "1.7.0", + "version": "2.1.0", "inBundle": true, "license": "Apache-2.0", "dependencies": { - "@sigstore/protobuf-specs": "^0.1.0", - "@sigstore/tuf": "^1.0.1", - "make-fetch-happen": "^11.0.1" - }, - "bin": { - "sigstore": "bin/sigstore.js" + "@sigstore/bundle": "^2.1.0", + "@sigstore/protobuf-specs": "^0.2.1", + "@sigstore/sign": "^2.1.0", + "@sigstore/tuf": "^2.1.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/smart-buffer": { @@ -13332,11 +13508,11 @@ "license": "CC0-1.0" }, "node_modules/npm/node_modules/ssri": { - "version": "10.0.4", + "version": "10.0.5", "inBundle": true, "license": "ISC", "dependencies": { - "minipass": "^5.0.0" + "minipass": "^7.0.3" }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" @@ -13449,6 +13625,14 @@ "node": ">=8" } }, + "node_modules/npm/node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, "node_modules/npm/node_modules/text-table": { "version": "0.2.0", "inBundle": true, @@ -13468,16 +13652,16 @@ } }, "node_modules/npm/node_modules/tuf-js": { - "version": "1.1.7", + "version": "2.1.0", "inBundle": true, "license": "MIT", "dependencies": { - "@tufjs/models": "1.0.4", + "@tufjs/models": "2.0.0", "debug": "^4.3.4", - "make-fetch-happen": "^11.1.1" + "make-fetch-happen": "^13.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/unique-filename": { @@ -13541,17 +13725,25 @@ } }, "node_modules/npm/node_modules/which": { - "version": "3.0.1", + "version": "4.0.0", "inBundle": true, "license": "ISC", "dependencies": { - "isexe": "^2.0.0" + "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/which/node_modules/isexe": { + "version": "3.1.1", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=16" } }, "node_modules/npm/node_modules/wide-align": { diff --git a/package.json b/package.json index 5f1d07d9f..39ba72e77 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "mongoose": "^7.5.0", "nanoid": "3.3.4", "nconf": "^0.12.0", - "npm": "^9.8.1", + "npm": "^10.0.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-frame-component": "^4.1.3", From 3e43b058a5bd2f60b18501c1ffd99064a6250be4 Mon Sep 17 00:00:00 2001 From: Sean Robertson Date: Wed, 6 Sep 2023 11:52:28 +1200 Subject: [PATCH 19/23] Move userpage brew data clean up to app.js --- client/homebrew/pages/userPage/userPage.jsx | 1 - server/app.js | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/client/homebrew/pages/userPage/userPage.jsx b/client/homebrew/pages/userPage/userPage.jsx index 57fc5f457..1e051987b 100644 --- a/client/homebrew/pages/userPage/userPage.jsx +++ b/client/homebrew/pages/userPage/userPage.jsx @@ -28,7 +28,6 @@ const UserPage = createClass({ const usernameWithS = this.props.username + (this.props.username.endsWith('s') ? `’` : `’s`); const brews = _.groupBy(this.props.brews, (brew)=>{ - brew.title = brew.title.trim(); return (brew.published ? 'published' : 'private'); }); diff --git a/server/app.js b/server/app.js index 520dd154e..f10b6ff5e 100644 --- a/server/app.js +++ b/server/app.js @@ -268,6 +268,9 @@ app.get('/user/:username', async (req, res, next)=>{ } req.brews = _.map(brews, (brew)=>{ + // Clean up brew data + brew.title = brew.title?.trim(); + brew.description = brew.description?.trim(); return sanitizeBrew(brew, ownAccount ? 'edit' : 'share'); }); From 3f828c8649565d22a3af56c9a655f46ac5896d00 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 7 Sep 2023 16:55:39 +1200 Subject: [PATCH 20/23] Make Default first option in built themes JSON --- scripts/buildHomebrew.js | 6 +++--- themes/codeMirror/editorThemes.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/buildHomebrew.js b/scripts/buildHomebrew.js index cc624fc5c..701240f31 100644 --- a/scripts/buildHomebrew.js +++ b/scripts/buildHomebrew.js @@ -106,12 +106,12 @@ fs.emptyDirSync('./build'); const editorThemeFile = './themes/codeMirror/editorThemes.json'; if(fs.existsSync(editorThemeFile)) fs.rmSync(editorThemeFile); const stream = fs.createWriteStream(editorThemeFile, { flags: 'a' }); - stream.write('[\n'); + stream.write('[\n"default"'); for (themeFile of editorThemeFiles) { - stream.write(`"${themeFile.slice(0, -4)}",\n`); + stream.write(`,\n"${themeFile.slice(0, -4)}"`); } - stream.write('"default"\n]\n'); + stream.write('\n]\n'); stream.end(); await fs.copy('./node_modules/codemirror/theme', './build/homebrew/cm-themes'); diff --git a/themes/codeMirror/editorThemes.json b/themes/codeMirror/editorThemes.json index c94cd29cf..a4dd74470 100644 --- a/themes/codeMirror/editorThemes.json +++ b/themes/codeMirror/editorThemes.json @@ -1,4 +1,5 @@ [ +"default", "3024-day", "3024-night", "abbott", @@ -63,6 +64,5 @@ "xq-light", "yeti", "yonce", -"zenburn", -"default" +"zenburn" ] From e16110da6a37587aa0b5f1a284ec8e5cb8a726f9 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 7 Sep 2023 17:05:52 +1200 Subject: [PATCH 21/23] Add custom styling for light background themes --- themes/codeMirror/customEditorStyles.less | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/themes/codeMirror/customEditorStyles.less b/themes/codeMirror/customEditorStyles.less index 4db332c20..3318e1305 100644 --- a/themes/codeMirror/customEditorStyles.less +++ b/themes/codeMirror/customEditorStyles.less @@ -65,4 +65,24 @@ } } } + // Themes with light backgrounds + &.cm-s-default, + &.cm-s-3024-day, + &.cm-s-ambiance-mobile, + &.cm-s-base16-light, + &.cm-s-duotone-light, + &.cm-s-eclipse, + &.cm-s-elegant, + &.cm-s-juejin, + &.cm-s-neat, + &.cm-s-neo, + &.cm-s-paraiso-lightm + &.cm-s-solarized, + &.cm-s-ssms, + &.cm-s-ttcn, + &.cm-s-xq-light, + &.cm-s-yeti { + // Future styling for themes with light backgrounds + --dummyVar: 'currently unused'; + } } \ No newline at end of file From e909bc8f356c1f54f63a090882eb24cb4e7dbd99 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 7 Sep 2023 17:33:36 +1200 Subject: [PATCH 22/23] Load editorThemes in SnippetBar.jsx --- client/homebrew/editor/snippetbar/snippetbar.jsx | 6 ++++-- scripts/buildHomebrew.js | 2 +- server/app.js | 9 +++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index c14c3e8a2..ad4c7d466 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -15,6 +15,9 @@ ThemeSnippets['V3_5eDMG'] = require('themes/V3/5eDMG/snippets.js'); ThemeSnippets['V3_Journal'] = require('themes/V3/Journal/snippets.js'); ThemeSnippets['V3_Blank'] = require('themes/V3/Blank/snippets.js'); +// const EditorThemes = require('../themes/codeMirror/editorThemes.json'); +const EditorThemes = require('build/homebrew/codeMirror/editorThemes.json'); + const execute = function(val, props){ if(_.isFunction(val)) return val(props); return val; @@ -115,7 +118,7 @@ const Snippetbar = createClass({ renderThemeSelector : function(){ return
@@ -229,5 +232,4 @@ const SnippetGroup = createClass({
; }, - }); diff --git a/scripts/buildHomebrew.js b/scripts/buildHomebrew.js index 701240f31..e78759168 100644 --- a/scripts/buildHomebrew.js +++ b/scripts/buildHomebrew.js @@ -115,7 +115,7 @@ fs.emptyDirSync('./build'); stream.end(); await fs.copy('./node_modules/codemirror/theme', './build/homebrew/cm-themes'); - // await fs.copy('./themes/codeMirror', './build/themes/codeMirror'); + await fs.copy('./themes/codeMirror', './build/homebrew/codeMirror'); //v==----------------------------- BUNDLE PACKAGES --------------------------------==v// diff --git a/server/app.js b/server/app.js index 5b72774c5..520dd154e 100644 --- a/server/app.js +++ b/server/app.js @@ -17,8 +17,6 @@ const asyncHandler = require('express-async-handler'); const { DEFAULT_BREW } = require('./brewDefaults.js'); -const codeMirrorThemes = require('../themes/codeMirror/editorThemes.json'); - const splitTextStyleAndMetadata = (brew)=>{ brew.text = brew.text.replaceAll('\r\n', '\n'); if(brew.text.startsWith('```metadata')) { @@ -419,10 +417,9 @@ const templateFn = require('./../client/template.js'); const renderPage = async (req, res)=>{ // Create configuration object const configuration = { - local : isLocalEnvironment, - publicUrl : config.get('publicUrl') ?? '', - environment : nodeEnv, - codeMirrorThemes : codeMirrorThemes + local : isLocalEnvironment, + publicUrl : config.get('publicUrl') ?? '', + environment : nodeEnv }; const props = { version : require('./../package.json').version, From 3f6eb7371fb8eadf0de2f64dd7e55c5f7bff584f Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 7 Sep 2023 18:28:08 +1200 Subject: [PATCH 23/23] Increase ESLint lines for SnippetBar.jsx --- client/homebrew/editor/snippetbar/snippetbar.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index ad4c7d466..246d534a9 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -1,3 +1,4 @@ +/*eslint max-lines: ["warn", {"max": 250, "skipBlankLines": true, "skipComments": true}]*/ require('./snippetbar.less'); const React = require('react'); const createClass = require('create-react-class'); @@ -15,7 +16,6 @@ ThemeSnippets['V3_5eDMG'] = require('themes/V3/5eDMG/snippets.js'); ThemeSnippets['V3_Journal'] = require('themes/V3/Journal/snippets.js'); ThemeSnippets['V3_Blank'] = require('themes/V3/Blank/snippets.js'); -// const EditorThemes = require('../themes/codeMirror/editorThemes.json'); const EditorThemes = require('build/homebrew/codeMirror/editorThemes.json'); const execute = function(val, props){