@squidcloud/cli 1.0.343 → 1.0.345

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 (30) hide show
  1. package/dist/index.js +22 -11
  2. package/package.json +2 -2
  3. package/dist/cli/src/build.d.ts +0 -1
  4. package/dist/cli/src/deploy.d.ts +0 -3
  5. package/dist/cli/src/environments/environment.d.ts +0 -2
  6. package/dist/cli/src/environments/environment.type.d.ts +0 -5
  7. package/dist/cli/src/index.d.ts +0 -1
  8. package/dist/cli/src/init-env.d.ts +0 -2
  9. package/dist/cli/src/init-webpack.d.ts +0 -1
  10. package/dist/cli/src/main.d.ts +0 -1
  11. package/dist/cli/src/sample.d.ts +0 -2
  12. package/dist/cli/src/start.d.ts +0 -1
  13. package/dist/cli/src/undeploy.d.ts +0 -3
  14. package/dist/cli/src/utils/formatting.d.ts +0 -1
  15. package/dist/cli/src/utils/git-utils.d.ts +0 -1
  16. package/dist/cli/src/utils/logging.d.ts +0 -2
  17. package/dist/cli/src/utils/process-utils.d.ts +0 -2
  18. package/dist/cli/src/utils/report-utils.d.ts +0 -2
  19. package/dist/cli/src/utils/resolve.d.ts +0 -4
  20. package/dist/cli/src/utils/validate.d.ts +0 -7
  21. package/dist/internal-common/src/public-types/communication.public-types.d.ts +0 -21
  22. package/dist/internal-common/src/public-types/regions.public-types.d.ts +0 -4
  23. package/dist/internal-common/src/types/communication.types.d.ts +0 -20
  24. package/dist/internal-common/src/types/console-app.utils.d.ts +0 -5
  25. package/dist/internal-common/src/types/stage.d.ts +0 -9
  26. package/dist/internal-common/src/utils/global.utils.d.ts +0 -13
  27. package/dist/internal-common/src/utils/http.d.ts +0 -1
  28. package/dist/internal-common/src/utils/resolve.d.ts +0 -2
  29. package/dist/internal-common/src/utils/shell-runner.d.ts +0 -12
  30. package/dist/internal-common/src/utils/tsoa-utils.d.ts +0 -10
package/dist/index.js CHANGED
@@ -2464,7 +2464,7 @@ class TsoaUtils {
2464
2464
  console.error(`Error processing ${file}:\n`, errorMessage);
2465
2465
  }
2466
2466
  await fsPromises.unlink(tempConfigPath);
2467
- throw new Error(`Failed to process ${file}`);
2467
+ throw new Error(`Failed to process ${file}: ` + errorMessage);
2468
2468
  }
2469
2469
  // Define output file paths.
2470
2470
  const swaggerOutput = path.join(outputDir, 'swagger.json');
@@ -11560,14 +11560,14 @@ function run() {
11560
11560
  type: 'boolean',
11561
11561
  description: 'Run in verbose mode',
11562
11562
  });
11563
- setupStartCommand(yargs_1.default);
11563
+ setupBuildCommand(yargs_1.default);
11564
11564
  setupDeployCommand(yargs_1.default);
11565
- setupUndeployCommand(yargs_1.default);
11566
- setupInitEnvCommand(yargs_1.default);
11567
- setupInitWebpackCommand(yargs_1.default);
11568
11565
  setupInitCommand(yargs_1.default);
11566
+ setupInitEnvCommand(yargs_1.default);
11569
11567
  setupInitSampleCommand(yargs_1.default);
11570
- setupBuildCommand(yargs_1.default);
11568
+ setupInitWebpackCommand(yargs_1.default);
11569
+ setupStartCommand(yargs_1.default);
11570
+ setupUndeployCommand(yargs_1.default);
11571
11571
  yargs_1.default.parse();
11572
11572
  }
