@squidcloud/cli 1.0.407 → 1.0.409
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/index.js +54 -17
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1000,10 +1000,28 @@ async function start() {
|
|
|
1000
1000
|
await (0, shell_runner_1.runInShell)(`npm run start-squid`);
|
|
1001
1001
|
}
|
|
1002
1002
|
else {
|
|
1003
|
-
|
|
1003
|
+
// Detect if CLI is running as TypeScript (dev mode)
|
|
1004
|
+
const isDevMode = __filename.endsWith('.ts');
|
|
1005
|
+
let mainPath;
|
|
1006
|
+
// In dev mode, try to use local-backend source files
|
|
1007
|
+
if (isDevMode) {
|
|
1008
|
+
const localBackendSrc = path_1.default.resolve(__dirname, '../../local-backend/src/main.ts');
|
|
1009
|
+
try {
|
|
1010
|
+
await fs.access(localBackendSrc);
|
|
1011
|
+
mainPath = localBackendSrc;
|
|
1012
|
+
console.log((0, logging_1.primary)('Dev mode detected:'), `using local-backend source files: ${mainPath}`);
|
|
1013
|
+
}
|
|
1014
|
+
catch (_) {
|
|
1015
|
+
// Fall back to built version if source files not found
|
|
1016
|
+
mainPath = path_1.default.resolve(modulePath, '../main.js');
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
else {
|
|
1020
|
+
mainPath = path_1.default.resolve(modulePath, '../main.js');
|
|
1021
|
+
}
|
|
1004
1022
|
try {
|
|
1005
1023
|
await fs.access(mainPath);
|
|
1006
|
-
await (0, shell_runner_1.runInShell)(`npx nodemon --watch ./src --ext ts,js,json --quiet --exec node -r ts-node/register -r tsconfig-paths/register "${mainPath}"`);
|
|
1024
|
+
await (0, shell_runner_1.runInShell)(`npx nodemon --watch ./src --watch ./.env --ext ts,js,json --quiet --exec node -r ts-node/register -r tsconfig-paths/register "${mainPath}"`);
|
|
1007
1025
|
}
|
|
1008
1026
|
catch (_) {
|
|
1009
1027
|
(0, process_utils_1.exitWithError)(validate_1.INVALID_PROJECT_ERROR);
|
|
@@ -6047,6 +6065,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
6047
6065
|
exports.INVALID_PROJECT_ERROR = void 0;
|
|
6048
6066
|
exports.validateSquidProject = validateSquidProject;
|
|
6049
6067
|
const promises_1 = __importDefault(__webpack_require__(1943));
|
|
6068
|
+
const process_env_utils_1 = __webpack_require__(9360);
|
|
6050
6069
|
const process_utils_1 = __webpack_require__(8251);
|
|
6051
6070
|
exports.INVALID_PROJECT_ERROR = 'Please make sure you are running this command in your Squid project directory';
|
|
6052
6071
|
async function validateSquidProject() {
|
|
@@ -6054,7 +6073,9 @@ async function validateSquidProject() {
|
|
|
6054
6073
|
const packageJson = await promises_1.default.readFile('package.json', 'utf8');
|
|
6055
6074
|
const parsedJson = JSON.parse(packageJson);
|
|
6056
6075
|
const { scripts } = parsedJson;
|
|
6057
|
-
|
|
6076
|
+
// Skip validation for connectors (when SQUID_CONNECTOR is set).
|
|
6077
|
+
const isConnector = (0, process_env_utils_1.isEnvVarTruthy)('SQUID_CONNECTOR');
|
|
6078
|
+
if (!isConnector && !scripts?.['start-squid'] && !scripts?.['start']?.includes('squid start')) {
|
|
6058
6079
|
(0, process_utils_1.exitWithError)(exports.INVALID_PROJECT_ERROR);
|
|
6059
6080
|
}
|
|
6060
6081
|
return parsedJson;
|
|
@@ -22734,23 +22755,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
22734
22755
|
})();
|
|
22735
22756
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
22736
22757
|
exports.exitWithError = exitWithError;
|
|
22737
|
-
exports.isEnvVarTruthy = isEnvVarTruthy;
|
|
22738
22758
|
const process = __importStar(__webpack_require__(932));
|
|
22739
22759
|
/** Prints the error message into console.error() and calls process.exit(1). */
|
|
22740
22760
|
function exitWithError(...messages) {
|
|
22741
22761
|
console.error(...messages);
|
|
22742
22762
|
process.exit(1);
|
|
22743
22763
|
}
|
|
22744
|
-
/**
|
|
22745
|
-
* Checks if an environment variable is set to a truthy value.
|
|
22746
|
-
* Considers 'true' and '1' as truthy values.
|
|
22747
|
-
* @param variableName The name of the environment variable
|
|
22748
|
-
* @returns true if the variable is set to 'true' or '1', false otherwise
|
|
22749
|
-
*/
|
|
22750
|
-
function isEnvVarTruthy(variableName) {
|
|
22751
|
-
const value = process.env[variableName];
|
|
22752
|
-
return value === 'true' || value === '1';
|
|
22753
|
-
}
|
|
22754
22764
|
|
|
22755
22765
|
|
|
22756
22766
|
/***/ }),
|
|
@@ -22759,7 +22769,7 @@ function isEnvVarTruthy(variableName) {
|
|
|
22759
22769
|
/***/ ((module) => {
|
|
22760
22770
|
|
|
22761
22771
|
"use strict";
|
|
22762
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.
|
|
22772
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.409","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","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.409","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.101.3","zip-webpack-plugin":"^4.0.1"},"devDependencies":{"@types/decompress":"^4.2.7","@types/node":"^20.19.9","terminal-link":"^3.0.0"}}');
|
|
22763
22773
|
|
|
22764
22774
|
/***/ }),
|
|
22765
22775
|
|
|
@@ -22885,6 +22895,7 @@ const fsSync = __importStar(__webpack_require__(9896));
|
|
|
22885
22895
|
const fs_1 = __webpack_require__(9896);
|
|
22886
22896
|
const path_1 = __importDefault(__webpack_require__(6928));
|
|
22887
22897
|
const webpack_1 = __importDefault(__webpack_require__(6807));
|
|
22898
|
+
const process_env_utils_1 = __webpack_require__(9360);
|
|
22888
22899
|
const resolve_1 = __webpack_require__(412);
|
|
22889
22900
|
const tsoa_utils_1 = __webpack_require__(1431);
|
|
22890
22901
|
const packageJson = __importStar(__webpack_require__(8330));
|
|
@@ -22912,7 +22923,7 @@ async function build({ verbose, dev, skipVersionCheck }) {
|
|
|
22912
22923
|
console.log(`Starting Squid project build. CLI package version: ${packageJson.version}`);
|
|
22913
22924
|
await (0, validate_1.validateSquidProject)();
|
|
22914
22925
|
// Start version checks in the background if not disabled.
|
|
22915
|
-
const shouldSkipVersionCheck = skipVersionCheck || (0,
|
|
22926
|
+
const shouldSkipVersionCheck = skipVersionCheck || (0, process_env_utils_1.isEnvVarTruthy)('SQUID_SKIP_BUILD_TIME_VERSION_CHECK');
|
|
22916
22927
|
// SQUID_CURRENT_CLI_VERSION_OVERRIDE is used for testing.
|
|
22917
22928
|
const currentVersion = process.env['SQUID_CURRENT_CLI_VERSION_OVERRIDE'] || packageJson.version;
|
|
22918
22929
|
const versionCheckPromise = shouldSkipVersionCheck ? Promise.resolve(undefined) : (0, version_check_1.checkCliVersion)(currentVersion);
|
|
@@ -22923,7 +22934,7 @@ async function build({ verbose, dev, skipVersionCheck }) {
|
|
|
22923
22934
|
await fs_1.promises.rm(distPath, { recursive: true, force: true });
|
|
22924
22935
|
}
|
|
22925
22936
|
await fs_1.promises.mkdir(distPath);
|
|
22926
|
-
const isSquidConnector = (0,
|
|
22937
|
+
const isSquidConnector = (0, process_env_utils_1.isEnvVarTruthy)('SQUID_CONNECTOR');
|
|
22927
22938
|
const openApiSpecAndControllers = await tsoa_utils_1.TsoaUtils.generateAllSpecs(false, !isSquidConnector);
|
|
22928
22939
|
await fs_1.promises.writeFile(path_1.default.join(distPath, '', 'openapi-spec-and-controllers.json'), JSON.stringify(openApiSpecAndControllers));
|
|
22929
22940
|
const isUserConfigMode = fsSync.existsSync(resolve_2.USER_WEBPACK_CONFIG_PATH);
|
|
@@ -24872,6 +24883,32 @@ module.exports = (string, columns, options) => {
|
|
|
24872
24883
|
};
|
|
24873
24884
|
|
|
24874
24885
|
|
|
24886
|
+
/***/ }),
|
|
24887
|
+
|
|
24888
|
+
/***/ 9360:
|
|
24889
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
24890
|
+
|
|
24891
|
+
"use strict";
|
|
24892
|
+
|
|
24893
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
24894
|
+
exports.getProcessEnv = getProcessEnv;
|
|
24895
|
+
exports.isEnvVarTruthy = isEnvVarTruthy;
|
|
24896
|
+
const assertic_1 = __webpack_require__(3205);
|
|
24897
|
+
function getProcessEnv(key) {
|
|
24898
|
+
return (0, assertic_1.truthy)(process.env[key], `No ${key} environment variable`);
|
|
24899
|
+
}
|
|
24900
|
+
/**
|
|
24901
|
+
* Checks if an environment variable is set to a truthy value.
|
|
24902
|
+
* Considers 'true' and '1' as truthy values.
|
|
24903
|
+
* @param variableName The name of the environment variable
|
|
24904
|
+
* @returns true if the variable is set to 'true' or '1', false otherwise
|
|
24905
|
+
*/
|
|
24906
|
+
function isEnvVarTruthy(variableName) {
|
|
24907
|
+
const value = process.env[variableName];
|
|
24908
|
+
return value === 'true' || value === '1';
|
|
24909
|
+
}
|
|
24910
|
+
|
|
24911
|
+
|
|
24875
24912
|
/***/ }),
|
|
24876
24913
|
|
|
24877
24914
|
/***/ 9386:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.409",
|
|
4
4
|
"description": "The Squid CLI",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"node": ">=18.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@squidcloud/local-backend": "^1.0.
|
|
31
|
+
"@squidcloud/local-backend": "^1.0.409",
|
|
32
32
|
"copy-webpack-plugin": "^12.0.2",
|
|
33
33
|
"decompress": "^4.2.1",
|
|
34
34
|
"nodemon": "^3.1.3",
|