Skip to content

Commit

Permalink
fix: bundle generálás javítva
Browse files Browse the repository at this point in the history
  • Loading branch information
juzraai committed Jan 20, 2024
1 parent 0c41b6a commit 38b43e1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
dist/
node_modules/
scripts/token.sh
szamlak/
temp/
.env
dijnet-bot.js
error.log
src/_OLD
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ A **Díjnet Bot** lementi az **összes [Díjnet](https://www.dijnet.hu/)-en tár

Ahhoz, hogy a programot futtatni tudd, telepítened kell a [Node.js](https://nodejs.org/en/) legalább 20-as verzióját.

A **Díjnet Bot** önmagában egyetlen fájl (`dijnet-bot.js`), melyet [innen tudsz letölteni](https://github.com/juzraai/dijnet-bot/releases/latest).
A **Díjnet Bot** önmagában egyetlen fájl (`dijnet-bot.cjs`), melyet [innen tudsz letölteni](https://github.com/juzraai/dijnet-bot/releases/latest).

Ha duplakattintással szeretnéd futtatni (vagyis nem terminálból/parancssorból), akkor ezt a fájlt, vagy a `*.js` fájlokat az oprendszeredben hozzá kell rendelned a Node-hoz. (Windows-on: jobb klikk a fájlon -> Társítás -> Node.js vagy Másik alkalmazás -> "c:\Program Files\nodejs\node.exe")

Expand Down
8 changes: 4 additions & 4 deletions bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ import esbuild from 'esbuild';

const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));

const OUTPUT_FILE = 'dijnet-bot.js';
const OUTPUT_FILE = 'dist/dijnet-bot.cjs';

const banner = `
/*
Díjnet Bot v${packageJson.version}
${packageJson.homepage}
Licensed under ${packageJson.license}
*/
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
`;

console.log('Bundling...');
Expand All @@ -23,9 +21,11 @@ await esbuild.build({
},
bundle: true,
entryPoints: ['index.js'],
format: 'cjs',
minify: true,
outfile: OUTPUT_FILE,
platform: 'node',
target: 'node20',
});
console.timeEnd('Bundling done in');
console.log(OUTPUT_FILE, Math.round((fs.statSync('dijnet-bot.js').size / 1024) * 10) / 10, 'KB');
console.log(OUTPUT_FILE, Math.round((fs.statSync(OUTPUT_FILE).size / 1024) * 10) / 10, 'KB');

0 comments on commit 38b43e1

Please sign in to comment.