Skip to content

Commit

Permalink
dynamically add the tag builder to projects
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaffter committed Oct 6, 2024
1 parent e8517a4 commit d32495d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@ export async function buildProjectConfiguration(

const metadata = {};
const tags: string[] = [];
console.log(`HELLO: ${options.projectBuilder}`);
if (options.projectBuilder) {
console.log(`BUILDER: ${options.projectBuilder}`);
tags.push(`builder:${options.projectBuilder}`);
}

return { targets, metadata, tags };
}
5 changes: 1 addition & 4 deletions libs/sage-monorepo/nx-sage-monorepo/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ async function createNodesInternal(
projectConfigurationsCache: Record<string, SageMonorepoProjectConfiguration>,
) {
const projectRoot = dirname(configFilePath);
// Do not create a project if project.json and Dockerfile isn't there.
const siblingFiles = readdirSync(join(context.workspaceRoot, projectRoot));
if (!siblingFiles.includes('project.json') && !siblingFiles.includes('Dockerfile')) {
return {};
}

// Content of the project file
const projectFileContent: ProjectConfiguration = readJsonFile(configFilePath);
Expand Down Expand Up @@ -101,6 +97,7 @@ async function createNodesInternal(
const projectConfigurationBuilderOptions: ProjectConfigurationBuilderOptions = {
projectRoot,
pluginConfig,
projectBuilder,
};
projectConfigurationsCache[hash] ??= await buildProjectConfiguration(
projectConfigurationBuilderOptions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { PluginConfiguration } from './plugin-configuration';
import { ProjectBuilder } from './project-builder';

export type ProjectConfigurationBuilderOptions = {
projectRoot: string;
pluginConfig: PluginConfiguration;
projectBuilder?: ProjectBuilder;
};

0 comments on commit d32495d

Please sign in to comment.