@grafana/create-plugin 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CONTRIBUTING.md +45 -8
  2. package/README.md +25 -62
  3. package/dist/commands/generate.plopfile.js +2 -1
  4. package/dist/commands/update.command.js +1 -1
  5. package/dist/constants.js +6 -3
  6. package/dist/utils/tests/utils.handlebars.test.js +3 -3
  7. package/dist/utils/tests/utils.plugin.test.js +1 -1
  8. package/dist/utils/utils.handlebars.js +4 -2
  9. package/fixtures/test-template/src/plugin.json +35 -0
  10. package/jest.config.js +2 -17
  11. package/package.json +12 -24
  12. package/scripts/generate-app.js +24 -0
  13. package/scripts/generate-datasource.js +24 -0
  14. package/scripts/generate-panel.js +23 -0
  15. package/src/commands/generate.plopfile.ts +1 -0
  16. package/src/commands/update.command.ts +1 -1
  17. package/src/constants.ts +7 -2
  18. package/src/utils/tests/utils.handlebars.test.ts +3 -3
  19. package/src/utils/tests/utils.plugin.test.ts +2 -2
  20. package/src/utils/utils.handlebars.ts +5 -2
  21. package/templates/app/src/plugin.json +4 -1
  22. package/templates/backend/go.mod +55 -2
  23. package/templates/backend/go.sum +91 -4
  24. package/templates/common/.config/README.md +4 -4
  25. package/templates/common/.config/jest.config.js +5 -1
  26. package/templates/common/.config/tsconfig.json +8 -0
  27. package/templates/common/.config/webpack/webpack.config.ts +29 -16
  28. package/templates/common/.nvmrc +1 -1
  29. package/templates/common/jest.config.js +4 -0
  30. package/templates/common/package.json +8 -3
  31. package/templates/datasource/src/plugin.json +2 -2
  32. package/templates/github/ci/.github/workflows/ci.yml +11 -2
  33. package/templates/github/ci/.github/workflows/release.yml +3 -3
  34. package/templates/panel/src/plugin.json +1 -0
  35. package/tsconfig.json +4 -13
  36. package/.eslintrc +0 -6
  37. package/.github/workflows/create-release.yml +0 -49
  38. package/.github/workflows/npm-bump-version.yml +0 -51
  39. package/.github/workflows/test.yml +0 -31
  40. package/.prettierrc +0 -10
  41. package/docs/example.mp4 +0 -0
  42. package/templates/common/.config/webpack/tsconfig.webpack.json +0 -9
@@ -16,7 +16,7 @@ jobs:
16
16
  - name: Setup Node.js environment
17
17
  uses: actions/setup-node@v2.1.2
18
18
  with:
19
- node-version: '14.x'
19
+ node-version: '16.x'
20
20
 
21
21
  - name: Setup Go environment
22
22
  uses: actions/setup-go@v2
@@ -120,10 +120,10 @@ jobs:
120
120
  - name: Lint plugin
121
121
  run: |
122
122
  git clone https://github.com/grafana/plugin-validator
123
- pushd ./plugin-validator/cmd/plugincheck
123
+ pushd ./plugin-validator/pkg/cmd/plugincheck2
124
124
  go install
125
125
  popd
126
- plugincheck $\{{ steps.metadata.outputs.archive }}
126
+ plugincheck2 -config ./plugin-validator/config/publishing.yaml $\{{ steps.metadata.outputs.archive }}
127
127
 
128
128
  - name: Create release
129
129
  id: create_release
@@ -4,6 +4,7 @@
4
4
  "name": "{{ titleCase pluginName }}",
5
5
  "id": "{{ normalize_id pluginName orgName 'panel' }}",
