@wix/create-new 0.0.98 → 0.0.99

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.
@@ -13,7 +13,7 @@ import {
13
13
  require_lib,
14
14
  temporaryDirectory,
15
15
  updateEnvFile
16
- } from "./chunk-T7ZBC7FB.js";
16
+ } from "./chunk-FPLWF45Q.js";
17
17
  import {
18
18
  __toESM,
19
19
  init_esm_shims
@@ -115,4 +115,4 @@ async function generateApp({
115
115
  export {
116
116
  generateApp
117
117
  };
118
- //# sourceMappingURL=generator-52DJIP4U.js.map
118
+ //# sourceMappingURL=generator-JYIXHB6D.js.map
package/build/index.js CHANGED
@@ -82,6 +82,7 @@ import {
82
82
  USER_CONFIG_FILENAME,
83
83
  WIX_CONFIG_FILENAME,
84
84
  createPackageManager,
85
+ ensureMinimumDependencies,
85
86
  execa,
86
87
  external_exports,
87
88
  generator,
@@ -118,7 +119,7 @@ import {
118
119
  writeJson,
119
120
  writePackageJson,
120
121
  zod_default
121
- } from "./chunk-T7ZBC7FB.js";
122
+ } from "./chunk-FPLWF45Q.js";
122
123
  import {
123
124
  __commonJS,
124
125
  __dirname,
@@ -82829,7 +82830,7 @@ function getTasks({
82829
82830
  cause: e2
82830
82831
  });
82831
82832
  }
82832
- const { generateApp } = await import("./generator-52DJIP4U.js");
82833
+ const { generateApp } = await import("./generator-JYIXHB6D.js");
82833
82834
  await generateApp({
82834
82835
  packageName,
82835
82836
  packageFolder,
@@ -83712,24 +83713,6 @@ init_esm_shims();
83712
83713
  // ../cli-project-extender/src/extend.ts
83713
83714
  init_esm_shims();
83714
83715
 
83715
- // ../cli-project-extender/src/add-missing-dependencies.ts
83716
- init_esm_shims();
83717
- function addMissingDependencies(packageJson, options) {
83718
- addMissingDependenciesOfType(packageJson, "dependencies", options);
83719
- addMissingDependenciesOfType(packageJson, "devDependencies", options);
83720
- }
83721
- function addMissingDependenciesOfType(packageJson, type, options) {
83722
- for (const [key, value2] of Object.entries(options[type] ?? {})) {
83723
- if (packageJson.dependencies?.[key] || packageJson.devDependencies?.[key]) {
83724
- continue;
83725
- }
83726
- if (!packageJson[type]?.[key]) {
83727
- packageJson[type] ??= {};
83728
- packageJson[type][key] = value2;
83729
- }
83730
- }
83731
- }
83732
-
83733
83716
  // ../cli-project-extender/src/modify-astro-config.ts
83734
83717
  init_esm_shims();
83735
83718
  import { join as join11 } from "node:path";
@@ -92606,13 +92589,7 @@ async function modifyAstroConfig(projectFolder) {
92606
92589
  addIntegration2(loadedFile, react);
92607
92590
  const wix = setImport(loadedFile, "@wix/astro", "wix");
92608
92591
  addIntegration2(loadedFile, wix);
92609
- const adapterName = setImport(
92610
- loadedFile,
92611
- "@wix/cloud-provider-fetch-adapter",
92612
- "cloudProviderFetchAdapter"
92613
- );
92614
- addIsBuildVariable(loadedFile);
92615
- setConditionalAdapter(loadedFile, adapterName);
92592
+ setAdapter(loadedFile);
92616
92593
  const config = getDefineConfigOptions(loadedFile);
92617
92594
  config.image ??= {};
92618
92595
  config.image.domains ??= [];
@@ -92636,66 +92613,30 @@ function setImport(target, from, local) {
92636
92613
  imports.$append({ imported: "default", local, from });
92637
92614
  return local;
92638
92615
  }
92639
- function getModuleBody(target) {
92640
- const ast = target.$ast;
92641
- return ast.program?.body ?? ast.body;
92642
- }
92643
- function addIsBuildVariable(target) {
92644
- const body = getModuleBody(target);
92645
- if (!body) {
92646
- return;
92647
- }
92648
- const hasIsBuild = body.some(
92649
- (node) => node.type === "VariableDeclaration" && node.declarations.some(
92650
- (decl) => decl.id.type === "Identifier" && decl.id.name === "isBuild"
92651
- )
92652
- );
92653
- if (hasIsBuild) {
92654
- return;
92655
- }
92656
- const snippet = parseModule(
92657
- `const isBuild = process.env.NODE_ENV == "production";`
92658
- );
92659
- const snippetBody = getModuleBody(snippet);
92660
- const isBuildDeclaration = snippetBody?.[0];
92661
- if (!isBuildDeclaration) {
92616
+ function setAdapter(target) {
92617
+ const config = getDefineConfigOptions(target);
92618
+ if (hasAdapter(config)) {
92662
92619
  return;
92663
92620
  }
92664
- const exportIndex = body.findIndex(
92665
- (node) => node.type === "ExportDefaultDeclaration"
92621
+ const adapterName = setImport(
92622
+ target,
92623
+ "@wix/astro-wix-hosting-adapter",
92624
+ "wixHostingAdapter"
92666
92625
  );
92667
- if (exportIndex !== -1) {
92668
- body.splice(exportIndex, 0, isBuildDeclaration);
92669
- }
92626
+ config.adapter = builders.functionCall(adapterName);
92670
92627
  }
92671
- function setConditionalAdapter(target, adapterName) {
92672
- const config = getDefineConfigOptions(target);
92628
+ function hasAdapter(config) {
92673
92629
  if (config.adapter) {
92674
- return;
92630
+ return true;
92675
92631
  }
92676
92632
  const configAst = config.$ast;
92677
- const hasAdapter = configAst.properties?.some(
92678
- (prop) => (
92679
- // Direct property: adapter: ...
92680
- prop.key?.name === "adapter" || // Spread with adapter: ...(isBuild && { adapter: ... })
92681
- prop.type === "SpreadElement" && (prop.argument?.right?.properties?.some(
92682
- (p) => p.key?.name === "adapter"
92683
- ) ?? prop.argument?.left?.properties?.some(
92684
- (p) => p.key?.name === "adapter"
92685
- ))
92686
- )
92687
- );
92688
- if (hasAdapter) {
92689
- return;
92690
- }
92691
- const spreadArgument = builders.raw(
92692
- `isBuild && { adapter: ${adapterName}({}) }`
92693
- );
92694
- const spreadElement = {
92695
- type: "SpreadElement",
92696
- argument: spreadArgument.$ast
92697
- };
92698
- configAst.properties?.push(spreadElement);
92633
+ return configAst.properties?.some(
92634
+ (prop) => prop.key?.name === "adapter" || prop.type === "SpreadElement" && (prop.argument?.right?.properties?.some(
92635
+ (p) => p.key?.name === "adapter"
92636
+ ) ?? prop.argument?.left?.properties?.some(
92637
+ (p) => p.key?.name === "adapter"
92638
+ ))
92639
+ ) ?? false;
92699
92640
  }
92700
92641
  function addIntegration2(target, name) {
92701
92642
  const config = getDefineConfigOptions(target);
@@ -92722,22 +92663,21 @@ function setScripts(packageJson, scripts) {
92722
92663
  // ../cli-project-extender/src/extend.ts
92723
92664
  async function extend2(projectFolder) {
92724
92665
  const packageJson = await readPackageJson(projectFolder);
92725
- addMissingDependencies(packageJson, {
92666
+ ensureMinimumDependencies(packageJson, {
92726
92667
  dependencies: {
92727
92668
  "@wix/sdk": "^1.15.23",
92728
92669
  "@wix/essentials": "^0.1.23",
92729
92670
  "@wix/dashboard": "^1.3.43"
92730
92671
  },
92731
92672
  devDependencies: {
92732
- "@astrojs/cloudflare": "^12.5.3",
92733
92673
  "@astrojs/react": "^4.3.0",
92734
92674
  "@types/react": "^18.3.1",
92735
92675
  "@types/react-dom": "^18.3.1",
92736
92676
  "@wix/cli": "^1.1.92",
92737
- "@wix/astro": "^2.38.0",
92677
+ "@wix/astro": "^2.39.0",
92738
92678
  react: "18.3.1",
92739
92679
  "react-dom": "18.3.1",
92740
- "@wix/cloud-provider-fetch-adapter": "^1.0.0"
92680
+ "@wix/astro-wix-hosting-adapter": "^2.0.0"
92741
92681
  }
92742
92682
  });
92743
92683
  setScripts(packageJson, {
@@ -95250,7 +95190,7 @@ import { randomUUID as randomUUID3 } from "node:crypto";
95250
95190
  var package_default = {
95251
95191
  name: "@wix/create-new",
95252
95192
  description: "General entry point for creating Wix projects",
95253
- version: "0.0.98",
95193
+ version: "0.0.99",
95254
95194
  bin: "bin/index.cjs",
95255
95195
  devDependencies: {
95256
95196
  "@commander-js/extra-typings": "^13.0.0",