-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from Infinite-Chess/restructure
Merge restructure branch into main branch
- Loading branch information
Showing
378 changed files
with
452 additions
and
2,148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Build | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: "Run build" | ||
run: npm run build | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: Build | ||
path: dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ node_modules | |
cert | ||
database | ||
logs | ||
dist | ||
|
||
# JetBrains IDEs | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { readdir, cp as copy, rm as remove, readFile, writeFile } from "node:fs/promises"; | ||
import { minify } from "terser"; | ||
|
||
/** Whether to generate source maps */ | ||
const generateMaps = true; | ||
|
||
/** | ||
* | ||
* @param {string} path | ||
* @param {string} ext | ||
* @returns {Promise<string[]>} | ||
*/ | ||
async function getExtFiles(path, ext) { | ||
const filesNFolder = await readdir(path); | ||
const folders = filesNFolder.filter(v => !v.endsWith(ext)); | ||
let files = filesNFolder.filter(v => v.endsWith(ext)); | ||
|
||
for (const folder of folders) { | ||
try { | ||
const newFiles = await getExtFiles(`${path}/${folder}`, ext); | ||
files.push(...newFiles.map(v => `${folder}/${v}`)); | ||
} catch (e) { | ||
if (e.code) continue; | ||
console.log(e); | ||
} | ||
} | ||
|
||
return files; | ||
} | ||
|
||
await remove("./dist", { | ||
recursive: true, | ||
force: true, | ||
}); | ||
|
||
await copy("./src/client", "./dist", { | ||
recursive: true, | ||
force: true, | ||
}); | ||
|
||
const clientScript = await getExtFiles("./src/client/scripts", ".js"); | ||
const clientStyle = []; // await getExtFiles("./src/client/css", ".css"); | ||
|
||
const clientFiles = []; | ||
clientFiles.push(...clientScript.map(v => `./src/client/scripts/${v}`), ...clientStyle.map(v => `./src/client/css/${v}`)); | ||
|
||
const filesToWrite = []; | ||
|
||
for (const file of clientFiles) { | ||
const filePath = `./dist/${file.replace('./src/client/', '')}`; | ||
const code = await readFile(filePath, 'utf8'); | ||
const minified = await minify(code, { | ||
mangle: true, // Disable variable name mangling | ||
compress: true, // Enable compression | ||
sourceMap: generateMaps | ||
}); | ||
|
||
filesToWrite.push( | ||
writeFile(filePath, minified.code, 'utf8') | ||
); | ||
if (generateMaps) { | ||
filesToWrite.push( | ||
writeFile(filePath + ".map", minified.map, "utf8") | ||
); | ||
} | ||
} | ||
|
||
await Promise.all(filesToWrite); |
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
{ | ||
"ignore": [ | ||
"./database/**/*", | ||
"./public/**/*", | ||
"./dist/**/*", | ||
"./protected-owner/**/*", | ||
"./protected-patron/**/*" | ||
] | ||
} | ||
], | ||
"exec": "npm run build && npm run start" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.