6
6
  "info": {
7
+ "keywords": ["panel"],
7
8
  "description": "{{ sentenceCase pluginDescription }}",
8
9
  "author": {
9
10
  "name": "{{ sentenceCase orgName }}"
package/tsconfig.json CHANGED
@@ -1,17 +1,8 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "esModuleInterop": true,
4
- "removeComments": true,
5
- "preserveConstEnums": true,
6
- "outDir": "./dist",
7
- "noImplicitAny": true,
8
- "noImplicitReturns": true,
9
- "noImplicitThis": true,
10
- "noUnusedLocals": true,
11
- "pretty": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "allowSyntheticDefaultImports": true,
3
+ "outDir": "./dist"
14
4
  },
15
- "include": ["src"],
16
5
  "exclude": ["node_modules", "templates"],
17
- }
6
+ "extends": "../../tsconfig.base.json",
7
+ "include": ["src"]
8
+ }
package/.eslintrc DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "extends": ["@grafana/eslint-config"],
3
- "rules": {
4
- "react/prop-types": "off"
5
- }
6
- }
@@ -1,49 +0,0 @@
1
- on:
2
- push:
3
- tags:
4
- - 'v*'
5
-
6
- name: Create Release
7
-
8
- jobs:
9
- publish:
10
- name: Publish to npm
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v2
14
-
15
- - name: Setup environment
16
- uses: actions/setup-node@v2.5.1
17
- with:
18
- node-version: '16'
19
- registry-url: 'https://registry.npmjs.org'
20
- cache: 'yarn'
21
-
22
- - name: Install dependencies
23
- run: yarn install --immutable
24
-
25
- - name: Build package
26
- run: yarn build
27
-
28
- - name: Publish
29
- run: npm publish --access public
30
- env:
31
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
32
-
33
- create-github-release:
34
- name: Create GitHub Release
35
- runs-on: ubuntu-latest
36
- needs: publish
37
- steps:
38
- - name: Checkout code
39
- uses: actions/checkout@v3
40
-
41
- - name: Create Release Notes
42
- uses: actions/github-script@v4.0.2
43
- with:
44
- github-token: ${{secrets.GH_BOT_ACCESS_TOKEN}}
45
- script: |
46
- await github.request(`POST /repos/${{ github.repository }}/releases`, {
47
- tag_name: "${{ github.ref }}",
48
- generate_release_notes: true
49
- });
@@ -1,51 +0,0 @@
1
- name: NPM bump version
2
-
3
- on:
4
- workflow_dispatch:
5
- inputs:
6
- version:
7
- description: 'Semver type of new version (major / minor / patch)'
8
- required: true
9
- type: choice
10
- options:
11
- - patch
12
- - minor
13
- - major
14
-
15
- jobs:
16
- bump-version:
17
- runs-on: ubuntu-latest
18
-
19
- steps:
20
- - uses: actions/checkout@v3
21
- with:
22
- token: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
23
-
24
- - name: Setup environment
25
- uses: actions/setup-node@v3.1.1
26
- with:
27
- node-version: '16'
28
- cache: 'yarn'
29
-
30
- - name: Install dependencies
31
- run: yarn install --immutable
32
-
33
- - name: Check types
34
- run: yarn typecheck
35
-
36
- - name: Lint
37
- run: yarn lint
38
-
39
- - name: Unit tests
40
- run: yarn jest
41
-
42
- - name: Setup Git
43
- run: |
44
- git config user.name 'grafanabot'
45
- git config user.email 'bot@grafana.com'
46
-
47
- - name: bump version
48
- run: npm version ${{ github.event.inputs.version }}
49
-
50
- - name: Push latest version
51
- run: git push origin main --follow-tags
@@ -1,31 +0,0 @@
1
- name: test
2
- on: push
3
-
4
- jobs:
5
- test:
6
- runs-on: ubuntu-latest
7
- name: Run unit tests
8
- steps:
9
- - name: Checkout repository
10
- uses: actions/checkout@v2
11
- with:
12
- ref: ${{ github.ref }}
13
- - name: Setup .npmrc file for NPM registry
14
- uses: actions/setup-node@v2
15
- with:
16
- node-version: '16'
17
- registry-url: 'https://registry.npmjs.org'
18
- - name: Install dependencies
19
- run: yarn
20
- - name: Check types
21
- run: yarn typecheck
22
- - name: Lint
23
- run: yarn lint
24
- - name: Unit tests
25
- run: yarn jest
26
- - name: test an app plugin generation
27
- run: yarn generate-app && (cd generated && yarn && yarn build && yarn lint)
28
- - name: test panel plugin generation
29
- run: yarn generate-panel && (cd generated && yarn && yarn build && yarn lint)
30
- - name: test datasource plugin generation
31
- run: yarn generate-datasource && (cd generated && yarn && yarn build && yarn lint)
package/.prettierrc DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "endOfLine": "auto",
3
- "printWidth": 120,
4
- "trailingComma": "es5",
5
- "semi": true,
6
- "jsxSingleQuote": false,
7
- "singleQuote": true,
8
- "useTabs": false,
9
- "tabWidth": 2
10
- }
package/docs/example.mp4 DELETED
Binary file
@@ -1,9 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "target": "es5",
5
- "esModuleInterop": true
6
- },
7
- "transpileOnly": true,
8
- "transpiler": "ts-node/transpilers/swc-experimental"
9
- }