@rodyssey/cli 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/dist/cli.js +57 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2071,7 +2071,7 @@ var {
2071
2071
  // package.json
2072
2072
  var package_default = {
2073
2073
  name: "@rodyssey/cli",
2074
- version: "0.2.0",
2074
+ version: "0.2.1",
2075
2075
  description: "Scaffold new projects from airconcepts templates",
2076
2076
  repository: {
2077
2077
  type: "git",
@@ -3804,8 +3804,15 @@ var DEPLOY_URLS = {
3804
3804
  };
3805
3805
  var BUILD_DIR = "dist";
3806
3806
  var ZIP_FILE = "webapp-build.zip";
3807
+ var FULLSTACK_DEPLOY_ENVS = new Set(["development", "staging", "production"]);
3807
3808
  var MAX_FILES_PER_BATCH = 5;
3808
3809
  var MAX_SIZE_PER_BATCH = 30 * 1024 * 1024;
3810
+ function shellQuote(value) {
3811
+ return `'${value.replace(/'/g, "'\\''")}'`;
3812
+ }
3813
+ function isFullstackProject() {
3814
+ return existsSync4("app") && existsSync4("workers/app.ts") && existsSync4("wrangler.jsonc");
3815
+ }
3809
3816
  function getAllFiles(dirPath, arrayOfFiles = []) {
3810
3817
  if (!existsSync4(dirPath))
3811
3818
  return arrayOfFiles;
@@ -3824,8 +3831,47 @@ function fileToBlob(filePath) {
3824
3831
  const buffer = readFileSync3(filePath);
3825
3832
  return new Blob([buffer], { type: src_default.getType(filePath) || "application/octet-stream" });
3826
3833
  }
3827
- async function deploy(env = "development", overrides = {}) {
3828
- loadEnv(env);
3834
+ async function deployFullstack(env, overrides) {
3835
+ if (env === "local") {
3836
+ console.error("❌ Fullstack projects deploy to Cloudflare Workers and do not support the local CMS deploy target.");
3837
+ process.exit(1);
3838
+ }
3839
+ if (!FULLSTACK_DEPLOY_ENVS.has(env)) {
3840
+ console.error(`❌ Unknown fullstack environment "${env}". Available: ${Array.from(FULLSTACK_DEPLOY_ENVS).join(", ")}`);
3841
+ process.exit(1);
3842
+ }
3843
+ if (!process.env.DEPLOY_TOKEN) {
3844
+ console.error("❌ Error: DEPLOY_TOKEN is not set in environment variables.");
3845
+ console.info(`\uD83D\uDCA1 Please check your .env or .env.${env} file.`);
3846
+ process.exit(1);
3847
+ }
3848
+ const childEnv = {
3849
+ ...process.env,
3850
+ CLOUDFLARE_ENV: env
3851
+ };
3852
+ console.log(`\uD83D\uDE80 Starting fullstack deployment process for [${env}] environment...
3853
+ `);
3854
+ console.log("\uD83D\uDCE6 Step 1: Building the fullstack webapp...");
3855
+ execSync2("bun run build", { stdio: "inherit", env: childEnv });
3856
+ console.log(`✅ Build completed
3857
+ `);
3858
+ console.log("☁️ Step 2: Deploying Cloudflare Worker...");
3859
+ const wranglerEnvArgs = env === "development" ? "" : ` --env ${shellQuote(env)}`;
3860
+ execSync2(`bun run wrangler deploy${wranglerEnvArgs}`, { stdio: "inherit", env: childEnv });
3861
+ console.log(`✅ Worker deployed
3862
+ `);
3863
+ console.log("\uD83D\uDCCB Step 3: Syncing widget manifest to CMS config...");
3864
+ const syncArgs = [
3865
+ "--env",
3866
+ shellQuote(env),
3867
+ ...overrides.host ? ["--host", shellQuote(overrides.host)] : [],
3868
+ ...overrides.port ? ["--port", shellQuote(String(overrides.port))] : []
3869
+ ];
3870
+ execSync2(`bun run sync-widget-manifest -- ${syncArgs.join(" ")}`, { stdio: "inherit", env: childEnv });
3871
+ console.log(`
3872
+ ✨ Fullstack deployment successful!`);
3873
+ }
3874
+ async function deploySpa(env, overrides) {
3829
3875
  let DEPLOY_URL = DEPLOY_URLS[env];
3830
3876
  if (!DEPLOY_URL) {
3831
3877
  console.error(`❌ Unknown environment "${env}". Available: ${Object.keys(DEPLOY_URLS).join(", ")}`);
@@ -3980,6 +4026,14 @@ ${errorText}`);
3980
4026
  console.log(`
3981
4027
  ✨ Deployment successful!`);
3982
4028
  }
4029
+ async function deploy(env = "development", overrides = {}) {
4030
+ loadEnv(env);
4031
+ if (isFullstackProject()) {
4032
+ await deployFullstack(env, overrides);
4033
+ return;
4034
+ }
4035
+ await deploySpa(env, overrides);
4036
+ }
3983
4037
 
3984
4038
  // src/global-config.ts
3985
4039
  import { existsSync as existsSync5, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rodyssey/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Scaffold new projects from airconcepts templates",
5
5
  "repository": {
6
6
  "type": "git",