@spicemod/creator 0.0.2 → 0.0.22

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 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.2";
138
+ var version = "0.0.22";
139
139
 
140
140
  //#endregion
141
141
  //#region src/utils/common.ts
@@ -262,6 +262,7 @@ const CommonSchema = v.object({
262
262
  framework: v.picklist(frameworkTypes),
263
263
  packageManager: v.picklist(packageManagers),
264
264
  esbuildOptions: v.record(v.string(), v.any()),
265
+ devModeVarName: v.optional(v.string()),
265
266
  serverConfig: v.partial(ServerConfigSchema),
266
267
  version: v.string()
267
268
  });
@@ -286,6 +287,7 @@ const DISCORD_LINK = "https://discord.gg/YGkktjdYV8";
286
287
  const DOCS_LINK = "https://github.com/sanoojes/spicetify-creator";
287
288
  const CONFIG_REF_LINK = "https://github.com/sanoojes/spicetify-creator";
288
289
  const SPICETIFY_LINK = "https://spicetify.app/docs/getting-started";
290
+ const DEV_MODE_VAR_NAME = `__SPICE_CREATOR_DEV__`;
289
291
  const CHECK = pc.bold(pc.green("✔"));
290
292
  const CROSS = pc.bold(pc.red("✖"));
291
293
  const WARN = pc.bold(pc.yellow("⚠"));
@@ -452,6 +454,7 @@ async function resolveContext(config) {
452
454
  if (!config.entry.js || config.entry.js.length === 0) config.entry.js = resolveDefaultEntries(cwd, "js");
453
455
  if (!config.entry.css || config.entry.css.length === 0) config.entry.css = resolveDefaultEntries(cwd, "css");
454
456
  } else config.entry = resolveDefaultEntries(cwd, "js");
457
+ if (!config.devModeVarName) config.devModeVarName = DEV_MODE_VAR_NAME;
455
458
  config.outDir = resolve(cwd, config.outDir || "./dist");
456
459
  config.esbuildOptions ??= {};
457
460
  config.serverConfig ??= {};
@@ -944,6 +947,11 @@ function getJSBuildOptions(config, options) {
944
947
  "react",
945
948
  "react-dom"
946
949
  ],
