diff --git a/.gitignore b/.gitignore index db6695d..6df2256 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,10 @@ -.temp/ +.temp +.tmp node_modules/ -dist/ +/index.html +/bin +/dist +/build + +yarn-error.log +neutralinojs.log \ No newline at end of file diff --git a/build.js b/build.js new file mode 100644 index 0000000..1b9021e --- /dev/null +++ b/build.js @@ -0,0 +1,54 @@ +// Usage: node build <[dev]/prod> + +import Path from 'path' +import { copyFile } from 'fs/promises' + +let [ platform, environment = 'dev' ] = process.argv.slice(2) +let projectRoot = Path.dirname(new URL(import.meta.url).pathname) + +const indexTemplate = scripts => `\ + + + + + +${scripts.map(src => "").join('\n')} + + + + + + +` + +let out + +switch(environment) { + case 'dev': + out = indexTemplate([ + Path.join('platforms', platform + '.js'), + 'editor.js', + 'build/libs.js' + ]) + break + + case 'prod': + await copyFile( + Path.join(projectRoot, 'platforms', platform + '.js'), + Path.join(projectRoot, 'build', 'platform.js') + ) + + out = indexTemplate([ + 'platform.js', + 'editor.js', + 'libs.js' + ]) + break +} + +process.stdout.write(out) \ No newline at end of file diff --git a/index.js b/editor.js similarity index 99% rename from index.js rename to editor.js index 046db47..32ac818 100644 --- a/index.js +++ b/editor.js @@ -147,7 +147,7 @@ function App() { } }, { - key: 'Ctrl-n', + key: 'Ctrl-r', run(state, event) { event.preventDefault() let mainSelection = self.editor.state.selection.main @@ -269,6 +269,7 @@ function ChildWindow(index) { this.index = app.views.length this.window = window.open('about:blank', '_blank') + console.log(this) this.window.document.head.appendChild(document.getElementById('stylesheet').cloneNode(true)) this.editor = new $.EditorView({ state, diff --git a/index.html b/index.html index 6701d5e..5802b6f 100644 --- a/index.html +++ b/index.html @@ -2,11 +2,13 @@ - - + + + +