@light-cloud/cli 0.1.2 → 0.1.3
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 +17 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1840,7 +1840,8 @@ async function uploadSource(ctx, directory, detection) {
|
|
|
1840
1840
|
hint: put.status === 403 ? "Deploy from a git repository meanwhile: lc deploy --repo <owner/name>." : "Try again in a moment."
|
|
1841
1841
|
});
|
|
1842
1842
|
}
|
|
1843
|
-
|
|
1843
|
+
spin.message("Inspecting source");
|
|
1844
|
+
const server = await ctx.api.completeUpload(org.id, session.uploadId, {
|
|
1844
1845
|
detectedFramework: detection.framework,
|
|
1845
1846
|
detectedRuntime: detection.runtime,
|
|
1846
1847
|
detectedDeploymentType: detection.deploymentType,
|
|
@@ -1848,7 +1849,11 @@ async function uploadSource(ctx, directory, detection) {
|
|
|
1848
1849
|
detectedOutputDirectory: detection.outputDirectory
|
|
1849
1850
|
});
|
|
1850
1851
|
spin.stop(`Uploaded ${pack.fileCount} files ${c.dim(`(${formatBytes(pack.buffer.length)})`)}`);
|
|
1851
|
-
|
|
1852
|
+
if (server.detectionSource === "server" && server.detectedFramework && server.detectedFramework !== detection.framework) {
|
|
1853
|
+
log.info(`Light Cloud read the source as ${server.detectedFramework} (${server.detectedDeploymentType}).`);
|
|
1854
|
+
}
|
|
1855
|
+
if (server.configWarning) log.warn(server.configWarning);
|
|
1856
|
+
return { uploadId: session.uploadId, fileCount: pack.fileCount, totalSize: pack.totalSize, archiveSize: pack.buffer.length, server };
|
|
1852
1857
|
}
|
|
1853
1858
|
function describeDetection(detection) {
|
|
1854
1859
|
const parts = [];
|
|
@@ -3789,6 +3794,15 @@ async function createApp(ctx, directory, options, extra = {}) {
|
|
|
3789
3794
|
const name = await pickName(options.name ?? path9.basename(directory), interactive);
|
|
3790
3795
|
const definition = framework ? getFrameworkById(framework) : void 0;
|
|
3791
3796
|
const upload = await uploadSource(ctx, directory, { ...detection, framework, deploymentType, buildCommand, outputDirectory });
|
|
3797
|
+
const server = upload.server.detectionSource === "server" ? upload.server : void 0;
|
|
3798
|
+
if (server) {
|
|
3799
|
+
framework = options.framework ?? server.detectedFramework ?? framework;
|
|
3800
|
+
deploymentType = options.type ?? server.detectedDeploymentType ?? deploymentType;
|
|
3801
|
+
buildCommand = options.build ?? server.detectedBuildCommand ?? buildCommand;
|
|
3802
|
+
outputDirectory = options.output ?? server.detectedOutputDirectory ?? outputDirectory;
|
|
3803
|
+
containerPort = options.port ? Number(options.port) : server.detectedContainerPort ?? containerPort;
|
|
3804
|
+
}
|
|
3805
|
+
const finalDefinition = framework ? getFrameworkById(framework) : definition;
|
|
3792
3806
|
const spinCreate = spinner2();
|
|
3793
3807
|
spinCreate.start(`Creating ${name}`);
|
|
3794
3808
|
const app = await ctx.api.createFromUpload({
|
|
@@ -3797,7 +3811,7 @@ async function createApp(ctx, directory, options, extra = {}) {
|
|
|
3797
3811
|
uploadId: upload.uploadId,
|
|
3798
3812
|
deploymentType,
|
|
3799
3813
|
framework: framework ?? (detection.hasDockerfile ? "custom" : void 0),
|
|
3800
|
-
runtime:
|
|
3814
|
+
runtime: server?.detectedRuntime ?? finalDefinition?.runtime ?? (detection.hasDockerfile ? "custom" : void 0),
|
|
3801
3815
|
buildCommand,
|
|
3802
3816
|
outputDirectory: deploymentType === "static" ? outputDirectory : void 0,
|
|
3803
3817
|
containerPort: deploymentType === "container" ? containerPort : void 0
|
package/package.json
CHANGED