Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 57 additions & 2 deletions packages/build-info/src/frameworks/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,61 @@ import { Environment } from '../file-system.js'
import { getBuildCommands, getDevCommands } from '../get-commands.js'
import { Project } from '../project.js'

export type FrameworkId =
| 'analog'
| 'angular'
| 'assemble'
| 'astro'
| 'blitz'
| 'brunch'
| 'cecil'
| 'create-react-app'
| 'docpad'
| 'docusaurus'
| 'eleventy'
| 'ember'
| 'expo'
| 'gatsby'
| 'gridsome'
| 'grunt'
| 'gulp'
| 'harp'
| 'hexo'
| 'hono'
| 'hugo'
| 'hydrogen'
| 'jekyll'
| 'metalsmith'
| 'middleman'
| 'next'
| 'nuxt'
| 'observable'
| 'parcel'
| 'phenomic'
| 'quasar'
| 'qwik'
| 'react-router'
| 'react-static'
| 'redwoodjs'
| 'remix'
| 'roots'
| 'sapper'
| 'solid-js'
| 'solid-start'
| 'stencil'
| 'svelte'
| 'svelte-kit'
| 'tanstack-router'
| 'tanstack-start'
| 'vike'
| 'vite'
| 'vue'
| 'vuepress'
| 'waku'
| 'wintersmith'
| 'wmr'
| 'zola'

export enum Category {
BackendFramework = 'backend_framework',
FrontendFramework = 'frontend_framework',
Expand Down Expand Up @@ -56,7 +111,7 @@ export type FrameworkInfo = ReturnType<Framework['toJSON']>
export interface Framework {
project: Project

id: string
id: FrameworkId
name: string
category: Category
/**
Expand Down Expand Up @@ -178,7 +233,7 @@ export function mergeDetections(detections: (Detection | undefined)[]): Detectio
}

export abstract class BaseFramework implements Framework {
id: string
id: FrameworkId
name: string
category: Category
detected?: Detection
Expand Down
6 changes: 3 additions & 3 deletions packages/build-info/src/frameworks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Docusaurus } from './docusaurus.js'
import { Eleventy } from './eleventy.js'
import { Ember } from './ember.js'
import { Expo } from './expo.js'
import { FrameworkId } from './framework.js'
import { Gatsby } from './gatsby.js'
import { Gridsome } from './gridsome.js'
import { Grunt } from './grunt.js'
Expand Down Expand Up @@ -115,7 +116,6 @@ export const frameworks = [
WMR,
]

type Frameworks = typeof frameworks
// To get a list of the names it's required that ALL Frameworks have the id property as `readonly`
export type FrameworkName = InstanceType<Frameworks[number]>['id']
// TODO: see if the FrameworkName type can be removed
export type FrameworkName = FrameworkId
export type { FrameworkInfo, PollingStrategy } from './framework.js'
1 change: 1 addition & 0 deletions packages/build-info/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type {
DetectedFramework,
FrameworkInfo,
PollingStrategy,
FrameworkId,
VersionAccuracy,
} from './frameworks/framework.js'
export * from './get-framework.js'
Expand Down
4 changes: 2 additions & 2 deletions packages/build-info/src/settings/get-build-settings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Framework } from '../frameworks/framework.js'
import { FrameworkId, type Framework } from '../frameworks/framework.js'
import { type Project } from '../project.js'

export type Settings = {
Expand All @@ -12,7 +12,7 @@ export type Settings = {
frameworkPort?: number
/** the detected framework */
framework: {
id: string
id: FrameworkId
name: string
}
buildSystem?: {
Expand Down
Loading