mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-27 22:33:07 +00:00
Compare commits
1 Commits
vitreum-to
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69bde779fa |
@@ -49,4 +49,4 @@ const Admin = ()=>{
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Admin;
|
module.exports = Admin;
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
@import './shared/naturalcrit/styles/reset.less';
|
@import 'naturalcrit/styles/reset.less';
|
||||||
@import './shared/naturalcrit/styles/elements.less';
|
@import 'naturalcrit/styles/elements.less';
|
||||||
@import './shared/naturalcrit/styles/animations.less';
|
@import 'naturalcrit/styles/animations.less';
|
||||||
@import './shared/naturalcrit/styles/colors.less';
|
@import 'naturalcrit/styles/colors.less';
|
||||||
@import './shared/naturalcrit/styles/tooltip.less';
|
@import 'naturalcrit/styles/tooltip.less';
|
||||||
@import './themes/fonts/iconFonts/fontAwesome.less';
|
@import './themes/fonts/iconFonts/fontAwesome.less';
|
||||||
|
|
||||||
|
@import 'font-awesome/css/font-awesome.css';
|
||||||
|
|
||||||
html,body, #reactContainer, .naturalCrit { min-height : 100%; }
|
html,body, #reactContainer, .naturalCrit { min-height : 100%; }
|
||||||
|
|
||||||
@sidebarWidth : 250px;
|
@sidebarWidth : 250px;
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
@import '../../../shared/naturalcrit/styles/colors.less';
|
|
||||||
|
|
||||||
.brewUtil {
|
.brewUtil {
|
||||||
.result {
|
.result {
|
||||||
margin-top : 20px;
|
margin-top : 20px;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import diceFont from '../../../themes/fonts/iconFonts/diceFont.js';
|
import diceFont from 'themes/fonts/iconFonts/diceFont.js';
|
||||||
import elderberryInn from '../../../themes/fonts/iconFonts/elderberryInn.js';
|
import elderberryInn from 'themes/fonts/iconFonts/elderberryInn.js';
|
||||||
import fontAwesome from '../../../themes/fonts/iconFonts/fontAwesome.js';
|
import fontAwesome from 'themes/fonts/iconFonts/fontAwesome.js';
|
||||||
import gameIcons from '../../../themes/fonts/iconFonts/gameIcons.js';
|
import gameIcons from 'themes/fonts/iconFonts/gameIcons.js';
|
||||||
|
|
||||||
const emojis = {
|
const emojis = {
|
||||||
...diceFont,
|
...diceFont,
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
@import './shared/naturalcrit/styles/colors.less';
|
|
||||||
|
|
||||||
.renderWarnings {
|
.renderWarnings {
|
||||||
position : relative;
|
position : relative;
|
||||||
float : right;
|
float : right;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import './splitPane.less';
|
import './splitPane.less';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
@import './shared/naturalcrit/styles/core.less';
|
|
||||||
|
|
||||||
.splitPane {
|
.splitPane {
|
||||||
position : relative;
|
position : relative;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import dedent from 'dedent';
|
|||||||
import { printCurrentBrew } from '../../../shared/helpers.js';
|
import { printCurrentBrew } from '../../../shared/helpers.js';
|
||||||
|
|
||||||
import HeaderNav from './headerNav/headerNav.jsx';
|
import HeaderNav from './headerNav/headerNav.jsx';
|
||||||
import safeHTML from './safeHTML.js';
|
import { safeHTML } from './safeHTML.js';
|
||||||
|
|
||||||
const PAGEBREAK_REGEX_V3 = /^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m;
|
const PAGEBREAK_REGEX_V3 = /^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m;
|
||||||
const PAGEBREAK_REGEX_LEGACY = /\\page(?:break)?/m;
|
const PAGEBREAK_REGEX_LEGACY = /\\page(?:break)?/m;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
@import './shared/naturalcrit/styles/colors.less';
|
|
||||||
|
|
||||||
.errorBar {
|
.errorBar {
|
||||||
position : absolute;
|
position : absolute;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import './notificationPopup.less';
|
import './notificationPopup.less';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import request from '../../utils/request-middleware.js';
|
import request from '../../utils/request-middleware.js';
|
||||||
import Markdown from '../../../../shared/markdown.js';
|
import Markdown from 'markdown.js';
|
||||||
|
|
||||||
import Dialog from '../../../components/dialog.jsx';
|
import Dialog from '../../../components/dialog.jsx';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
@import './client/homebrew/navbar/navbar.less';
|
|
||||||
|
|
||||||
.popups {
|
.popups {
|
||||||
position : fixed;
|
position : fixed;
|
||||||
top : calc(@navbarHeight + @viewerToolsHeight);
|
top : calc(@navbarHeight + @viewerToolsHeight);
|
||||||
|
|||||||
@@ -43,4 +43,4 @@ function safeHTML(htmlString) {
|
|||||||
return div.innerHTML;
|
return div.innerHTML;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default safeHTML;
|
module.exports.safeHTML = safeHTML;
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
@import './shared/naturalcrit/styles/core.less';
|
@import 'themes/codeMirror/customEditorStyles.less';
|
||||||
@import './themes/codeMirror/customEditorStyles.less';
|
|
||||||
|
|
||||||
.editor {
|
.editor {
|
||||||
position : relative;
|
position : relative;
|
||||||
width : 100%;
|
width : 100%;
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ import request from '../../utils/request-middleware.js';
|
|||||||
import Combobox from '../../../components/combobox.jsx';
|
import Combobox from '../../../components/combobox.jsx';
|
||||||
import TagInput from '../tagInput/tagInput.jsx';
|
import TagInput from '../tagInput/tagInput.jsx';
|
||||||
|
|
||||||
|
import Themes from 'themes/themes.json';
|
||||||
import Themes from '../../../../themes/themes.json';
|
|
||||||
import validations from './validations.js';
|
import validations from './validations.js';
|
||||||
|
|
||||||
const SYSTEMS = ['5e', '4e', '3.5e', 'Pathfinder'];
|
const SYSTEMS = ['5e', '4e', '3.5e', 'Pathfinder'];
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import './shared/naturalcrit/styles/core.less';
|
@import 'naturalcrit/styles/colors.less';
|
||||||
|
|
||||||
.userThemeName {
|
.userThemeName {
|
||||||
padding-right : 10px;
|
padding-right : 10px;
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import cx from 'classnames';
|
|||||||
import { loadHistory } from '../../utils/versionHistory.js';
|
import { loadHistory } from '../../utils/versionHistory.js';
|
||||||
import { brewSnippetsToJSON } from '../../../../shared/helpers.js';
|
import { brewSnippetsToJSON } from '../../../../shared/helpers.js';
|
||||||
|
|
||||||
import Legacy5ePHB from '../../../../themes/Legacy/5ePHB/snippets.js';
|
import Legacy5ePHB from 'themes/Legacy/5ePHB/snippets.js';
|
||||||
import V3_5ePHB from '../../../../themes/V3/5ePHB/snippets.js';
|
import V3_5ePHB from 'themes/V3/5ePHB/snippets.js';
|
||||||
import V3_5eDMG from '../../../../themes/V3/5eDMG/snippets.js';
|
import V3_5eDMG from 'themes/V3/5eDMG/snippets.js';
|
||||||
import V3_Journal from '../../../../themes/V3/Journal/snippets.js';
|
import V3_Journal from 'themes/V3/Journal/snippets.js';
|
||||||
import V3_Blank from '../../../../themes/V3/Blank/snippets.js';
|
import V3_Blank from 'themes/V3/Blank/snippets.js';
|
||||||
|
|
||||||
const ThemeSnippets = {
|
const ThemeSnippets = {
|
||||||
Legacy_5ePHB : Legacy5ePHB,
|
Legacy_5ePHB : Legacy5ePHB,
|
||||||
@@ -23,7 +23,7 @@ const ThemeSnippets = {
|
|||||||
V3_Blank : V3_Blank,
|
V3_Blank : V3_Blank,
|
||||||
};
|
};
|
||||||
|
|
||||||
import EditorThemes from '../../../../build/homebrew/codeMirror/editorThemes.json';
|
import EditorThemes from 'build/homebrew/codeMirror/editorThemes.json';
|
||||||
|
|
||||||
const execute = function(val, props){
|
const execute = function(val, props){
|
||||||
if(_.isFunction(val)) return val(props);
|
if(_.isFunction(val)) return val(props);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
@import './shared/naturalcrit/styles/core.less';
|
|
||||||
@import (less) './client/icons/customIcons.less';
|
@import (less) './client/icons/customIcons.less';
|
||||||
@import (less) '././././themes/fonts/5e/fonts.less';
|
@import (less) '././././themes/fonts/5e/fonts.less';
|
||||||
|
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ const Homebrew = (props)=>{
|
|||||||
global.config = config;
|
global.config = config;
|
||||||
|
|
||||||
const backgroundObject = ()=>{
|
const backgroundObject = ()=>{
|
||||||
if(global.config?.deployment || (config?.local && config?.development)){
|
if(global.config.deployment || (config.local && config.development)){
|
||||||
const bgText = global.config?.deployment || 'Local';
|
const bgText = global.config.deployment || 'Local';
|
||||||
return {
|
return {
|
||||||
backgroundImage : `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='100px' width='200px'><text x='0' y='15' fill='%23fff7' font-size='20'>${bgText}</text></svg>")`
|
backgroundImage : `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='100px' width='200px'><text x='0' y='15' fill='%23fff7' font-size='20'>${bgText}</text></svg>")`
|
||||||
};
|
};
|
||||||
@@ -58,7 +58,7 @@ const Homebrew = (props)=>{
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Router location={url}>
|
<Router location={url}>
|
||||||
<div className={`homebrew${(config?.deployment || config?.local) ? ' deployment' : ''}`} style={backgroundObject()}>
|
<div className={`homebrew${(config.deployment || config.local) ? ' deployment' : ''}`} style={backgroundObject()}>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path='/edit/:id' element={<WithRoute el={EditPage} brew={brew} userThemes={userThemes}/>} />
|
<Route path='/edit/:id' element={<WithRoute el={EditPage} brew={brew} userThemes={userThemes}/>} />
|
||||||
<Route path='/share/:id' element={<WithRoute el={SharePage} brew={brew} />} />
|
<Route path='/share/:id' element={<WithRoute el={SharePage} brew={brew} />} />
|
||||||
@@ -80,4 +80,4 @@ const Homebrew = (props)=>{
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Homebrew;
|
module.exports = Homebrew;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
@import './shared/naturalcrit/styles/core.less';
|
@import 'naturalcrit/styles/core.less';
|
||||||
.homebrew {
|
.homebrew {
|
||||||
height : 100%;
|
height : 100%;
|
||||||
background-color:@steel;
|
background-color:@steel;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ const Account = createReactClass({
|
|||||||
|
|
||||||
// Logged out
|
// Logged out
|
||||||
// LOCAL ONLY
|
// LOCAL ONLY
|
||||||
if(global.config?.local) {
|
if(global.config.local) {
|
||||||
return <Nav.item color='teal' icon='fas fa-sign-in-alt' onClick={this.localLogin}>
|
return <Nav.item color='teal' icon='fas fa-sign-in-alt' onClick={this.localLogin}>
|
||||||
login
|
login
|
||||||
</Nav.item>;
|
</Nav.item>;
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
@import './shared/naturalcrit/styles/core.less';
|
|
||||||
|
|
||||||
.navItem.error {
|
.navItem.error {
|
||||||
position : relative;
|
position : relative;
|
||||||
background-color : @red;
|
background-color : @red;
|
||||||
|
|||||||
@@ -7,11 +7,17 @@ import PatreonNavItem from './patreon.navitem.jsx';
|
|||||||
|
|
||||||
const Navbar = createReactClass({
|
const Navbar = createReactClass({
|
||||||
displayName : 'Navbar',
|
displayName : 'Navbar',
|
||||||
getInitialState: function() {
|
getInitialState : function() {
|
||||||
return {
|
return {
|
||||||
// showNonChromeWarning: false, // uncomment if needed
|
//showNonChromeWarning : false,
|
||||||
ver: global.version || '0.0.0'
|
ver : '0.0.0'
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
getInitialState : function() {
|
||||||
|
return {
|
||||||
|
ver : global.version
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import './shared/naturalcrit/styles/core.less';
|
@import 'naturalcrit/styles/colors.less';
|
||||||
|
|
||||||
@navbarHeight : 28px;
|
@navbarHeight : 28px;
|
||||||
@viewerToolsHeight : 32px;
|
@viewerToolsHeight : 32px;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
@import './shared/naturalcrit/styles/core.less';
|
|
||||||
|
|
||||||
.brewItem {
|
.brewItem {
|
||||||
position : relative;
|
position : relative;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import RecentNavItems from '../../navbar/recent.navitem.jsx';
|
|||||||
const { both: RecentNavItem } = RecentNavItems;
|
const { both: RecentNavItem } = RecentNavItems;
|
||||||
|
|
||||||
// Page specific imports
|
// Page specific imports
|
||||||
import Meta from '../../../../vitreum/headtags.js';
|
import { Meta } from 'vitreum/headtags';
|
||||||
import { md5 } from 'hash-wasm';
|
import { md5 } from 'hash-wasm';
|
||||||
import { gzipSync, strToU8 } from 'fflate';
|
import { gzipSync, strToU8 } from 'fflate';
|
||||||
import { makePatches, stringifyPatches } from '@sanity/diff-match-patch';
|
import { makePatches, stringifyPatches } from '@sanity/diff-match-patch';
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const { both: RecentNavItem } = RecentNavItems;
|
|||||||
|
|
||||||
|
|
||||||
// Page specific imports
|
// Page specific imports
|
||||||
import Meta from '../../../../vitreum/headtags.js';
|
import { Meta } from 'vitreum/headtags';
|
||||||
|
|
||||||
const BREWKEY = 'homebrewery-new';
|
const BREWKEY = 'homebrewery-new';
|
||||||
const STYLEKEY = 'homebrewery-new-style';
|
const STYLEKEY = 'homebrewery-new-style';
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
@import './shared/naturalcrit/styles/core.less';
|
|
||||||
|
|
||||||
.homePage {
|
.homePage {
|
||||||
position : relative;
|
position : relative;
|
||||||
a.floatingNewButton {
|
a.floatingNewButton {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import RecentNavItems from '../../navbar/recent.navitem.jsx';
|
|||||||
const { both: RecentNavItem } = RecentNavItems;
|
const { both: RecentNavItem } = RecentNavItems;
|
||||||
|
|
||||||
// Page specific imports
|
// Page specific imports
|
||||||
import { Meta } from '../../../../vitreum/headtags.js';
|
import { Meta } from 'vitreum/headtags';
|
||||||
|
|
||||||
const BREWKEY = 'HB_newPage_content';
|
const BREWKEY = 'HB_newPage_content';
|
||||||
const STYLEKEY = 'HB_newPage_style';
|
const STYLEKEY = 'HB_newPage_style';
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
@import './shared/naturalcrit/styles/colors.less';
|
|
||||||
|
|
||||||
.newPage {
|
.newPage {
|
||||||
.navItem.save {
|
.navItem.save {
|
||||||
background-color : @orange;
|
background-color : @orange;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import './sharePage.less';
|
import './sharePage.less';
|
||||||
import React, { useState, useEffect, useCallback } from 'react';
|
import React, { useState, useEffect, useCallback } from 'react';
|
||||||
import Meta from '../../../../vitreum/headtags.js';
|
import { Meta } from 'vitreum/headtags';
|
||||||
|
|
||||||
import Nav from '../../navbar/nav.jsx';
|
import Nav from '../../navbar/nav.jsx';
|
||||||
import Navbar from '../../navbar/navbar.jsx';
|
import Navbar from '../../navbar/navbar.jsx';
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
@import './shared/naturalcrit/styles/core.less';
|
|
||||||
|
|
||||||
.vaultPage {
|
.vaultPage {
|
||||||
height : 100%;
|
height : 100%;
|
||||||
overflow-y : hidden;
|
overflow-y : hidden;
|
||||||
|
|||||||
4400
package-lock.json
generated
4400
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@@ -12,10 +12,6 @@
|
|||||||
"url": "git://github.com/naturalcrit/homebrewery.git"
|
"url": "git://github.com/naturalcrit/homebrewery.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"viteDev": "node scripts/dev.js",
|
|
||||||
"viteDevAdmin": "vite --config vite.config.js --ssr client/admin/admin.jsx",
|
|
||||||
"viteBuild": "vite build",
|
|
||||||
"viteStart": "vite preview --outDir build",
|
|
||||||
"dev": "node --experimental-require-module scripts/dev.js",
|
"dev": "node --experimental-require-module scripts/dev.js",
|
||||||
"quick": "node --experimental-require-module scripts/quick.js",
|
"quick": "node --experimental-require-module scripts/quick.js",
|
||||||
"build": "node --experimental-require-module scripts/buildHomebrew.js && node --experimental-require-module scripts/buildAdmin.js",
|
"build": "node --experimental-require-module scripts/buildHomebrew.js && node --experimental-require-module scripts/buildAdmin.js",
|
||||||
@@ -100,7 +96,6 @@
|
|||||||
"@dmsnell/diff-match-patch": "^1.1.0",
|
"@dmsnell/diff-match-patch": "^1.1.0",
|
||||||
"@googleapis/drive": "^19.2.0",
|
"@googleapis/drive": "^19.2.0",
|
||||||
"@sanity/diff-match-patch": "^3.2.0",
|
"@sanity/diff-match-patch": "^3.2.0",
|
||||||
"@vitejs/plugin-react": "^5.1.2",
|
|
||||||
"body-parser": "^2.2.0",
|
"body-parser": "^2.2.0",
|
||||||
"classnames": "^2.5.1",
|
"classnames": "^2.5.1",
|
||||||
"codemirror": "^5.65.6",
|
"codemirror": "^5.65.6",
|
||||||
@@ -119,7 +114,7 @@
|
|||||||
"idb-keyval": "^6.2.2",
|
"idb-keyval": "^6.2.2",
|
||||||
"js-yaml": "^4.1.1",
|
"js-yaml": "^4.1.1",
|
||||||
"jwt-simple": "^0.5.6",
|
"jwt-simple": "^0.5.6",
|
||||||
"less": "^4.5.1",
|
"less": "^3.13.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"marked": "15.0.12",
|
"marked": "15.0.12",
|
||||||
"marked-alignment-paragraphs": "^1.0.0",
|
"marked-alignment-paragraphs": "^1.0.0",
|
||||||
@@ -143,7 +138,7 @@
|
|||||||
"romans": "^3.1.0",
|
"romans": "^3.1.0",
|
||||||
"sanitize-filename": "1.6.3",
|
"sanitize-filename": "1.6.3",
|
||||||
"superagent": "^10.2.1",
|
"superagent": "^10.2.1",
|
||||||
"vite": "^7.3.1",
|
"vitreum": "git+https://git@github.com/calculuschild/vitreum.git",
|
||||||
"written-number": "^0.11.1"
|
"written-number": "^0.11.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -153,7 +148,7 @@
|
|||||||
"eslint": "^9.39.1",
|
"eslint": "^9.39.1",
|
||||||
"eslint-plugin-jest": "^29.1.0",
|
"eslint-plugin-jest": "^29.1.0",
|
||||||
"eslint-plugin-react": "^7.37.5",
|
"eslint-plugin-react": "^7.37.5",
|
||||||
"globals": "^16.4.0",
|
"globals": "^17.1.0",
|
||||||
"jest": "^30.2.0",
|
"jest": "^30.2.0",
|
||||||
"jest-expect-message": "^1.1.3",
|
"jest-expect-message": "^1.1.3",
|
||||||
"jsdom": "^27.4.0",
|
"jsdom": "^27.4.0",
|
||||||
|
|||||||
@@ -1,44 +1,22 @@
|
|||||||
import express from "express";
|
const label = 'dev';
|
||||||
import { createServer as createViteServer } from "vite";
|
console.time(label);
|
||||||
import path from "path";
|
|
||||||
import url from "url";
|
|
||||||
import template from "../client/template.js";
|
|
||||||
|
|
||||||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
const jsx = require('vitreum/steps/jsx.watch.js');
|
||||||
const app = express();
|
const less = require('vitreum/steps/less.watch.js');
|
||||||
|
const assets = require('vitreum/steps/assets.watch.js');
|
||||||
|
const server = require('vitreum/steps/server.watch.js');
|
||||||
|
const livereload = require('vitreum/steps/livereload.js');
|
||||||
|
|
||||||
async function start() {
|
const Proj = require('./project.json');
|
||||||
const vite = await createViteServer({
|
|
||||||
server: { middlewareMode: true },
|
|
||||||
root: __dirname,
|
|
||||||
appType: "custom",
|
|
||||||
});
|
|
||||||
|
|
||||||
app.use(vite.middlewares);
|
Promise.resolve()
|
||||||
app.use("/assets", express.static(path.resolve(__dirname, "/client/assets")));
|
.then(()=>jsx('homebrew', './client/homebrew/homebrew.jsx', { libs: Proj.libs, shared: ['./shared'] }))
|
||||||
|
.then((deps)=>less('homebrew', { shared: ['./shared'] }, deps))
|
||||||
|
.then(()=>jsx('admin', './client/admin/admin.jsx', { libs: Proj.libs, shared: ['./shared'] }))
|
||||||
|
.then((deps)=>less('admin', { shared: ['./shared'] }, deps))
|
||||||
|
|
||||||
app.use(/(.*)/, async (req, res, next) => {
|
.then(()=>assets(Proj.assets, ['./shared', './client']))
|
||||||
try {
|
.then(()=>livereload())
|
||||||
const parsed = url.parse(req.url);
|
.then(()=>server('./server.js', ['server']))
|
||||||
const pathname = parsed.pathname || "/";
|
.then(console.timeEnd.bind(console, label))
|
||||||
|
.catch(console.error);
|
||||||
// Ignore vite HMR or ping requests
|
|
||||||
if (pathname.startsWith("/__vite")) return next();
|
|
||||||
|
|
||||||
const entry = pathname.startsWith("/admin") ? "admin" : "homebrew";
|
|
||||||
|
|
||||||
const ssrModule = await vite.ssrLoadModule(`client/${entry}/${entry}.jsx`);
|
|
||||||
|
|
||||||
const html = await template(entry, "", { path: pathname, ssrModule });
|
|
||||||
res.status(200).set({ "Content-Type": "text/html" }).end(html);
|
|
||||||
} catch (e) {
|
|
||||||
vite.ssrFixStacktrace(e);
|
|
||||||
console.error(e);
|
|
||||||
res.status(500).end(e.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.listen(8000, () => console.log("Dev server running on http://localhost:8000"));
|
|
||||||
}
|
|
||||||
|
|
||||||
start();
|
|
||||||
@@ -110,9 +110,9 @@ app.use(homebrewApi);
|
|||||||
app.use(adminApi);
|
app.use(adminApi);
|
||||||
app.use(vaultApi);
|
app.use(vaultApi);
|
||||||
|
|
||||||
const welcomeText = fs.readFileSync('./client/homebrew/pages/homePage/welcome_msg.md', 'utf8');
|
const welcomeText = fs.readFileSync('client/homebrew/pages/homePage/welcome_msg.md', 'utf8');
|
||||||
const welcomeTextLegacy = fs.readFileSync('./client/homebrew/pages/homePage/welcome_msg_legacy.md', 'utf8');
|
const welcomeTextLegacy = fs.readFileSync('client/homebrew/pages/homePage/welcome_msg_legacy.md', 'utf8');
|
||||||
const migrateText = fs.readFileSync('./client/homebrew/pages/homePage/migrate.md', 'utf8');
|
const migrateText = fs.readFileSync('client/homebrew/pages/homePage/migrate.md', 'utf8');
|
||||||
const changelogText = fs.readFileSync('changelog.md', 'utf8');
|
const changelogText = fs.readFileSync('changelog.md', 'utf8');
|
||||||
const faqText = fs.readFileSync('faq.md', 'utf8');
|
const faqText = fs.readFileSync('faq.md', 'utf8');
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
@import './reset.less';
|
@import 'naturalcrit/styles/reset.less';
|
||||||
//@import './elements.less';
|
//@import 'naturalcrit/styles/elements.less';
|
||||||
@import './animations.less';
|
@import 'naturalcrit/styles/animations.less';
|
||||||
@import './colors.less';
|
@import 'naturalcrit/styles/colors.less';
|
||||||
@import './tooltip.less';
|
@import 'naturalcrit/styles/tooltip.less';
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family : 'CodeLight';
|
font-family : 'CodeLight';
|
||||||
src : data-uri('naturalcrit/styles/CODE Light.otf') format('opentype');
|
src : data-uri('naturalcrit/styles/CODE Light.otf') format('opentype');
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import Markdown from './shared/markdown.js';
|
import Markdown from 'markdown.js';
|
||||||
|
|
||||||
test('Processes the markdown within an HTML block if its just a class wrapper', function() {
|
test('Processes the markdown within an HTML block if its just a class wrapper', function() {
|
||||||
const source = '<div>*Bold text*</div>';
|
const source = '<div>*Bold text*</div>';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import Markdown from './shared/markdown.js';
|
import Markdown from 'markdown.js';
|
||||||
|
|
||||||
describe('Inline Definition Lists', ()=>{
|
describe('Inline Definition Lists', ()=>{
|
||||||
test('No Term 1 Definition', function() {
|
test('No Term 1 Definition', function() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import Markdown from './shared/markdown.js';
|
import Markdown from 'markdown.js';
|
||||||
import dedent from 'dedent';
|
import dedent from 'dedent';
|
||||||
|
|
||||||
// Marked.js adds line returns after closing tags on some default tokens.
|
// Marked.js adds line returns after closing tags on some default tokens.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import Markdown from './shared/markdown.js';
|
import Markdown from 'markdown.js';
|
||||||
|
|
||||||
describe('Hard Breaks', ()=>{
|
describe('Hard Breaks', ()=>{
|
||||||
test('Single Break', function() {
|
test('Single Break', function() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable max-lines */
|
/* eslint-disable max-lines */
|
||||||
|
|
||||||
import dedent from 'dedent';
|
import dedent from 'dedent';
|
||||||
import Markdown from './shared/markdown.js';
|
import Markdown from 'markdown.js';
|
||||||
|
|
||||||
// Marked.js adds line returns after closing tags on some default tokens.
|
// Marked.js adds line returns after closing tags on some default tokens.
|
||||||
// This removes those line returns for comparison sake.
|
// This removes those line returns for comparison sake.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import Markdown from './shared/markdown.js';
|
import Markdown from 'markdown.js';
|
||||||
|
|
||||||
describe('Non-Breaking Spaces Interactions', ()=>{
|
describe('Non-Breaking Spaces Interactions', ()=>{
|
||||||
test('I am actually a single-line definition list!', function() {
|
test('I am actually a single-line definition list!', function() {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import Markdown from './shared/markdown.js';
|
import Markdown from 'markdown.js';
|
||||||
|
|
||||||
describe('Justification', ()=>{
|
describe('Justification', ()=>{
|
||||||
test('Left Justify', function() {
|
test('Left Justify', function() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable max-lines */
|
/* eslint-disable max-lines */
|
||||||
|
|
||||||
import dedent from 'dedent';
|
import dedent from 'dedent';
|
||||||
import Markdown from './shared/markdown.js';
|
import Markdown from 'markdown.js';
|
||||||
|
|
||||||
// Marked.js adds line returns after closing tags on some default tokens.
|
// Marked.js adds line returns after closing tags on some default tokens.
|
||||||
// This removes those line returns for comparison sake.
|
// This removes those line returns for comparison sake.
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* eslint-disable max-lines */
|
/* eslint-disable max-lines */
|
||||||
|
|
||||||
import MagicGen from './snippets/magic.gen.js';
|
import MagicGen from './snippets/magic.gen.js';
|
||||||
import ClassTableGen from './snippets/classtable.gen.js';
|
import ClassTableGen from './snippets/classtable.gen.js';
|
||||||
import MonsterBlockGen from './snippets/monsterblock.gen.js';
|
import MonsterBlockGen from './snippets/monsterblock.gen.js';
|
||||||
import ClassFeatureGen from './snippets/classfeature.gen.js';
|
import ClassFeatureGen from './snippets/classfeature.gen.js';
|
||||||
import CoverPageGen from './snippets/coverpage.gen.js';
|
import CoverPageGen from './snippets/coverpage.gen.js';
|
||||||
import TableOfContentsGen from './snippets/tableOfContents.gen.js';
|
import TableOfContentsGen from './snippets/tableOfContents.gen.js';
|
||||||
import dedent from 'dedent';
|
import dedent from 'dedent';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
function classFeatureGen(classname) {
|
export default function(classname){
|
||||||
|
|
||||||
classname = _.sample(['archivist', 'fancyman', 'linguist', 'fletcher',
|
classname = _.sample(['archivist', 'fancyman', 'linguist', 'fletcher',
|
||||||
'notary', 'berserker-typist', 'fishmongerer', 'manicurist', 'haberdasher', 'concierge']);
|
'notary', 'berserker-typist', 'fishmongerer', 'manicurist', 'haberdasher', 'concierge']);
|
||||||
@@ -49,6 +49,4 @@ function classFeatureGen(classname) {
|
|||||||
`- ${_.sample(['10 lint fluffs', '1 button', 'a cherished lost sock'])}`,
|
`- ${_.sample(['10 lint fluffs', '1 button', 'a cherished lost sock'])}`,
|
||||||
'\n\n\n'
|
'\n\n\n'
|
||||||
].join('\n');
|
].join('\n');
|
||||||
}
|
};
|
||||||
|
|
||||||
export default classFeatureGen;
|
|
||||||
|
|||||||
@@ -98,8 +98,8 @@ const subtitles = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
function coverPageGen() {
|
export default ()=>{
|
||||||
return `<style>
|
return `<style>
|
||||||
.phb#p1{ text-align:center; }
|
.phb#p1{ text-align:center; }
|
||||||
.phb#p1:after{ display:none; }
|
.phb#p1:after{ display:none; }
|
||||||
</style>
|
</style>
|
||||||
@@ -114,6 +114,4 @@ return `<style>
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
\\page`;
|
\\page`;
|
||||||
}
|
};
|
||||||
|
|
||||||
export default coverPageGen;
|
|
||||||
@@ -4,7 +4,7 @@ import ClassFeatureGen from './classfeature.gen.js';
|
|||||||
|
|
||||||
import ClassTableGen from './classtable.gen.js';
|
import ClassTableGen from './classtable.gen.js';
|
||||||
|
|
||||||
function fullClassGen(){
|
export default function(){
|
||||||
|
|
||||||
const classname = _.sample(['Archivist', 'Fancyman', 'Linguist', 'Fletcher',
|
const classname = _.sample(['Archivist', 'Fancyman', 'Linguist', 'Fletcher',
|
||||||
'Notary', 'Berserker-Typist', 'Fishmongerer', 'Manicurist', 'Haberdasher', 'Concierge']);
|
'Notary', 'Berserker-Typist', 'Fishmongerer', 'Manicurist', 'Haberdasher', 'Concierge']);
|
||||||
@@ -40,6 +40,4 @@ function fullClassGen(){
|
|||||||
|
|
||||||
|
|
||||||
].join('\n')}\n\n\n`;
|
].join('\n')}\n\n\n`;
|
||||||
}
|
};
|
||||||
|
|
||||||
export default fullClassGen;
|
|
||||||
@@ -47,8 +47,7 @@ const getTOC = (pages)=>{
|
|||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
function tableOfContentsGen(props){
|
export default function(props){
|
||||||
|
|
||||||
const pages = props.brew.text.split('\\page');
|
const pages = props.brew.text.split('\\page');
|
||||||
const TOC = getTOC(pages);
|
const TOC = getTOC(pages);
|
||||||
const markdown = _.reduce(TOC, (r, g1, idx1)=>{
|
const markdown = _.reduce(TOC, (r, g1, idx1)=>{
|
||||||
@@ -70,6 +69,4 @@ function tableOfContentsGen(props){
|
|||||||
##### Table Of Contents
|
##### Table Of Contents
|
||||||
${markdown}
|
${markdown}
|
||||||
</div>\n`;
|
</div>\n`;
|
||||||
}
|
};
|
||||||
|
|
||||||
export default tableOfContentsGen;
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
// vite.config.js
|
|
||||||
import { defineConfig } from "vite";
|
|
||||||
import react from "@vitejs/plugin-react";
|
|
||||||
import path from "path";
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: [react()],
|
|
||||||
build: {
|
|
||||||
outDir: "build",
|
|
||||||
emptyOutDir: true,
|
|
||||||
ssrManifest: true,
|
|
||||||
rollupOptions: {
|
|
||||||
input: {
|
|
||||||
admin: path.resolve(__dirname, "client/admin/admin.jsx"),
|
|
||||||
homebrew: path.resolve(__dirname, "client/homebrew/homebrew.jsx"),
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
entryFileNames: "[name]/bundle.js",
|
|
||||||
chunkFileNames: "[name]/[name]-[hash].js",
|
|
||||||
assetFileNames: "[name]/[name].[ext]",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
server: {
|
|
||||||
fs: {
|
|
||||||
allow: ["."],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
import React, { useEffect } from "react";
|
|
||||||
import injectTag from "./injectTag.js";
|
|
||||||
|
|
||||||
const obj2props = (obj) =>
|
|
||||||
Object.entries(obj)
|
|
||||||
.map(([k, v]) => `${k}="${v}"`)
|
|
||||||
.join(" ");
|
|
||||||
const toStr = (chld) => (Array.isArray(chld) ? chld.join("") : chld);
|
|
||||||
const onServer = typeof window === "undefined";
|
|
||||||
|
|
||||||
let NamedTags = {};
|
|
||||||
let UnnamedTags = [];
|
|
||||||
|
|
||||||
export const HeadComponents = {
|
|
||||||
Title({ children }) {
|
|
||||||
if (onServer) NamedTags.title = `<title>${toStr(children)}</title>`;
|
|
||||||
useEffect(() => {
|
|
||||||
document.title = toStr(children);
|
|
||||||
}, [children]);
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
Favicon({ type = "image/png", href = "", rel = "icon", id = "favicon" }) {
|
|
||||||
if (onServer) NamedTags.favicon = `<link rel='shortcut icon' type="${type}" id="${id}" href="${href}" />`;
|
|
||||||
useEffect(() => {
|
|
||||||
document.getElementById(id).href = href;
|
|
||||||
}, [id, href]);
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
Description({ children }) {
|
|
||||||
if (onServer) NamedTags.description = `<meta name='description' content='${toStr(children)}' />`;
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
Noscript({ children }) {
|
|
||||||
if (onServer) UnnamedTags.push(`<noscript>${toStr(children)}</noscript>`);
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
Script({ children = [], ...props }) {
|
|
||||||
if (onServer) {
|
|
||||||
UnnamedTags.push(
|
|
||||||
children.length
|
|
||||||
? `<script ${obj2props(props)}>${toStr(children)}</script>`
|
|
||||||
: `<script ${obj2props(props)} />`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
Meta(props) {
|
|
||||||
let tag = `<meta ${obj2props(props)} />`;
|
|
||||||
props.property || props.name ? (NamedTags[props.property || props.name] = tag) : UnnamedTags.push(tag);
|
|
||||||
useEffect(() => {
|
|
||||||
document
|
|
||||||
.getElementsByTagName("head")[0]
|
|
||||||
.insertAdjacentHTML("beforeend", Object.values(NamedTags).join("\n"));
|
|
||||||
}, [NamedTags]);
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
Style({ children, type = "text/css" }) {
|
|
||||||
if (onServer) UnnamedTags.push(`<style type="${type}">${toStr(children)}</style>`);
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Inject = ({ tag, children, ...props }) => {
|
|
||||||
useEffect(() => {
|
|
||||||
injectTag(tag, props, children);
|
|
||||||
}, []);
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const generate = () => Object.values(NamedTags).concat(UnnamedTags).join("\n");
|
|
||||||
|
|
||||||
export const flush = () => {
|
|
||||||
NamedTags = {};
|
|
||||||
UnnamedTags = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Meta = HeadComponents.Meta;
|
|
||||||
|
|
||||||
export default {
|
|
||||||
Inject,
|
|
||||||
...HeadComponents,
|
|
||||||
generate,
|
|
||||||
flush,
|
|
||||||
};
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
const injectTag = (tag, props, children) => {
|
|
||||||
const injectNode = document.createElement(tag);
|
|
||||||
Object.entries(props).forEach(([key, val]) => injectNode[key] = val);
|
|
||||||
if (children) injectNode.appendChild(document.createTextNode(children));
|
|
||||||
document.getElementsByTagName('head')[0].appendChild(injectNode);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default injectTag;
|
|
||||||
Reference in New Issue
Block a user