single repository using yarn workspaces

Hello

I’m developing several custom plugins based on the plugin template provided in the documentation (“https://github.com/grafana/simple-angular-panel”). In my project I would like to use a single repository for all of my plugins. I’m approaching this by the yarn workspaces. Right now, the proper workspace structure is created (due to https://classic.yarnpkg.com/en/docs/cli/workspaces/), but the grafana-toolkit scripts are failing to build template plugins. There is a problem with the script paths.

So far I’ve tried it on Windows, with this command:
yarn install
yarn workspaces run build

Have anyone tried to develop his own plugins with similar approach? Any help will be much appeciated.

Hi!

Could you provide the errors that grafana-toolkit outputs? This might also be a related to Windows paths, have you tried it on another operating system?

/Tobias Skarhed

Hi @skarhed,

I tried with grafana-toolkit, plugin datasource, yarn workspace
When building in workspace root project, toolkit show errors

Toolkit version: 7.3.6

$ yarn workspace test-datasource build
yarn workspace v1.22.5
yarn run v1.22.5
$ grafana-toolkit plugin:build
✔ Preparing
⠙ Linting  
  
  
  /home/node/modules/datasource/src/ConfigEditor.tsx
    13:3   error  Insert `··`                                                   prettier/prettier
    14:5   error  Insert `····`                                                 prettier/prettier
    15:1   error  Replace `····` with `········`                                prettier/prettier
    16:1   error  Replace `······` with `············`                          prettier/prettier
    17:1   error  Insert `······`                                               prettier/prettier
    18:1   error  Replace `····` with `········`                                prettier/prettier
    19:1   error  Insert `····`                                                 prettier/prettier
    20:3   error  Insert `··`                                                   prettier/prettier
    22:1   error  Insert `··`                                                   prettier/prettier
    23:1   error  Insert `··`                                                   prettier/prettier
    24:1   error  Replace `····` with `········`                                prettier/prettier
    25:5   error  Insert `····`                                                 prettier/prettier
    26:1   error  Replace `······` with `············`                          prettier/prettier
    27:1   error  Replace `······` with `············`                          prettier/prettier
    28:1   error  Replace `········` with `················`                    prettier/prettier
    29:7   error  Insert `······`                                               prettier/prettier
    30:1   error  Insert `····`                                                 prettier/prettier
    31:3   error  Insert `··`                                                   prettier/prettier
    33:1   error  Insert `··`                                                   prettier/prettier
    34:1   error  Insert `····`                                                 prettier/prettier
    35:5   error  Insert `····`                                                 prettier/prettier
    36:1   error  Replace `······` with `············`                          prettier/prettier
    37:1   error  Replace `······` with `············`                          prettier/prettier
    38:1   error  Replace `········` with `················`                    prettier/prettier
    39:9   error  Insert `········`                                             prettier/prettier
    40:1   error  Replace `······` with `············`                          prettier/prettier
    41:1   error  Insert `······`                                               prettier/prettier
    42:1   error  Replace `········` with `················`                    prettier/prettier
    43:9   error  Insert `········`                                             prettier/prettier
    44:1   error  Insert `······`                                               prettier/prettier
    45:5   error  Insert `····`                                                 prettier/prettier
    46:3   error  Insert `··`                                                   prettier/prettier
    48:1   error  Insert `··`                                                   prettier/prettier
    49:5   error  Insert `····`                                                 prettier/prettier
    50:1   error  Replace `····` with `········`                                prettier/prettier
    51:1   error  Insert `····`                                                 prettier/prettier
    53:5   error  Insert `····`                                                 prettier/prettier
    54:1   error  Replace `······` with `············`                          prettier/prettier
    55:1   error  Replace `········` with `················`                    prettier/prettier
    56:1   error  Replace `··········` with `····················`              prettier/prettier
    57:1   error  Replace `············` with `························`        prettier/prettier
    58:1   error  Replace `············` with `························`        prettier/prettier
    59:1   error  Replace `············` with `························`        prettier/prettier
    60:1   error  Replace `············` with `························`        prettier/prettier
    61:1   error  Replace `············` with `························`        prettier/prettier
    62:1   error  Replace `············` with `························`        prettier/prettier
    63:11  error  Insert `··········`                                           prettier/prettier
    64:1   error  Replace `········` with `················`                    prettier/prettier
    66:1   error  Insert `········`                                             prettier/prettier
    67:11  error  Insert `··········`                                           prettier/prettier
    68:1   error  Replace `············` with `························`        prettier/prettier
    69:1   error  Replace `··············` with `····························`  prettier/prettier
    70:15  error  Insert `··············`                                       prettier/prettier
    71:1   error  Replace `··············` with `····························`  prettier/prettier
    72:1   error  Insert `··············`                                       prettier/prettier
    73:1   error  Replace `··············` with `····························`  prettier/prettier
    74:1   error  Replace `··············` with `····························`  prettier/prettier
    75:1   error  Replace `··············` with `····························`  prettier/prettier
    76:1   error  Replace `··············` with `····························`  prettier/prettier
    77:13  error  Insert `············`                                         prettier/prettier
    78:1   error  Replace `··········` with `····················`              prettier/prettier
    79:1   error  Replace `········` with `················`                    prettier/prettier
    80:1   error  Replace `······` with `············`                          prettier/prettier
    81:5   error  Insert `····`                                                 prettier/prettier
    82:1   error  Insert `··`                                                   prettier/prettier
  
  /home/node/modules/datasource/src/DataSource.ts
     4:3  error  Insert `··`                                       prettier/prettier
     5:1  error  Replace `··` with `····`                          prettier/prettier
     6:1  error  Replace `··` with `····`                          prettier/prettier
     7:1  error  Insert `··`                                       prettier/prettier
     8:1  error  Replace `··` with `····`                          prettier/prettier
     9:1  error  Insert `··`                                       prettier/prettier
    15:3  error  Insert `··`                                       prettier/prettier
    16:1  error  Insert `····`                                     prettier/prettier
    17:3  error  Insert `··`                                       prettier/prettier
    19:1  error  Insert `··`                                       prettier/prettier
    20:5  error  Insert `····`                                     prettier/prettier
    21:1  error  Replace `····` with `········`                    prettier/prettier
    22:1  error  Replace `····` with `········`                    prettier/prettier
    24:1  error  Replace `····` with `········`                    prettier/prettier
    25:1  error  Insert `····`                                     prettier/prettier
    26:1  error  Replace `······` with `············`              prettier/prettier
    27:1  error  Insert `······`                                   prettier/prettier
    28:9  error  Insert `········`                                 prettier/prettier
    29:9  error  Insert `········`                                 prettier/prettier
    30:1  error  Replace `··········` with `····················`  prettier/prettier
    31:1  error  Replace `··········` with `····················`  prettier/prettier
    32:9  error  Insert `········`                                 prettier/prettier
    33:1  error  Replace `······` with `············`              prettier/prettier
    34:1  error  Replace `····` with `········`                    prettier/prettier
    36:1  error  Insert `····`                                     prettier/prettier
    37:3  error  Insert `··`                                       prettier/prettier
    39:1  error  Insert `··`                                       prettier/prettier
    40:5  error  Insert `····`                                     prettier/prettier
    41:5  error  Insert `····`                                     prettier/prettier
    42:1  error  Replace `······` with `············`              prettier/prettier
    43:1  error  Replace `······` with `············`              prettier/prettier
    44:5  error  Insert `····`                                     prettier/prettier
    45:1  error  Insert `··`                                       prettier/prettier
  
  /home/node/modules/datasource/src/QueryEditor.tsx
    14:3  error  Insert `··`                                       prettier/prettier
    15:5  error  Insert `····`                                     prettier/prettier
    16:1  error  Replace `····` with `········`                    prettier/prettier
    17:3  error  Insert `··`                                       prettier/prettier
    19:1  error  Replace `··` with `····`                          prettier/prettier
    20:5  error  Insert `····`                                     prettier/prettier
    21:1  error  Replace `····` with `········`                    prettier/prettier
    22:1  error  Insert `····`                                     prettier/prettier
    23:5  error  Insert `····`                                     prettier/prettier
    24:1  error  Insert `··`                                       prettier/prettier
    26:3  error  Insert `··`                                       prettier/prettier
    27:1  error  Insert `····`                                     prettier/prettier
    28:1  error  Replace `····` with `········`                    prettier/prettier
    30:5  error  Insert `····`                                     prettier/prettier
    31:1  error  Insert `······`                                   prettier/prettier
    32:9  error  Insert `········`                                 prettier/prettier
    33:1  error  Replace `··········` with `····················`  prettier/prettier
    34:1  error  Replace `··········` with `····················`  prettier/prettier
    35:1  error  Insert `··········`                               prettier/prettier
    36:1  error  Replace `··········` with `····················`  prettier/prettier
    37:1  error  Replace `··········` with `····················`  prettier/prettier
    38:1  error  Replace `··········` with `····················`  prettier/prettier
    39:9  error  Insert `········`                                 prettier/prettier
    40:1  error  Replace `········` with `················`        prettier/prettier
    41:1  error  Replace `··········` with `····················`  prettier/prettier
    42:1  error  Replace `··········` with `····················`  prettier/prettier
    43:1  error  Insert `··········`                               prettier/prettier
    44:1  error  Replace `··········` with `····················`  prettier/prettier
    45:1  error  Replace `··········` with `····················`  prettier/prettier
    46:1  error  Insert `········`                                 prettier/prettier
    47:7  error  Insert `······`                                   prettier/prettier
    48:5  error  Insert `····`                                     prettier/prettier
    49:1  error  Insert `··`                                       prettier/prettier
  
  /home/node/modules/datasource/src/module.ts
    8:3  error  Insert `··`  prettier/prettier
    9:1  error  Insert `··`  prettier/prettier
  
  /home/node/modules/datasource/src/types.ts
     4:3  error  Insert `··`               prettier/prettier
     5:1  error  Insert `··`               prettier/prettier
     9:1  error  Replace `··` with `····`  prettier/prettier
    16:3  error  Insert `··`               prettier/prettier
    23:1  error  Insert `··`               prettier/prettier
  
  ✖ 138 problems (138 errors, 0 warnings)
    138 errors and 0 warnings potentially fixable with the `--fix` option.
  
  
  
  Trace: Error: 138 linting errors found in 5 files
      at /home/node/node_modules/@grafana/toolkit/src/cli/tasks/plugin.build.js:98:31
      at step (/home/node/node_modules/@grafana/toolkit/node_modules/tslib/tslib.js:140:27)
      at Object.next (/home/node/node_modules/@grafana/toolkit/node_modules/tslib/tslib.js:121:57)
      at fulfilled (/home/node/node_modules/@grafana/toolkit/node_modules/tslib/tslib.js:111:62)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
      at /home/node/node_modules/@grafana/toolkit/src/cli/utils/useSpinner.js:25:29
      at step (/home/node/node_modules/@grafana/toolkit/node_modules/tslib/tslib.js:140:27)
      at Object.throw (/home/node/node_modules/@grafana/toolkit/node_modules/tslib/tslib.js:121:57)
      at rejected (/home/node/node_modules/@grafana/toolkit/node_modules/tslib/tslib.js:112:69)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
✖ 138 linting errors found in 5 files
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /usr/local/bin/node
Arguments: /opt/yarn-v1.22.5/lib/cli.js build
Directory: /home/node/modules/datasource
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.