950
+ define: {
951
+ [DEV_MODE_VAR_NAME]: "false",
952
+ [config.devModeVarName]: "false",
953
+ ...config.esbuildOptions.define
954
+ },
947
955
  plugins: [...config.esbuildOptions?.plugins ? config.esbuildOptions.plugins : [], ...getCommonPlugins({
948
956
  ...config,
949
957
  minify,
@@ -1724,6 +1732,11 @@ function getJSDevOptions(config, options) {
1724
1732
  "react",
1725
1733
  "react-dom"
1726
1734
  ],
1735
+ define: {
1736
+ [DEV_MODE_VAR_NAME]: "true",
1737
+ [config.devModeVarName]: "true",
1738
+ ...config.esbuildOptions.define
1739
+ },
1727
1740
  plugins: [...config.esbuildOptions?.plugins ? config.esbuildOptions.plugins : [], ...getCommonPlugins({
1728
1741
  ...config,
1729
1742
  minify,
@@ -14,6 +14,7 @@ declare const FileOptionsSchema: v.IntersectSchema<[Omit<v.ObjectSchema<{
14
14
  readonly framework: v.PicklistSchema<readonly ["react", "vanilla"], undefined>;
15
15
  readonly packageManager: v.PicklistSchema<PackageManagerType[], undefined>;
16
16
  readonly esbuildOptions: v.GenericSchema<ESBuildOptions>;
17
+ readonly devModeVarName: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
17
18
  readonly serverConfig: Omit<v.ObjectSchema<{
18
19
  readonly port: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
19
20
  readonly serveDir: v.StringSchema<undefined>;
@@ -61,6 +62,7 @@ declare const FileOptionsSchema: v.IntersectSchema<[Omit<v.ObjectSchema<{
61
62
  readonly framework: v.OptionalSchema<v.PicklistSchema<readonly ["react", "vanilla"], undefined>, undefined>;
62
63
  readonly packageManager: v.OptionalSchema<v.PicklistSchema<PackageManagerType[], undefined>, undefined>;
63
64
  readonly esbuildOptions: v.OptionalSchema<v.GenericSchema<ESBuildOptions>, undefined>;
65
+ readonly devModeVarName: v.OptionalSchema<v.OptionalSchema<v.StringSchema<undefined>, undefined>, undefined>;
64
66
  readonly serverConfig: v.OptionalSchema<Omit<v.ObjectSchema<{
65
67
  readonly port: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
66
68
  readonly serveDir: v.StringSchema<undefined>;
@@ -108,6 +110,7 @@ declare const FileOptionsSchema: v.IntersectSchema<[Omit<v.ObjectSchema<{
108
110
  framework?: "react" | "vanilla" | undefined;
109
111
  packageManager?: PackageManagerType | undefined;
110
112
  esbuildOptions?: ESBuildOptions | undefined;
113
+ devModeVarName?: string | undefined;
111
114
  serverConfig?: {
112
115
  port?: number | undefined;
113
116
  serveDir?: string | undefined;
@@ -121,6 +124,7 @@ declare const FileOptionsSchema: v.IntersectSchema<[Omit<v.ObjectSchema<{
121
124
  framework?: "react" | "vanilla" | undefined;
122
125
  packageManager?: PackageManagerType | undefined;
123
126
  esbuildOptions?: ESBuildOptions | undefined;
127
+ devModeVarName?: string | undefined;
124
128
  serverConfig?: {
125
129
  port?: number | undefined;
126
130
  serveDir?: string | undefined;
@@ -135,6 +139,7 @@ declare const FileOptionsSchema: v.IntersectSchema<[Omit<v.ObjectSchema<{
135
139
  framework?: "react" | "vanilla" | undefined;
136
140
  packageManager?: PackageManagerType | undefined;
137
141
  esbuildOptions?: ESBuildOptions | undefined;
142
+ devModeVarName?: string | undefined;
138
143
  serverConfig?: {
139
144
  port?: number | undefined;
140
145
  serveDir?: string | undefined;
@@ -150,6 +155,7 @@ declare const FileOptionsSchema: v.IntersectSchema<[Omit<v.ObjectSchema<{
150
155
  framework?: "react" | "vanilla" | undefined;
151
156
  packageManager?: PackageManagerType | undefined;
152
157
  esbuildOptions?: ESBuildOptions | undefined;
158
+ devModeVarName?: string | undefined;
153
159
  serverConfig?: {
154
160
  port?: number | undefined;
155
161
  serveDir?: string | undefined;
@@ -164,6 +170,7 @@ declare const FileOptionsSchema: v.IntersectSchema<[Omit<v.ObjectSchema<{
164
170
  framework?: "react" | "vanilla" | undefined;
165
171
  packageManager?: PackageManagerType | undefined;
166
172
  esbuildOptions?: ESBuildOptions | undefined;
173
+ devModeVarName?: string | undefined;
167
174
  serverConfig?: {
168
175
  port?: number | undefined;
169
176
  serveDir?: string | undefined;
@@ -2167,6 +2174,7 @@ declare namespace _Spicetify {
2167
2174
  }
2168
2175
  declare global {
2169
2176
  const Spicetify: typeof _Spicetify;
2177
+ const __SPICE_CREATOR_DEV__: boolean;
2170
2178
  }
2171
2179
  //#endregion
2172
2180
  //#region src/client/index.d.ts
@@ -8,7 +8,7 @@ __ESBUILD__HAS_CSS &&
8
8
  style.textContent = css;
9
9
  document.head.appendChild(style);
10
10
  }
11
- } catch { }
11
+ } catch {}
12
12
  })();
13
13
  (async () => {
14
14
  const _ID = `${__ESBUILD__APP_SLUG}-${__ESBUILD__APP_TYPE}`;
@@ -45,4 +45,4 @@ __ESBUILD__HAS_CSS &&
45
45
  window.Spicetify?.showNotification(`⚠️ ${appId}: ${msg} (check console for more info)`, true);
46
46
  console.error(`[${appId}] Error:`, err);
47
47
  }
48
- })();
48
+ })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spicemod/creator",
3
- "version": "0.0.2",
3
+ "version": "0.0.22",
4
4
  "description": "Easily make Spicetify extensions and themes",
5
5
  "keywords": [
6
6
  "cli",
@@ -8,7 +8,7 @@ __ESBUILD__HAS_CSS &&
8
8
  style.textContent = css;
9
9
  document.head.appendChild(style);
10
10
  }
11
- } catch { }
11
+ } catch {}
12
12
  })();
13
13
  (async () => {
14
14
  const _ID = `${__ESBUILD__APP_SLUG}-${__ESBUILD__APP_TYPE}`;
@@ -45,4 +45,4 @@ __ESBUILD__HAS_CSS &&
45
45
  window.Spicetify?.showNotification(`⚠️ ${appId}: ${msg} (check console for more info)`, true);
46
46
  console.error(`[${appId}] Error:`, err);
47
47
  }
48
- })();
48
+ })();