diff --git a/.changeset/four-ads-hide.md b/.changeset/four-ads-hide.md new file mode 100644 index 000000000..88d56c864 --- /dev/null +++ b/.changeset/four-ads-hide.md @@ -0,0 +1,17 @@ +--- +"@slack/cli-test": major +--- + +refactor(cli-test)!: move 'create' to 'project create' + +Before the Slack CLI v4.0.0 release, the `create` command became a `project` subcommand while remaining aliased the same. This project now prefers: + +```js +const createOutput = await SlackCLI.project.create({ + template: "slack-samples/bolt-js-starter-template", + appPath, + verbose: true, +}); +``` + +But continues to run the `slack create` command for confidence in getting started guides. diff --git a/packages/cli-test/src/cli/commands/create.test.ts b/packages/cli-test/src/cli/commands/project.test.ts similarity index 80% rename from packages/cli-test/src/cli/commands/create.test.ts rename to packages/cli-test/src/cli/commands/project.test.ts index a9a06b869..651999a82 100644 --- a/packages/cli-test/src/cli/commands/create.test.ts +++ b/packages/cli-test/src/cli/commands/project.test.ts @@ -4,9 +4,9 @@ import sinon from 'sinon'; import { mockProcess } from '../../utils/test'; import { shell } from '../shell'; -import { create } from './create'; +import project from './project'; -describe('create', () => { +describe('project', () => { const sandbox = sinon.createSandbox(); let spawnSpy: sinon.SinonStub; @@ -24,13 +24,13 @@ describe('create', () => { sandbox.restore(); }); - describe('method', () => { + describe('create', () => { it('should invoke `create `', async () => { - await create({ appPath: 'myApp' }); + await project.create({ appPath: 'myApp' }); sandbox.assert.calledWith(spawnSpy, sinon.match.string, sinon.match.array.contains(['create', 'myApp'])); }); it('should invoke `create --template` if template specified', async () => { - await create({ appPath: 'myApp', template: 'slack-samples/deno-hello-world' }); + await project.create({ appPath: 'myApp', template: 'slack-samples/deno-hello-world' }); sandbox.assert.calledWith( spawnSpy, sinon.match.string, @@ -38,7 +38,7 @@ describe('create', () => { ); }); it('should invoke `create --template --branch` if both template and branch specified', async () => { - await create({ appPath: 'myApp', template: 'slack-samples/deno-hello-world', branch: 'feat-functions' }); + await project.create({ appPath: 'myApp', template: 'slack-samples/deno-hello-world', branch: 'feat-functions' }); sandbox.assert.calledWith( spawnSpy, sinon.match.string, diff --git a/packages/cli-test/src/cli/commands/create.ts b/packages/cli-test/src/cli/commands/project.ts similarity index 90% rename from packages/cli-test/src/cli/commands/create.ts rename to packages/cli-test/src/cli/commands/project.ts index d3195edcf..a16d97b52 100644 --- a/packages/cli-test/src/cli/commands/create.ts +++ b/packages/cli-test/src/cli/commands/project.ts @@ -5,7 +5,7 @@ import { type SlackCLICommandOptions, SlackCLIProcess } from '../cli-process'; * `slack create` * @returns command output */ -export const create = async function create( +export const create = async function projectCreate( args: ProjectCommandArguments & { /** @description URL to an app template to use when creating app. */ template?: string; @@ -25,4 +25,6 @@ export const create = async function create( return proc.output; }; -export default create; +export default { + create, +}; diff --git a/packages/cli-test/src/cli/index.ts b/packages/cli-test/src/cli/index.ts index 2d9a8a440..06fd29eeb 100644 --- a/packages/cli-test/src/cli/index.ts +++ b/packages/cli-test/src/cli/index.ts @@ -6,13 +6,13 @@ import logger from '../utils/logger'; import app from './commands/app'; import auth from './commands/auth'; import collaborator from './commands/collaborator'; -import { create } from './commands/create'; import datastore from './commands/datastore'; import env from './commands/env'; import externalAuth from './commands/external-auth'; import func from './commands/function'; import manifest from './commands/manifest'; import platform from './commands/platform'; +import project from './commands/project'; import trigger from './commands/trigger'; import version from './commands/version'; @@ -23,13 +23,13 @@ export const SlackCLI = { app, auth, collaborator, - create, datastore, env, externalAuth, function: func, manifest, platform, + project, trigger, version,