fix(config): update .smartconfig.json handling and harden bundler runtime compatibility
This commit is contained in:
+10
-12
@@ -40,29 +40,27 @@ export class AssetsHandler {
|
||||
// copies the html
|
||||
public async processAssets(optionsArg?: { from?: string; to?: string }) {
|
||||
// lets assemble the options
|
||||
optionsArg = {
|
||||
...{
|
||||
from: this.defaultFromDirPath,
|
||||
to: this.defaultToDirPath,
|
||||
},
|
||||
const options = {
|
||||
from: this.defaultFromDirPath,
|
||||
to: this.defaultToDirPath,
|
||||
...(optionsArg || {}),
|
||||
};
|
||||
await this.ensureAssetsDir();
|
||||
optionsArg.from = plugins.smartpath.transform.toAbsolute(
|
||||
optionsArg.from,
|
||||
options.from = plugins.smartpath.transform.toAbsolute(
|
||||
options.from,
|
||||
paths.cwd,
|
||||
) as string;
|
||||
optionsArg.to = plugins.smartpath.transform.toAbsolute(
|
||||
optionsArg.to,
|
||||
options.to = plugins.smartpath.transform.toAbsolute(
|
||||
options.to,
|
||||
paths.cwd,
|
||||
) as string;
|
||||
|
||||
// lets clean the target directory
|
||||
const toExists = await plugins.fs.directory(optionsArg.to).exists();
|
||||
const toExists = await plugins.fs.directory(options.to).exists();
|
||||
if (toExists) {
|
||||
await plugins.fs.directory(optionsArg.to).delete();
|
||||
await plugins.fs.directory(options.to).delete();
|
||||
}
|
||||
|
||||
await this.copyDirectoryRecursive(optionsArg.from, optionsArg.to);
|
||||
await this.copyDirectoryRecursive(options.from, options.to);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user