mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 12:51:55 +00:00
web: drop legacy GraphQL schema generator (#45945)
This commit is contained in:
parent
ac60779abf
commit
79917a7e98
@ -1,9 +1,9 @@
|
||||
# Input hashes for repository rule npm_translate_lock(name = "npm", pnpm_lock = "//:pnpm-lock.yaml").
|
||||
# This file should be checked into version control along with the pnpm-lock.yaml file.
|
||||
.npmrc=2146577291
|
||||
pnpm-lock.yaml=-1835484148
|
||||
yarn.lock=189145180
|
||||
package.json=44218985
|
||||
pnpm-lock.yaml=2077318041
|
||||
yarn.lock=35066893
|
||||
package.json=168647617
|
||||
client/branded/package.json=784076174
|
||||
client/browser/package.json=-2024393090
|
||||
client/build-config/package.json=-745736751
|
||||
@ -19,7 +19,7 @@ client/observability-client/package.json=-463261822
|
||||
client/observability-server/package.json=1984976913
|
||||
client/search-ui/package.json=-602996280
|
||||
client/search/package.json=-467983686
|
||||
client/shared/package.json=426064482
|
||||
client/shared/package.json=1160771529
|
||||
client/storybook/package.json=-1924844575
|
||||
client/template-parser/package.json=-867948495
|
||||
client/web/package.json=-1637464847
|
||||
@ -27,3 +27,4 @@ client/wildcard/package.json=362918481
|
||||
client/vscode/package.json=1345248728
|
||||
dev/release/package.json=1426426960
|
||||
pnpm-workspace.yaml=-1949047588
|
||||
client/testing/package.json=366497236
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -111,7 +111,6 @@ package-lock.json
|
||||
.nyc_output/
|
||||
coverage/
|
||||
out/
|
||||
client/shared/src/schema.ts
|
||||
client/shared/src/schema/*.d.ts
|
||||
puppeteer/
|
||||
package-lock.json
|
||||
|
||||
@ -16,7 +16,6 @@ vendor/
|
||||
.nyc_output/
|
||||
out/
|
||||
dist/
|
||||
client/shared/src/graphqlschema.ts
|
||||
client/shared/src/schema/*.d.ts
|
||||
ts-node-*
|
||||
testdata
|
||||
|
||||
@ -1,3 +1,2 @@
|
||||
# TODO(bazel): remove when no longer generated into src
|
||||
src/schema.ts
|
||||
src/graphql-operations.ts
|
||||
|
||||
@ -1,3 +1,2 @@
|
||||
out/
|
||||
src/schema.ts
|
||||
src/graphql-operations.ts
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
# TODO(bazel): remove when no longer generated into src
|
||||
src/schema.ts
|
||||
src/graphql/schema.ts
|
||||
src/graphql-operations.ts
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
out/
|
||||
src/schema/*
|
||||
src/schema.ts
|
||||
src/graphql/schema.ts
|
||||
src/graphql-operations.ts
|
||||
src/polyfills/vendor/*
|
||||
|
||||
@ -27,7 +27,6 @@ js_library(
|
||||
],
|
||||
[
|
||||
"src/testing/**/*.*",
|
||||
"src/schema.ts",
|
||||
# TODO: Ignore legacy build generated file as it conflicts with the Bazel
|
||||
# build. This can be removed after the migration.
|
||||
"src/graphql-operations.ts",
|
||||
@ -36,16 +35,6 @@ js_library(
|
||||
visibility = ["//client/shared:__pkg__"],
|
||||
)
|
||||
|
||||
js_run_binary(
|
||||
name = "graphql_schema",
|
||||
outs = ["src/schema.ts"],
|
||||
args = [
|
||||
"src/schema.ts",
|
||||
],
|
||||
chdir = package_name(),
|
||||
tool = "//client/shared/dev:generate_graphql_schema",
|
||||
)
|
||||
|
||||
[generate_schema(
|
||||
name = name,
|
||||
out = "src/schema/%s.schema.d.ts" % name,
|
||||
|
||||
@ -12,22 +12,6 @@ js_binary(
|
||||
|
||||
# gazelle:exclude .
|
||||
|
||||
js_binary(
|
||||
name = "generate_graphql_schema",
|
||||
data = [
|
||||
"//:node_modules/@gql2ts/from-schema",
|
||||
"//:node_modules/@gql2ts/language-typescript",
|
||||
"//:node_modules/glob",
|
||||
"//:node_modules/graphql",
|
||||
"//:node_modules/mz",
|
||||
"//:node_modules/prettier",
|
||||
"//:prettier_config_js",
|
||||
"//cmd/frontend/graphqlbackend:graphql_schema",
|
||||
],
|
||||
entry_point = "generateGraphQlSchema.js",
|
||||
visibility = ["//client/shared:__pkg__"],
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = "extract_graphql_operation_codegen_plugin",
|
||||
srcs = [
|
||||
|
||||
@ -14,11 +14,7 @@ const VSCODE_FOLDER = path.resolve(ROOT_FOLDER, './client/vscode')
|
||||
const JETBRAINS_FOLDER = path.resolve(ROOT_FOLDER, './client/jetbrains')
|
||||
const SCHEMA_PATH = path.join(ROOT_FOLDER, './cmd/frontend/graphqlbackend/*.graphql')
|
||||
|
||||
const SHARED_DOCUMENTS_GLOB = [
|
||||
`${SHARED_FOLDER}/src/**/*.{ts,tsx}`,
|
||||
`!${SHARED_FOLDER}/src/testing/**/*.*`,
|
||||
`!${SHARED_FOLDER}/src/schema.ts`,
|
||||
]
|
||||
const SHARED_DOCUMENTS_GLOB = [`${SHARED_FOLDER}/src/**/*.{ts,tsx}`]
|
||||
|
||||
const WEB_DOCUMENTS_GLOB = [
|
||||
`${WEB_FOLDER}/src/**/*.{ts,tsx}`,
|
||||
|
||||
@ -1,82 +0,0 @@
|
||||
/**
|
||||
* Generates the TypeScript types for the GraphQL schema.
|
||||
* These are used by older code, new code should rely on the new query-specific generated types.
|
||||
*
|
||||
* Usage: <outputFile>
|
||||
* - outputFile - filename to write types to
|
||||
*/
|
||||
const path = require('path')
|
||||
|
||||
const { generateNamespace } = require('@gql2ts/from-schema')
|
||||
const { DEFAULT_OPTIONS, DEFAULT_TYPE_MAP } = require('@gql2ts/language-typescript')
|
||||
const glob = require('glob')
|
||||
const { buildSchema, introspectionFromSchema } = require('graphql')
|
||||
const { mkdir, readFile, writeFile } = require('mz/fs')
|
||||
const { format, resolveConfig } = require('prettier')
|
||||
|
||||
const GRAPHQL_SCHEMA_GLOB = path.join(__dirname, '../../../cmd/frontend/graphqlbackend/*.graphql')
|
||||
|
||||
async function main(args) {
|
||||
if (args.length !== 1) {
|
||||
throw new Error('Usage: <outputFile>')
|
||||
}
|
||||
|
||||
const outputFile = args[0]
|
||||
await graphQlSchema(outputFile)
|
||||
}
|
||||
|
||||
async function graphQlSchema(outputFile) {
|
||||
const schemaFiles = glob.sync(GRAPHQL_SCHEMA_GLOB)
|
||||
let combinedSchema = ''
|
||||
for (const schemaPath of schemaFiles) {
|
||||
const schemaString = await readFile(schemaPath, 'utf8')
|
||||
combinedSchema += `\n${schemaString}`
|
||||
}
|
||||
const schema = buildSchema(combinedSchema)
|
||||
|
||||
const result = introspectionFromSchema(schema)
|
||||
|
||||
const formatOptions = await resolveConfig(__dirname, { config: __dirname + '/../../../prettier.config.js' })
|
||||
const typings =
|
||||
'export type ID = string\n' +
|
||||
'export type GitObjectID = string\n' +
|
||||
'export type DateTime = string\n' +
|
||||
'export type JSONCString = string\n' +
|
||||
'\n' +
|
||||
generateNamespace(
|
||||
'',
|
||||
result,
|
||||
{
|
||||
typeMap: {
|
||||
...DEFAULT_TYPE_MAP,
|
||||
ID: 'ID',
|
||||
GitObjectID: 'GitObjectID',
|
||||
DateTime: 'DateTime',
|
||||
JSONCString: 'JSONCString',
|
||||
},
|
||||
},
|
||||
{
|
||||
generateNamespace: (name, interfaces) => interfaces,
|
||||
interfaceBuilder: (name, body) => `export ${DEFAULT_OPTIONS.interfaceBuilder(name, body)}`,
|
||||
enumTypeBuilder: (name, values) =>
|
||||
`export ${DEFAULT_OPTIONS.enumTypeBuilder(name, values).replace(/^const enum/, 'enum')}`,
|
||||
typeBuilder: (name, body) => `export ${DEFAULT_OPTIONS.typeBuilder(name, body)}`,
|
||||
wrapList: type => `${type}[]`,
|
||||
postProcessor: code => format(code, { ...formatOptions, parser: 'typescript' }),
|
||||
}
|
||||
)
|
||||
await mkdir(path.dirname(outputFile), { recursive: true })
|
||||
await writeFile(outputFile, typings)
|
||||
}
|
||||
|
||||
// Entry point used by Bazel binary
|
||||
if (require.main === module) {
|
||||
main(process.argv.slice(2)).catch(error => {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
graphQlSchema,
|
||||
}
|
||||
@ -7,30 +7,8 @@ const { readFile } = require('mz/fs')
|
||||
|
||||
const { cssModulesTypings, watchCSSModulesTypings } = require('./dev/generateCssModulesTypes')
|
||||
const { generateGraphQlOperations, ALL_DOCUMENTS_GLOB } = require('./dev/generateGraphQlOperations')
|
||||
const { graphQlSchema: _graphQlSchema } = require('./dev/generateGraphQlSchema')
|
||||
const { generateSchema } = require('./dev/generateSchema')
|
||||
|
||||
const GRAPHQL_SCHEMA_GLOB = path.join(__dirname, '../../cmd/frontend/graphqlbackend/*.graphql')
|
||||
|
||||
/**
|
||||
* Generates the TypeScript types for the GraphQL schema.
|
||||
* These are used by older code, new code should rely on the new query-specific generated types.
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function graphQlSchema() {
|
||||
await _graphQlSchema(__dirname + '/src/schema.ts')
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the legacy graphql.ts types on file changes.
|
||||
*/
|
||||
async function watchGraphQlSchema() {
|
||||
await new Promise((resolve, reject) => {
|
||||
gulp.watch(GRAPHQL_SCHEMA_GLOB, graphQlSchema).on('error', reject)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether to regenerate GraphQL operations based on the given
|
||||
* Chokidar event. If we can determine that the file being modified is a
|
||||
@ -99,16 +77,6 @@ async function graphQlOperations() {
|
||||
await generateGraphQlOperations()
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow json-schema-ref-parser to resolve the v7 draft of JSON Schema
|
||||
* using a local copy of the spec, enabling developers to run/develop Sourcegraph offline
|
||||
*/
|
||||
const draftV7resolver = {
|
||||
order: 1,
|
||||
read: () => readFile(path.join(__dirname, '../../schema/json-schema-draft-07.schema.json')),
|
||||
canRead: file => file.url === 'http://json-schema.org/draft-07/schema',
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the TypeScript types for the JSON schemas.
|
||||
*
|
||||
@ -129,8 +97,6 @@ function watchSchema() {
|
||||
module.exports = {
|
||||
watchSchema,
|
||||
schema,
|
||||
graphQlSchema,
|
||||
watchGraphQlSchema,
|
||||
graphQlOperations,
|
||||
watchGraphQlOperations,
|
||||
cssModulesTypings,
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
"lint:js": "yarn run -T eslint --cache '**/*.[jt]s?(x)'",
|
||||
"lint:css": "yarn run -T stylelint 'src/**/*.scss' --quiet",
|
||||
"test": "yarn run -T jest",
|
||||
"graphql": "yarn run -T gulp graphQlSchema",
|
||||
"schema": "yarn run -T gulp schema",
|
||||
"graphql-operations": "yarn run -T gulp graphQlOperations",
|
||||
"watch-schema": "yarn run -T gulp watchSchema"
|
||||
|
||||
@ -4,9 +4,8 @@ import { map } from 'rxjs/operators'
|
||||
import { createAggregateError, memoizeObservable } from '@sourcegraph/common'
|
||||
import { dataOrThrowErrors, gql } from '@sourcegraph/http-client'
|
||||
|
||||
import { TreeEntriesResult, TreeFields } from '../graphql-operations'
|
||||
import { ResolveRawRepoNameResult, TreeEntriesResult, TreeFields } from '../graphql-operations'
|
||||
import { PlatformContext } from '../platform/context'
|
||||
import * as GQL from '../schema'
|
||||
import { AbsoluteRepoFile, makeRepoURI, RepoSpec } from '../util/url'
|
||||
|
||||
import { CloneInProgressError, RepoNotFoundError } from './errors'
|
||||
@ -20,7 +19,7 @@ export const resolveRawRepoName = memoizeObservable(
|
||||
repoName,
|
||||
}: Pick<RepoSpec, 'repoName'> & Pick<PlatformContext, 'requestGraphQL'>): Observable<string> =>
|
||||
from(
|
||||
requestGraphQL<GQL.IQuery>({
|
||||
requestGraphQL<ResolveRawRepoNameResult>({
|
||||
request: gql`
|
||||
query ResolveRawRepoName($repoName: String!) {
|
||||
repository(name: $repoName) {
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { fetchEventSource } from '@microsoft/fetch-event-source'
|
||||
/* eslint-disable id-length */
|
||||
import { Observable, fromEvent, Subscription, OperatorFunction, pipe, Subscriber, Notification } from 'rxjs'
|
||||
import { defaultIfEmpty, map, materialize, scan, switchMap } from 'rxjs/operators'
|
||||
import { AggregableBadge } from 'sourcegraph'
|
||||
@ -7,8 +6,7 @@ import { AggregableBadge } from 'sourcegraph'
|
||||
import { asError, ErrorLike, isErrorLike } from '@sourcegraph/common'
|
||||
import { SearchMode } from '@sourcegraph/search'
|
||||
|
||||
import { SearchPatternType } from '../graphql-operations'
|
||||
import { SymbolKind } from '../schema'
|
||||
import { SearchPatternType, SymbolKind } from '../graphql-operations'
|
||||
|
||||
// The latest supported version of our search syntax. Users should never be able to determine the search version.
|
||||
// The version is set based on the release tag of the instance.
|
||||
@ -485,10 +483,10 @@ function initiateSearchStream(
|
||||
if (trace) {
|
||||
parameters.push(['trace', trace])
|
||||
}
|
||||
for (const v of featureOverrides || []) {
|
||||
parameters.push(['feat', v])
|
||||
for (const value of featureOverrides || []) {
|
||||
parameters.push(['feat', value])
|
||||
}
|
||||
const parameterEncoded = parameters.map(([k, v]) => k + '=' + encodeURIComponent(v)).join('&')
|
||||
const parameterEncoded = parameters.map(([key, value]) => key + '=' + encodeURIComponent(value)).join('&')
|
||||
|
||||
const eventSource = new EventSource(`${sourcegraphURL}/search/stream?${parameterEncoded}`)
|
||||
subscriptions.add(() => eventSource.close())
|
||||
|
||||
@ -5,9 +5,8 @@ import { isErrorLike } from '@sourcegraph/common'
|
||||
import { dataOrThrowErrors, gql } from '@sourcegraph/http-client'
|
||||
|
||||
import { SettingsEdit } from '../api/client/services/settings'
|
||||
import { Scalars } from '../graphql-operations'
|
||||
import { Scalars, KeyPathSegment, ConfigurationEdit, SettingsEdit as SettingsEditArg } from '../graphql-operations'
|
||||
import { PlatformContext } from '../platform/context'
|
||||
import * as GQL from '../schema'
|
||||
|
||||
/**
|
||||
* A helper function for performing an update to settings.
|
||||
@ -22,7 +21,7 @@ export function updateSettings(
|
||||
{ requestGraphQL }: Pick<PlatformContext, 'requestGraphQL'>,
|
||||
subject: Scalars['ID'],
|
||||
lastID: number | null,
|
||||
edit: GQL.ISettingsEdit | string
|
||||
edit: SettingsEditArg | string
|
||||
) => Promise<void>
|
||||
): Promise<void> {
|
||||
return from(settings)
|
||||
@ -60,7 +59,7 @@ export function updateSettings(
|
||||
.toPromise()
|
||||
}
|
||||
|
||||
function toGQLKeyPath(keyPath: (string | number)[]): GQL.IKeyPathSegment[] {
|
||||
function toGQLKeyPath(keyPath: (string | number)[]): KeyPathSegment[] {
|
||||
return keyPath.map(member => (typeof member === 'string' ? { property: member } : { index: member }))
|
||||
}
|
||||
|
||||
@ -74,7 +73,7 @@ export function mutateSettings(
|
||||
{ requestGraphQL }: Pick<PlatformContext, 'requestGraphQL'>,
|
||||
subject: Scalars['ID'],
|
||||
lastID: number | null,
|
||||
edit: GQL.IConfigurationEdit | string
|
||||
edit: ConfigurationEdit | string
|
||||
): Promise<void> {
|
||||
return typeof edit === 'string'
|
||||
? overwriteSettings({ requestGraphQL }, subject, lastID, edit)
|
||||
@ -93,7 +92,7 @@ function editSettings(
|
||||
{ requestGraphQL }: Pick<PlatformContext, 'requestGraphQL'>,
|
||||
subject: Scalars['ID'],
|
||||
lastID: number | null,
|
||||
edit: GQL.IConfigurationEdit
|
||||
edit: ConfigurationEdit
|
||||
): Promise<void> {
|
||||
return from(
|
||||
requestGraphQL({
|
||||
|
||||
@ -24,8 +24,15 @@ import { Key } from 'ts-key-enum'
|
||||
import { isDefined, logger } from '@sourcegraph/common'
|
||||
import { dataOrThrowErrors, gql, GraphQLResult } from '@sourcegraph/http-client'
|
||||
|
||||
import { ExternalServiceKind } from '../graphql-operations'
|
||||
import { IMutation, IQuery, IRepository } from '../schema'
|
||||
import {
|
||||
ExternalServiceKind,
|
||||
ExternalServicesForTestsResult,
|
||||
OverwriteSettingsForTestsResult,
|
||||
RepositoryNameForTestsResult,
|
||||
SiteForTestsResult,
|
||||
UpdateSiteConfigurationForTestsResult,
|
||||
UserSettingsForTestsResult,
|
||||
} from '../graphql-operations'
|
||||
import { Settings } from '../settings/settings'
|
||||
|
||||
import { getConfig } from './config'
|
||||
@ -388,7 +395,7 @@ export class Driver {
|
||||
}): Promise<void> {
|
||||
// Use the graphQL API to query external services on the instance.
|
||||
const { externalServices } = dataOrThrowErrors(
|
||||
await this.makeGraphQLRequest<IQuery>({
|
||||
await this.makeGraphQLRequest<ExternalServicesForTestsResult>({
|
||||
request: gql`
|
||||
query ExternalServicesForTests {
|
||||
externalServices(first: 1) {
|
||||
@ -571,10 +578,10 @@ export class Driver {
|
||||
return response
|
||||
}
|
||||
|
||||
public async getRepository(name: string): Promise<Pick<IRepository, 'id'>> {
|
||||
const response = await this.makeGraphQLRequest<IQuery>({
|
||||
public async getRepository(name: string): Promise<RepositoryNameForTestsResult['repository']> {
|
||||
const response = await this.makeGraphQLRequest<RepositoryNameForTestsResult>({
|
||||
request: gql`
|
||||
query ($name: String!) {
|
||||
query RepositoryNameForTests($name: String!) {
|
||||
repository(name: $name) {
|
||||
id
|
||||
}
|
||||
@ -593,7 +600,7 @@ export class Driver {
|
||||
path: jsonc.JSONPath,
|
||||
editFunction: (oldValue: jsonc.Node | undefined) => any
|
||||
): Promise<void> {
|
||||
const currentConfigResponse = await this.makeGraphQLRequest<IQuery>({
|
||||
const currentConfigResponse = await this.makeGraphQLRequest<SiteForTestsResult>({
|
||||
request: gql`
|
||||
query SiteForTests {
|
||||
site {
|
||||
@ -611,7 +618,7 @@ export class Driver {
|
||||
const { site } = dataOrThrowErrors(currentConfigResponse)
|
||||
const currentConfig = site.configuration.effectiveContents
|
||||
const newConfig = modifyJSONC(currentConfig, path, editFunction)
|
||||
const updateConfigResponse = await this.makeGraphQLRequest<IMutation>({
|
||||
const updateConfigResponse = await this.makeGraphQLRequest<UpdateSiteConfigurationForTestsResult>({
|
||||
request: gql`
|
||||
mutation UpdateSiteConfigurationForTests($lastID: Int!, $input: String!) {
|
||||
updateSiteConfiguration(lastID: $lastID, input: $input)
|
||||
@ -634,7 +641,7 @@ export class Driver {
|
||||
}
|
||||
|
||||
public async setUserSettings<S extends Settings>(settings: S): Promise<void> {
|
||||
const currentSettingsResponse = await this.makeGraphQLRequest<IQuery>({
|
||||
const currentSettingsResponse = await this.makeGraphQLRequest<UserSettingsForTestsResult>({
|
||||
request: gql`
|
||||
query UserSettingsForTests {
|
||||
currentUser {
|
||||
@ -654,7 +661,7 @@ export class Driver {
|
||||
throw new Error('no currentUser')
|
||||
}
|
||||
|
||||
const updateConfigResponse = await this.makeGraphQLRequest<IMutation>({
|
||||
const updateConfigResponse = await this.makeGraphQLRequest<OverwriteSettingsForTestsResult>({
|
||||
request: gql`
|
||||
mutation OverwriteSettingsForTests($subject: ID!, $lastID: Int, $contents: String!) {
|
||||
settingsMutation(input: { subject: $subject, lastID: $lastID }) {
|
||||
|
||||
@ -11,10 +11,8 @@ const signale = require('signale')
|
||||
const createWebpackCompiler = require('webpack')
|
||||
|
||||
const {
|
||||
graphQlSchema,
|
||||
graphQlOperations,
|
||||
schema,
|
||||
watchGraphQlSchema,
|
||||
watchGraphQlOperations,
|
||||
watchSchema,
|
||||
cssModulesTypings,
|
||||
@ -73,10 +71,10 @@ async function esbuild() {
|
||||
}
|
||||
|
||||
// Ensure the typings that TypeScript depends on are build to avoid first-time-run errors
|
||||
const generate = gulp.parallel(schema, graphQlSchema, graphQlOperations, cssModulesTypings)
|
||||
const generate = gulp.parallel(schema, graphQlOperations, cssModulesTypings)
|
||||
|
||||
// Watches code generation only, rebuilds on file changes
|
||||
const watchGenerators = gulp.parallel(watchSchema, watchGraphQlSchema, watchGraphQlOperations, watchCSSModulesTypings)
|
||||
const watchGenerators = gulp.parallel(watchSchema, watchGraphQlOperations, watchCSSModulesTypings)
|
||||
|
||||
/**
|
||||
* Builds everything.
|
||||
|
||||
@ -14,10 +14,8 @@ const createWebpackCompiler = require('webpack')
|
||||
const WebpackDevServer = require('webpack-dev-server')
|
||||
|
||||
const {
|
||||
graphQlSchema,
|
||||
graphQlOperations,
|
||||
schema,
|
||||
watchGraphQlSchema,
|
||||
watchGraphQlOperations,
|
||||
watchSchema,
|
||||
cssModulesTypings,
|
||||
@ -174,10 +172,10 @@ const esbuildDevelopmentProxy = () =>
|
||||
const developmentServer = DEV_WEB_BUILDER === 'webpack' ? webpackDevelopmentServer : esbuildDevelopmentProxy
|
||||
|
||||
// Ensure the typings that TypeScript depends on are build to avoid first-time-run errors
|
||||
const generate = gulp.parallel(schema, graphQlSchema, graphQlOperations, cssModulesTypings)
|
||||
const generate = gulp.parallel(schema, graphQlOperations, cssModulesTypings)
|
||||
|
||||
// Watches code generation only, rebuilds on file changes
|
||||
const watchGenerators = gulp.parallel(watchSchema, watchGraphQlSchema, watchGraphQlOperations, watchCSSModulesTypings)
|
||||
const watchGenerators = gulp.parallel(watchSchema, watchGraphQlOperations, watchCSSModulesTypings)
|
||||
|
||||
/**
|
||||
* Builds everything.
|
||||
|
||||
10
gulpfile.js
10
gulpfile.js
@ -2,13 +2,7 @@
|
||||
|
||||
const gulp = require('gulp')
|
||||
|
||||
const {
|
||||
graphQlSchema,
|
||||
graphQlOperations,
|
||||
schema,
|
||||
watchGraphQlSchema,
|
||||
watchGraphQlOperations,
|
||||
} = require('./client/shared/gulpfile')
|
||||
const { graphQlOperations, schema, watchGraphQlOperations } = require('./client/shared/gulpfile')
|
||||
const { webpack: webWebpack, developmentServer, generate, watchGenerators } = require('./client/web/gulpfile')
|
||||
|
||||
/**
|
||||
@ -32,8 +26,6 @@ module.exports = {
|
||||
build,
|
||||
dev: development,
|
||||
schema,
|
||||
graphQlSchema,
|
||||
watchGraphQlSchema,
|
||||
graphQlOperations,
|
||||
watchGraphQlOperations,
|
||||
}
|
||||
|
||||
@ -101,8 +101,6 @@
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@gql2ts/from-schema": "^1.10.1",
|
||||
"@gql2ts/language-typescript": "^1.9.0",
|
||||
"@gql2ts/types": "^1.9.0",
|
||||
"@graphql-codegen/cli": "^2.16.1",
|
||||
"@graphql-codegen/typescript": "2.8.5",
|
||||
|
||||
1805
pnpm-lock.yaml
1805
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user