Skip to content

Commit

Permalink
[feat] return list of copied files from copy utils (#2674)
Browse files Browse the repository at this point in the history
  • Loading branch information
pngwn authored Oct 25, 2021
1 parent ee16419 commit fa25813
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-jeans-cover.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ export function get_utils({ cwd, config, build_data, log }) {
copy,

copy_client_files(dest) {
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
Original file line number Diff line number Diff line change
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

0 comments on commit fa25813

Please sign in to comment.