@liara/cli
Advanced tools
Comparing version 5.6.0 to 5.7.1-beta.1
@@ -35,3 +35,3 @@ var _a; | ||
import ReachedMaxSourceSizeError from '../errors/max-source-size.js'; | ||
import mergePlatformConfigWithDefaults from '../utils/merge-platform-config.js'; | ||
import getPlatformVersion from '../services/get-platform-version.js'; | ||
class Deploy extends Command { | ||
@@ -240,7 +240,49 @@ async run() { | ||
// @ts-ignore | ||
body.platformConfig = await mergePlatformConfigWithDefaults(config.path, | ||
// @ts-ignore | ||
config.platform, | ||
// @ts-ignore | ||
config[config.platform] || {}, this.debug); | ||
body.platformConfig = config[config.platform] || {}; | ||
if (body.platformConfig.pythonVersion) { | ||
// django and flask | ||
this.logKeyValue('Python version', body.platformConfig.pythonVersion); | ||
} | ||
else if (body.platformConfig.version) { | ||
// node, netcore, php | ||
this.logKeyValue(`${config.platform} version`, body.platformConfig.version); | ||
} | ||
else if (body.platformConfig.phpVersion) { | ||
// laravel | ||
this.logKeyValue('PHP version', body.platformConfig.phpVersion); | ||
} | ||
else { | ||
this.log('No version specified in liara.json'); | ||
this.log('Auto-detecting version...'); | ||
let platformVersion = null; | ||
switch (config.platform) { | ||
case 'django': | ||
case 'flask': | ||
platformVersion = await getPlatformVersion(config.platform, config.path, this.debug); | ||
if (platformVersion) { | ||
this.logKeyValue('Auto-detected Python version', platformVersion); | ||
} | ||
break; | ||
case 'php': | ||
case 'laravel': | ||
platformVersion = await getPlatformVersion(config.platform, config.path, this.debug); | ||
if (platformVersion) { | ||
this.logKeyValue('Auto-detected php version', platformVersion); | ||
} | ||
break; | ||
case 'node': | ||
case 'netcore': | ||
platformVersion = await getPlatformVersion(config.platform, config.path, this.debug); | ||
if (platformVersion) { | ||
this.logKeyValue(`Auto-detected ${config.platform} version`, platformVersion); | ||
} | ||
break; | ||
default: | ||
this.debug(`Can not auto-detect version for ${config.platform} platform`); | ||
break; | ||
} | ||
if (!platformVersion) { | ||
this.log('No version for this platform found. Using default version'); | ||
} | ||
} | ||
if (config.healthCheck) { | ||
@@ -247,0 +289,0 @@ body.healthCheck = config.healthCheck; |
@@ -6,8 +6,16 @@ import path from 'node:path'; | ||
export default async function mergePlatformConfigWithDefaults(projectPath, platform, userProvidedConfig, debug) { | ||
if (platform === 'laravel') { | ||
return getDefaultLaravelPlatformConfig(projectPath, userProvidedConfig, debug); | ||
} | ||
if (platform === 'netcore') { | ||
return await detectNetCorePlatformVersion(projectPath, userProvidedConfig, debug); | ||
} | ||
// if (platform === 'laravel') { | ||
// return getDefaultLaravelPlatformConfig( | ||
// projectPath, | ||
// userProvidedConfig, | ||
// debug | ||
// ); | ||
// } | ||
// if (platform === 'netcore') { | ||
// return await detectNetCorePlatformVersion( | ||
// projectPath, | ||
// userProvidedConfig, | ||
// debug | ||
// ); | ||
// } | ||
return userProvidedConfig; | ||
@@ -59,6 +67,6 @@ } | ||
} | ||
function getDefaultLaravelPlatformConfig(parojectPath, userProvidedConfig, debug) { | ||
function getDefaultLaravelPlatformConfig(projectPath, userProvidedConfig, debug) { | ||
const newConfig = { ...userProvidedConfig }; | ||
if (!userProvidedConfig.phpVersion) { | ||
const detectedPHPVersion = getRequiredPHPVersion(parojectPath, debug); | ||
const detectedPHPVersion = getRequiredPHPVersion(projectPath, debug); | ||
if (detectedPHPVersion) { | ||
@@ -70,3 +78,3 @@ newConfig.phpVersion = detectedPHPVersion; | ||
} | ||
function getRequiredPHPVersion(parojectPath, debug) { | ||
function getRequiredPHPVersion(projectPath, debug) { | ||
var _a, _b, _c; | ||
@@ -77,3 +85,3 @@ // semver forces us to use the full semver syntax, | ||
try { | ||
const composerJson = fs.readJSONSync(path.join(parojectPath, 'composer.json')); | ||
const composerJson = fs.readJSONSync(path.join(projectPath, 'composer.json')); | ||
if ((_b = (_a = composerJson === null || composerJson === void 0 ? void 0 : composerJson.config) === null || _a === void 0 ? void 0 : _a.platform) === null || _b === void 0 ? void 0 : _b.php) { | ||
@@ -80,0 +88,0 @@ const range = convertSinglePipeToDouble(composerJson.config.platform.php); |
{ | ||
"name": "@liara/cli", | ||
"description": "The command line interface for Liara", | ||
"version": "5.6.0", | ||
"version": "5.7.1-beta.1", | ||
"author": "Mhe <mhemrg120@gmail.com> (http://liara.ir/) @mhemrg", | ||
@@ -175,3 +175,4 @@ "type": "module", | ||
"readme": "oclif readme", | ||
"prepare": "husky install" | ||
"prepare": "husky install", | ||
"start": "nn" | ||
}, | ||
@@ -178,0 +179,0 @@ "husky": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
529864
212
12447
1
20