Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion news/changelog-1.8.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
All changes included in 1.8:
# v1.9 backports

## In this release

- ([#13396](https://github.com/quarto-dev/quarto-cli/issues/13396)): Fix `quarto publish connect` regression.

# v1.8 changes

## Regression fixes

Expand Down
23 changes: 17 additions & 6 deletions src/deno_ral/tar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,47 @@
* Abstraction layer over Deno's `tar` utilities.
*/

import { TarStream, type TarStreamInput } from "jsr:@std/tar/tar-stream";
import { TarStream, type TarStreamInput } from "tar/tar-stream";
import { join } from "../deno_ral/path.ts";
import { pathWithForwardSlashes } from "../core/path.ts";

/**
* Creates a tar archive from the specified files and directories.
* @param outputPath The path where the tar archive will be created.
* @param filePaths An array of file and directory paths to include in the tar archive. Paths are relative to outputPath.
* @param filePaths An array of file and directory paths to include in the tar archive.
* @param options Optional configuration for tar creation.
* @param options.baseDir Base directory for resolving relative paths in the archive.
* @returns A promise that resolves when the tar archive is created.
*/
export async function createTarFromFiles(
outputPath: string,
filePaths: string[],
options?: { baseDir?: string },
) {
const baseDir = options?.baseDir;

// Create array of TarStreamInput objects from file paths
const inputs: TarStreamInput[] = await Promise.all(
filePaths.map(async (path) => {
const stat = await Deno.stat(path);
const fullPath = baseDir ? join(baseDir, path) : path;
const stat = await Deno.stat(fullPath);

// Use original path for archive, full path for reading
const archivePath = pathWithForwardSlashes(path);

if (stat.isDirectory) {
// Handle directory
return {
type: "directory",
path: path + (path.endsWith("/") ? "" : "/"),
path: archivePath + (archivePath.endsWith("/") ? "" : "/"),
};
} else {
// Handle file
return {
type: "file",
path: path,
path: archivePath,
size: stat.size,
readable: (await Deno.open(path)).readable,
readable: (await Deno.open(fullPath)).readable,
};
}
}),
Expand Down
5 changes: 1 addition & 4 deletions src/publish/common/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import { ensureDirSync } from "../../deno_ral/fs.ts";
import { PublishFiles } from "../provider-types.ts";
import { TempContext } from "../../core/temp-types.ts";
import { md5HashBytes } from "../../core/hash.ts";
import { pathWithForwardSlashes } from "../../core/path.ts";

import { copy } from "io/copy";
import { TarStream, type TarStreamInput } from "tar/tar-stream";
import { createTarFromFiles } from "../../deno_ral/tar.ts";

interface ManifestMetadata {
Expand Down Expand Up @@ -110,7 +107,7 @@ export async function createBundle(
// await copy(tar.getReader(), writer);
// writer.close();

await createTarFromFiles(tarFile, tarFiles);
await createTarFromFiles(tarFile, tarFiles, { baseDir: stageDir });

// compress to tar.gz
const targzFile = `${tarFile}.gz`;
Expand Down
Loading