Skip to content

Commit

Permalink
CEM manifest config blobs and excludes
Browse files Browse the repository at this point in the history
  • Loading branch information
Matsuuu committed Nov 12, 2023
1 parent aa6ca7c commit 78eb002
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
15 changes: 10 additions & 5 deletions lib/custom-elements-languageserver-core/src/cem/analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ export async function analyzeLocalProject(basePath: string): Promise<AnalyzerOut
const projectConfig = await getPossibleProjectConfig(basePath);
const frameworkPlugins = await getFrameworkPlugins(projectConfig);
const globs = projectConfig.globs ?? [];
console.log("Project config: ", projectConfig);
const globExcludes = projectConfig.exclude ??
console.log("Project config: ", projectConfig);

Check warning on line 46 in lib/custom-elements-languageserver-core/src/cem/analyzer.ts

View workflow job for this annotation

GitHub Actions / Qodana for JS

Void function return value used

Void function return value is used

const plugins = [...(projectConfig?.plugins || []), ...frameworkPlugins]
const sourceFiles = await getFilesForGlobs(globs, basePath);
const sourceFiles = await getFilesForGlobs(globs, globExcludes, basePath);

console.log("Sourcefile count ", sourceFiles.length);

Expand All @@ -66,15 +67,19 @@ export async function analyzeLocalProject(basePath: string): Promise<AnalyzerOut
}
}

async function getFilesForGlobs(globs: string[], basePath: string) {
async function getFilesForGlobs(globs: string[], globExcludes: string[], basePath: string) {
let globsToUse = [...globs];
if (!globs || globs.length === 0) {
const pattern = `./**/*.(${FILE_TYPES_TO_MATCH.join("|")})`
globs = [pattern];
globsToUse = [pattern];
}

globsToUse = [...globsToUse, ...globExcludes.map(g => "!" + g)];

let filesForAnalyzer: string[] = [];
try {
filesForAnalyzer = await globby([...globs, "!node_modules"], {
console.log("Using globs ", globsToUse)
filesForAnalyzer = await globby([...globsToUse, "!node_modules"], {
gitignore: true,
cwd: basePath
});
Expand Down
15 changes: 3 additions & 12 deletions usage-testing-project/custom-elements-manifest.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
export default {
exclude: [],
// globs: ["./**/*.(js|ts|jsx)"],
exclude: ["node_modules", "html"],
dependencies: true,
dev: false,
packagejson: true,
litelement: true,
plugins: [

]
}

/*module.exports = {
exclude: [],
dependencies: true,
dev: false,
packagejson: true,
plugins: [
]
};*/
}

0 comments on commit 78eb002

Please sign in to comment.