-
Notifications
You must be signed in to change notification settings - Fork 0
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 #12 from JosunLP/dev
Version 1.6.0
- Loading branch information
Showing
18 changed files
with
127 additions
and
220 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
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
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,4 +1,5 @@ | ||
import { Session } from "./classes/session" | ||
import "./sass/app.sass" | ||
|
||
class App { | ||
|
||
|
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,12 +1,9 @@ | ||
class Background { | ||
constructor() { | ||
this.main(); | ||
} | ||
|
||
constructor() { | ||
this.main(); | ||
} | ||
|
||
async main(): Promise<void> { | ||
|
||
} | ||
async main(): Promise<void> {} | ||
} | ||
|
||
new Background(); | ||
new Background(); |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,72 @@ | ||
import * as fs from "fs"; | ||
import * as path from "path"; | ||
const appConfig = JSON.parse(fs.readFileSync("./app.config.json", "utf8")); | ||
const DEPLOY_TARGET = "./dist/"; | ||
|
||
function findCssFileNames(source: string): string[] { | ||
let files: string[] = []; | ||
const dir = fs.readdirSync(source); | ||
dir.forEach(function (file: string) { | ||
const sourceFile = path.join(source, file); | ||
const stat = fs.lstatSync(sourceFile); | ||
if (stat.isDirectory()) { | ||
files = files.concat(findCssFileNames(sourceFile)); | ||
} else { | ||
if (path.extname(sourceFile) == ".css") { | ||
files.push(file); | ||
} | ||
} | ||
}); | ||
return files; | ||
} | ||
|
||
function findHtmlFilesRecursive(source: string): string[] { | ||
let files: string[] = []; | ||
const dir = fs.readdirSync(source); | ||
dir.forEach(function (file: string) { | ||
const sourceFile = path.join(source, file); | ||
const stat = fs.lstatSync(sourceFile); | ||
if (stat.isDirectory()) { | ||
files = files.concat(findHtmlFilesRecursive(sourceFile)); | ||
} else { | ||
if (path.extname(sourceFile) == ".html") { | ||
files.push(sourceFile); | ||
} | ||
} | ||
}); | ||
return files; | ||
} | ||
|
||
function replaceKeywordsInHtmlFile(file: string) { | ||
let content = fs.readFileSync(file, "utf8"); | ||
const pairs: { key: string; value: string }[] = appConfig.htmlTemplatePairs; | ||
pairs.forEach(function (pair: { key: string; value: string }) { | ||
//@ts-ignore | ||
content = content.replaceAll(pair.key, pair.value); | ||
}); | ||
file = file.replace("public\\", DEPLOY_TARGET); | ||
fs.writeFileSync(file, content); | ||
} | ||
|
||
function buildHtmlFiles(source: string) { | ||
const files = findHtmlFilesRecursive(source); | ||
files.forEach(function (file: string) { | ||
replaceKeywordsInHtmlFile(file); | ||
}); | ||
} | ||
|
||
findCssFileNames(DEPLOY_TARGET).forEach((file: string) => { | ||
const files = findHtmlFilesRecursive(DEPLOY_TARGET); | ||
files.forEach(function (htmlFile: string) { | ||
let content = fs.readFileSync(htmlFile, "utf8"); | ||
content = content.replace( | ||
"</head>", | ||
`<link rel="stylesheet" href="./assets/${file}">\n</head>` | ||
); | ||
fs.writeFileSync(htmlFile, content); | ||
}); | ||
}); | ||
|
||
buildHtmlFiles(DEPLOY_TARGET); | ||
|
||
console.log("Parsed Files: ", findHtmlFilesRecursive(DEPLOY_TARGET)); |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { defineConfig } from "vite"; | ||
import { resolve } from "path"; | ||
import tsconfigPaths from "vite-tsconfig-paths"; | ||
|
||
export default defineConfig({ | ||
build: { | ||
rollupOptions: { | ||
input: { | ||
app: resolve(__dirname, "src/app.ts"), | ||
settings: resolve(__dirname, "src/settings.ts"), | ||
background: resolve(__dirname, "src/background.ts"), | ||
}, | ||
output: { | ||
entryFileNames: "[name].js", | ||
dir: resolve(__dirname, "dist"), | ||
}, | ||
}, | ||
sourcemap: true, | ||
}, | ||
plugins: [tsconfigPaths()], | ||
resolve: { | ||
extensions: [".tsx", ".ts", ".scss", ".sass"], | ||
}, | ||
esbuild: { | ||
include: /.*\.tsx?$/, | ||
exclude: [/node_modules/, /dist/], | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.