-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
3,754 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
# Maintain dependencies for npm | ||
- package-ecosystem: "npm" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "daily" | ||
open-pull-requests-limit: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ 'main', 'gh-pages' ] | ||
# pull_request: | ||
# The branches below must be a subset of the branches above | ||
# branches: [ main ] | ||
# schedule: | ||
# - cron: '31 10 * * 3' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'javascript' ] | ||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] | ||
# Learn more about CodeQL language support at https://git.io/codeql-language-support | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
# queries: ./path/to/local/query, your-org/your-repo/queries@main | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v2 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 https://git.io/JvXDl | ||
|
||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||
# and modify them (or add more) to build your code if your project | ||
# uses a compiled language | ||
|
||
#- run: | | ||
# make bootstrap | ||
# make release | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
canvas.bundle.min.js | ||
:w | ||
*~ | ||
*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright © 2022 Sitdisch | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*! MTW-BOILERPLATE-DECKS: CANVAS.CONFIG.JS | ||
* | ||
* Author: sitdisch | ||
* Source: https://github.com/mythemeway | ||
* License: MIT | ||
* Copyright © 2022 sitdisch | ||
*/ | ||
|
||
// | ||
// CANVAS SETTINGS | ||
// - path: path to canvas | ||
// - id: canvas id attribute | ||
// | ||
|
||
const canvas = { path: './src/mtw-deck-flights.js', id: 'mtw-canvas' }; | ||
// const canvas = { path: './src/mtw-deck-trips.js', id: 'mtw-canvas' }; | ||
|
||
module.exports = canvas; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
/*! MTW-BOILERPLATE-DECKS: DEV.CONFIG.JS | ||
* | ||
* Author: sitdisch | ||
* Source: https://github.com/mythemeway | ||
* License: MIT | ||
* Copyright © 2022 sitdisch | ||
*/ | ||
|
||
const { build, analyzeMetafile } = require('esbuild'); | ||
const { get, createServer } = require('http'); | ||
|
||
console.log("[\x1b[90mesbuild\x1b[0m]: starting `\x1b[36mdevelopment-mode\x1b[0m`...\n"); | ||
|
||
var canvas = require('./canvas.config.js'); | ||
var canvasBundle, address, servLog = ''; | ||
|
||
const clients = []; | ||
const addErrDiv = ` | ||
document.getElementById('mtw-canvas').style.display = 'none'; | ||
document.body.innerHTML += '<div style="margin:30vh 10px;text-align:center;color:white;font-size:45px;">❌ <b>[ERROR]</b> Hm... something went wrong<br><br>Check your terminal for more information about the 🐛</div>'; | ||
`; | ||
|
||
async function buildCmd() { | ||
return build({ | ||
entryPoints: [`${canvas.path}`], | ||
outfile: './canvas.bundle.js', | ||
logLevel: 'info', | ||
bundle: true, | ||
write: false, | ||
metafile: true, | ||
define: { MTW_CANVAS_ID: '"mtw-canvas"' }, | ||
|
||
watch: { | ||
onRebuild(err, result) { | ||
if (!(err)) buildThen(result) | ||
else { | ||
toClients(addErrDiv); | ||
console.log(servLog); | ||
} | ||
}, | ||
}, | ||
}); | ||
} | ||
|
||
async function buildThen(result) { | ||
buildResult = result; | ||
analyzeMetafile(result.metafile).then(msg => | ||
console.log(msg+servLog) | ||
); | ||
toClients(result.outputFiles[0].text) | ||
} | ||
|
||
function toClients(data) { | ||
get(address, () => { | ||
canvasBundle = data; | ||
}).end(); | ||
|
||
clients.forEach(res => res.end("data: reload\n\n")); | ||
clients.length = 0; | ||
} | ||
|
||
async function setListen(tryPort) { | ||
const tryServer = createServer().listen(tryPort, () => | ||
tryServer.close().on('close', () => server.listen(tryPort))) | ||
.on('error', err => { | ||
if (err.code === 'EADDRINUSE') { | ||
tryServer.close().on('close', () => setListen(tryPort+1)); | ||
return; | ||
} else throw err; | ||
}) | ||
}; | ||
|
||
const server = createServer((req, res) => { | ||
req.on('error', err => { | ||
if (err.code != 'ECONNRESET') { | ||
console.error(err); | ||
res.statusCode = 400; | ||
res.end('400: Bad Request'); | ||
return; | ||
} | ||
}); | ||
|
||
res.on('error', err => console.error(err)); | ||
|
||
switch (req.url) { | ||
case '/': | ||
res.writeHead(200, { | ||
'Content-Type': 'text/html; charset=utf-8' | ||
}); | ||
res.end(` | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="shortcut icon" href="#"> | ||
<title>mtw-boilerplate-decks</title> | ||
<style> | ||
body { | ||
margin: 0; | ||
background: black; | ||
} | ||
.mtw-container { | ||
position: relative; | ||
width: 100vw; | ||
height: 100vh; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="mtw-container"> | ||
<canvas id="mtw-canvas"></canvas> | ||
</div> | ||
<script src="/canvas.bundle.js"></script> | ||
<script> | ||
var evtSource = new EventSource("/events"); | ||
evtSource.onerror = () => window.location.reload(); | ||
evtSource.onmessage = () => window.location.reload(); | ||
window.addEventListener("beforeunload", () => evtSource.close()); | ||
</script> | ||
</body> | ||
</html> | ||
`) | ||
break; | ||
|
||
case '/canvas.bundle.js': | ||
res.writeHead(200, { | ||
'Content-Type': 'text/javascript; charset=utf-8', | ||
}); | ||
res.end(canvasBundle); | ||
break; | ||
|
||
case '/events': | ||
clients.push( | ||
res.writeHead(200, { | ||
'Content-Type': 'text/event-stream', | ||
'Cache-Control': 'no-cache', | ||
'Connection': 'keep-alive' | ||
}) | ||
); | ||
break; | ||
|
||
default: | ||
res.statusCode = 404; | ||
res.end('404: Resource Not Found'); | ||
}; | ||
}); | ||
|
||
setListen(8080); | ||
|
||
var buildResult = buildCmd(); | ||
|
||
server.on('listening', () => { | ||
address ='http://localhost:'+server.address().port+'/'; | ||
servLog = "\n server: \x1b[1;36m"+address+"\x1b[0m\n exit: \x1b[35mctrl-c\x1b[0m\n"; | ||
buildResult.then(result => buildThen(result)); | ||
}); | ||
|
||
build({ | ||
entryPoints: ['./canvas.config.js'], | ||
write: false, | ||
watch: { | ||
onRebuild() { | ||
buildResult.stop(); | ||
delete require.cache[require.resolve('./canvas.config.js')]; | ||
|
||
try { | ||
canvas = require('./canvas.config.js'); | ||
} catch (err) { | ||
toClients(addErrDiv); | ||
throw err; | ||
} | ||
|
||
console.log('[watch] build started (change: "canvas.config.js")'); | ||
buildCmd().then(result => buildThen(result)); | ||
}, | ||
}, | ||
}); |
Oops, something went wrong.