Skip to content

Commit 5a9bb9a

Browse files
authored
refactor(cli-test)!: move 'create' to 'project create' (#2554)
1 parent c0e7ac8 commit 5a9bb9a

4 files changed

Lines changed: 29 additions & 10 deletions

File tree

.changeset/four-ads-hide.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
"@slack/cli-test": major
3+
---
4+
5+
refactor(cli-test)!: move 'create' to 'project create'
6+
7+
Before the Slack CLI v4.0.0 release, the `create` command became a `project` subcommand while remaining aliased the same. This project now prefers:
8+
9+
```js
10+
const createOutput = await SlackCLI.project.create({
11+
template: "slack-samples/bolt-js-starter-template",
12+
appPath,
13+
verbose: true,
14+
});
15+
```
16+
17+
But continues to run the `slack create` command for confidence in getting started guides.

packages/cli-test/src/cli/commands/create.test.ts renamed to packages/cli-test/src/cli/commands/project.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import sinon from 'sinon';
44

55
import { mockProcess } from '../../utils/test';
66
import { shell } from '../shell';
7-
import { create } from './create';
7+
import project from './project';
88

9-
describe('create', () => {
9+
describe('project', () => {
1010
const sandbox = sinon.createSandbox();
1111
let spawnSpy: sinon.SinonStub;
1212

@@ -24,21 +24,21 @@ describe('create', () => {
2424
sandbox.restore();
2525
});
2626

27-
describe('method', () => {
27+
describe('create', () => {
2828
it('should invoke `create <appPath>`', async () => {
29-
await create({ appPath: 'myApp' });
29+
await project.create({ appPath: 'myApp' });
3030
sandbox.assert.calledWith(spawnSpy, sinon.match.string, sinon.match.array.contains(['create', 'myApp']));
3131
});
3232
it('should invoke `create <appPath> --template` if template specified', async () => {
33-
await create({ appPath: 'myApp', template: 'slack-samples/deno-hello-world' });
33+
await project.create({ appPath: 'myApp', template: 'slack-samples/deno-hello-world' });
3434
sandbox.assert.calledWith(
3535
spawnSpy,
3636
sinon.match.string,
3737
sinon.match.array.contains(['create', 'myApp', '--template', 'slack-samples/deno-hello-world']),
3838
);
3939
});
4040
it('should invoke `create <appPath> --template --branch` if both template and branch specified', async () => {
41-
await create({ appPath: 'myApp', template: 'slack-samples/deno-hello-world', branch: 'feat-functions' });
41+
await project.create({ appPath: 'myApp', template: 'slack-samples/deno-hello-world', branch: 'feat-functions' });
4242
sandbox.assert.calledWith(
4343
spawnSpy,
4444
sinon.match.string,

packages/cli-test/src/cli/commands/create.ts renamed to packages/cli-test/src/cli/commands/project.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { type SlackCLICommandOptions, SlackCLIProcess } from '../cli-process';
55
* `slack create`
66
* @returns command output
77
*/
8-
export const create = async function create(
8+
export const create = async function projectCreate(
99
args: ProjectCommandArguments & {
1010
/** @description URL to an app template to use when creating app. */
1111
template?: string;
@@ -25,4 +25,6 @@ export const create = async function create(
2525
return proc.output;
2626
};
2727

28-
export default create;
28+
export default {
29+
create,
30+
};

packages/cli-test/src/cli/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import logger from '../utils/logger';
66
import app from './commands/app';
77
import auth from './commands/auth';
88
import collaborator from './commands/collaborator';
9-
import { create } from './commands/create';
109
import datastore from './commands/datastore';
1110
import env from './commands/env';
1211
import externalAuth from './commands/external-auth';
1312
import func from './commands/function';
1413
import manifest from './commands/manifest';
1514
import platform from './commands/platform';
15+
import project from './commands/project';
1616
import trigger from './commands/trigger';
1717
import version from './commands/version';
1818

@@ -23,13 +23,13 @@ export const SlackCLI = {
2323
app,
2424
auth,
2525
collaborator,
26-
create,
2726
datastore,
2827
env,
2928
externalAuth,
3029
function: func,
3130
manifest,
3231
platform,
32+
project,
3333
trigger,
3434
version,
3535

0 commit comments

Comments
 (0)