@spicemod/creator 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +26 -1
- package/package.json +1 -1
package/dist/bin.mjs
CHANGED
|
@@ -135,7 +135,7 @@ const templateFilePath = dist("templates/wrapper.js", import.meta.url);
|
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region package.json
|
|
137
137
|
var name = "@spicemod/creator";
|
|
138
|
-
var version = "0.0.
|
|
138
|
+
var version = "0.0.2";
|
|
139
139
|
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region src/utils/common.ts
|
|
@@ -664,6 +664,7 @@ function validateSpicetify(bin) {
|
|
|
664
664
|
|
|
665
665
|
//#endregion
|
|
666
666
|
//#region src/esbuild/plugins/spicetifyHandlers.ts
|
|
667
|
+
const skipSpicetify = process.env.SPICETIFY_SKIP === "true" || process.env.CI === "true";
|
|
667
668
|
const spicetifyHandler = ({ config, options, cache, logger = createLogger("plugin:spicetifyHandler") }) => ({
|
|
668
669
|
name: "spice_internal__spicetify-build-handler",
|
|
669
670
|
async setup(build) {
|
|
@@ -671,6 +672,30 @@ const spicetifyHandler = ({ config, options, cache, logger = createLogger("plugi
|
|
|
671
672
|
let hasAppliedOnce = false;
|
|
672
673
|
const isExtension = config.template === "extension";
|
|
673
674
|
const identifier = isExtension ? `${urlSlugify(config.name)}.js` : urlSlugify(config.name);
|
|
675
|
+
if (skipSpicetify) {
|
|
676
|
+
logger.info(pc.yellow("SPICETIFY_SKIP=true, skipping spicetify operations"));
|
|
677
|
+
build.onEnd(async (result) => {
|
|
678
|
+
if (result.errors.length > 0) return;
|
|
679
|
+
if (!cache.hasChanges || cache.changed.size === 0) return;
|
|
680
|
+
const tasks = [];
|
|
681
|
+
for (const filePath of cache.changed) {
|
|
682
|
+
const fileData = cache.files.get(filePath);
|
|
683
|
+
if (!fileData) continue;
|
|
684
|
+
const targetPath = resolve(outDir, basename(filePath));
|
|
685
|
+
tasks.push((async () => {
|
|
686
|
+
await mkdirp(outDir);
|
|
687
|
+
await writeFile(targetPath, fileData.contents);
|
|
688
|
+
})());
|
|
689
|
+
}
|
|
690
|
+
try {
|
|
691
|
+
await Promise.all(tasks);
|
|
692
|
+
logger.debug(pc.green(`${CHECK} Built files written to ${outDir}`));
|
|
693
|
+
} catch (err) {
|
|
694
|
+
logger.error(pc.red(`${CROSS} Failed to write files: ${err instanceof Error ? err.message : String(err)}`));
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
674
699
|
const spiceConfig = await getSpicetifyConfig();
|
|
675
700
|
logger.debug(pc.green("Spicetify Config: "), spiceConfig);
|
|
676
701
|
if (apply) {
|