Now Rollup scripts into one (somewhat large ;) ) file

This commit is contained in:
Alexander Bass 2022-06-24 14:42:39 -04:00
parent 04ace65942
commit d428eb3efe
22 changed files with 43 additions and 28 deletions

View file

@ -1,10 +1,15 @@
rm -rf dist
mkdir -p dist/server
mkdir -p dist/www/
echo "Compiling SCSS......."
scss client/scss/main.scss dist/www/style.css
cp -r client/www/* dist/www
rm -rf .sass-cache
echo "Moving Static Webpage object to www......"
cp -r client/www/* dist/www
echo "Rolling up ES6 Modules into bundle......"
npx rollup -c
echo "Compiling TypeScript"
npx tsc
echo "Starting server......."
echo "~-+/\________________/==o=O=o==\________________/\+-~"
echo "$(tput setaf 3)~-+/\________________/==o=O=o==\________________/\+-~$(tput setaf 8)"
node dist/server/main.js

View file

@ -1,5 +1,4 @@
import {tileArray} from './tileRenderer.js';
import { cursor } from '../interface/game/mouse.js'
import { ctx} from './html.js';
import { game } from '../game/game.js'

View file

@ -1,4 +1,4 @@
import {game} from "/scripts/game/game.js"
import {game} from "../game/game.js"
export const tileArray = loadSprites('/img/mine.png', game.tileSize);
var counter = 0;

4
client/scripts/index.js Normal file
View file

@ -0,0 +1,4 @@
import './display/draw.js';
import './game/game.js'
import './interface/mainmenu/menu.js'
import './net/netcode.js'

View file

@ -1,5 +1,5 @@
import {game} from "../../game/game.js";
import { clickCanvas } from "/scripts/net/netcode.js";
import { clickCanvas } from "../../net/netcode.js";
import { canvas } from "../../display/html.js"
class Cursor {

View file

@ -1,10 +1,10 @@
import {joinGame, createGame} from "/scripts/net/netcode.js"
import { changeScene } from "/scripts/interface/scene.js"
import {joinGame, createGame} from "../../net/netcode.js"
import { changeScene } from "../scene.js"
import {Picker} from "./picker.js"
import {tileArray, menuArray} from "/scripts/display/tileRenderer.js"
import * as util from "/scripts/util.js"
import {ID} from "/scripts/util.js"
import * as status from "/scripts/net/status.js"
import {tileArray, menuArray} from "../../display/tileRenderer.js"
import * as util from "../../util.js"
import {ID} from "../../util.js"
import * as status from "../../net/status.js"
var menuPicker, colorPicker;

View file

@ -1,6 +1,6 @@
import * as status from "../../net/status.js"
import {joinGame, createGame} from "/scripts/net/netcode.js"
import { changeScene } from "/scripts/interface/scene.js"
// import {joinGame, createGame} from "../../net/netcode.js"
import { changeScene } from "../scene.js"
import * as createMenu from "./create.js"
function ID(id) {

View file

@ -1,9 +1,9 @@
import * as env from "/scripts/env.js"
import * as status from "/scripts/net/status.js"
import {game} from "/scripts/game/game.js"
import {render} from "/scripts/display/draw.js"
import { changeScene } from "/scripts/interface/scene.js"
import { illegalAction } from "/scripts/interface/common/illegalaction.js"
import * as env from "../env.js"
import * as status from "./status.js"
import {game} from "../game/game.js"
import {render} from "../display/draw.js"
import { changeScene } from "../interface/scene.js"
import { illegalAction } from "../interface/common/illegalaction.js"
export var socket = io.connect(env.IP_ADDRESS);

View file

@ -1,4 +1,4 @@
import {updateConnectionStatus} from "/scripts/interface/game/connection.js"
import {updateConnectionStatus} from "../interface/game/connection.js"
var SERVER_CONNECTION = "disconnected"

View file

@ -5,7 +5,7 @@
<script src="http://localhost:35729/livereload.js" charset="utf-8"></script>
<script type="text/javascript" src="socket.io.min.js"></script>
<link rel="stylesheet" href="style.css">
<script src='scripts/script.js' type="module"></script>
<script src='index.js' type="module"></script>
</head>
<body>
<!-- Canvas used to generate individual sprites off one sprite atlas -->

View file

@ -1,4 +0,0 @@
import '/scripts/display/draw.js';
import '/scripts/game/game.js'
import '/scripts/interface/mainmenu/menu.js'
import "/scripts/net/netcode.js"

6
package-lock.json generated
View file

@ -10,7 +10,6 @@
"license": "UNLICENSED",
"dependencies": {
"express": "^4.18.1",
"rollup": "^2.75.7",
"sass": "^1.52.3",
"socket.io": "^4.5.0",
"ts-node": "^10.8.1",
@ -19,7 +18,8 @@
"devDependencies": {
"@tsconfig/node16": "^1.0.3",
"@types/express": "^4.17.13",
"@types/node": "^18.0.0"
"@types/node": "^18.0.0",
"rollup": "^2.75.7"
}
},
"node_modules/@cspotcode/source-map-support": {
@ -906,6 +906,7 @@
"version": "2.75.7",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.75.7.tgz",
"integrity": "sha512-VSE1iy0eaAYNCxEXaleThdFXqZJ42qDBatAwrfnPlENEZ8erQ+0LYX4JXOLPceWfZpV1VtZwZ3dFCuOZiSyFtQ==",
"dev": true,
"bin": {
"rollup": "dist/bin/rollup"
},
@ -1924,6 +1925,7 @@
"version": "2.75.7",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.75.7.tgz",
"integrity": "sha512-VSE1iy0eaAYNCxEXaleThdFXqZJ42qDBatAwrfnPlENEZ8erQ+0LYX4JXOLPceWfZpV1VtZwZ3dFCuOZiSyFtQ==",
"dev": true,
"requires": {
"fsevents": "~2.3.2"
}

View file

@ -16,7 +16,6 @@
"license": "UNLICENSED",
"dependencies": {
"express": "^4.18.1",
"rollup": "^2.75.7",
"sass": "^1.52.3",
"socket.io": "^4.5.0",
"ts-node": "^10.8.1",
@ -24,6 +23,7 @@
},
"devDependencies": {
"@tsconfig/node16": "^1.0.3",
"rollup": "^2.75.7",
"@types/express": "^4.17.13",
"@types/node": "^18.0.0"
}

9
rollup.config.js Normal file
View file

@ -0,0 +1,9 @@
export default {
input: 'client/scripts/index.js',
output: [
{
file: 'dist/www/index.js',
format: 'iife'
}
]
};