Skip to content

Commit

Permalink
add version in the background
Browse files Browse the repository at this point in the history
  • Loading branch information
s956142 committed Apr 20, 2024
1 parent caadc1e commit fff04a7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tetris-battle",
"version": "1.0.1",
"version": "1.0.28",
"description": "forFun",
"main": "index.js",
"repository": "https://github.com/s956142/tetris-battle.git",
Expand Down
1 change: 1 addition & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<button id="restart">重新開始</button>
</div>
</div>
<input type="hidden" name="version" value="">
<div class="inline-div score-board fs-16 ta-l">
<div class="mt-10">分數: <span id="score-number">0</span></div>
<div class="mt-10">Combo: <span id="combo-number">0</span></div>
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ type CubeAndType={
initEvent()
// fillOneRect(0,5,colorSet.red);
set.startX = Math.round(set.grid_cols/2)

$('input[name="version"]').val( process.env.VERSION||"");
start()
}
const setValue = function(key:string, val:any) {
Expand Down Expand Up @@ -858,7 +858,7 @@ type CubeAndType={
setValue
}
}

const pageController = PageController()
pageController.init()
})()
5 changes: 5 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const isProduction = process.env.NODE_ENV == "production";
const CopyPlugin = require('copy-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { DefinePlugin } = require('webpack');
const packageJson = require('./package.json');

const config = {
entry: "./src/index.ts",
Expand Down Expand Up @@ -40,6 +42,9 @@ const config = {
template: './src/index.html', // HTML 模板文件路径
chunks: ['index'], // 指定注入的 JavaScript 文件名
}),
new DefinePlugin({
'process.env.VERSION': JSON.stringify(packageJson.version),
}),

],
};
Expand Down

0 comments on commit fff04a7

Please sign in to comment.