chore: remove unused codeGenGlobs (#21438)

This commit is contained in:
Zachary Williams
2022-05-12 17:45:25 -05:00
committed by GitHub
parent 07478cb7a6
commit df3ca1524d
11 changed files with 0 additions and 98 deletions

View File

@@ -14,11 +14,6 @@ describe('<CreateSpecModal />', () => {
gql={{
currentProject: {
id: 'id',
codeGenGlobs: {
id: 'super-unique-id',
__typename: 'CodeGenGlobs',
component: '**.vue',
},
currentTestingType: 'component',
configFile: 'cypress.config.js',
configFileAbsolutePath: '/path/to/cypress.config.js',
@@ -79,11 +74,6 @@ describe('playground', () => {
gql={{
currentProject: {
id: 'id',
codeGenGlobs: {
id: 'super-unique-id',
__typename: 'CodeGenGlobs',
component: '**.vue',
},
currentTestingType: 'component',
configFile: 'cypress.config.js',
configFileAbsolutePath: '/path/to/cypress.config.js',

View File

@@ -20,7 +20,6 @@
v-if="generator"
:key="`${generator.id}-${iteration}`"
v-model:title="title"
:code-gen-glob="codeGenGlob"
:gql="props.gql.currentProject"
:type="props.gql.currentProject?.currentTestingType"
:spec-file-name="specFileName"
@@ -78,10 +77,6 @@ fragment CreateSpecModal on Query {
id
fileExtensionToUse
defaultSpecFileName
codeGenGlobs {
id
component
}
...EmptyGenerator
}
}
@@ -114,14 +109,6 @@ const specFileName = computed(() => {
return getPathForPlatform(fileName)
})
const codeGenGlob = computed(() => {
if (!generator.value) {
return null
}
return props.gql.currentProject?.codeGenGlobs[generator.value.id]
})
const filteredGenerators = getFilteredGeneratorList(props.gql.currentProject?.currentTestingType)
const singleGenerator = computed(() => filteredGenerators.value.length === 1 ? filteredGenerators.value[0] : null)

View File

@@ -23,7 +23,6 @@
"@urql/exchange-graphcache": "4.3.6",
"chokidar": "3.5.1",
"common-path-prefix": "3.0.0",
"create-cypress-tests": "0.0.0-development",
"cross-fetch": "^3.1.4",
"dataloader": "^2.0.0",
"dayjs": "^1.9.3",

View File

@@ -1,8 +1,6 @@
import os from 'os'
import chokidar from 'chokidar'
import type { ResolvedFromConfig, RESOLVED_FROM, FoundSpec, TestingType } from '@packages/types'
import { WIZARD_FRAMEWORKS } from '@packages/scaffold-config'
import { scanFSForAvailableDependency } from 'create-cypress-tests'
import minimatch from 'minimatch'
import { debounce, isEqual } from 'lodash'
import path from 'path'
@@ -365,31 +363,6 @@ export class ProjectDataSource {
return preferences[projectTitle] ?? null
}
private guessFramework (projectRoot: string) {
const guess = WIZARD_FRAMEWORKS.find((framework) => {
const lookingForDeps = framework.detectors.map((x) => x.package).reduce(
(acc, dep) => ({ ...acc, [dep]: '*' }),
{},
)
return scanFSForAvailableDependency(projectRoot, lookingForDeps)
})
return guess ?? null
}
async getCodeGenGlobs () {
assert(this.ctx.currentProject, `Cannot find glob without currentProject.`)
const looseComponentGlob = '*.{js,jsx,ts,tsx,.vue}'
const framework = this.guessFramework(this.ctx.currentProject)
return {
component: framework?.glob ?? looseComponentGlob,
}
}
async getResolvedConfigFields (): Promise<ResolvedFromConfig[]> {
const config = this.ctx.lifecycleManager.loadedFullConfig?.resolved ?? {}

View File

@@ -1,10 +1,8 @@
import { parse } from '@babel/parser'
import { WIZARD_FRAMEWORKS } from '@packages/scaffold-config'
import { expect } from 'chai'
import dedent from 'dedent'
import fs from 'fs-extra'
import path from 'path'
import sinon from 'sinon'
import { DataContext } from '../../../src'
import {
Action, codeGenerator, CodeGenResult, CodeGenResults,
@@ -221,9 +219,6 @@ describe('code-generator', () => {
target,
}
// @ts-ignore
sinon.stub(ctx.project, 'guessFramework').returns(WIZARD_FRAMEWORKS[0])
const newSpecCodeGenOptions = new SpecOptions(ctx, {
codeGenPath: path.join(__dirname, 'files', 'react', 'Button.jsx'),
codeGenType: 'component',
@@ -244,9 +239,6 @@ describe('code-generator', () => {
target,
}
// @ts-ignore
sinon.stub(ctx.project, 'guessFramework').returns(WIZARD_FRAMEWORKS[1])
const newSpecCodeGenOptions = new SpecOptions(ctx, {
codeGenPath: path.join(__dirname, 'files', 'vue', 'Button.vue'),
codeGenType: 'component',

View File

@@ -43,11 +43,6 @@ export const createTestCurrentProject = (title: string, currentProject: Partial<
],
config,
cloudProject: CloudProjectStubs.componentProject,
codeGenGlobs: {
id: 'super-unique-id',
__typename: 'CodeGenGlobs',
component: '**/*.vue',
},
activeBrowser: stubBrowsers[0],
browsers: stubBrowsers,
isDefaultSpecPattern: true,

View File

@@ -357,14 +357,6 @@ type CodeFrame {
line: Int
}
"""Glob patterns for detecting files for code gen."""
type CodeGenGlobs implements Node {
component: String!
"""Relay style Node ID field for the CodeGenGlobs field"""
id: ID!
}
enum CodeGenType {
component
e2e
@@ -397,7 +389,6 @@ type CurrentProject implements Node & ProjectLike {
"""List of all code generation candidates stories"""
codeGenCandidates(glob: String!): [FileParts]
codeGenGlobs: CodeGenGlobs!
"""Project configuration"""
config: JSON!

View File

@@ -1,10 +0,0 @@
import { objectType } from 'nexus'
export const CodeGenGlobs = objectType({
name: 'CodeGenGlobs',
description: 'Glob patterns for detecting files for code gen.',
node: 'component',
definition (t) {
t.nonNull.string('component')
},
})

View File

@@ -4,7 +4,6 @@ import path from 'path'
import { BrowserStatusEnum, FileExtensionEnum } from '..'
import { TestingTypeEnum } from '../enumTypes/gql-WizardEnums'
import { Browser } from './gql-Browser'
import { CodeGenGlobs } from './gql-CodeGenGlobs'
import { FileParts } from './gql-FileParts'
import { ProjectPreferences } from './gql-ProjectPreferences'
import { Spec } from './gql-Spec'
@@ -194,11 +193,6 @@ export const CurrentProject = objectType({
},
})
t.nonNull.field('codeGenGlobs', {
type: CodeGenGlobs,
resolve: (src, args, ctx) => ctx.project.getCodeGenGlobs(),
})
t.list.field('codeGenCandidates', {
type: FileParts,
description: 'List of all code generation candidates stories',

View File

@@ -5,7 +5,6 @@ export * from './gql-AuthState'
export * from './gql-Browser'
export * from './gql-CachedUser'
export * from './gql-CodeFrame'
export * from './gql-CodeGenGlobs'
export * from './gql-CurrentProject'
export * from './gql-DevState'
export * from './gql-Editor'

View File

@@ -73,7 +73,6 @@ export const WIZARD_FRAMEWORKS = [
]
},
codeGenFramework: 'react',
glob: '*.{js,jsx,tsx}',
mountModule: 'cypress/react',
supportStatus: 'full',
componentIndexHtml: componentIndexHtmlGenerator(),
@@ -93,7 +92,6 @@ export const WIZARD_FRAMEWORKS = [
]
},
codeGenFramework: 'vue',
glob: '*.vue',
mountModule: 'cypress/vue2',
supportStatus: 'full',
componentIndexHtml: componentIndexHtmlGenerator(),
@@ -113,7 +111,6 @@ export const WIZARD_FRAMEWORKS = [
]
},
codeGenFramework: 'vue',
glob: '*.vue',
mountModule: 'cypress/vue',
supportStatus: 'full',
componentIndexHtml: componentIndexHtmlGenerator(),
@@ -132,7 +129,6 @@ export const WIZARD_FRAMEWORKS = [
]
},
codeGenFramework: 'react',
glob: '*.{js,jsx,tsx}',
mountModule: 'cypress/react',
supportStatus: 'alpha',
componentIndexHtml: componentIndexHtmlGenerator('<div id="__next_css__DO_NOT_USE__"></div>'),
@@ -151,7 +147,6 @@ export const WIZARD_FRAMEWORKS = [
]
},
codeGenFramework: 'vue',
glob: '*.vue',
mountModule: 'cypress/vue2',
supportStatus: 'alpha',
componentIndexHtml: componentIndexHtmlGenerator(),
@@ -170,7 +165,6 @@ export const WIZARD_FRAMEWORKS = [
]
},
codeGenFramework: 'vue',
glob: '*.vue',
mountModule: 'cypress/vue2',
supportStatus: 'full',
componentIndexHtml: componentIndexHtmlGenerator(),
@@ -189,7 +183,6 @@ export const WIZARD_FRAMEWORKS = [
]
},
codeGenFramework: 'vue',
glob: '*.vue',
mountModule: 'cypress/vue',
supportStatus: 'full',
componentIndexHtml: componentIndexHtmlGenerator(),
@@ -208,7 +201,6 @@ export const WIZARD_FRAMEWORKS = [
]
},
codeGenFramework: 'react',
glob: '*.{js,jsx,tsx}',
mountModule: 'cypress/react',
supportStatus: 'full',
componentIndexHtml: componentIndexHtmlGenerator(),