@lukoweb/apitogo 0.1.8 → 0.1.10

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/cli.js +18 -6
  2. package/package.json +1 -1
package/dist/cli/cli.js CHANGED
@@ -3816,7 +3816,7 @@ import {
3816
3816
  // package.json
3817
3817
  var package_default = {
3818
3818
  name: "@lukoweb/apitogo",
3819
- version: "0.1.7",
3819
+ version: "0.1.9",
3820
3820
  type: "module",
3821
3821
  sideEffects: [
3822
3822
  "**/*.css",
@@ -8433,7 +8433,8 @@ var build_default = {
8433
8433
  import { access, readFile as readFile4 } from "node:fs/promises";
8434
8434
  import path25 from "node:path";
8435
8435
  import { create as createTar } from "tar";
8436
- var DEPLOY_ENDPOINT = "http://localhost:3000/deploy";
8436
+ var DEPLOY_ENDPOINT = "https://deployserver.apitogo.com/deploy";
8437
+ var DEPLOY_API_KEY = "qRVLTP22TFStdN6";
8437
8438
  var ARCHIVE_NAME = "dist.tgz";
8438
8439
  var createDeploymentArchive = async (dir) => {
8439
8440
  const distDir = path25.join(dir, "dist");
@@ -8453,14 +8454,17 @@ var createDeploymentArchive = async (dir) => {
8453
8454
  async function deploy(argv) {
8454
8455
  await build({ ...argv, preview: void 0 });
8455
8456
  const dir = path25.resolve(process.cwd(), argv.dir);
8456
- const deploymentToken = argv.deploymentToken?.trim();
8457
+ const deploymentToken = argv.deploymentToken?.trim() || process.env.npm_config_deployment_token?.trim();
8458
+ const env = argv.env?.trim() || process.env.npm_config_env?.trim() || "production";
8457
8459
  try {
8458
8460
  if (!deploymentToken) {
8459
8461
  throw new Error("A deployment token is required.");
8460
8462
  }
8461
8463
  printDiagnosticsToConsole("Creating deployment archive...");
8462
8464
  const archivePath = await createDeploymentArchive(dir);
8463
- printDiagnosticsToConsole(`Uploading ${path25.basename(archivePath)}...`);
8465
+ printDiagnosticsToConsole(
8466
+ `Uploading ${path25.basename(archivePath)} to ${env}...`
8467
+ );
8464
8468
  const archiveBuffer = await readFile4(archivePath);
8465
8469
  const formData = new FormData();
8466
8470
  formData.append(
@@ -8469,8 +8473,12 @@ async function deploy(argv) {
8469
8473
  path25.basename(archivePath)
8470
8474
  );
8471
8475
  formData.append("deploymentToken", deploymentToken);
8476
+ formData.append("env", env);
8472
8477
  const response = await fetch(DEPLOY_ENDPOINT, {
8473
8478
  method: "POST",
8479
+ headers: {
8480
+ "x-api-key": DEPLOY_API_KEY
8481
+ },
8474
8482
  body: formData
8475
8483
  });
8476
8484
  const responseText = await response.text();
@@ -8495,10 +8503,14 @@ async function deploy(argv) {
8495
8503
  // src/cli/cmds/deploy.ts
8496
8504
  var deploy_default = {
8497
8505
  desc: "Build, archive, and deploy",
8498
- command: "deploy [deploymentToken]",
8499
- builder: (yargs2) => yargs2.positional("deploymentToken", {
8506
+ command: "deploy",
8507
+ builder: (yargs2) => yargs2.option("deployment-token", {
8500
8508
  type: "string",
8501
8509
  describe: "Deployment token sent to the deploy endpoint"
8510
+ }).option("env", {
8511
+ type: "string",
8512
+ describe: "Deployment environment name",
8513
+ default: "production"
8502
8514
  }).option("dir", {
8503
8515
  type: "string",
8504
8516
  describe: "The directory containing your project",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukoweb/apitogo",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "**/*.css",