Skip to content

Commit

Permalink
Merge branch 'GovertDev' into electron-forge-github-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoxolotl authored Jun 7, 2024
2 parents 35e476a + 4fad68e commit 94b2547
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*~
# Logs
logs
*.log
Expand Down
26 changes: 14 additions & 12 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,10 @@ app.whenReady().then(() => {
}
break
case 'PUT':
if(fs.existsSync(dataDir + componentDirectory + "/" + componentName)){
return createComponentDirectory(componentDirectory)
.then(createComponentFile(componentDirectory + "/" + componentName, request))
.then(function() { return new Response('"ok"', { status: 200})})
.catch(function(){ return new Response('"something went wrong"', { status : 500 })}) // @TODO : return the error code
} else {
return new Response('"Not found"', { status: 404})
}
return createComponentDirectory(componentDirectory)
.then(createComponentFile(componentDirectory + "/" + componentName, request))
.then(function() { return new Response('"ok"', { status: 200})})
.catch(function(){ return new Response('"something went wrong"', { status : 500 })}) // @TODO : return the error code
break
case 'GET':
default:
Expand Down Expand Up @@ -262,7 +258,11 @@ app.whenReady().then(() => {
}
})

dataDir = dialog.showOpenDialogSync({properties: ['openDirectory']})[0];
if (process.argv[1]) {
dataDir = path.resolve(process.argv[1]);
} else {
dataDir = dialog.showOpenDialogSync({properties: ['openDirectory']})[0];
}
console.log(dataDir);
if (!dataDir.match(/\/$/)) {
dataDir += "/";
Expand All @@ -273,9 +273,11 @@ app.whenReady().then(() => {

app.on('activate', () => { // needed for macos
if (BrowserWindow.getAllWindows().length === 0) {
dataDir = dialog.showOpenDialogSync({properties: ['openDirectory']})[0];
console.log('were here')
console.log(dataDir)
if (process.argv[1]) {
dataDir = path.resolve(process.argv[1]);
} else {
dataDir = dialog.showOpenDialogSync({properties: ['openDirectory']})[0];
}
if (!dataDir.match(/\/$/)) {
dataDir += "/";
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "simply-code-app",
"name": "simplycode",
"version": "1.0.0",
"description": "Simplycode in electron to build websites",
"main": "main.js",
Expand Down
8 changes: 4 additions & 4 deletions simplycode/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1153,9 +1153,9 @@
})
.catch(function() {
let defaults = {
"componentPreview.html" : "<!DOCTYPE HTML>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <!-- Component CSS -->\n <style>\n {{componentCss}}\n </style>\n <!-- /Component CSS -->\n <!-- Page CSS -->\n <style>\n {{pageCss}}\n </style>\n <!-- /Page CSS -->\n <!-- Head HTML -->\n {{headHtml}}\n <!-- /Head HTML -->\n <script>\n function clone(ob) {\n return JSON.parse(JSON.stringify(ob));\n }\n function updateDataSource(name) {\n document.querySelectorAll('[data-simply-data=\"'+name+'\"]').forEach(function(list) {\n editor.list.applyDataSource(list, name);\n list.dataBindingPaused = 0;\n });\n }\n </script>\n </head>\n <body>\n <!-- Component HTML templates -->\n {{componentTemplates}}\n <!-- /Component HTML templates -->\n <div class=\"main\">\n {{componentPreview}}\n </div>\n <script src=\"js/simply.everything.js\"></script>\n <script src=\"js/simply-edit.js\" data-api-key=\"muze\"></script>\n <script>\n /* Transformers */\n editor.transformers = {\n {{transformers}}\n };\n /* /Transformers */\n </script>\n <script>\n /* Sorters */\n editor.sorters = {\n {{sorters}}\n };\n /* /Sorters */\n </script>\n <script>\n window.addEventListener(\"simply-content-loaded\", function() {\n /* Data sources */\n {{dataSources}}\n /* /Data sources */\n });\n </script>\n <!-- Foot HTML -->\n {{footHtml}}\n <!-- /Foot HTML -->\n </body>\n</html>",
"fullApp.html" : "<!DOCTYPE HTML>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <!-- Component CSS -->\n <style>\n {{componentCss}}\n </style>\n <!-- /Component CSS -->\n <!-- Page CSS -->\n <style>\n {{pageCss}}\n </style>\n <!-- /Page CSS -->\n <!-- Head HTML -->\n {{headHtml}}\n <!-- /Head HTML -->\n <script>\n var simplyDataApi = {};\n var simplyApp = {};\n window.addEventListener(\"simply-content-loaded\", function() {\n simply.bind = false;\n /* Raw API */\n var simplyRawApi = {\n {{rawApi}}\n };\n /* End of Raw API */\n /* Data API */\n simplyDataApi = {\n {{dataApi}}\n };\n /* End of Data API */\n simplyApp = simply.app({\n /* Actions */\n actions: {\n {{actions}}\n },\n /* /Actions */\n /* Commands */\n commands: {\n {{commands}}\n },\n /* /Commands */\n /* Routes */\n routes: {\n {{routes}}\n }\n /* /Routes */\n });\n });\n function clone(ob) {\n return JSON.parse(JSON.stringify(ob));\n }\n function updateDataSource(name) {\n document.querySelectorAll('[data-simply-data=\"'+name+'\"]').forEach(function(list) {\n editor.list.applyDataSource(list, name);\n list.dataBindingPaused = 0;\n });\n }\n </script>\n </head>\n <body>\n <!-- Body HTML -->\n {{bodyHtml}}\n <!-- /Body HTML -->\n <!-- Component HTML templates -->\n {{componentTemplates}}\n <!-- /Component HTML templates -->\n <header data-simply-path=\"/\" data-simply-field=\"header\" data-simply-content=\"template\" data-simply-default-value=\"Header\">\n <template data-simply-template='Header' rel=\"header\"></template>\n </header>\n <nav>\n <simply-render rel=\"menu\"></simply-render>\n </nav>\n <div class=\"main\" data-simply-field=\"page\" data-simply-content=\"template\">\n <!-- Page HTML templates -->\n {{pageTemplates}}\n <!-- /Page HTML templates -->\n </div>\n <script src=\"js/simply.everything.js\"></script>\n <script src=\"js/simply-edit.js\" data-api-key=\"muze\"></script>\n <script>\n /* Transformers */\n editor.transformers = {\n {{transformers}}\n };\n /* /Transformers */\n </script>\n <script>\n /* Sorters */\n editor.sorters = {\n {{sorters}}\n };\n /* /Sorters */\n </script>\n <script>\n window.addEventListener(\"simply-content-loaded\", function() {\n /* Data sources */\n {{dataSources}}\n /* /Data sources */\n });\n </script>\n <!-- Foot HTML -->\n {{footHtml}}\n <!-- /Foot HTML -->\n </body>\n</html>",
"pagePreview.html" : "<!DOCTYPE HTML>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <!-- Component CSS -->\n <style>\n {{componentCss}}\n </style>\n <!-- /Component CSS -->\n <!-- Page CSS -->\n <style>\n {{pageCss}}\n </style>\n <!-- /Page CSS -->\n <!-- Head HTML -->\n {{headHtml}}\n <!-- /Head HTML -->\n <script>\n function clone(ob) {\n return JSON.parse(JSON.stringify(ob));\n }\n function updateDataSource(name) {\n document.querySelectorAll('[data-simply-data=\"'+name+'\"]').forEach(function(list) {\n editor.list.applyDataSource(list, name);\n list.dataBindingPaused = 0;\n });\n }\n </script>\n </head>\n <body>\n <!-- Component HTML templates -->\n {{componentTemplates}}\n <!-- /Component HTML templates -->\n <header data-simply-path=\"/\" data-simply-field=\"header\" data-simply-content=\"template\" data-simply-default-value=\"Header\">\n <template data-simply-template='Header' rel=\"header\"></template>\n </header>\n <nav>\n <simply-render rel=\"menu\"></simply-render>\n </nav>\n <div class=\"main\" data-simply-field=\"page\" data-simply-content=\"template\">\n {{pagePreview}}\n </div>\n <script src=\"js/simply.everything.js\"></script>\n <script src=\"js/simply-edit.js\" data-api-key=\"muze\"></script>\n <script>\n /* Transformers */\n editor.transformers = {\n {{transformers}}\n };\n /* /Transformers */\n </script>\n <script>\n /* Sorters */\n editor.sorters = {\n {{sorters}}\n };\n /* /Sorters */\n </script>\n <script>\n window.addEventListener(\"simply-content-loaded\", function() {\n /* Data sources */\n {{dataSources}}\n /* /Data sources */\n });\n </script>\n <!-- Foot HTML -->\n {{footHtml}}\n <!-- /Foot HTML -->\n </body>\n</html>"
"componentPreview.html" : "<!DOCTYPE HTML>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <!-- Component CSS -->\n <style>\n {{componentCss}}\n </style>\n <!-- /Component CSS -->\n <!-- Page CSS -->\n <style>\n {{pageCss}}\n </style>\n <!-- /Page CSS -->\n <!-- Head HTML -->\n {{headHtml}}\n <!-- /Head HTML -->\n <script>\n function clone(ob) {\n return JSON.parse(JSON.stringify(ob));\n }\n function updateDataSource(name) {\n document.querySelectorAll('[data-simply-data=\"'+name+'\"]').forEach(function(list) {\n editor.list.applyDataSource(list, name);\n list.dataBindingPaused = 0;\n });\n }\n </script>\n </head>\n <body>\n <!-- Component HTML templates -->\n {{componentTemplates}}\n <!-- /Component HTML templates -->\n <div class=\"main\">\n {{componentPreview}}\n </div>\n <script src=\"js/simply.everything.js\"></script>\n <script src=\"js/simply-edit.js\" data-simply-storage=\"none\" data-api-key=\"muze\"></script>\n <script>\n /* Transformers */\n editor.transformers = {\n {{transformers}}\n };\n /* /Transformers */\n </script>\n <script>\n /* Sorters */\n editor.sorters = {\n {{sorters}}\n };\n /* /Sorters */\n </script>\n <script>\n window.addEventListener(\"simply-content-loaded\", function() {\n /* Data sources */\n {{dataSources}}\n /* /Data sources */\n });\n </script>\n <!-- Foot HTML -->\n {{footHtml}}\n <!-- /Foot HTML -->\n </body>\n</html>",
"fullApp.html" : "<!DOCTYPE HTML>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <!-- Component CSS -->\n <style>\n {{componentCss}}\n </style>\n <!-- /Component CSS -->\n <!-- Page CSS -->\n <style>\n {{pageCss}}\n </style>\n <!-- /Page CSS -->\n <!-- Head HTML -->\n {{headHtml}}\n <!-- /Head HTML -->\n <script>\n var simplyDataApi = {};\n var simplyApp = {};\n window.addEventListener(\"simply-content-loaded\", function() {\n simply.bind = false;\n /* Raw API */\n var simplyRawApi = {\n {{rawApi}}\n };\n /* End of Raw API */\n /* Data API */\n simplyDataApi = {\n {{dataApi}}\n };\n /* End of Data API */\n simplyApp = simply.app({\n /* Actions */\n actions: {\n {{actions}}\n },\n /* /Actions */\n /* Commands */\n commands: {\n {{commands}}\n },\n /* /Commands */\n /* Routes */\n routes: {\n {{routes}}\n }\n /* /Routes */\n });\n });\n function clone(ob) {\n return JSON.parse(JSON.stringify(ob));\n }\n function updateDataSource(name) {\n document.querySelectorAll('[data-simply-data=\"'+name+'\"]').forEach(function(list) {\n editor.list.applyDataSource(list, name);\n list.dataBindingPaused = 0;\n });\n }\n </script>\n </head>\n <body>\n <!-- Body HTML -->\n {{bodyHtml}}\n <!-- /Body HTML -->\n <!-- Component HTML templates -->\n {{componentTemplates}}\n <!-- /Component HTML templates -->\n <header data-simply-path=\"/\" data-simply-field=\"header\" data-simply-content=\"template\" data-simply-default-value=\"Header\">\n <template data-simply-template='Header' rel=\"header\"></template>\n </header>\n <nav>\n <simply-render rel=\"menu\"></simply-render>\n </nav>\n <div class=\"main\" data-simply-field=\"page\" data-simply-content=\"template\">\n <!-- Page HTML templates -->\n {{pageTemplates}}\n <!-- /Page HTML templates -->\n </div>\n <script src=\"js/simply.everything.js\"></script>\n <script src=\"js/simply-edit.js\" data-simply-storage=\"none\" data-api-key=\"muze\"></script>\n <script>\n /* Transformers */\n editor.transformers = {\n {{transformers}}\n };\n /* /Transformers */\n </script>\n <script>\n /* Sorters */\n editor.sorters = {\n {{sorters}}\n };\n /* /Sorters */\n </script>\n <script>\n window.addEventListener(\"simply-content-loaded\", function() {\n /* Data sources */\n {{dataSources}}\n /* /Data sources */\n });\n </script>\n <!-- Foot HTML -->\n {{footHtml}}\n <!-- /Foot HTML -->\n </body>\n</html>",
"pagePreview.html" : "<!DOCTYPE HTML>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <!-- Component CSS -->\n <style>\n {{componentCss}}\n </style>\n <!-- /Component CSS -->\n <!-- Page CSS -->\n <style>\n {{pageCss}}\n </style>\n <!-- /Page CSS -->\n <!-- Head HTML -->\n {{headHtml}}\n <!-- /Head HTML -->\n <script>\n function clone(ob) {\n return JSON.parse(JSON.stringify(ob));\n }\n function updateDataSource(name) {\n document.querySelectorAll('[data-simply-data=\"'+name+'\"]').forEach(function(list) {\n editor.list.applyDataSource(list, name);\n list.dataBindingPaused = 0;\n });\n }\n </script>\n </head>\n <body>\n <!-- Component HTML templates -->\n {{componentTemplates}}\n <!-- /Component HTML templates -->\n <header data-simply-path=\"/\" data-simply-field=\"header\" data-simply-content=\"template\" data-simply-default-value=\"Header\">\n <template data-simply-template='Header' rel=\"header\"></template>\n </header>\n <nav>\n <simply-render rel=\"menu\"></simply-render>\n </nav>\n <div class=\"main\" data-simply-field=\"page\" data-simply-content=\"template\">\n {{pagePreview}}\n </div>\n <script src=\"js/simply.everything.js\"></script>\n <script src=\"js/simply-edit.js\" data-simply-storage=\"none\" data-api-key=\"muze\"></script>\n <script>\n /* Transformers */\n editor.transformers = {\n {{transformers}}\n };\n /* /Transformers */\n </script>\n <script>\n /* Sorters */\n editor.sorters = {\n {{sorters}}\n };\n /* /Sorters */\n </script>\n <script>\n window.addEventListener(\"simply-content-loaded\", function() {\n /* Data sources */\n {{dataSources}}\n /* /Data sources */\n });\n </script>\n <!-- Foot HTML -->\n {{footHtml}}\n <!-- /Foot HTML -->\n </body>\n</html>"
};

let elements = {};
Expand Down Expand Up @@ -3330,7 +3330,7 @@ <h1>App preview</h1>
<!-- /Page HTML templates -->
</div>
<script src="js/simply.everything.js"></script>
<script src="js/simply-edit.js" data-api-key="muze"></script>
<script src="js/simply-edit.js" data-simply-storage="none" data-api-key="muze"></script>
<script>
/* Transformers */
editor.transformers = {
Expand Down
13 changes: 7 additions & 6 deletions simplycode/js/simply-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4626,12 +4626,6 @@
}
}());

editor.init({
endpoint : document.querySelector("[data-simply-endpoint]") ? document.querySelector("[data-simply-endpoint]").getAttribute("data-simply-endpoint") : null,
toolbars : defaultToolbars,
profile : 'live'
});

class SimplyComponent extends HTMLDivElement {
constructor() {
console.warn('simply-component is deprecated, use simply-render instead');
Expand Down Expand Up @@ -4680,4 +4674,11 @@
// Define the new element
customElements.define('simply-render', SimplyRender);

editor.init({
endpoint : document.querySelector("[data-simply-endpoint]") ? document.querySelector("[data-simply-endpoint]").getAttribute("data-simply-endpoint") : null,
toolbars : defaultToolbars,
profile : 'live'
});


}());

0 comments on commit 94b2547

Please sign in to comment.