Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changeset/four-ads-hide.md
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -24,21 +24,21 @@ describe('create', () => {
sandbox.restore();
});

describe('method', () => {
describe('create', () => {
it('should invoke `create <appPath>`', 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 <appPath> --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,
sinon.match.array.contains(['create', 'myApp', '--template', 'slack-samples/deno-hello-world']),
);
});
it('should invoke `create <appPath> --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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -25,4 +25,6 @@ export const create = async function create(
return proc.output;
};

export default create;
export default {
create,
};
4 changes: 2 additions & 2 deletions packages/cli-test/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -23,13 +23,13 @@ export const SlackCLI = {
app,
auth,
collaborator,
create,
datastore,
env,
externalAuth,
function: func,
manifest,
platform,
project,
trigger,
version,

Expand Down