add ui build folder
This commit is contained in:
parent
08961f692b
commit
58a193455a
6 changed files with 17 additions and 31 deletions
|
|
@ -8,3 +8,4 @@ test
|
|||
tsconfig.json
|
||||
asajs.config.js
|
||||
build
|
||||
*.js.map
|
||||
1
config.d.ts
vendored
1
config.d.ts
vendored
|
|
@ -15,6 +15,7 @@ export interface Config {
|
|||
fixInventoryItemRenderer?: boolean
|
||||
buildFolder?: string
|
||||
fileExtension?: string
|
||||
uiBuildFolder?: string
|
||||
}
|
||||
|
||||
ui_analyzer?: {
|
||||
|
|
|
|||
|
|
@ -12,23 +12,10 @@ export function rebaseUIFiles(pack_folder: string) {
|
|||
|
||||
if (!fs.existsSync(targetDir)) return
|
||||
|
||||
const processDirectory = (currentDir: string) => {
|
||||
const entries = fs.readdirSync(currentDir, { withFileTypes: true })
|
||||
for (const relativePath of ui) {
|
||||
const fullPath = path.join(targetDir, relativePath)
|
||||
|
||||
for (const entry of entries) {
|
||||
const fullPath = path.join(currentDir, entry.name)
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
processDirectory(fullPath)
|
||||
|
||||
if (fs.readdirSync(fullPath).length === 0) {
|
||||
fs.rmdirSync(fullPath)
|
||||
}
|
||||
} else if (entry.isFile()) {
|
||||
const relativePath = fullPath.replace(targetDir + path.sep, "")
|
||||
const normalizedPath = relativePath.split(path.sep).join("/")
|
||||
|
||||
if (ui.has(normalizedPath)) {
|
||||
if (fs.existsSync(fullPath) && fs.statSync(fullPath).isFile()) {
|
||||
try {
|
||||
const fileContent = fs.readFileSync(fullPath, "utf-8")
|
||||
const parsedData = parse(fileContent)
|
||||
|
|
@ -41,8 +28,4 @@ export function rebaseUIFiles(pack_folder: string) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processDirectory(targetDir)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ export const isBuildMode = options["build"] ?? config.compiler?.enabled ?? false
|
|||
export const isLinkMode = options["link"] ?? config.compiler?.autoImport ?? false
|
||||
export const unLinked = options["unlink"] ?? !(config.compiler?.autoImport ?? true)
|
||||
export const buildFolder = config.compiler?.buildFolder || "build"
|
||||
export const uiBuildFolder = config.compiler?.uiBuildFolder || "asajs"
|
||||
|
||||
export const bindingFuntions = config.binding_functions
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import { RandomString, ResolveBinding } from "./Utils.js"
|
|||
import { RandomNamespace } from "../compilers/Random.js"
|
||||
|
||||
import util from "node:util"
|
||||
import { config } from "../compilers/Configuration.js"
|
||||
import { config, uiBuildFolder } from "../compilers/Configuration.js"
|
||||
|
||||
interface ExtendUI {
|
||||
name: string
|
||||
|
|
@ -57,7 +57,7 @@ export class UI<T extends Type, K extends Renderer | null = null> extends Class
|
|||
this.namespace = namespace || RandomNamespace()
|
||||
|
||||
if (!path)
|
||||
this.path = `asajs/${this.namespace}${config.compiler?.fileExtension ? (config.compiler.fileExtension.startsWith(".") ? config.compiler.fileExtension : `.${config.compiler.fileExtension}`) : ".json"}`
|
||||
this.path = `${uiBuildFolder}/${this.namespace}${config.compiler?.fileExtension ? (config.compiler.fileExtension.startsWith(".") ? config.compiler.fileExtension : `.${config.compiler.fileExtension}`) : ".json"}`
|
||||
else this.path = path
|
||||
|
||||
this.extendable = this.name.search("/") === -1
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"outDir": "dist/js",
|
||||
"declarationDir": "dist/types",
|
||||
"declaration": true,
|
||||
"sourceMap": false,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"incremental": true,
|
||||
|
|
|
|||
Reference in a new issue