mirror of
https://github.com/Steffo99/bluelib.git
synced 2024-12-22 11:34:21 +00:00
First commit
This commit is contained in:
commit
40302d8cb9
12 changed files with 193 additions and 0 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
build/* linguist-vendored
|
||||||
|
docs/* linguist-vendored
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
node_modules
|
||||||
|
/*.log
|
||||||
|
.idea/
|
3
.sentryclirc
Normal file
3
.sentryclirc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[defaults]
|
||||||
|
org=stefano-pigozzi
|
||||||
|
project=example
|
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# [`bluelib-app-template`](https://github.com/Steffo99/bluelib-app-template)
|
||||||
|
|
||||||
|
A [Preact](https://preactjs.com/) website template.
|
40
package.json
Normal file
40
package.json
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"name": "example",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"license": "AGPL-3.0-or-later",
|
||||||
|
"scripts": {
|
||||||
|
"start": "preact watch --template src/template.html",
|
||||||
|
"build": "preact build --template src/template.html --no-prerender --dest docs && git add docs",
|
||||||
|
"ghpages": "npm run -s build && git add . && cross-env-shell git commit -m \"$npm_package_version\" && git push && cross-env-shell hub release create -m \"$npm_package_version\" \"$npm_package_version\" && cross-env-shell sentry-cli releases set-commits \"$npm_package_version\" --auto && cross-env-shell sentry-cli releases deploys \"$npm_package_version\" new --env production -n \"gh-pages\""
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@sentry/webpack-plugin": "^1.11.1",
|
||||||
|
"cross-env": "^7.0.2",
|
||||||
|
"preact-cli": "^3.0.0-rc.14"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@fortawesome/fontawesome-svg-core": "^1.2.28",
|
||||||
|
"@fortawesome/free-brands-svg-icons": "^5.13.0",
|
||||||
|
"@fortawesome/free-regular-svg-icons": "^5.13.0",
|
||||||
|
"@fortawesome/free-solid-svg-icons": "^5.13.0",
|
||||||
|
"@fortawesome/react-fontawesome": "^0.1.9",
|
||||||
|
"@sentry/browser": "^5.15.5",
|
||||||
|
"@sentry/integrations": "^5.15.5",
|
||||||
|
"bluelib": "^0.13.14",
|
||||||
|
"css-loader": "^3.5.2",
|
||||||
|
"file-loader": "^5.1.0",
|
||||||
|
"history": "^4.10.1",
|
||||||
|
"less": "^3.10.3",
|
||||||
|
"less-loader": "^5.0.0",
|
||||||
|
"path-browserify": "^1.0.1",
|
||||||
|
"preact": "^10.4.0",
|
||||||
|
"preact-render-to-string": "^5.1.6",
|
||||||
|
"preact-router": "^3.2.1",
|
||||||
|
"process": "^0.11.10",
|
||||||
|
"react-chartjs-2": "^2.9.0",
|
||||||
|
"react-markdown": "^4.3.1",
|
||||||
|
"react-simplemde-editor": "^4.1.0",
|
||||||
|
"style-loader": "^1.1.4"
|
||||||
|
}
|
||||||
|
}
|
60
preact.config.js
Normal file
60
preact.config.js
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
import SentryCliPlugin from "@sentry/webpack-plugin";
|
||||||
|
const DefinePlugin = require("webpack/lib/DefinePlugin");
|
||||||
|
const ProvidePlugin = require("webpack/lib/ProvidePlugin");
|
||||||
|
|
||||||
|
|
||||||
|
export default function (config, env, helpers) {
|
||||||
|
// noinspection JSUnresolvedVariable
|
||||||
|
config.resolve.alias["react"] = "preact/compat";
|
||||||
|
// noinspection JSUnresolvedVariable
|
||||||
|
config.resolve.alias["react-dom"] = "preact/compat";
|
||||||
|
// noinspection JSUnresolvedVariable
|
||||||
|
config.resolve.alias["path"] = "path-browserify";
|
||||||
|
|
||||||
|
config.module.rules.push(
|
||||||
|
{
|
||||||
|
test: /\.nojekyll$/,
|
||||||
|
loader: 'file-loader',
|
||||||
|
options: {
|
||||||
|
name: '.nojekyll'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
config.module.rules.push(
|
||||||
|
{
|
||||||
|
test: /CNAME$/,
|
||||||
|
loader: 'file-loader',
|
||||||
|
options: {
|
||||||
|
name: 'CNAME'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
config.module.rules.push(
|
||||||
|
{
|
||||||
|
test: /favicon\.ico$/,
|
||||||
|
loader: 'file-loader',
|
||||||
|
options: {
|
||||||
|
name: 'favicon.ico'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
config.plugins.push(
|
||||||
|
new DefinePlugin({"process.env.RELEASE": `"${process.env.npm_package_version}"`})
|
||||||
|
);
|
||||||
|
|
||||||
|
config.plugins.push(
|
||||||
|
new ProvidePlugin({"process": "process/browser"})
|
||||||
|
);
|
||||||
|
|
||||||
|
if(env.production) {
|
||||||
|
config.plugins.push(
|
||||||
|
new SentryCliPlugin({
|
||||||
|
include: './docs',
|
||||||
|
ignoreFile: ".gitignore",
|
||||||
|
configFile: '.sentryclirc',
|
||||||
|
release: process.env.npm_package_version,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
};
|
46
src/index.js
Normal file
46
src/index.js
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// Import debugging tools
|
||||||
|
let Sentry = null;
|
||||||
|
if(process.env.NODE_ENV === "development") {
|
||||||
|
console.debug("Initializing Preact Debugger...")
|
||||||
|
require("preact/debug");
|
||||||
|
}
|
||||||
|
else if(process.env.NODE_ENV === "production") {
|
||||||
|
console.debug("Initializing Sentry...")
|
||||||
|
Sentry = require("@sentry/browser");
|
||||||
|
let SentryIntegrations = require("@sentry/integrations")
|
||||||
|
// noinspection JSUnresolvedVariable
|
||||||
|
Sentry.init({
|
||||||
|
// TODO: Sentry DSN goes here
|
||||||
|
dsn: "",
|
||||||
|
release: process.env.RELEASE,
|
||||||
|
environment: "production",
|
||||||
|
beforeSend(event, hint) {
|
||||||
|
if (event.exception) {
|
||||||
|
Sentry.showReportDialog({ eventId: event.event_id });
|
||||||
|
}
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// noinspection ES6UnusedImports
|
||||||
|
import "bluelib/dist/index.css";
|
||||||
|
import {theme} from "bluelib";
|
||||||
|
import './meta/manifest.json';
|
||||||
|
import './meta/CNAME';
|
||||||
|
import './meta/.nojekyll';
|
||||||
|
import './meta/favicon.ico';
|
||||||
|
|
||||||
|
import Router from 'preact-router';
|
||||||
|
import {createHashHistory} from "history";
|
||||||
|
|
||||||
|
// noinspection JSUnusedGlobalSymbols
|
||||||
|
export default function(props) {
|
||||||
|
return (
|
||||||
|
<div id="app" class={theme.bluelib}>
|
||||||
|
<Router history={createHashHistory()}>
|
||||||
|
|
||||||
|
</Router>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
0
src/meta/.nojekyll
Normal file
0
src/meta/.nojekyll
Normal file
1
src/meta/CNAME
Normal file
1
src/meta/CNAME
Normal file
|
@ -0,0 +1 @@
|
||||||
|
example.org
|
BIN
src/meta/favicon.ico
Normal file
BIN
src/meta/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
16
src/meta/manifest.json
Normal file
16
src/meta/manifest.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"name": "Example",
|
||||||
|
"short_name": "Example",
|
||||||
|
"start_url": "/",
|
||||||
|
"display": "browser",
|
||||||
|
"orientation": "portrait",
|
||||||
|
"background_color": "#0d193b",
|
||||||
|
"theme_color": "#1c2b4f",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "/favicon.ico",
|
||||||
|
"type": "image/x-icon",
|
||||||
|
"sizes": "800x800"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
19
src/template.html
Normal file
19
src/template.html
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="it">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title><% preact.title %></title>
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<link rel="icon" href="/favicon.ico" type="image/x-icon"/>
|
||||||
|
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #0d193b;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<% preact.headEnd %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<% preact.bodyEnd %>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue