Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@sanity/scheduled-publishing
Advanced tools
Readme
This is a Sanity Studio v3 plugin. For the v2 version, please refer to the v2-branch.
Schedule your content for future publication and organise upcoming releases – no custom tasks or serverless functions required!
This plugin uses Sanity's Scheduling API which is available to customers on Growth or higher plans.
npm install --save @sanity/scheduled-publishing
or
yarn add @sanity/scheduled-publishing
Add it as a plugin in sanity.config.ts (or .js):
import {scheduledPublishing} from '@sanity/scheduled-publishing'
export default defineConfig({
// ...
plugins: [scheduledPublishing()],
})
This will automatically:
To change the date formatting used when creating and editing schedules, pass a valid date-fns
formatted token as an option.
plugins: [
// Make sure to specify a time component if you're specifying a custom format!
scheduledPublishing({
// E.g. 12/25/2000 6:30 AM
inputDateTimeFormat: 'MM/dd/yyyy h:mm a',
})
],
If left unspecified, this plugin will default to dd/MM/yyyy HH:mm
.
This example assumes you've customized your document actions and would like to only show the Schedule button on movie
documents only.
The Schedule document action allows users to both create and edit existing schedules directly from the form editor. It is added to all document types by the plugin, so you should remove it from types that should NOT have it.
import {scheduledPublishing, ScheduleAction} from '@sanity/scheduled-publishing'
export default defineConfig({
// ...
plugins: [scheduledPublishing()],
document: {
actions: (previousActions, {schemaType}) => {
/*
* Please note that this will only alter the visibility of the button in the studio.
* Users with document publish permissions will be able to create schedules directly
* via the Scheduled Publishing API.
*/
if (schemaType.name !== 'movie') {
// Remove the schedule action from any documents that is not 'movie'.
return previousActions.filter((action) => action !== ScheduleAction)
}
return previousActions
},
},
})
This example assumes you've customised your own document badges and would like to only show the Scheduled badge on movie
documents only.
The Scheduled document badge displays whether the current document is scheduled and when it will be published if so. It is added to all document types by the plugin, so you should remove it from types that should NOT have it.
import {scheduledPublishing, ScheduledBadge} from '@sanity/scheduled-publishing'
export default defineConfig({
// ...
plugins: [scheduledPublishing()],
document: {
actions: (previousBadges, {schemaType}) => {
if (schemaType.name !== 'movie') {
// Remove the schedule badge from any documents that is not 'movie'.
return previousBadges.filter((badge) => badge !== ScheduledBadge)
}
return previousBadges
},
},
})
Schedules sit adjacent to your dataset and can be managed using the Scheduling API (which this plugin does for you).
Schedules are a unique resource and are linked to, but do not exist within your Sanity project and dataset. It's important to understand the following behavior:
sanity dataset export
will not include schedules and sanity dataset import
does not support importing schedules.More information can be found on the Scheduling API page.
Time zones and their corresponding cities, regions and daylight savings offsets are directly sourced from the @vvo/dztb library, which is automatically updated with data from geonames.org.
Latest time zone + region data from @vvo/dztb is pulled in when first installing this plugin.
In the event you need to bring in upstream time zone and region data, run:
# Yarn
yarn upgrade @sanity/scheduled-publishing
# NPM
npm update @vvo/tzdb --legacy-peer-deps
The Studio V3 version differs from the v2 versions in a few ways:
This plugin uses @sanity/plugin-kit with default configuration for build & watch scripts.
See Testing a plugin in Sanity Studio on how to run this plugin with hot-reload in the studio.
Run the CI & Release workflow. Make sure to select the main branch and check "Release new version".
Semantic release will only release on configured branches, so it is safe to run release on any branch.
This repository is published under the MIT license.
FAQs
> This is a **Sanity Studio v3** plugin. > For the v2 version, please refer to the [v2-branch](https://github.com/sanity-io/sanity-plugin-scheduled-publishing/tree/studio-v2).
The npm package @sanity/scheduled-publishing receives a total of 13,317 weekly downloads. As such, @sanity/scheduled-publishing popularity was classified as popular.
We found that @sanity/scheduled-publishing demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 44 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.