diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 2f5a8435fb..7ae2593ed7 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Default deployment type to SubQuery when deploying to the managed service (#2523). ## [5.2.0] - 2024-08-05 ### Changed diff --git a/packages/cli/src/commands/project/create-project.ts b/packages/cli/src/commands/project/create-project.ts index ac92305123..ce484df6b5 100644 --- a/packages/cli/src/commands/project/create-project.ts +++ b/packages/cli/src/commands/project/create-project.ts @@ -1,6 +1,7 @@ // Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 +import assert from 'assert'; import {Command, Flags} from '@oclif/core'; import {BASE_PROJECT_URL, ROOT_API_URL_PROD} from '../../constants'; import {createProject} from '../../controller/project-controller'; @@ -19,12 +20,21 @@ export default class Create_project extends Command { description: Flags.string({description: 'Enter description', default: '', required: false}), apiVersion: Flags.string({description: 'Enter api version', default: '2', required: false}), dedicatedDB: Flags.string({description: 'Enter dedicated DataBase', required: false}), + projectType: Flags.string({ + description: 'Enter project type [subquery|subgraph]', + default: 'subquery', + required: false, + }), }; async run(): Promise { const {flags} = await this.parse(Create_project); let {gitRepo, org, projectName} = flags; + assert( + ['subquery'].includes(flags.projectType), + 'Invalid project type, only "subquery" is supported. Please deploy Subgraphs through the website.' + ); const authToken = await checkToken(); org = await valueOrPrompt(org, 'Enter organisation', 'Organisation is required'); @@ -35,6 +45,7 @@ export default class Create_project extends Command { org, flags.subtitle, flags.logoURL, + flags.projectType === 'subquery' ? 1 : 3, projectName, authToken, gitRepo, diff --git a/packages/cli/src/controller/deploy-controller.spec.ts b/packages/cli/src/controller/deploy-controller.spec.ts index caa4f49c28..f4639dc7ab 100644 --- a/packages/cli/src/controller/deploy-controller.spec.ts +++ b/packages/cli/src/controller/deploy-controller.spec.ts @@ -80,6 +80,7 @@ describe.skip('CLI deploy, delete, promote', () => { org, subtitle, logoURl, + 1, projectName, testAuth, repository, diff --git a/packages/cli/src/controller/project-controller.spec.ts b/packages/cli/src/controller/project-controller.spec.ts index 660e4b0716..b1f88b0c9b 100644 --- a/packages/cli/src/controller/project-controller.spec.ts +++ b/packages/cli/src/controller/project-controller.spec.ts @@ -30,6 +30,7 @@ describe('CLI create project and delete project', () => { org!, subtitle, logoURl, + 1, projectName, testAuth!, repository, diff --git a/packages/cli/src/controller/project-controller.ts b/packages/cli/src/controller/project-controller.ts index 8d02ee4476..c7d50fd855 100644 --- a/packages/cli/src/controller/project-controller.ts +++ b/packages/cli/src/controller/project-controller.ts @@ -17,6 +17,7 @@ export async function createProject( organization: string, subtitle: string, logoUrl: string, + project_type: number, project_name: string, authToken: string, gitRepository: string, @@ -42,6 +43,7 @@ export async function createProject( name: project_name, subtitle: subtitle, dedicateDBKey: dedicateDB, + type: project_type, }, }); return res.data as unknown as CreateProjectResponse;