From c53b1142e5aad3a4cd4a7c432c4dfc6998698dac Mon Sep 17 00:00:00 2001 From: Thomas Schaffter Date: Fri, 11 Oct 2024 14:14:45 +0000 Subject: [PATCH] remove old files --- .../plugins/build-project-configuration.ts | 2 +- .../src/plugins/plugin-configuration.ts | 10 +++---- .../nx-plugin/src/plugins/plugin-options.ts | 3 --- .../nx-plugin/src/plugins/plugin.ts | 12 ++++----- .../project-configuration-builder-options.ts | 4 +-- ...figuration.ts => project-configuration.ts} | 0 .../nx-plugin/src/plugins/project-type.ts | 11 -------- .../nx-plugin/src/plugins/project.ts | 26 ------------------- 8 files changed, 13 insertions(+), 55 deletions(-) delete mode 100644 libs/sage-monorepo/nx-plugin/src/plugins/plugin-options.ts rename libs/sage-monorepo/nx-plugin/src/plugins/{sage-monorepo-project-configuration.ts => project-configuration.ts} (100%) delete mode 100644 libs/sage-monorepo/nx-plugin/src/plugins/project-type.ts delete mode 100644 libs/sage-monorepo/nx-plugin/src/plugins/project.ts diff --git a/libs/sage-monorepo/nx-plugin/src/plugins/build-project-configuration.ts b/libs/sage-monorepo/nx-plugin/src/plugins/build-project-configuration.ts index 745823722..522e5106e 100644 --- a/libs/sage-monorepo/nx-plugin/src/plugins/build-project-configuration.ts +++ b/libs/sage-monorepo/nx-plugin/src/plugins/build-project-configuration.ts @@ -1,6 +1,6 @@ import { TargetConfiguration } from '@nx/devkit'; import { buildImageTarget } from './build-image-target'; -import { SageMonorepoProjectConfiguration } from './sage-monorepo-project-configuration'; +import { SageMonorepoProjectConfiguration } from './project-configuration'; import { ProjectConfigurationBuilderOptions } from './project-configuration-builder-options'; export async function buildProjectConfiguration( diff --git a/libs/sage-monorepo/nx-plugin/src/plugins/plugin-configuration.ts b/libs/sage-monorepo/nx-plugin/src/plugins/plugin-configuration.ts index b8af9391f..d109a2f9b 100644 --- a/libs/sage-monorepo/nx-plugin/src/plugins/plugin-configuration.ts +++ b/libs/sage-monorepo/nx-plugin/src/plugins/plugin-configuration.ts @@ -1,12 +1,12 @@ -import { PluginOptions } from './plugin-options'; - -export type PluginConfiguration = { - buildImageTargetName: string; +export type SageMonorepoPluginOptions = { + buildImageTargetName?: string; }; +export type SageMonorepoPluginConfiguration = Required; + export function createPluginConfiguration({ buildImageTargetName = 'build-image', -}: PluginOptions): PluginConfiguration { +}: SageMonorepoPluginOptions): SageMonorepoPluginConfiguration { return { buildImageTargetName, }; diff --git a/libs/sage-monorepo/nx-plugin/src/plugins/plugin-options.ts b/libs/sage-monorepo/nx-plugin/src/plugins/plugin-options.ts deleted file mode 100644 index 6bbbc8f3c..000000000 --- a/libs/sage-monorepo/nx-plugin/src/plugins/plugin-options.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type PluginOptions = { - buildImageTargetName?: string; -}; diff --git a/libs/sage-monorepo/nx-plugin/src/plugins/plugin.ts b/libs/sage-monorepo/nx-plugin/src/plugins/plugin.ts index 43917237e..94bea4242 100644 --- a/libs/sage-monorepo/nx-plugin/src/plugins/plugin.ts +++ b/libs/sage-monorepo/nx-plugin/src/plugins/plugin.ts @@ -14,13 +14,11 @@ import { calculateHashForCreateNodes } from '@nx/devkit/src/utils/calculate-hash import { dirname, join } from 'path'; import { existsSync, readdirSync } from 'fs'; import { getLockFileName } from '@nx/js'; -import { SageMonorepoProjectConfiguration } from './sage-monorepo-project-configuration'; -import { createPluginConfiguration } from './plugin-configuration'; -import { PluginOptions } from './plugin-options'; +import { SageMonorepoProjectConfiguration } from './project-configuration'; +import { createPluginConfiguration, SageMonorepoPluginOptions } from './plugin-configuration'; import { buildProjectConfiguration } from './build-project-configuration'; -import { inferProjectType } from './project-type'; import { ProjectConfigurationBuilderOptions } from './project-configuration-builder-options'; -import { inferProjectMetadata } from './project-metadata'; +import { inferProjectMetadata, inferProjectType } from './project-metadata'; function readProjectCOnfigurationsCache( cachePath: string, @@ -38,7 +36,7 @@ function writeProjectConfigurationsToCache( const projectFilePattern = '{apps,libs}/openchallenges/**/project.json'; -export const createNodesV2: CreateNodesV2 = [ +export const createNodesV2: CreateNodesV2 = [ projectFilePattern, async (configFilePaths, options, context) => { options ??= {}; @@ -64,7 +62,7 @@ export const createNodesV2: CreateNodesV2 = [ async function createNodesInternal( configFilePath: string, - options: PluginOptions | undefined, + options: SageMonorepoPluginOptions | undefined, context: CreateNodesContext, projectConfigurationsCache: Record, ) { diff --git a/libs/sage-monorepo/nx-plugin/src/plugins/project-configuration-builder-options.ts b/libs/sage-monorepo/nx-plugin/src/plugins/project-configuration-builder-options.ts index f0b49e7b5..394f688e9 100644 --- a/libs/sage-monorepo/nx-plugin/src/plugins/project-configuration-builder-options.ts +++ b/libs/sage-monorepo/nx-plugin/src/plugins/project-configuration-builder-options.ts @@ -1,10 +1,10 @@ -import { PluginConfiguration } from './plugin-configuration'; +import { SageMonorepoPluginConfiguration } from './plugin-configuration'; import { ProjectMetadata } from './project-metadata'; export type ProjectConfigurationBuilderOptions = { projectRoot: string; projectName: string; - pluginConfig: PluginConfiguration; + pluginConfig: SageMonorepoPluginConfiguration; projectMetadata: ProjectMetadata; dockerized?: boolean; }; diff --git a/libs/sage-monorepo/nx-plugin/src/plugins/sage-monorepo-project-configuration.ts b/libs/sage-monorepo/nx-plugin/src/plugins/project-configuration.ts similarity index 100% rename from libs/sage-monorepo/nx-plugin/src/plugins/sage-monorepo-project-configuration.ts rename to libs/sage-monorepo/nx-plugin/src/plugins/project-configuration.ts diff --git a/libs/sage-monorepo/nx-plugin/src/plugins/project-type.ts b/libs/sage-monorepo/nx-plugin/src/plugins/project-type.ts deleted file mode 100644 index 73fc1d48c..000000000 --- a/libs/sage-monorepo/nx-plugin/src/plugins/project-type.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ProjectType } from '@nx/devkit'; - -export function inferProjectType(projectRoot: string): ProjectType { - if (projectRoot.startsWith('apps/')) { - return 'application'; - } else if (projectRoot.startsWith('libs/')) { - return 'library'; - } - - throw new Error(`Unknown project type for project root: ${projectRoot}`); -} diff --git a/libs/sage-monorepo/nx-plugin/src/plugins/project.ts b/libs/sage-monorepo/nx-plugin/src/plugins/project.ts deleted file mode 100644 index 754e009f1..000000000 --- a/libs/sage-monorepo/nx-plugin/src/plugins/project.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ProjectType } from '@nx/devkit'; - -export type Builder = 'esbuild' | 'gradle' | 'poetry' | 'wheel'; -export type Linter = 'eslint' | 'pylint'; -export type TypeChecker = 'mypy' | 'pyright'; -export type TestingTool = 'pytest' | null; -export type Formatter = 'Black' | 'Prettier'; -export type ContainerType = 'Docker' | 'Singularity'; -export type Language = 'python' | 'typescript' | 'javascript'; -export type Framework = 'Flask' | 'React' | 'Angular' | 'Vue' | null; - -export type ProjectMetadata = { - projectType: ProjectType; - builder: Builder; - linter: Linter; - typeChecker: TypeChecker[]; - testing: { - unit: TestingTool; - integration: TestingTool; - e2e: TestingTool; - }; - formatter: Formatter; - containerType: ContainerType; - language: Language; - framework: Framework; -};