Skip to content

Bit workspace can be created with an invalid scope name #10315

@Ionaru

Description

@Ionaru

Describe the bug

It is possible to create a Bit workspace with an invalid scope name, which causes all commands after the initialization to fail.

Steps to Reproduce

  1. Run bit init --default-scope my.invalid.scope
  2. Run bit templates

Expected Behavior

Either bit init --default-scope my.invalid.scope should have failed with an error indicating that I entered an invalid scope name, OR subsequent commands should work normally.

Actual behavior

❯ bit templates
error: "my.invalid.scope" is invalid, component scope names can only contain alphanumeric, lowercase characters, and the following ["-", "_", "$", "!"]
InvalidScopeName: error: "my.invalid.scope" is invalid, component scope names can only contain alphanumeric, lowercase characters, and the following ["-", "_", "$", "!"]
    at Workspace.validateConfig (C:\Users\Name\AppData\Local\.bvm\versions\1.13.58\bit-1.13.58\node_modules\@teambit\workspace\dist\workspace.js:435:68)
    at new Workspace (C:\Users\Name\AppData\Local\.bvm\versions\1.13.58\bit-1.13.58\node_modules\@teambit\workspace\dist\workspace.js:424:10)
    at WorkspaceMain.provider (C:\Users\Name\AppData\Local\.bvm\versions\1.13.58\bit-1.13.58\node_modules\@teambit\workspace\dist\workspace.main.runtime.js:265:23) {
  isUserError: true
}

Specifications

  • Bit version: 1.13.58
  • Platform: Windows

Additional information

I ran into this because the Introduction page does not mention any limits on the scope name, and com.my-company.my-project is a common pattern for project scopes.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions