@farm.js/cli 0.1.0-beta.71 → 0.1.0-beta.73

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/build.js CHANGED
@@ -7,6 +7,7 @@ let _farm_js_core_internal_production_node_env = require("@farm.js/core/internal
7
7
  */
8
8
  async function buildFarm(options = {}) {
9
9
  const root = options.root || process.cwd();
10
+ const hasDeployOverride = options.preset !== void 0 || options.target !== void 0;
10
11
  try {
11
12
  await (0, _farm_js_core_internal_production_node_env.withProductionNodeEnv)(async () => {
12
13
  const mode = "production";
@@ -22,7 +23,7 @@ async function buildFarm(options = {}) {
22
23
  const userConfig = userConfigResult.value;
23
24
  if (!userConfig) throw new Error("No Farm config found. Please create farm.config.ts or config.ts.");
24
25
  const config = await (0, _farm_js_core_internal_config_runtime.resolveConfig)(userConfig, mode);
25
- if (options.preset || options.target) {
26
+ if (hasDeployOverride) {
26
27
  const deploy = (0, _farm_js_core_internal_config_runtime.resolveDeployConfig)(userConfig, {
27
28
  preset: options.preset,
28
29
  target: options.target
@@ -31,7 +32,7 @@ async function buildFarm(options = {}) {
31
32
  config.deploy = deploy;
32
33
  }
33
34
  await buildRuntimeResult.value.build(config, {
34
- preset: config.preset,
35
+ preset: hasDeployOverride ? config.preset : void 0,
35
36
  root,
36
37
  productionVite: productionViteResult.value
37
38
  });
package/dist/build.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","names":["withProductionNodeEnv","loadFarmProductionVite","loadConfig","resolveConfig","resolveDeployConfig"],"sources":["../src/build.ts"],"sourcesContent":["import {\n loadConfig,\n loadFarmProductionVite,\n logger,\n resolveConfig,\n resolveDeployConfig,\n} from \"@farm.js/core/internal/config-runtime\";\nimport { withProductionNodeEnv } from \"@farm.js/core/internal/production-node-env\";\n\nexport { withProductionNodeEnv };\n\nexport interface BuildFarmOptions {\n root?: string;\n preset?: string;\n /** Deployment platform the build serves. Wins over the preset-derived target. */\n target?: string;\n}\n\n/**\n * Build Farm.js application\n */\nexport async function buildFarm(options: BuildFarmOptions = {}) {\n const root = options.root || process.cwd();\n\n try {\n await withProductionNodeEnv(async () => {\n const mode = \"production\";\n const productionVitePromise = loadFarmProductionVite();\n const [userConfigResult, buildRuntimeResult, productionViteResult] = await Promise.allSettled(\n [\n productionVitePromise.then((runtime) =>\n loadConfig(root, undefined, mode, runtime.loadEnv),\n ),\n import(\"@farm.js/core/internal/build-runtime\"),\n productionVitePromise,\n ],\n );\n\n if (userConfigResult.status === \"rejected\") throw userConfigResult.reason;\n if (buildRuntimeResult.status === \"rejected\") throw buildRuntimeResult.reason;\n if (productionViteResult.status === \"rejected\") throw productionViteResult.reason;\n\n const userConfig = userConfigResult.value;\n\n if (!userConfig) {\n throw new Error(\"No Farm config found. Please create farm.config.ts or config.ts.\");\n }\n\n const config = await resolveConfig(userConfig, mode);\n\n // Override preset/target if provided via CLI\n if (options.preset || options.target) {\n const deploy = resolveDeployConfig(userConfig, {\n preset: options.preset as any,\n target: options.target,\n });\n config.preset = deploy.preset;\n config.deploy = deploy;\n }\n\n // Build. Completion is reported by the build pipeline itself, which\n // also knows the preset and output directory; a second banner here\n // would only repeat it.\n await buildRuntimeResult.value.build(config, {\n preset: config.preset,\n root,\n productionVite: productionViteResult.value,\n });\n });\n } catch (error: any) {\n logger.error(`❌ Build failed: ${error.message}`);\n if (error.stack) {\n console.error(error.stack);\n }\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;AAqBA,eAAsB,UAAU,UAA4B,CAAC,GAAG;CAC9D,MAAM,OAAO,QAAQ,QAAQ,QAAQ,IAAI;CAEzC,IAAI;EACF,OAAA,GAAMA,2CAAAA,sBAAAA,CAAsB,YAAY;GACtC,MAAM,OAAO;GACb,MAAM,yBAAA,GAAwBC,sCAAAA,uBAAAA,CAAuB;GACrD,MAAM,CAAC,kBAAkB,oBAAoB,wBAAwB,MAAM,QAAQ,WACjF;IACE,sBAAsB,MAAM,aAAA,GAC1BC,sCAAAA,WAAAA,CAAW,MAAM,KAAA,GAAW,MAAM,QAAQ,OAAO,CACnD;IACA,OAAO;IACP;GACF,CACF;GAEA,IAAI,iBAAiB,WAAW,YAAY,MAAM,iBAAiB;GACnE,IAAI,mBAAmB,WAAW,YAAY,MAAM,mBAAmB;GACvE,IAAI,qBAAqB,WAAW,YAAY,MAAM,qBAAqB;GAE3E,MAAM,aAAa,iBAAiB;GAEpC,IAAI,CAAC,YACH,MAAM,IAAI,MAAM,kEAAkE;GAGpF,MAAM,SAAS,OAAA,GAAMC,sCAAAA,cAAAA,CAAc,YAAY,IAAI;GAGnD,IAAI,QAAQ,UAAU,QAAQ,QAAQ;IACpC,MAAM,UAAA,GAASC,sCAAAA,oBAAAA,CAAoB,YAAY;KAC7C,QAAQ,QAAQ;KAChB,QAAQ,QAAQ;IAClB,CAAC;IACD,OAAO,SAAS,OAAO;IACvB,OAAO,SAAS;GAClB;GAKA,MAAM,mBAAmB,MAAM,MAAM,QAAQ;IAC3C,QAAQ,OAAO;IACf;IACA,gBAAgB,qBAAqB;GACvC,CAAC;EACH,CAAC;CACH,SAAS,OAAY;EACnB,sCAAA,OAAO,MAAM,mBAAmB,MAAM,SAAS;EAC/C,IAAI,MAAM,OACR,QAAQ,MAAM,MAAM,KAAK;EAE3B,QAAQ,KAAK,CAAC;CAChB;AACF"}
1
+ {"version":3,"file":"build.js","names":["withProductionNodeEnv","loadFarmProductionVite","loadConfig","resolveConfig","resolveDeployConfig"],"sources":["../src/build.ts"],"sourcesContent":["import {\n loadConfig,\n loadFarmProductionVite,\n logger,\n resolveConfig,\n resolveDeployConfig,\n} from \"@farm.js/core/internal/config-runtime\";\nimport { withProductionNodeEnv } from \"@farm.js/core/internal/production-node-env\";\n\nexport { withProductionNodeEnv };\n\nexport interface BuildFarmOptions {\n root?: string;\n preset?: string;\n /** Deployment platform the build serves. Wins over the preset-derived target. */\n target?: string;\n}\n\n/**\n * Build Farm.js application\n */\nexport async function buildFarm(options: BuildFarmOptions = {}) {\n const root = options.root || process.cwd();\n const hasDeployOverride = options.preset !== undefined || options.target !== undefined;\n\n try {\n await withProductionNodeEnv(async () => {\n const mode = \"production\";\n const productionVitePromise = loadFarmProductionVite();\n const [userConfigResult, buildRuntimeResult, productionViteResult] = await Promise.allSettled(\n [\n productionVitePromise.then((runtime) =>\n loadConfig(root, undefined, mode, runtime.loadEnv),\n ),\n import(\"@farm.js/core/internal/build-runtime\"),\n productionVitePromise,\n ],\n );\n\n if (userConfigResult.status === \"rejected\") throw userConfigResult.reason;\n if (buildRuntimeResult.status === \"rejected\") throw buildRuntimeResult.reason;\n if (productionViteResult.status === \"rejected\") throw productionViteResult.reason;\n\n const userConfig = userConfigResult.value;\n\n if (!userConfig) {\n throw new Error(\"No Farm config found. Please create farm.config.ts or config.ts.\");\n }\n\n const config = await resolveConfig(userConfig, mode);\n\n // Override preset/target if provided via CLI\n if (hasDeployOverride) {\n const deploy = resolveDeployConfig(userConfig, {\n preset: options.preset as any,\n target: options.target,\n });\n config.preset = deploy.preset;\n config.deploy = deploy;\n }\n\n // Build. Completion is reported by the build pipeline itself, which\n // also knows the preset and output directory; a second banner here\n // would only repeat it.\n await buildRuntimeResult.value.build(config, {\n preset: hasDeployOverride ? config.preset : undefined,\n root,\n productionVite: productionViteResult.value,\n });\n });\n } catch (error: any) {\n logger.error(`❌ Build failed: ${error.message}`);\n if (error.stack) {\n console.error(error.stack);\n }\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;AAqBA,eAAsB,UAAU,UAA4B,CAAC,GAAG;CAC9D,MAAM,OAAO,QAAQ,QAAQ,QAAQ,IAAI;CACzC,MAAM,oBAAoB,QAAQ,WAAW,KAAA,KAAa,QAAQ,WAAW,KAAA;CAE7E,IAAI;EACF,OAAA,GAAMA,2CAAAA,sBAAAA,CAAsB,YAAY;GACtC,MAAM,OAAO;GACb,MAAM,yBAAA,GAAwBC,sCAAAA,uBAAAA,CAAuB;GACrD,MAAM,CAAC,kBAAkB,oBAAoB,wBAAwB,MAAM,QAAQ,WACjF;IACE,sBAAsB,MAAM,aAAA,GAC1BC,sCAAAA,WAAAA,CAAW,MAAM,KAAA,GAAW,MAAM,QAAQ,OAAO,CACnD;IACA,OAAO;IACP;GACF,CACF;GAEA,IAAI,iBAAiB,WAAW,YAAY,MAAM,iBAAiB;GACnE,IAAI,mBAAmB,WAAW,YAAY,MAAM,mBAAmB;GACvE,IAAI,qBAAqB,WAAW,YAAY,MAAM,qBAAqB;GAE3E,MAAM,aAAa,iBAAiB;GAEpC,IAAI,CAAC,YACH,MAAM,IAAI,MAAM,kEAAkE;GAGpF,MAAM,SAAS,OAAA,GAAMC,sCAAAA,cAAAA,CAAc,YAAY,IAAI;GAGnD,IAAI,mBAAmB;IACrB,MAAM,UAAA,GAASC,sCAAAA,oBAAAA,CAAoB,YAAY;KAC7C,QAAQ,QAAQ;KAChB,QAAQ,QAAQ;IAClB,CAAC;IACD,OAAO,SAAS,OAAO;IACvB,OAAO,SAAS;GAClB;GAKA,MAAM,mBAAmB,MAAM,MAAM,QAAQ;IAC3C,QAAQ,oBAAoB,OAAO,SAAS,KAAA;IAC5C;IACA,gBAAgB,qBAAqB;GACvC,CAAC;EACH,CAAC;CACH,SAAS,OAAY;EACnB,sCAAA,OAAO,MAAM,mBAAmB,MAAM,SAAS;EAC/C,IAAI,MAAM,OACR,QAAQ,MAAM,MAAM,KAAK;EAE3B,QAAQ,KAAK,CAAC;CAChB;AACF"}
package/dist/build.mjs CHANGED
@@ -6,6 +6,7 @@ import { withProductionNodeEnv } from "@farm.js/core/internal/production-node-en
6
6
  */
7
7
  async function buildFarm(options = {}) {
8
8
  const root = options.root || process.cwd();
9
+ const hasDeployOverride = options.preset !== void 0 || options.target !== void 0;
9
10
  try {
10
11
  await withProductionNodeEnv(async () => {
11
12
  const mode = "production";
@@ -21,7 +22,7 @@ async function buildFarm(options = {}) {
21
22
  const userConfig = userConfigResult.value;
22
23
  if (!userConfig) throw new Error("No Farm config found. Please create farm.config.ts or config.ts.");
23
24
  const config = await resolveConfig(userConfig, mode);
24
- if (options.preset || options.target) {
25
+ if (hasDeployOverride) {
25
26
  const deploy = resolveDeployConfig(userConfig, {
26
27
  preset: options.preset,
27
28
  target: options.target
@@ -30,7 +31,7 @@ async function buildFarm(options = {}) {
30
31
  config.deploy = deploy;
31
32
  }
32
33
  await buildRuntimeResult.value.build(config, {
33
- preset: config.preset,
34
+ preset: hasDeployOverride ? config.preset : void 0,
34
35
  root,
35
36
  productionVite: productionViteResult.value
36
37
  });
@@ -1 +1 @@
1
- {"version":3,"file":"build.mjs","names":[],"sources":["../src/build.ts"],"sourcesContent":["import {\n loadConfig,\n loadFarmProductionVite,\n logger,\n resolveConfig,\n resolveDeployConfig,\n} from \"@farm.js/core/internal/config-runtime\";\nimport { withProductionNodeEnv } from \"@farm.js/core/internal/production-node-env\";\n\nexport { withProductionNodeEnv };\n\nexport interface BuildFarmOptions {\n root?: string;\n preset?: string;\n /** Deployment platform the build serves. Wins over the preset-derived target. */\n target?: string;\n}\n\n/**\n * Build Farm.js application\n */\nexport async function buildFarm(options: BuildFarmOptions = {}) {\n const root = options.root || process.cwd();\n\n try {\n await withProductionNodeEnv(async () => {\n const mode = \"production\";\n const productionVitePromise = loadFarmProductionVite();\n const [userConfigResult, buildRuntimeResult, productionViteResult] = await Promise.allSettled(\n [\n productionVitePromise.then((runtime) =>\n loadConfig(root, undefined, mode, runtime.loadEnv),\n ),\n import(\"@farm.js/core/internal/build-runtime\"),\n productionVitePromise,\n ],\n );\n\n if (userConfigResult.status === \"rejected\") throw userConfigResult.reason;\n if (buildRuntimeResult.status === \"rejected\") throw buildRuntimeResult.reason;\n if (productionViteResult.status === \"rejected\") throw productionViteResult.reason;\n\n const userConfig = userConfigResult.value;\n\n if (!userConfig) {\n throw new Error(\"No Farm config found. Please create farm.config.ts or config.ts.\");\n }\n\n const config = await resolveConfig(userConfig, mode);\n\n // Override preset/target if provided via CLI\n if (options.preset || options.target) {\n const deploy = resolveDeployConfig(userConfig, {\n preset: options.preset as any,\n target: options.target,\n });\n config.preset = deploy.preset;\n config.deploy = deploy;\n }\n\n // Build. Completion is reported by the build pipeline itself, which\n // also knows the preset and output directory; a second banner here\n // would only repeat it.\n await buildRuntimeResult.value.build(config, {\n preset: config.preset,\n root,\n productionVite: productionViteResult.value,\n });\n });\n } catch (error: any) {\n logger.error(`❌ Build failed: ${error.message}`);\n if (error.stack) {\n console.error(error.stack);\n }\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;AAqBA,eAAsB,UAAU,UAA4B,CAAC,GAAG;CAC9D,MAAM,OAAO,QAAQ,QAAQ,QAAQ,IAAI;CAEzC,IAAI;EACF,MAAM,sBAAsB,YAAY;GACtC,MAAM,OAAO;GACb,MAAM,wBAAwB,uBAAuB;GACrD,MAAM,CAAC,kBAAkB,oBAAoB,wBAAwB,MAAM,QAAQ,WACjF;IACE,sBAAsB,MAAM,YAC1B,WAAW,MAAM,KAAA,GAAW,MAAM,QAAQ,OAAO,CACnD;IACA,OAAO;IACP;GACF,CACF;GAEA,IAAI,iBAAiB,WAAW,YAAY,MAAM,iBAAiB;GACnE,IAAI,mBAAmB,WAAW,YAAY,MAAM,mBAAmB;GACvE,IAAI,qBAAqB,WAAW,YAAY,MAAM,qBAAqB;GAE3E,MAAM,aAAa,iBAAiB;GAEpC,IAAI,CAAC,YACH,MAAM,IAAI,MAAM,kEAAkE;GAGpF,MAAM,SAAS,MAAM,cAAc,YAAY,IAAI;GAGnD,IAAI,QAAQ,UAAU,QAAQ,QAAQ;IACpC,MAAM,SAAS,oBAAoB,YAAY;KAC7C,QAAQ,QAAQ;KAChB,QAAQ,QAAQ;IAClB,CAAC;IACD,OAAO,SAAS,OAAO;IACvB,OAAO,SAAS;GAClB;GAKA,MAAM,mBAAmB,MAAM,MAAM,QAAQ;IAC3C,QAAQ,OAAO;IACf;IACA,gBAAgB,qBAAqB;GACvC,CAAC;EACH,CAAC;CACH,SAAS,OAAY;EACnB,OAAO,MAAM,mBAAmB,MAAM,SAAS;EAC/C,IAAI,MAAM,OACR,QAAQ,MAAM,MAAM,KAAK;EAE3B,QAAQ,KAAK,CAAC;CAChB;AACF"}
1
+ {"version":3,"file":"build.mjs","names":[],"sources":["../src/build.ts"],"sourcesContent":["import {\n loadConfig,\n loadFarmProductionVite,\n logger,\n resolveConfig,\n resolveDeployConfig,\n} from \"@farm.js/core/internal/config-runtime\";\nimport { withProductionNodeEnv } from \"@farm.js/core/internal/production-node-env\";\n\nexport { withProductionNodeEnv };\n\nexport interface BuildFarmOptions {\n root?: string;\n preset?: string;\n /** Deployment platform the build serves. Wins over the preset-derived target. */\n target?: string;\n}\n\n/**\n * Build Farm.js application\n */\nexport async function buildFarm(options: BuildFarmOptions = {}) {\n const root = options.root || process.cwd();\n const hasDeployOverride = options.preset !== undefined || options.target !== undefined;\n\n try {\n await withProductionNodeEnv(async () => {\n const mode = \"production\";\n const productionVitePromise = loadFarmProductionVite();\n const [userConfigResult, buildRuntimeResult, productionViteResult] = await Promise.allSettled(\n [\n productionVitePromise.then((runtime) =>\n loadConfig(root, undefined, mode, runtime.loadEnv),\n ),\n import(\"@farm.js/core/internal/build-runtime\"),\n productionVitePromise,\n ],\n );\n\n if (userConfigResult.status === \"rejected\") throw userConfigResult.reason;\n if (buildRuntimeResult.status === \"rejected\") throw buildRuntimeResult.reason;\n if (productionViteResult.status === \"rejected\") throw productionViteResult.reason;\n\n const userConfig = userConfigResult.value;\n\n if (!userConfig) {\n throw new Error(\"No Farm config found. Please create farm.config.ts or config.ts.\");\n }\n\n const config = await resolveConfig(userConfig, mode);\n\n // Override preset/target if provided via CLI\n if (hasDeployOverride) {\n const deploy = resolveDeployConfig(userConfig, {\n preset: options.preset as any,\n target: options.target,\n });\n config.preset = deploy.preset;\n config.deploy = deploy;\n }\n\n // Build. Completion is reported by the build pipeline itself, which\n // also knows the preset and output directory; a second banner here\n // would only repeat it.\n await buildRuntimeResult.value.build(config, {\n preset: hasDeployOverride ? config.preset : undefined,\n root,\n productionVite: productionViteResult.value,\n });\n });\n } catch (error: any) {\n logger.error(`❌ Build failed: ${error.message}`);\n if (error.stack) {\n console.error(error.stack);\n }\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;AAqBA,eAAsB,UAAU,UAA4B,CAAC,GAAG;CAC9D,MAAM,OAAO,QAAQ,QAAQ,QAAQ,IAAI;CACzC,MAAM,oBAAoB,QAAQ,WAAW,KAAA,KAAa,QAAQ,WAAW,KAAA;CAE7E,IAAI;EACF,MAAM,sBAAsB,YAAY;GACtC,MAAM,OAAO;GACb,MAAM,wBAAwB,uBAAuB;GACrD,MAAM,CAAC,kBAAkB,oBAAoB,wBAAwB,MAAM,QAAQ,WACjF;IACE,sBAAsB,MAAM,YAC1B,WAAW,MAAM,KAAA,GAAW,MAAM,QAAQ,OAAO,CACnD;IACA,OAAO;IACP;GACF,CACF;GAEA,IAAI,iBAAiB,WAAW,YAAY,MAAM,iBAAiB;GACnE,IAAI,mBAAmB,WAAW,YAAY,MAAM,mBAAmB;GACvE,IAAI,qBAAqB,WAAW,YAAY,MAAM,qBAAqB;GAE3E,MAAM,aAAa,iBAAiB;GAEpC,IAAI,CAAC,YACH,MAAM,IAAI,MAAM,kEAAkE;GAGpF,MAAM,SAAS,MAAM,cAAc,YAAY,IAAI;GAGnD,IAAI,mBAAmB;IACrB,MAAM,SAAS,oBAAoB,YAAY;KAC7C,QAAQ,QAAQ;KAChB,QAAQ,QAAQ;IAClB,CAAC;IACD,OAAO,SAAS,OAAO;IACvB,OAAO,SAAS;GAClB;GAKA,MAAM,mBAAmB,MAAM,MAAM,QAAQ;IAC3C,QAAQ,oBAAoB,OAAO,SAAS,KAAA;IAC5C;IACA,gBAAgB,qBAAqB;GACvC,CAAC;EACH,CAAC;CACH,SAAS,OAAY;EACnB,OAAO,MAAM,mBAAmB,MAAM,SAAS;EAC/C,IAAI,MAAM,OACR,QAAQ,MAAM,MAAM,KAAK;EAE3B,QAAQ,KAAK,CAAC;CAChB;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm.js/cli",
3
- "version": "0.1.0-beta.71",
3
+ "version": "0.1.0-beta.73",
4
4
  "description": "CLI for Farm.js framework",
5
5
  "keywords": [
6
6
  "@farm.js/cli",
@@ -30,7 +30,7 @@
30
30
  "commander": "^11.1.0",
31
31
  "croner": "9.1.0",
32
32
  "picocolors": "^1.0.0",
33
- "@farm.js/core": "0.1.0-beta.71"
33
+ "@farm.js/core": "0.1.0-beta.73"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^20.10.5",