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
1 change: 1 addition & 0 deletions docs/reference/experiments.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ The Slack CLI has an experiment flag, behind which we put features under develop
The following is a list of currently available experiments. We may remove an experiment once the feature is released.

* `bolt-install`: enables creating, installing, and running Bolt projects that manage their app manifest on app settings (remote manifest).
* `slack create` and `slack init` now set manifest source to "app settings" (remote) for Bolt JS & Bolt Python projects ([PR#96](https://github.com/slackapi/slack-cli/pull/96)).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔗 ✨

* `read-only-collaborators`: enables creating and modifying collaborator permissions via the `slack collaborator` commands.
12 changes: 11 additions & 1 deletion internal/pkg/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,21 @@ func InstallProjectDependencies(
}
}

// Set "manifest.source" in .slack/config.json
// Default manifest source to ManifestSourceLocal
if !manifestSource.Exists() {
manifestSource = config.ManifestSourceLocal
}

// When the BoltInstall experiment is enabled, set non-ROSI projects to ManifestSourceRemote.
if clients.Config.WithExperimentOn(experiment.BoltInstall) {
// TODO: should check if Slack hosted project, but the SDKConfig has not been initialized yet.
isDenoProject := strings.Contains(strings.ToLower(clients.Runtime.Name()), "deno")
if !isDenoProject {
manifestSource = config.ManifestSourceRemote
}
}

// Set "manifest.source" in .slack/config.json
if err := clients.Config.ProjectConfig.SetManifestSource(ctx, manifestSource); err != nil {
clients.IO.PrintDebug(ctx, "Error setting manifest source in project-level config: %s", err)
} else {
Expand Down
18 changes: 18 additions & 0 deletions internal/pkg/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func TestCreateGitArgs(t *testing.T) {
func Test_Create_installProjectDependencies(t *testing.T) {
tests := map[string]struct {
experiments []string
runtime string
manifestSource config.ManifestSource
existingFiles map[string]string
expectedOutputs []string
Expand Down Expand Up @@ -208,6 +209,19 @@ func Test_Create_installProjectDependencies(t *testing.T) {
`Updated config.json manifest source to "app settings" (remote)`,
},
},
"When bolt + bolt-install experiment and Deno project, should set manifest source to project (local)": {
experiments: []string{"bolt", "bolt-install"},
expectedOutputs: []string{
`Updated config.json manifest source to "project" (local)`,
},
},
"When bolt + bolt-install experiment and non-Deno project, should set manifest source to app settings (remote)": {
experiments: []string{"bolt", "bolt-install"},
runtime: "node",
expectedOutputs: []string{
`Updated config.json manifest source to "app settings" (remote)`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! It's so nice to make this output explicit to avoid unexpected UI changes in perhaps later iteration 👾

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I agree. I remember when you suggested adding it and it's helping to catch changes. 🪤

},
},
}
for name, tt := range tests {
t.Run(name, func(t *testing.T) {
Expand All @@ -226,6 +240,7 @@ func Test_Create_installProjectDependencies(t *testing.T) {
ctx := slackcontext.MockContext(t.Context())
clientsMock := shared.NewClientsMock()
clientsMock.Os.On("Getwd").Return(projectDirPath, nil)
clientsMock.HookExecutor.On("Execute", mock.Anything, mock.Anything).Return(`{}`, nil)
clientsMock.AddDefaultMocks()

// Set experiment flag
Expand All @@ -237,6 +252,9 @@ func Test_Create_installProjectDependencies(t *testing.T) {

// Set runtime to be Deno (or node or whatever)
clients.SDKConfig.Runtime = "deno"
if tt.runtime != "" {
clients.SDKConfig.Runtime = tt.runtime
}

// Create project directory
if err := clients.Fs.MkdirAll(filepath.Dir(projectDirPath), 0755); err != nil {
Expand Down
Loading