Compare commits
No commits in common. "d6944cd4c1c465e3df93405b35aefc941f4b0958" and "133b4e623606a45c7813451fed368a1a159f75e7" have entirely different histories.
d6944cd4c1
...
133b4e6236
|
@ -5,4 +5,3 @@ todo.org
|
|||
node_modules
|
||||
static/scripts/dist
|
||||
static/templates/*
|
||||
generated/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[default]
|
||||
template_dir = "generated/templates/"
|
||||
template_dir = "static/templates/"
|
||||
|
||||
[development]
|
||||
address = "localhost"
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"webpack-dev": "webpack --watch",
|
||||
"build:protobuf": "mkdir -p src/frontend/_proto && protoc --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts -I ./proto --js_out=import_style=commonjs,binary:./src/frontend/_proto --ts_out=service=grpc-web:./src/frontend/_proto ./proto/*.proto",
|
||||
"build:webpack": "webpack"
|
||||
"webpack-dev": "cd static/scripts && webpack serve --watch --inline --port 8081 --host 0.0.0.0 --output-path=./build",
|
||||
"build:protobuf": "mkdir -p static/scripts/_proto && protoc --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts -I ./proto --js_out=import_style=commonjs,binary:./static/scripts/_proto --ts_out=service=grpc-web:./static/scripts/_proto ./proto/*.proto",
|
||||
"build:webpack": "cd static/scripts && webpack"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -43,7 +43,7 @@ async fn make_rocket(database: sqlx::SqlitePool) -> Result<(), Box<dyn std::erro
|
|||
.mount("/api", api_routes)
|
||||
.mount(
|
||||
"/scripts",
|
||||
StaticFiles::from(concat!(env!("CARGO_MANIFEST_DIR"), "/generated/scripts")),
|
||||
StaticFiles::from(concat!(env!("CARGO_MANIFEST_DIR"), "/static/scripts")),
|
||||
)
|
||||
.mount(
|
||||
"/protos",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,23 @@
|
|||
(self["webpackChunk"] = self["webpackChunk"] || []).push([["blah"],{
|
||||
|
||||
/***/ "./src/blah.ts":
|
||||
/*!*********************!*\
|
||||
!*** ./src/blah.ts ***!
|
||||
\*********************/
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
var cofd_api_pb_1 = __webpack_require__(/*! ../_proto/cofd_api_pb */ "./_proto/cofd_api_pb.js");
|
||||
var x = new cofd_api_pb_1.UpdateSkillValueRequest();
|
||||
x.setCharacterId(1);
|
||||
x.setCharacterUsername("guy");
|
||||
console.log("hello", x);
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
},
|
||||
0,[["./src/blah.ts","runtime","vendors-node_modules_google-protobuf_google-protobuf_js","_proto_cofd_api_pb_js"]]]);
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvYmxhaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztBQUVBLGdHQUFnRTtBQUVoRSxJQUFJLENBQUMsR0FBRyxJQUFJLHFDQUF1QixFQUFFLENBQUM7QUFDdEMsQ0FBQyxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUNwQixDQUFDLENBQUMsb0JBQW9CLENBQUMsS0FBSyxDQUFDLENBQUM7QUFDOUIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQUFDLENBQUMiLCJmaWxlIjoiYmxhaC5idW5kbGUuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBncnBjIH0gZnJvbSBcIkBpbXByb2JhYmxlLWVuZy9ncnBjLXdlYlwiO1xuaW1wb3J0IHsgQ29mZEFwaSB9IGZyb20gXCIuLi9fcHJvdG8vY29mZF9hcGlfcGJfc2VydmljZVwiO1xuaW1wb3J0IHsgVXBkYXRlU2tpbGxWYWx1ZVJlcXVlc3QgfSBmcm9tIFwiLi4vX3Byb3RvL2NvZmRfYXBpX3BiXCI7XG5cbmxldCB4ID0gbmV3IFVwZGF0ZVNraWxsVmFsdWVSZXF1ZXN0KCk7XG54LnNldENoYXJhY3RlcklkKDEpO1xueC5zZXRDaGFyYWN0ZXJVc2VybmFtZShcImd1eVwiKTtcbmNvbnNvbGUubG9nKFwiaGVsbG9cIiwgeCk7XG4iXSwic291cmNlUm9vdCI6IiJ9
|
|
@ -0,0 +1,21 @@
|
|||
(self["webpackChunk"] = self["webpackChunk"] || []).push([["index"],{
|
||||
|
||||
/***/ "./src/index.ts":
|
||||
/*!**********************!*\
|
||||
!*** ./src/index.ts ***!
|
||||
\**********************/
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
var cofd_api_pb_1 = __webpack_require__(/*! ../_proto/cofd_api_pb */ "./_proto/cofd_api_pb.js");
|
||||
var x = new cofd_api_pb_1.UpdateSkillValueRequest();
|
||||
console.log("hello from index");
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
},
|
||||
0,[["./src/index.ts","runtime","vendors-node_modules_google-protobuf_google-protobuf_js","_proto_cofd_api_pb_js"]]]);
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7QUFFQSxnR0FBZ0U7QUFFaEUsSUFBSSxDQUFDLEdBQUcsSUFBSSxxQ0FBdUIsRUFBRSxDQUFDO0FBS3RDLE9BQU8sQ0FBQyxHQUFHLENBQUMsa0JBQWtCLENBQUMsQ0FBQyIsImZpbGUiOiJpbmRleC5idW5kbGUuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBncnBjIH0gZnJvbSBcIkBpbXByb2JhYmxlLWVuZy9ncnBjLXdlYlwiO1xuLy8gaW1wb3J0IHsgQ29mZEFwaSB9IGZyb20gXCIuLi9fcHJvdG8vY29mZF9hcGlfcGJfc2VydmljZVwiO1xuaW1wb3J0IHsgVXBkYXRlU2tpbGxWYWx1ZVJlcXVlc3QgfSBmcm9tIFwiLi4vX3Byb3RvL2NvZmRfYXBpX3BiXCI7XG5cbmxldCB4ID0gbmV3IFVwZGF0ZVNraWxsVmFsdWVSZXF1ZXN0KCk7XG4vLyB4LnNldENoYXJhY3RlcklkKDEpO1xuLy8geC5zZXRDaGFyYWN0ZXJVc2VybmFtZShcImd1eVwiKTtcbi8vIGNvbnNvbGUubG9nKFwiaGVsbG9cIiwgeCk7XG5cbmNvbnNvbGUubG9nKFwiaGVsbG8gZnJvbSBpbmRleFwiKTtcbiJdLCJzb3VyY2VSb290IjoiIn0=
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,12 +1,12 @@
|
|||
import { UpdateSkillValueRequest, UpdateAttributeRequest } from "../../_proto/cofd_api_pb";
|
||||
import * as api from "../api";
|
||||
|
||||
// This is the scripting for the edit character page, which submits
|
||||
// changes to the server as the user makes them.
|
||||
|
||||
(async () => {
|
||||
// Useful for making sure elements actually exist in event handler.
|
||||
type Option<T> = T | null | undefined;
|
||||
//TODO start refactoring these into a separate script, and make API calls
|
||||
//take all necessary info (e.g. username and character ID, plus other stuff)
|
||||
//as object params.
|
||||
//const root = await protobuf.load("/protos/cofd_api.proto");
|
||||
|
||||
const [, , USERNAME, CHARACTER_ID] = window.location.pathname.split('/');
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
const webpack = require('webpack');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const path = require('path');
|
||||
|
||||
const root = path.resolve(__dirname, '..', '..');
|
||||
|
||||
function packPage(page, chunks) {
|
||||
if (!chunks) chunks = [];
|
||||
return new HtmlWebpackPlugin({
|
||||
template: `${root}/src/templates/${page}`,
|
||||
filename: `${root}/static/templates/${page}`,
|
||||
publicPath: '/scripts/dist',
|
||||
scriptLoading: 'defer',
|
||||
chunks: chunks,
|
||||
inject: false,
|
||||
minify: false
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
edit_character: "./src/characters/edit.ts",
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: "single",
|
||||
splitChunks: {
|
||||
chunks: 'all',
|
||||
},
|
||||
},
|
||||
mode: "development",
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: '[name].bundle.js'
|
||||
},
|
||||
devtool: 'inline-source-map',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
include: /src|_proto/,
|
||||
exclude: /node_modules/,
|
||||
loader: "ts-loader"
|
||||
}
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts", ".js"]
|
||||
},
|
||||
plugins: [
|
||||
new CleanWebpackPlugin(),
|
||||
packPage('login.html.tera'),
|
||||
packPage('base.html.tera'),
|
||||
packPage('error.html.tera'),
|
||||
packPage('index.html.tera'),
|
||||
packPage('registration.html.tera'),
|
||||
packPage('characters/edit_character.html.tera', ['edit_character']),
|
||||
packPage('characters/edit_character_macros.html.tera'),
|
||||
packPage('characters/new_character.html.tera'),
|
||||
packPage('characters/view_character.html.tera'),
|
||||
packPage('characters/view_character_macros.html.tera'),
|
||||
]
|
||||
};
|
|
@ -1,68 +0,0 @@
|
|||
const webpack = require('webpack');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const path = require('path');
|
||||
|
||||
const root = path.resolve(__dirname, '.');
|
||||
console.log("root is", root);
|
||||
|
||||
function packPage(page, chunks) {
|
||||
if (!chunks) chunks = [];
|
||||
return new HtmlWebpackPlugin({
|
||||
template: `${root}/src/frontend/templates/${page}`,
|
||||
filename: `${root}/generated/templates/${page}`,
|
||||
publicPath: '/scripts/dist',
|
||||
scriptLoading: 'defer',
|
||||
chunks: chunks,
|
||||
inject: false,
|
||||
minify: false
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
edit_character: "./src/frontend/scripts/characters/edit.ts",
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: "single",
|
||||
splitChunks: {
|
||||
chunks: 'all',
|
||||
},
|
||||
},
|
||||
mode: "development",
|
||||
output: {
|
||||
path: `${root}/generated`,
|
||||
filename: 'scripts/dist/[name].bundle.js'
|
||||
},
|
||||
devtool: 'inline-source-map',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
include: /src|_proto/,
|
||||
exclude: /node_modules/,
|
||||
loader: "ts-loader"
|
||||
}
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts", ".js"]
|
||||
},
|
||||
plugins: [
|
||||
new CleanWebpackPlugin({
|
||||
cleanOnceBeforeBuildPatterns: ['!templates/**/*'],
|
||||
cleanAfterEveryBuildPatterns: ['!templates/**/*'],
|
||||
dry: false
|
||||
}),
|
||||
packPage('login.html.tera'),
|
||||
packPage('base.html.tera'),
|
||||
packPage('error.html.tera'),
|
||||
packPage('index.html.tera'),
|
||||
packPage('registration.html.tera'),
|
||||
packPage('characters/edit_character.html.tera', ['edit_character']),
|
||||
packPage('characters/edit_character_macros.html.tera'),
|
||||
packPage('characters/new_character.html.tera'),
|
||||
packPage('characters/view_character.html.tera'),
|
||||
packPage('characters/view_character_macros.html.tera'),
|
||||
]
|
||||
};
|
Loading…
Reference in New Issue