pull/4914/head
pushkine 5 years ago
parent fe86552670
commit 16da0c260c

@ -281,9 +281,11 @@ export function replaceIfUpdated(config_getter, cwd) {
glob("samples/*/input.svelte", { cwd }).forEach((dir) => {
function compile(options) {
return svelte.compile(
readFileSync(`${cwd}/${dir}`, "utf-8").replace(/\s+$/, "").replace(/\r/g, ""),
readFileSync(`${cwd}/${dir}`, "utf-8")
.replace(/\s+$/, "")
.replace(/\r/g, ""),
options
)
);
}
function check_news(file, value) {
const path = `${cwd}/${dir.replace("input.svelte", file)}`;
@ -301,12 +303,13 @@ export function replaceIfUpdated(config_getter, cwd) {
);
}
} catch (e) {
if (typeof value === "object") value = JSON.stringify(value, null, "\t");
if (typeof value === "object")
value = JSON.stringify(value, null, "\t");
writeFileSync(path, value);
}
}
function get_relative(name) {
return `${cwd}/${dir.replace("input.svelte", name)}`
return `${cwd}/${dir.replace("input.svelte", name)}`;
}
config_getter(compile, check_news, get_relative);

Loading…
Cancel
Save