11573
11573
  function setupStartCommand(yargs) {
@@ -11669,9 +11669,9 @@ function setupInitSampleCommand(yargs) {
11669
11669
  });
11670
11670
  }
11671
11671
  function setupBuildCommand(yargs) {
11672
- yargs.command('build', 'Builds a Squid backend project', () => { }, async () => {
11672
+ yargs.command('build', 'Builds a Squid backend project', () => { }, async (argv) => {
11673
11673
  await (0, validate_1.validateSquidProject)();
11674
- await (0, build_1.default)();
11674
+ await (0, build_1.default)({ verbose: !!argv.verbose });
11675
11675
  });
11676
11676
  }
11677
11677
  run();
@@ -22767,7 +22767,7 @@ function exitWithError(...messages) {
22767
22767
  /***/ ((module) => {
22768
22768
 
22769
22769
  "use strict";
22770
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.343","description":"The Squid CLI","main":"dist/index.js","scripts":{"start":"node dist/index.js","start-ts":"ts-node -r tsconfig-paths/register src/index.ts","prebuild":"rimraf dist","build":"webpack --mode=production","build:dev":"webpack --mode=development","build:prod":"webpack --mode=production","lint":"eslint","link":"npm run build && chmod 755 dist/index.js && npm link","watch":"webpack --watch","deploy":"npm run build && npm pack --silent | xargs -I {} mv {} package.tgz && npm install -g package.tgz && rm -rf package.tgz","publish:public":"npm run build && npm publish --access public"},"files":["dist/**/*"],"bin":{"squid":"dist/index.js"},"keywords":[],"author":"","license":"ISC","engines":{"node":">=18.0.0"},"dependencies":{"@squidcloud/local-backend":"^1.0.343","copy-webpack-plugin":"^12.0.2","decompress":"^4.2.1","nodemon":"^3.1.3","terser-webpack-plugin":"^5.3.10","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.1.0","webpack":"^5.96.0","zip-webpack-plugin":"^4.0.1"},"devDependencies":{"@types/decompress":"^4.2.7","@types/node":"^20.16.10","terminal-link":"^3.0.0"}}');
22770
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.345","description":"The Squid CLI","main":"dist/index.js","scripts":{"start":"node dist/index.js","start-ts":"ts-node -r tsconfig-paths/register src/index.ts","prebuild":"rimraf dist","build":"webpack --mode=production","build:dev":"webpack --mode=development","build:prod":"webpack --mode=production","lint":"eslint","link":"npm run build && chmod 755 dist/index.js && npm link","watch":"webpack --watch","deploy":"npm run build && npm pack --silent | xargs -I {} mv {} package.tgz && npm install -g package.tgz && rm -rf package.tgz","publish:public":"npm run build && npm publish --access public"},"files":["dist/**/*"],"bin":{"squid":"dist/index.js"},"keywords":[],"author":"","license":"ISC","engines":{"node":">=18.0.0"},"dependencies":{"@squidcloud/local-backend":"^1.0.345","copy-webpack-plugin":"^12.0.2","decompress":"^4.2.1","nodemon":"^3.1.3","terser-webpack-plugin":"^5.3.10","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.1.0","webpack":"^5.96.0","zip-webpack-plugin":"^4.0.1"},"devDependencies":{"@types/decompress":"^4.2.7","@types/node":"^20.16.10","terminal-link":"^3.0.0"}}');
22771
22771
 
22772
22772
  /***/ }),
22773
22773
 
@@ -22898,15 +22898,21 @@ const fs_1 = __webpack_require__(9896);
22898
22898
  const resolve_1 = __webpack_require__(412);
22899
22899
  const resolve_2 = __webpack_require__(3878);
22900
22900
  const tsoa_utils_1 = __webpack_require__(1431);
22901
+ const packageJson = __importStar(__webpack_require__(8330));
22902
+ const assertic_1 = __webpack_require__(5036);
22901
22903
  function isEnvVarFalsy(variableName) {
22902
22904
  const value = process.env[variableName];
22903
22905
  return !value || value.toLowerCase() === 'false' || value === '0';
22904
22906
  }
22905
22907
  const useColorsInOutput = !isEnvVarFalsy('FORCE_COLOR') || isEnvVarFalsy('NO_COLOR');
22906
- async function default_1() {
22908
+ async function default_1({ verbose }) {
22909
+ if (verbose)
22910
+ console.log(`Starting Squid project build. CLI package version: ${packageJson.version}`);
22907
22911
  await (0, validate_1.validateSquidProject)();
22908
22912
  const distPath = path_1.default.resolve(process.cwd(), 'dist');
22909
22913
  if (fsSync.existsSync(distPath)) {
22914
+ if (verbose)
22915
+ console.log(`Cleaning existing dist dir before the build: ${distPath}`);
22910
22916
  await fs_1.promises.rm(distPath, { recursive: true, force: true });
22911
22917
  }
22912
22918
  await fs_1.promises.mkdir(distPath);
@@ -22915,6 +22921,8 @@ async function default_1() {
22915
22921
  await fs_1.promises.writeFile(path_1.default.join(distPath, '', 'openapi-spec-and-controllers.json'), JSON.stringify(openApiSpecAndControllers));
22916
22922
  const isUserConfigMode = fsSync.existsSync(resolve_2.USER_WEBPACK_CONFIG_PATH);
22917
22923
  const webpackConfigPath = isUserConfigMode ? resolve_2.USER_WEBPACK_CONFIG_PATH : resolve_2.BUILT_IN_WEBPACK_CONFIG_PATH;
22924
+ if (verbose)
22925
+ console.log(`Using webpack config from ${webpackConfigPath}`);
22918
22926
  const localConfig = (0, resolve_1.requirePath)(webpackConfigPath);
22919
22927
  const webpackConfig = localConfig(undefined, { mode: 'production' });
22920
22928
  webpackConfig.mode = 'production';
@@ -22947,7 +22955,10 @@ async function default_1() {
22947
22955
  });
22948
22956
  }
22949
22957
  catch (e) {
22950
- (0, process_utils_1.exitWithError)(e.message);
22958
+ const errorMessage = (0, assertic_1.getMessageFromError)(e);
22959
+ if (verbose)
22960
+ console.log(`Exiting with error: ${errorMessage}`);
22961
+ (0, process_utils_1.exitWithError)(errorMessage);
22951
22962
  }
22952
22963
  }
22953
22964
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/cli",
3
- "version": "1.0.343",
3
+ "version": "1.0.345",
4
4
  "description": "The Squid CLI",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -29,7 +29,7 @@
29
29
  "node": ">=18.0.0"
30
30
  },
31
31
  "dependencies": {
32
- "@squidcloud/local-backend": "^1.0.343",
32
+ "@squidcloud/local-backend": "^1.0.345",
33
33
  "copy-webpack-plugin": "^12.0.2",
34
34
  "decompress": "^4.2.1",
35
35
  "nodemon": "^3.1.3",
@@ -1 +0,0 @@
1
- export default function (): Promise<void>;
@@ -1,3 +0,0 @@
1
- import { AppId, EnvironmentId } from '../../internal-common/src/public-types/communication.public-types';
2
- import { Stage } from '../../internal-common/src/types/stage';
3
- export default function (stage: Stage, appId: AppId, bundlePath: string, apiKey: string | undefined, verbose: boolean, direct: boolean, isUserSpecifiedPath: boolean, skipBuild: boolean, internalApiKey: string | undefined, environmentId: EnvironmentId): Promise<void>;
@@ -1,2 +0,0 @@
1
- import { Environment } from './environment.type';
2
- export declare const environment: Environment;
@@ -1,5 +0,0 @@
1
- import { SquidRegion } from '../../../internal-common/src/public-types/regions.public-types';
2
- export interface Environment {
3
- consoleAppId: string;
4
- region: SquidRegion;
5
- }
@@ -1 +0,0 @@
1
- import './main';
@@ -1,2 +0,0 @@
1
- import { AppId, EnvironmentId, SquidDeveloperId } from '../../internal-common/src/public-types/communication.public-types';
2
- export default function (pathStr: string | undefined, appId: AppId, apiKey: string, environmentId: EnvironmentId, squidDeveloperId: SquidDeveloperId, region: string): Promise<void>;
@@ -1 +0,0 @@
1
- export default function (): Promise<void>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { AppId } from '../../internal-common/src/public-types/communication.public-types';
2
- export default function initSample(dirPath: string, appId: AppId, apiKey: string, environmentId: string, squidDeveloperId: string, region: string, templateName: string, verbose?: boolean): Promise<void>;
@@ -1 +0,0 @@
1
- export default function (): Promise<void>;
@@ -1,3 +0,0 @@
1
- import { AppId, EnvironmentId } from '../../internal-common/src/public-types/communication.public-types';
2
- import { Stage } from '../../internal-common/src/types/stage';
3
- export default function (stage: Stage, appId: AppId, apiKey: string | undefined, environmentId: EnvironmentId): Promise<void>;
@@ -1 +0,0 @@
1
- export declare function normalizeToKebabOrSnakeCase(str: string): string;
@@ -1 +0,0 @@
1
- export declare function downloadRepo(username: string, repo: string, dest: string): Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const primary: import("chalk").ChalkInstance;
2
- export declare const link: (url: string, text?: string) => string;
@@ -1,2 +0,0 @@
1
- /** Prints error message into console.error() and calls process.exit(1). */
2
- export declare function exitWithError(...messages: unknown[]): never;
@@ -1,2 +0,0 @@
1
- import { AppId } from '../../../internal-common/src/public-types/communication.public-types';
2
- export declare function reportLocalBackendInitialized(appId: AppId, apiKey: string, appRegion: string, verbose: boolean): Promise<void>;
@@ -1,4 +0,0 @@
1
- export declare function findModulePath(moduleName: string, startDir?: string): Promise<string | null>;
2
- export declare const requirePath: (file: string) => any;
3
- export declare const USER_WEBPACK_CONFIG_PATH: string;
4
- export declare const BUILT_IN_WEBPACK_CONFIG_PATH: string;
@@ -1,7 +0,0 @@
1
- export declare const INVALID_PROJECT_ERROR = "Please make sure you are running this command in your Squid project directory";
2
- type PackageType = {
3
- scripts?: Record<string, string>;
4
- [key: string]: unknown;
5
- };
6
- export declare function validateSquidProject(): Promise<PackageType>;
7
- export {};
@@ -1,21 +0,0 @@
1
- /** A type alias for an application id. */
2
- export type AppId = string;
3
- export declare const ENVIRONMENT_IDS: readonly ["dev", "prod"];
4
- export type EnvironmentId = (typeof ENVIRONMENT_IDS)[number];
5
- export type SquidDeveloperId = string;
6
- /** A type alias for an integration id. */
7
- export type IntegrationId = string;
8
- export type ClientId = string;
9
- export type SquidDocId = string;
10
- export type ClientRequestId = string;
11
- /** ID of AI agent. Also known as AI profile id. */
12
- export type AiAgentId = string;
13
- /**
14
- * The built-in agent id. Cannot be customized.
15
- * @category AI
16
- */
17
- export declare const BUILT_IN_AGENT_ID = "built_in_agent";
18
- /**
19
- * @category AI
20
- */
21
- export type AiContextId = string;
@@ -1,4 +0,0 @@
1
- /** The list of regions in Squid. */
2
- export declare const SQUID_REGIONS: readonly ["us-east-1.aws", "ap-south-1.aws", "us-central1.gcp"];
3
- /** Region type used by Squid. */
4
- export type SquidRegion = (typeof SQUID_REGIONS)[number];
@@ -1,20 +0,0 @@
1
- import { AppId, EnvironmentId, SquidDeveloperId } from '../public-types/communication.public-types';
2
- export type ChatId = string;
3
- /** @internal */
4
- export interface ParsedAppId {
5
- appId: AppId;
6
- environmentId: EnvironmentId;
7
- squidDeveloperId?: SquidDeveloperId;
8
- }
9
- /** @internal */
10
- export declare function parseAppId(appId: AppId): ParsedAppId;
11
- /** @internal */
12
- export declare function appIdWithEnvironmentId(appId: AppId, environmentId: EnvironmentId | undefined): AppId;
13
- /** @internal */
14
- export declare function appIdWithEnvironmentIdAndDevId(appId: AppId, environmentId: EnvironmentId | undefined, developerId: SquidDeveloperId | undefined): AppId;
15
- /** @internal */
16
- export declare function validateEnvironment(appId: AppId): ParsedAppId;
17
- /** @internal */
18
- export declare function verifyWithSquidDevId(appId: AppId): void;
19
- /** @internal */
20
- export declare function omitSquidDevId(appId: AppId): AppId;
@@ -1,5 +0,0 @@
1
- /*** Console application details needed by packages other than console. */
2
- import { Stage } from './stage';
3
- /**
4
- * Returns Console application Squid region for the given stage. */
5
- export declare function getConsoleAppRegionByStage(stage: Stage): string;
@@ -1,9 +0,0 @@
1
- /**
2
- * Stage of the Squid deployment:
3
- * - 'local' - Squid is run locally.
4
- * - 'dev' - Old development environment (https://dev-console.squid.cloud). Deprecated.
5
- * - 'prod' - Production environment (https://console.getsquid.ai).
6
- * - 'sandbox' - One of the sandbox environments (https://console.sandbox.squid.cloud).
7
- */
8
- export declare const STAGES: readonly ["local", "dev", "prod", "sandbox"];
9
- export type Stage = (typeof STAGES)[number];
@@ -1,13 +0,0 @@
1
- /** @internal */
2
- export declare function getGlobal(): any;
3
- /** @internal */
4
- export declare function isDebugEnabled(): boolean;
5
- /** @internal */
6
- export declare function enableDebugLogs(mode?: boolean): void;
7
- /** @internal */
8
- export declare function disableTimestampsInLog(): void;
9
- export declare function isTimestampEnabled(): boolean;
10
- /** @internal */
11
- export declare class DebugLogger {
12
- static debug(...args: any[]): void;
13
- }
@@ -1 +0,0 @@
1
- export declare function getApplicationUrl(regionPrefix: string, appId: string, path: string): string;
@@ -1,2 +0,0 @@
1
- export declare function findModulePath(moduleName: string, startDir?: string): Promise<string | null>;
2
- export declare const requirePath: (file: string) => any;
@@ -1,12 +0,0 @@
1
- export interface ErrorLine {
2
- level: 'error' | 'info';
3
- message: string;
4
- }
5
- export interface ProcessError {
6
- errorMessage: string;
7
- combinedOutput: Array<ErrorLine>;
8
- }
9
- export declare function runInShell(command: string, printMessages?: boolean, cwd?: string, envVars?: Record<string, string>): Promise<{
10
- combinedOutput: Array<ErrorLine>;
11
- }>;
12
- export declare function printCombinedOutput(combinedOutput: Array<ErrorLine>): void;
@@ -1,10 +0,0 @@
1
- export interface OpenApiSpecAndControllers {
2
- openApiControllersMap: Record<string, string>;
3
- openApiSpecsMap: Record<string, string>;
4
- }
5
- export declare class TsoaUtils {
6
- constructor();
7
- static generateAllSpecs(verbose?: boolean, supportsDefault?: boolean): Promise<OpenApiSpecAndControllers>;
8
- private static extractTsoaName;
9
- private static attachCodeSamples;
10
- }