Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] return list of copied files from copy utils #2674

Merged
merged 7 commits into from Oct 25, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/brown-jeans-cover.md
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

Return the copied files from the adapter's copy\_ utils.
6 changes: 3 additions & 3 deletions packages/kit/src/core/adapt/utils.js
Expand Up @@ -19,15 +19,15 @@ export function get_utils({ cwd, config, build_data, log }) {
copy,

copy_client_files(dest) {
benmccann marked this conversation as resolved.
Show resolved Hide resolved
copy(`${cwd}/${SVELTE_KIT}/output/client`, dest, (file) => file[0] !== '.');
return copy(`${cwd}/${SVELTE_KIT}/output/client`, dest, (file) => file[0] !== '.');
},

copy_server_files(dest) {
copy(`${cwd}/${SVELTE_KIT}/output/server`, dest, (file) => file[0] !== '.');
return copy(`${cwd}/${SVELTE_KIT}/output/server`, dest, (file) => file[0] !== '.');
},

copy_static_files(dest) {
copy(config.kit.files.assets, dest);
return copy(config.kit.files.assets, dest);
},

async prerender({ all = false, dest, fallback }) {
Expand Down
25 changes: 21 additions & 4 deletions packages/kit/types/config.d.ts
Expand Up @@ -6,10 +6,27 @@ export interface AdapterUtils {
log: Logger;
rimraf(dir: string): void;
mkdirp(dir: string): void;
copy_client_files(dest: string): void;
copy_server_files(dest: string): void;
copy_static_files(dest: string): void;
copy(from: string, to: string, filter?: (basename: string) => boolean): void;
/**
* @param dest the destination folder to which files should be copied
* @returns an array of paths corresponding to the files that have been created by the copy
*/
copy_client_files(dest: string): string[];
/**
* @param dest the destination folder to which files should be copied
* @returns an array of paths corresponding to the files that have been created by the copy
*/
copy_server_files(dest: string): string[];
/**
* @param dest the destination folder to which files should be copied
* @returns an array of paths corresponding to the files that have been created by the copy
*/
copy_static_files(dest: string): string[];
/**
* @param from the source folder from which files should be copied
* @param to the destination folder to which files should be copied
* @returns an array of paths corresponding to the files that have been created by the copy
*/
copy(from: string, to: string, filter?: (basename: string) => boolean): string[];
prerender(options: { all?: boolean; dest: string; fallback?: string }): Promise<void>;
}

Expand Down