Skip to content

Commit 9ed9c40

Browse files
JeanMechepkozlowski-opensource
authored andcommitted
docs(docs-infra): remove non-necessary files from playground zip. (angular#59728)
fixes angular#56739 PR Close angular#59728
1 parent e98b0f1 commit 9ed9c40

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

adev/shared-docs/utils/filesystem.utils.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,23 @@ interface FileSystemAPI {
4141
export const checkFilesInDirectory = async (
4242
dir: string,
4343
fs: FileSystemAPI,
44-
filterFoldersPredicate: (path?: string) => boolean = () => true,
44+
filterFromRootPredicate: ((path: string) => boolean) | null,
4545
files: FileAndContent[] = [],
4646
) => {
4747
const entries = (await fs.readdir(dir, {withFileTypes: true})) ?? [];
4848

4949
for (const entry of entries) {
5050
const fullPath = normalizePath(`${dir}/${entry.name}`);
5151

52+
if (filterFromRootPredicate && !filterFromRootPredicate?.(entry.name)) {
53+
continue;
54+
}
55+
5256
if (entry.isFile()) {
5357
const content = await fs.readFile(fullPath, 'utf-8');
5458
files.push({content, path: fullPath});
55-
} else if (entry.isDirectory() && filterFoldersPredicate(entry.name)) {
56-
await checkFilesInDirectory(fullPath, fs, filterFoldersPredicate, files);
59+
} else if (entry.isDirectory()) {
60+
await checkFilesInDirectory(fullPath, fs, null, files);
5761
}
5862
}
5963

adev/src/app/editor/node-runtime-sandbox.service.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,20 @@ export class NodeRuntimeSandbox {
143143
async getSolutionFiles(): Promise<FileAndContent[]> {
144144
const webContainer = await this.webContainerPromise!;
145145

146-
const excludeFolders = ['node_modules', '.angular', 'dist'];
146+
const excludeFromRoot = [
147+
'node_modules',
148+
'.angular',
149+
'dist',
150+
'BUILD.bazel',
151+
'idx',
152+
'package.json.template',
153+
'config.json',
154+
];
147155

148156
return await checkFilesInDirectory(
149157
'',
150158
webContainer.fs,
151-
(path?: string) => !!path && !excludeFolders.includes(path),
159+
(path: string) => !excludeFromRoot.includes(path),
152160
);
153161
}
154162

0 commit comments

Comments
 (0)