sanity-plugin-dashboard-widget-document-list 0.0.13 → 0.1.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.
- package/.github/workflows/main.yml +133 -0
- package/.releaserc.json +7 -0
- package/.semantic-release/sanity-plugin-dashboard-widget-document-list-0.1.0.tgz +0 -0
- package/CHANGELOG.md +18 -0
- package/LICENSE +1 -1
- package/README.md +11 -2
- package/package.json +20 -17
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: CI & Release
|
|
3
|
+
|
|
4
|
+
# Workflow name based on selected inputs. Fallback to default Github naming when expression evaluates to empty string
|
|
5
|
+
run-name: >-
|
|
6
|
+
${{
|
|
7
|
+
inputs.release && inputs.test && format('Build {0} ➤ Test ➤ Publish to NPM', github.ref_name) ||
|
|
8
|
+
inputs.release && !inputs.test && format('Build {0} ➤ Skip Tests ➤ Publish to NPM', github.ref_name) ||
|
|
9
|
+
github.event_name == 'workflow_dispatch' && inputs.test && format('Build {0} ➤ Test', github.ref_name) ||
|
|
10
|
+
github.event_name == 'workflow_dispatch' && !inputs.test && format('Build {0} ➤ Skip Tests', github.ref_name) ||
|
|
11
|
+
''
|
|
12
|
+
}}
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
# Build on pushes branches that have a PR (including drafts)
|
|
16
|
+
pull_request:
|
|
17
|
+
# Build on commits pushed to branches without a PR if it's in the allowlist
|
|
18
|
+
push:
|
|
19
|
+
branches: [main,studio-v2]
|
|
20
|
+
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
|
|
21
|
+
workflow_dispatch:
|
|
22
|
+
inputs:
|
|
23
|
+
test:
|
|
24
|
+
description: Run tests
|
|
25
|
+
required: true
|
|
26
|
+
default: true
|
|
27
|
+
type: boolean
|
|
28
|
+
release:
|
|
29
|
+
description: Release new version
|
|
30
|
+
required: true
|
|
31
|
+
default: false
|
|
32
|
+
type: boolean
|
|
33
|
+
|
|
34
|
+
concurrency:
|
|
35
|
+
# On PRs builds will cancel if new pushes happen before the CI completes, as it defines `github.head_ref` and gives it the name of the branch the PR wants to merge into
|
|
36
|
+
# Otherwise `github.run_id` ensures that you can quickly merge a queue of PRs without causing tests to auto cancel on any of the commits pushed to main.
|
|
37
|
+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
38
|
+
cancel-in-progress: true
|
|
39
|
+
|
|
40
|
+
jobs:
|
|
41
|
+
log-the-inputs:
|
|
42
|
+
name: Log inputs
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
steps:
|
|
45
|
+
- run: |
|
|
46
|
+
echo "Inputs: $INPUTS"
|
|
47
|
+
env:
|
|
48
|
+
INPUTS: ${{ toJSON(inputs) }}
|
|
49
|
+
|
|
50
|
+
build:
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
name: Lint & Build
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
|
|
55
|
+
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3
|
|
56
|
+
with:
|
|
57
|
+
cache: npm
|
|
58
|
+
node-version: lts/*
|
|
59
|
+
- run: npm ci
|
|
60
|
+
# Linting can be skipped
|
|
61
|
+
- run: npm run lint --if-present
|
|
62
|
+
if: github.event.inputs.test != 'false'
|
|
63
|
+
# But not the build script, as semantic-release will crash if this command fails so it makes sense to test it early
|
|
64
|
+
- run: npm run prepublishOnly --if-present
|
|
65
|
+
|
|
66
|
+
# test:
|
|
67
|
+
# needs: build
|
|
68
|
+
# # The test matrix can be skipped, in case a new release needs to be fast-tracked and tests are already passing on main
|
|
69
|
+
# if: github.event.inputs.test != 'false'
|
|
70
|
+
# runs-on: ${{ matrix.os }}
|
|
71
|
+
# name: Node.js ${{ matrix.node }} / ${{ matrix.os }}
|
|
72
|
+
# strategy:
|
|
73
|
+
# # A test failing on windows doesn't mean it'll fail on macos. It's useful to let all tests run to its completion to get the full picture
|
|
74
|
+
# fail-fast: false
|
|
75
|
+
# matrix:
|
|
76
|
+
# # Run the testing suite on each major OS with the latest LTS release of Node.js
|
|
77
|
+
# os: [macos-latest, ubuntu-latest, windows-latest]
|
|
78
|
+
# node: [lts/*]
|
|
79
|
+
# # It makes sense to also test the oldest, and latest, versions of Node.js, on ubuntu-only since it's the fastest CI runner
|
|
80
|
+
# include:
|
|
81
|
+
# - os: ubuntu-latest
|
|
82
|
+
# # Test the oldest LTS release of Node that's still receiving bugfixes and security patches, versions older than that have reached End-of-Life
|
|
83
|
+
# node: lts/-2
|
|
84
|
+
# - os: ubuntu-latest
|
|
85
|
+
# # Test the actively developed version that will become the latest LTS release next October
|
|
86
|
+
# node: current
|
|
87
|
+
# steps:
|
|
88
|
+
# # It's only necessary to do this for windows, as mac and ubuntu are sane OS's that already use LF
|
|
89
|
+
# - name: Set git to use LF
|
|
90
|
+
# if: matrix.os == 'windows-latest'
|
|
91
|
+
# run: |
|
|
92
|
+
# git config --global core.autocrlf false
|
|
93
|
+
# git config --global core.eol lf
|
|
94
|
+
# - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
|
|
95
|
+
# - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3
|
|
96
|
+
# with:
|
|
97
|
+
# cache: npm
|
|
98
|
+
# node-version: ${{ matrix.node }}
|
|
99
|
+
# - run: npm i
|
|
100
|
+
# - run: npm test --if-present
|
|
101
|
+
|
|
102
|
+
release:
|
|
103
|
+
# needs: [build, test]
|
|
104
|
+
needs: [build]
|
|
105
|
+
# only run if opt-in during workflow_dispatch
|
|
106
|
+
if: always() && github.event.inputs.release == 'true' && needs.build.result != 'failure' && needs.test.result != 'failure' && needs.test.result != 'cancelled'
|
|
107
|
+
runs-on: ubuntu-latest
|
|
108
|
+
name: Semantic release
|
|
109
|
+
steps:
|
|
110
|
+
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
|
|
111
|
+
with:
|
|
112
|
+
# Need to fetch entire commit history to
|
|
113
|
+
# analyze every commit since last release
|
|
114
|
+
fetch-depth: 0
|
|
115
|
+
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3
|
|
116
|
+
with:
|
|
117
|
+
cache: npm
|
|
118
|
+
node-version: lts/*
|
|
119
|
+
- run: npm ci
|
|
120
|
+
# Branches that will release new versions are defined in .releaserc.json
|
|
121
|
+
- run: npx semantic-release
|
|
122
|
+
# Don't allow interrupting the release step if the job is cancelled, as it can lead to an inconsistent state
|
|
123
|
+
# e.g. git tags were pushed but it exited before `npm publish`
|
|
124
|
+
if: always()
|
|
125
|
+
env:
|
|
126
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
127
|
+
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
|
128
|
+
# Re-run semantic release with rich logs if it failed to publish for easier debugging
|
|
129
|
+
- run: npx semantic-release --dry-run --debug
|
|
130
|
+
if: failure()
|
|
131
|
+
env:
|
|
132
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
133
|
+
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
package/.releaserc.json
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- markdownlint-disable --><!-- textlint-disable -->
|
|
2
|
+
|
|
3
|
+
# 📓 Changelog
|
|
4
|
+
|
|
5
|
+
All notable changes to this project will be documented in this file. See
|
|
6
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
|
+
|
|
8
|
+
## [0.1.0](https://github.com/sanity-io/dashboard-widget-document-list/compare/v0.0.13...v0.1.0) (2022-11-22)
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
- make semantic-release happy (not really a feat) ([afe6342](https://github.com/sanity-io/dashboard-widget-document-list/commit/afe634251827e4651422ea82e4841954447d2e35))
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- added workflow so it can be triggered from v3 ([1fcacd7](https://github.com/sanity-io/dashboard-widget-document-list/commit/1fcacd76267754c7a8c8480ceb04d10c3fda981b))
|
|
17
|
+
- **ci:** publish using semantic-release ([8f5b196](https://github.com/sanity-io/dashboard-widget-document-list/commit/8f5b1964c484552bc712d88c962c94f9cf150004))
|
|
18
|
+
- typo ([3929617](https://github.com/sanity-io/dashboard-widget-document-list/commit/39296177e02b56c4748eff1fcaabcd275e746c06))
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2022, Sanity.io <hello@sanity.io>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to
|
package/README.md
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
# dashboard-widget-document-list
|
|
2
|
-
Dashboard widget for the Sanity Content Studio which displays a list of documents
|
|
3
2
|
|
|
3
|
+
>This is a **Sanity Studio v2** plugin.
|
|
4
|
+
> For the v3 version, please refer to the [v3-branch](https://github.com/sanity-io/dashboard-widget-document-list).
|
|
4
5
|
|
|
6
|
+
Dashboard widget for the Sanity Content Studio which displays a list of documents
|
|
5
7
|
|
|
6
8
|
## Usage
|
|
7
9
|
Assuming you already have a functional Dashboard in your Sanity Content Studio.
|
|
8
10
|
|
|
9
11
|
1. Install this widget in your Studio folder like so:
|
|
10
12
|
|
|
13
|
+
```sh
|
|
14
|
+
yarn add sanity-plugin-dashboard-widget-document-list@studio-v2
|
|
11
15
|
```
|
|
12
|
-
|
|
16
|
+
|
|
17
|
+
Next, add `"dashboard-widget-document-list"` to `sanity.json` plugins array:
|
|
18
|
+
```json
|
|
19
|
+
"plugins": [
|
|
20
|
+
"dashboard-widget-document-list"
|
|
21
|
+
]
|
|
13
22
|
```
|
|
14
23
|
|
|
15
24
|
2. Update your `src/dashboardConfig.js` file by adding `{name: 'document-list'}` to the `widgets` array
|
package/package.json
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"public": true,
|
|
3
2
|
"name": "sanity-plugin-dashboard-widget-document-list",
|
|
4
|
-
"version": "0.0
|
|
5
|
-
"author": "Sanity.io <hello@sanity.io>",
|
|
3
|
+
"version": "0.1.0",
|
|
6
4
|
"description": "Example dashboard widget for Sanity Content Studio",
|
|
7
|
-
"homepage": "https://github.com/sanity-io/dashboard-widget-document-list#readme",
|
|
8
5
|
"keywords": [
|
|
9
6
|
"sanity",
|
|
10
7
|
"plugin",
|
|
@@ -13,23 +10,33 @@
|
|
|
13
10
|
"widget",
|
|
14
11
|
"documents"
|
|
15
12
|
],
|
|
16
|
-
"
|
|
17
|
-
"license": "MIT",
|
|
13
|
+
"homepage": "https://github.com/sanity-io/dashboard-widget-document-list#readme",
|
|
18
14
|
"bugs": {
|
|
19
15
|
"url": "https://github.com/sanity-io/dashboard-widget-document-list/issues"
|
|
20
16
|
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git@github.com:sanity-io/dashboard-widget-document-list.git"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "Sanity.io <hello@sanity.io>",
|
|
23
|
+
"main": "lib/index.js",
|
|
21
24
|
"scripts": {
|
|
25
|
+
"prebuild": "npm run clean",
|
|
22
26
|
"build": "sanipack build",
|
|
23
|
-
"test": "sanipack verify",
|
|
24
27
|
"clean": "rimraf lib",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
28
|
+
"prepublishOnly": "npm run build && npm test",
|
|
29
|
+
"test": "sanipack verify"
|
|
27
30
|
},
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"lodash": "^4.17.15",
|
|
33
|
+
"prop-types": "^15.7.2",
|
|
34
|
+
"rxjs": "^6.0.0"
|
|
31
35
|
},
|
|
32
36
|
"devDependencies": {
|
|
37
|
+
"@commitlint/cli": "^17.1.2",
|
|
38
|
+
"@commitlint/config-conventional": "^17.1.0",
|
|
39
|
+
"@sanity/semantic-release-preset": "^2.0.1",
|
|
33
40
|
"babel-eslint": "^7.2.3",
|
|
34
41
|
"eslint": "^4.3.0",
|
|
35
42
|
"eslint-config-sanity": "^2.1.4",
|
|
@@ -41,9 +48,5 @@
|
|
|
41
48
|
"@sanity/base": ">=1",
|
|
42
49
|
"react": "^16 || ^17"
|
|
43
50
|
},
|
|
44
|
-
"
|
|
45
|
-
"lodash": "^4.17.15",
|
|
46
|
-
"prop-types": "^15.7.2",
|
|
47
|
-
"rxjs": "^6.0.0"
|
|
48
|
-
}
|
|
51
|
+
"public": true
|
|
49
52
|
}
|