Move typescript into source tree.

This commit is contained in:
jeff 2021-01-09 12:57:13 +00:00
parent 133b4e6236
commit 06dc6c1274
29 changed files with 66 additions and 5617 deletions

View File

@ -6,8 +6,8 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"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"
"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"
},
"repository": {
"type": "git",

File diff suppressed because one or more lines are too long

View File

@ -1,23 +0,0 @@
(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

View File

@ -1,21 +0,0 @@
(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

View File

@ -1,63 +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, '..', '..');
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'),
]
};

64
webpack.config.js Normal file
View File

@ -0,0 +1,64 @@
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}/static/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}/static/scripts/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'),
]
};