├── src ├── vue │ ├── prismicImage.md │ ├── prismicText.md │ ├── prismicEmbed.md │ ├── prismicLink.md │ ├── prismicRichText.md │ ├── prismicSliceZone.md │ ├── prismicGroup.md │ ├── prismicSliceScaffold.md │ └── prismicSliceSimulatorScaffold.md ├── react │ ├── prismicText.md │ ├── prismicToolbar.md │ ├── prismicRichText.md │ ├── prismicLink.md │ ├── prismicImage.md │ ├── prismicSliceZone.md │ ├── prismicProvider.md │ ├── prismicGroup.md │ ├── prismicSliceScaffold--ts.md │ ├── prismicSliceScaffold.md │ └── prismicSliceSimulatorScaffold.md └── js │ ├── prismicRouteResolverScaffold.md │ ├── prismicLinkResolverScaffold.md │ ├── prismicLinkResolverScaffold--ts.md │ ├── prismicHTMLSerializerScaffold.md │ └── prismicHTMLSerializerScaffold--ts.md ├── .editorconfig ├── sublime └── snippets │ ├── javascript-prismic-text.sublime-snippet │ ├── javascriptreact-prismic-text.sublime-snippet │ ├── typescriptreact-prismic-text.sublime-snippet │ ├── vue-html-prismic-image.sublime-snippet │ ├── javascript-prismic-rich-text.sublime-snippet │ ├── javascript-prismic-toolbar.sublime-snippet │ ├── javascriptreact-prismic-rich-text.sublime-snippet │ ├── javascriptreact-prismic-toolbar.sublime-snippet │ ├── typescriptreact-prismic-rich-text.sublime-snippet │ ├── typescriptreact-prismic-toolbar.sublime-snippet │ ├── vue-html-prismic-text.sublime-snippet │ ├── vue-html-prismic-embed.sublime-snippet │ ├── javascript-prismic-link.sublime-snippet │ ├── javascript-prismic-slicezone.sublime-snippet │ ├── javascriptreact-prismic-slicezone.sublime-snippet │ ├── typescriptreact-prismic-slicezone.sublime-snippet │ ├── vue-html-prismic-link.sublime-snippet │ ├── javascriptreact-prismic-link.sublime-snippet │ ├── typescriptreact-prismic-link.sublime-snippet │ ├── vue-html-prismic-rich-text.sublime-snippet │ ├── javascript-prismic-provider.sublime-snippet │ ├── vue-html-prismic-slicezone.sublime-snippet │ ├── javascriptreact-prismic-provider.sublime-snippet │ ├── typescriptreact-prismic-provider.sublime-snippet │ ├── vue-html-prismic-group.sublime-snippet │ ├── javascript-prismic-group.sublime-snippet │ ├── javascriptreact-prismic-group.sublime-snippet │ ├── typescriptreact-prismic-group.sublime-snippet │ ├── javascript-prismic-route-resolver-scaffold.sublime-snippet │ ├── typescript-prismic-route-resolver-scaffold.sublime-snippet │ ├── typescriptreact-prismic-slice-scaffold.sublime-snippet │ ├── javascript-prismic-slice-scaffold.sublime-snippet │ ├── javascriptreact-prismic-slice-scaffold.sublime-snippet │ ├── javascript-prismic-link-resolver-scaffold.sublime-snippet │ ├── typescript-prismic-link-resolver-scaffold.sublime-snippet │ ├── javascript-prismic-html-serializer-scaffold.sublime-snippet │ ├── typescript-prismic-html-serializer-scaffold.sublime-snippet │ ├── vue-prismic-slice-scaffold.sublime-snippet │ ├── javascript-prismic-slice-simulator-scaffold.sublime-snippet │ ├── javascriptreact-prismic-slice-simulator-scaffold.sublime-snippet │ ├── typescriptreact-prismic-slice-simulator-scaffold.sublime-snippet │ └── vue-prismic-slice-simulator-scaffold.sublime-snippet ├── tsconfig.json ├── .prettierrc ├── .gitattributes ├── .gitignore ├── .eslintignore ├── .prettierignore ├── schnipsel.config.ts ├── .eslintrc.cjs ├── .versionrc ├── package.json ├── CHANGELOG.md ├── README.md ├── LICENSE └── CONTRIBUTING.md /src/vue/prismicImage.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Image" 3 | description: "Yields a ready-to-use `` component" 4 | scopes: ["vue-html", "html"] 5 | prefix: "prismicImage" 6 | --- 7 | 8 | ```html 9 | 10 | ``` 11 | -------------------------------------------------------------------------------- /src/vue/prismicText.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Text" 3 | description: "Yields a ready-to-use `` component" 4 | scopes: ["vue-html", "html"] 5 | prefix: "prismicText" 6 | --- 7 | 8 | ```html 9 | 10 | ``` 11 | -------------------------------------------------------------------------------- /src/react/prismicText.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Text" 3 | description: "Yields a ready-to-use `` component" 4 | scopes: ["javascript", "javascriptreact", "typescriptreact"] 5 | prefix: "prismicText" 6 | --- 7 | 8 | ```jsx 9 | 10 | ``` 11 | -------------------------------------------------------------------------------- /src/vue/prismicEmbed.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Embed" 3 | description: "Yields a ready-to-use `` component" 4 | scopes: ["vue-html", "html"] 5 | prefix: "prismicEmbed" 6 | --- 7 | 8 | ```html 9 | 10 | ``` 11 | -------------------------------------------------------------------------------- /src/vue/prismicLink.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Link" 3 | description: "Yields a ready-to-use `` component" 4 | scopes: ["vue-html", "html"] 5 | prefix: "prismicLink" 6 | --- 7 | 8 | ```html 9 | 10 | ${2} 11 | 12 | ``` 13 | -------------------------------------------------------------------------------- /src/vue/prismicRichText.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Rich Text" 3 | description: "Yields a ready-to-use `` component" 4 | scopes: ["vue-html", "html"] 5 | prefix: "prismicRichText" 6 | --- 7 | 8 | ```html 9 | 10 | ``` 11 | -------------------------------------------------------------------------------- /src/react/prismicToolbar.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Toolbar" 3 | description: "Yields a ready-to-use `` component" 4 | scopes: ["javascript", "javascriptreact", "typescriptreact"] 5 | prefix: "prismicToolbar" 6 | --- 7 | 8 | ```jsx 9 | 10 | ``` 11 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = tab 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.yml] 15 | indent_style = space 16 | indent_size = 2 17 | -------------------------------------------------------------------------------- /src/react/prismicRichText.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Rich Text" 3 | description: "Yields a ready-to-use `` component" 4 | scopes: ["javascript", "javascriptreact", "typescriptreact"] 5 | prefix: "prismicRichText" 6 | --- 7 | 8 | ```jsx 9 | 10 | ``` 11 | -------------------------------------------------------------------------------- /src/react/prismicLink.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Link" 3 | description: "Yields a ready-to-use `` component" 4 | scopes: ["javascript", "javascriptreact", "typescriptreact"] 5 | prefix: "prismicLink" 6 | --- 7 | 8 | ```jsx 9 | 10 | ${2} 11 | 12 | ``` 13 | -------------------------------------------------------------------------------- /sublime/snippets/javascript-prismic-text.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicText 6 | source.js 7 | Yields a ready-to-use `<PrismicText />` component 8 | 9 | -------------------------------------------------------------------------------- /src/vue/prismicSliceZone.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic SliceZone" 3 | description: "Yields a ready-to-use `` component" 4 | scopes: ["vue-html", "html"] 5 | prefix: "prismicSliceZone" 6 | --- 7 | 8 | ```html 9 | 10 | ``` 11 | -------------------------------------------------------------------------------- /sublime/snippets/javascriptreact-prismic-text.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicText 6 | source.jsx 7 | Yields a ready-to-use `<PrismicText />` component 8 | 9 | -------------------------------------------------------------------------------- /sublime/snippets/typescriptreact-prismic-text.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicText 6 | source.tsx 7 | Yields a ready-to-use `<PrismicText />` component 8 | 9 | -------------------------------------------------------------------------------- /sublime/snippets/vue-html-prismic-image.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicImage 6 | text.html.vue 7 | Yields a ready-to-use `<PrismicImage />` component 8 | 9 | -------------------------------------------------------------------------------- /src/react/prismicImage.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Image" 3 | description: "Yields a ready-to-use `` component" 4 | # scopes: ["javascript", "javascriptreact", "typescriptreact"] 5 | scopes: [] # empty for now 6 | prefix: "prismicImage" 7 | --- 8 | 9 | ```jsx 10 | 11 | ``` 12 | -------------------------------------------------------------------------------- /src/react/prismicSliceZone.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic SliceZone" 3 | description: "Yields a ready-to-use `` component" 4 | scopes: ["javascript", "javascriptreact", "typescriptreact"] 5 | prefix: "prismicSliceZone" 6 | --- 7 | 8 | ```jsx 9 | 10 | ``` 11 | -------------------------------------------------------------------------------- /src/vue/prismicGroup.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Group" 3 | description: "Yields a ready-to-use Group field/Slice repeatable template" 4 | scopes: ["vue-html", "html"] 5 | prefix: "prismicGroup" 6 | --- 7 | 8 | ```html 9 | <${3:div} v-for="${2:item} in ${1:slice.items}" :key="${2:item}"> 10 | {{ ${2:item} }}${4} 11 | 12 | ``` 13 | -------------------------------------------------------------------------------- /sublime/snippets/javascript-prismic-rich-text.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicRichText 6 | source.js 7 | Yields a ready-to-use `<PrismicRichText />` component 8 | 9 | -------------------------------------------------------------------------------- /sublime/snippets/javascript-prismic-toolbar.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicToolbar 6 | source.js 7 | Yields a ready-to-use `<PrismicToolbar />` component 8 | 9 | -------------------------------------------------------------------------------- /sublime/snippets/javascriptreact-prismic-rich-text.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicRichText 6 | source.jsx 7 | Yields a ready-to-use `<PrismicRichText />` component 8 | 9 | -------------------------------------------------------------------------------- /sublime/snippets/javascriptreact-prismic-toolbar.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicToolbar 6 | source.jsx 7 | Yields a ready-to-use `<PrismicToolbar />` component 8 | 9 | -------------------------------------------------------------------------------- /sublime/snippets/typescriptreact-prismic-rich-text.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicRichText 6 | source.tsx 7 | Yields a ready-to-use `<PrismicRichText />` component 8 | 9 | -------------------------------------------------------------------------------- /sublime/snippets/typescriptreact-prismic-toolbar.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicToolbar 6 | source.tsx 7 | Yields a ready-to-use `<PrismicToolbar />` component 8 | 9 | -------------------------------------------------------------------------------- /sublime/snippets/vue-html-prismic-text.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicText 6 | text.html.vue 7 | Yields a ready-to-use `<PrismicText />` component 8 | 9 | -------------------------------------------------------------------------------- /src/react/prismicProvider.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Provider" 3 | description: "Yields a ready-to-use `` component" 4 | scopes: ["javascript", "javascriptreact", "typescriptreact"] 5 | prefix: "prismicProvider" 6 | --- 7 | 8 | ```jsx 9 | 10 | {children}${2} 11 | 12 | ``` 13 | -------------------------------------------------------------------------------- /sublime/snippets/vue-html-prismic-embed.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicEmbed 6 | text.html.vue 7 | Yields a ready-to-use `<PrismicEmbed />` component 8 | 9 | -------------------------------------------------------------------------------- /sublime/snippets/javascript-prismic-link.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ${2} 5 | 6 | ]]> 7 | prismicLink 8 | source.js 9 | Yields a ready-to-use `<PrismicLink />` component 10 | 11 | -------------------------------------------------------------------------------- /sublime/snippets/javascript-prismic-slicezone.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicSliceZone 6 | source.js 7 | Yields a ready-to-use `<SliceZone />` component 8 | 9 | -------------------------------------------------------------------------------- /sublime/snippets/javascriptreact-prismic-slicezone.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicSliceZone 6 | source.jsx 7 | Yields a ready-to-use `<SliceZone />` component 8 | 9 | -------------------------------------------------------------------------------- /sublime/snippets/typescriptreact-prismic-slicezone.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicSliceZone 6 | source.tsx 7 | Yields a ready-to-use `<SliceZone />` component 8 | 9 | -------------------------------------------------------------------------------- /sublime/snippets/vue-html-prismic-link.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ${2} 5 | 6 | ]]> 7 | prismicLink 8 | text.html.vue 9 | Yields a ready-to-use `<PrismicLink />` component 10 | 11 | -------------------------------------------------------------------------------- /sublime/snippets/javascriptreact-prismic-link.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ${2} 5 | 6 | ]]> 7 | prismicLink 8 | source.jsx 9 | Yields a ready-to-use `<PrismicLink />` component 10 | 11 | -------------------------------------------------------------------------------- /sublime/snippets/typescriptreact-prismic-link.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ${2} 5 | 6 | ]]> 7 | prismicLink 8 | source.tsx 9 | Yields a ready-to-use `<PrismicLink />` component 10 | 11 | -------------------------------------------------------------------------------- /sublime/snippets/vue-html-prismic-rich-text.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicRichText 6 | text.html.vue 7 | Yields a ready-to-use `<PrismicRichText />` component 8 | 9 | -------------------------------------------------------------------------------- /sublime/snippets/javascript-prismic-provider.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | {children}${2} 5 | 6 | ]]> 7 | prismicProvider 8 | source.js 9 | Yields a ready-to-use `<PrismicProvider />` component 10 | 11 | -------------------------------------------------------------------------------- /sublime/snippets/vue-html-prismic-slicezone.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ]]> 5 | prismicSliceZone 6 | text.html.vue 7 | Yields a ready-to-use `<SliceZone />` component 8 | 9 | -------------------------------------------------------------------------------- /src/react/prismicGroup.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Group" 3 | description: "Yields a ready-to-use Group field/Slice repeatable template" 4 | scopes: ["javascript", "javascriptreact", "typescriptreact"] 5 | prefix: "prismicGroup" 6 | --- 7 | 8 | ```jsx 9 | {${1:slice.items}.map((${2:item}) => ( 10 | <${3:div} key={${2:item}}> 11 | {{ ${2:item} }}${4} 12 | 13 | ))} 14 | ``` 15 | -------------------------------------------------------------------------------- /sublime/snippets/javascriptreact-prismic-provider.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | {children}${2} 5 | 6 | ]]> 7 | prismicProvider 8 | source.jsx 9 | Yields a ready-to-use `<PrismicProvider />` component 10 | 11 | -------------------------------------------------------------------------------- /sublime/snippets/typescriptreact-prismic-provider.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | {children}${2} 5 | 6 | ]]> 7 | prismicProvider 8 | source.tsx 9 | Yields a ready-to-use `<PrismicProvider />` component 10 | 11 | -------------------------------------------------------------------------------- /sublime/snippets/vue-html-prismic-group.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | {{ ${2:item} }}${4} 5 | 6 | ]]> 7 | prismicGroup 8 | text.html.vue 9 | Yields a ready-to-use Group field/Slice repeatable template 10 | 11 | -------------------------------------------------------------------------------- /src/react/prismicSliceScaffold--ts.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Slice Scaffold" 3 | description: "Yields a ready-to-use Slice components scaffold" 4 | scopes: ["typescriptreact"] 5 | prefix: "prismicSliceScaffold" 6 | --- 7 | 8 | ```jsx 9 | import { SliceComponentProps } from "@prismicio/react"; 10 | 11 | export default function ${1:SliceName}({ slice }: SliceComponentProps) { 12 | return (${2}); 13 | }; 14 | ``` 15 | -------------------------------------------------------------------------------- /sublime/snippets/javascript-prismic-group.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | ( 4 | <${3:div} key={${2:item}}> 5 | {{ ${2:item} }}${4} 6 | 7 | ))} 8 | ]]> 9 | prismicGroup 10 | source.js 11 | Yields a ready-to-use Group field/Slice repeatable template 12 | 13 | -------------------------------------------------------------------------------- /sublime/snippets/javascriptreact-prismic-group.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | ( 4 | <${3:div} key={${2:item}}> 5 | {{ ${2:item} }}${4} 6 | 7 | ))} 8 | ]]> 9 | prismicGroup 10 | source.jsx 11 | Yields a ready-to-use Group field/Slice repeatable template 12 | 13 | -------------------------------------------------------------------------------- /sublime/snippets/typescriptreact-prismic-group.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | ( 4 | <${3:div} key={${2:item}}> 5 | {{ ${2:item} }}${4} 6 | 7 | ))} 8 | ]]> 9 | prismicGroup 10 | source.tsx 11 | Yields a ready-to-use Group field/Slice repeatable template 12 | 13 | -------------------------------------------------------------------------------- /src/js/prismicRouteResolverScaffold.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Route Resolver Scaffold" 3 | description: "Yields a ready-to-use Route Resolver scaffold" 4 | scopes: ["javascript", "typescript"] 5 | prefix: "prismicRouteResolverScaffold" 6 | --- 7 | 8 | ```javascript 9 | [ 10 | { 11 | type: "${1:page}", 12 | path: "${2:path}", 13 | // resolver: { 14 | // parent: "${4:parent_page}", 15 | // } 16 | } 17 | ] 18 | ``` 19 | -------------------------------------------------------------------------------- /src/react/prismicSliceScaffold.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Slice Scaffold" 3 | description: "Yields a ready-to-use Slice components scaffold" 4 | scopes: ["javascript", "javascriptreact"] 5 | prefix: "prismicSliceScaffold" 6 | --- 7 | 8 | ```jsx 9 | export default function ${1:SliceName}( 10 | /** 11 | * @type {import("@prismicio/react").SliceComponentProps} 12 | */ 13 | { slice } 14 | ) { 15 | return (${2}); 16 | }; 17 | ``` 18 | -------------------------------------------------------------------------------- /sublime/snippets/javascript-prismic-route-resolver-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 13 | prismicRouteResolverScaffold 14 | source.js 15 | Yields a ready-to-use Route Resolver scaffold 16 | 17 | -------------------------------------------------------------------------------- /sublime/snippets/typescript-prismic-route-resolver-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 13 | prismicRouteResolverScaffold 14 | source.ts 15 | Yields a ready-to-use Route Resolver scaffold 16 | 17 | -------------------------------------------------------------------------------- /sublime/snippets/typescriptreact-prismic-slice-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 9 | prismicSliceScaffold 10 | source.tsx 11 | Yields a ready-to-use Slice components scaffold 12 | 13 | -------------------------------------------------------------------------------- /sublime/snippets/javascript-prismic-slice-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 12 | prismicSliceScaffold 13 | source.js 14 | Yields a ready-to-use Slice components scaffold 15 | 16 | -------------------------------------------------------------------------------- /sublime/snippets/javascriptreact-prismic-slice-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 12 | prismicSliceScaffold 13 | source.jsx 14 | Yields a ready-to-use Slice components scaffold 15 | 16 | -------------------------------------------------------------------------------- /src/js/prismicLinkResolverScaffold.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Link Resolver Scaffold" 3 | description: "Yields a ready-to-use Link Resolver scaffold" 4 | scopes: ["javascript"] 5 | prefix: "prismicLinkResolverScaffold" 6 | --- 7 | 8 | ```javascript 9 | /** 10 | * @type {import("@prismicio/helpers").LinkResolverFunction} 11 | */ 12 | const linkResolver = (doc) => { 13 | if (doc.isBroken) { 14 | return "/404"; 15 | } 16 | 17 | if (doc.type === "${1:page}") { 18 | return `/${${2:doc.uid}}`; 19 | } 20 | }; 21 | ``` 22 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "strict": true, 4 | "skipLibCheck": true, 5 | 6 | "target": "esnext", 7 | "module": "esnext", 8 | "declaration": false, 9 | "moduleResolution": "node", 10 | "resolveJsonModule": true, 11 | "allowSyntheticDefaultImports": true, 12 | "esModuleInterop": true, 13 | 14 | "forceConsistentCasingInFileNames": true, 15 | "jsx": "preserve", 16 | "lib": ["esnext", "dom"], 17 | "types": ["node"] 18 | }, 19 | "exclude": ["node_modules", "dist", "examples"] 20 | } 21 | -------------------------------------------------------------------------------- /src/js/prismicLinkResolverScaffold--ts.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Link Resolver Scaffold" 3 | description: "Yields a ready-to-use Link Resolver scaffold" 4 | scopes: ["typescript"] 5 | prefix: "prismicLinkResolverScaffold" 6 | --- 7 | 8 | ```typescript 9 | import * as prismicH from "@prismicio/helpers"; 10 | 11 | const linkResolver: prismicH.LinkResolverFunction = (doc) => { 12 | if (doc.isBroken) { 13 | return "/404"; 14 | } 15 | 16 | if (doc.type === "${1:page}") { 17 | return `/${${2:doc.uid}}`; 18 | } 19 | }; 20 | ``` 21 | -------------------------------------------------------------------------------- /src/js/prismicHTMLSerializerScaffold.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic HTML Serializer Scaffold" 3 | description: "Yields a ready-to-use HTML Serializer scaffold" 4 | scopes: ["javascript"] 5 | prefix: "prismicHTMLSerializerScaffold" 6 | --- 7 | 8 | ```javascript 9 | /** 10 | * @type {import("@prismicio/helpers").HTMLMapSerializer} 11 | */ 12 | const htmlSerializer = { 13 | // Those are just examples, update them and add your own~ 14 | heading1: ({ children }) => `

\${children}

`, 15 | paragraph: ({ children }) => `

\${children}

`, 16 | }; 17 | ``` 18 | -------------------------------------------------------------------------------- /sublime/snippets/javascript-prismic-link-resolver-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 7 | if (doc.isBroken) { 8 | return "/404"; 9 | } 10 | 11 | if (doc.type === "${1:page}") { 12 | return `/${${2:doc.uid}}`; 13 | } 14 | }; 15 | ]]> 16 | prismicLinkResolverScaffold 17 | source.js 18 | Yields a ready-to-use Link Resolver scaffold 19 | 20 | -------------------------------------------------------------------------------- /src/js/prismicHTMLSerializerScaffold--ts.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic HTML Serializer Scaffold" 3 | description: "Yields a ready-to-use HTML Serializer scaffold" 4 | scopes: ["typescript"] 5 | prefix: "prismicHTMLSerializerScaffold" 6 | --- 7 | 8 | ```typescript 9 | import * as prismicH from "@prismicio/helpers"; 10 | 11 | const htmlSerializer: prismicH.HTMLMapSerializer = { 12 | // Those are just examples, update them and add your own~ 13 | heading1: ({ children }) => `

\${children}

`, 14 | paragraph: ({ children }) => `

\${children}

`, 15 | }; 16 | ``` 17 | -------------------------------------------------------------------------------- /sublime/snippets/typescript-prismic-link-resolver-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | = (doc) => { 6 | if (doc.isBroken) { 7 | return "/404"; 8 | } 9 | 10 | if (doc.type === "${1:page}") { 11 | return `/${${2:doc.uid}}`; 12 | } 13 | }; 14 | ]]> 15 | prismicLinkResolverScaffold 16 | source.ts 17 | Yields a ready-to-use Link Resolver scaffold 18 | 19 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["prettier-plugin-jsdoc"], 3 | "jsdocSeparateReturnsFromParam": true, 4 | "jsdocSeparateTagGroups": true, 5 | "jsdocSingleLineComment": false, 6 | "tsdoc": true, 7 | "printWidth": 80, 8 | "useTabs": true, 9 | "semi": true, 10 | "singleQuote": false, 11 | "quoteProps": "as-needed", 12 | "jsxSingleQuote": false, 13 | "trailingComma": "all", 14 | "bracketSpacing": true, 15 | "bracketSameLine": false, 16 | "arrowParens": "always", 17 | "requirePragma": false, 18 | "insertPragma": false, 19 | "htmlWhitespaceSensitivity": "css", 20 | "endOfLine": "lf" 21 | } 22 | -------------------------------------------------------------------------------- /sublime/snippets/javascript-prismic-html-serializer-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | `

\${children}

`, 9 | paragraph: ({ children }) => `

\${children}

`, 10 | }; 11 | ]]>
12 | prismicHTMLSerializerScaffold 13 | source.js 14 | Yields a ready-to-use HTML Serializer scaffold 15 |
16 | -------------------------------------------------------------------------------- /sublime/snippets/typescript-prismic-html-serializer-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | `

\${children}

`, 8 | paragraph: ({ children }) => `

\${children}

`, 9 | }; 10 | ]]>
11 | prismicHTMLSerializerScaffold 12 | source.ts 13 | Yields a ready-to-use HTML Serializer scaffold 14 |
15 | -------------------------------------------------------------------------------- /src/vue/prismicSliceScaffold.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Slice Scaffold" 3 | description: "Yields a ready-to-use Slice components scaffold" 4 | scopes: ["vue"] 5 | prefix: "prismicSliceScaffold" 6 | --- 7 | 8 | ```html 9 | 12 | 13 | 22 | ``` 23 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # asserts everything is text 2 | * text eol=lf 3 | 4 | # treats lock files as binaries to prevent merge headache 5 | package-lock.json -diff 6 | yarn.lock -diff 7 | 8 | # treats assets as binaries 9 | *.png binary 10 | *.jpg binary 11 | *.jpeg binary 12 | *.gif binary 13 | *.ico binary 14 | 15 | # custom 16 | 17 | # ignore generated files 18 | intellij/src/main/resources/liveTemplates/* -diff 19 | sublime/snippets/* -diff 20 | vscode/snippets/* -diff 21 | 22 | # ignore from exports 23 | .github export-ignore 24 | .vscode export-ignore 25 | intellij export-ignore 26 | scripts export-ignore 27 | vscode export-ignore 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # custom 2 | *.vsix 3 | vscode/README.md 4 | vscode/CHANGELOG.md 5 | vscode/LICENSE 6 | 7 | # intellij 8 | .idea 9 | .gradle 10 | gradle 11 | intellij/build 12 | 13 | # os 14 | .DS_Store 15 | ._* 16 | 17 | # node 18 | logs 19 | *.log 20 | node_modules 21 | 22 | # yarn 23 | yarn-debug.log* 24 | yarn-error.log* 25 | lerna-debug.log* 26 | .yarn-integrity 27 | yarn.lock 28 | 29 | # npm 30 | npm-debug.log* 31 | 32 | # tests 33 | coverage 34 | .eslintcache 35 | .nyc_output 36 | 37 | # .env 38 | .env 39 | .env.test 40 | .env*.local 41 | 42 | # vscode 43 | .vscode/* 44 | !.vscode/tasks.json 45 | !.vscode/launch.json 46 | *.code-workspace 47 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # .gitignore copy 2 | 3 | # custom 4 | *.vsix 5 | vscode/README.md 6 | vscode/CHANGELOG.md 7 | vscode/LICENSE 8 | 9 | # intellij 10 | .idea 11 | .gradle 12 | gradle 13 | intellij/build 14 | 15 | # os 16 | .DS_Store 17 | ._* 18 | 19 | # node 20 | logs 21 | *.log 22 | node_modules 23 | 24 | # yarn 25 | yarn-debug.log* 26 | yarn-error.log* 27 | lerna-debug.log* 28 | .yarn-integrity 29 | yarn.lock 30 | 31 | # npm 32 | npm-debug.log* 33 | 34 | # tests 35 | coverage 36 | .eslintcache 37 | .nyc_output 38 | 39 | # .env 40 | .env 41 | .env.test 42 | .env*.local 43 | 44 | # vscode 45 | .vscode/* 46 | !.vscode/tasks.json 47 | !.vscode/launch.json 48 | *.code-workspace 49 | -------------------------------------------------------------------------------- /sublime/snippets/vue-prismic-slice-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | ${1} 5 | 6 | 7 | 16 | ]]> 17 | prismicSliceScaffold 18 | text.html.vue 19 | Yields a ready-to-use Slice components scaffold 20 | 21 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # custom 2 | CHANGELOG.md 3 | 4 | # .gitignore copy 5 | 6 | # custom 7 | *.vsix 8 | vscode/README.md 9 | vscode/CHANGELOG.md 10 | vscode/LICENSE 11 | 12 | # intellij 13 | .idea 14 | .gradle 15 | gradle 16 | intellij/build 17 | 18 | # os 19 | .DS_Store 20 | ._* 21 | 22 | # node 23 | logs 24 | *.log 25 | node_modules 26 | 27 | # yarn 28 | yarn-debug.log* 29 | yarn-error.log* 30 | lerna-debug.log* 31 | .yarn-integrity 32 | yarn.lock 33 | 34 | # npm 35 | npm-debug.log* 36 | 37 | # tests 38 | coverage 39 | .eslintcache 40 | .nyc_output 41 | 42 | # .env 43 | .env 44 | .env.test 45 | .env*.local 46 | 47 | # vscode 48 | .vscode/* 49 | !.vscode/tasks.json 50 | !.vscode/launch.json 51 | *.code-workspace 52 | -------------------------------------------------------------------------------- /src/vue/prismicSliceSimulatorScaffold.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Slice Simulator Scaffold" 3 | description: "Yields a ready-to-use Slice Simulator scaffold" 4 | scopes: ["vue"] 5 | prefix: "prismicSliceSimulatorScaffold" 6 | --- 7 | 8 | ```html 9 | 14 | 15 | 32 | ``` 33 | -------------------------------------------------------------------------------- /src/react/prismicSliceSimulatorScaffold.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Prismic Slice Simulator Scaffold" 3 | description: "Yields a ready-to-use Slice Simulator scaffold" 4 | scopes: ["javascript", "javascriptreact", "typescriptreact"] 5 | prefix: "prismicSliceSimulatorScaffold" 6 | --- 7 | 8 | ```jsx 9 | import { SliceSimulator } from "@prismicio/slice-simulator-react"; 10 | import { SliceZone } from "@prismicio/react"; 11 | 12 | import state from "../.slicemachine/libraries-state.json"; 13 | // A component map mapping Prismic slice types to React components 14 | import { components } from "${1:../slices/components}"; 15 | 16 | const SliceSimulatorPage = () => { 17 | return ( 18 | ( 20 | 21 | )} 22 | state={state} 23 | /> 24 | ); 25 | }; 26 | 27 | export default SliceSimulatorPage; 28 | ``` 29 | -------------------------------------------------------------------------------- /sublime/snippets/javascript-prismic-slice-simulator-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 11 | return ( 12 | ( 14 | 15 | )} 16 | state={state} 17 | /> 18 | ); 19 | }; 20 | 21 | export default SliceSimulatorPage; 22 | ]]> 23 | prismicSliceSimulatorScaffold 24 | source.js 25 | Yields a ready-to-use Slice Simulator scaffold 26 | 27 | -------------------------------------------------------------------------------- /sublime/snippets/javascriptreact-prismic-slice-simulator-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 11 | return ( 12 | ( 14 | 15 | )} 16 | state={state} 17 | /> 18 | ); 19 | }; 20 | 21 | export default SliceSimulatorPage; 22 | ]]> 23 | prismicSliceSimulatorScaffold 24 | source.jsx 25 | Yields a ready-to-use Slice Simulator scaffold 26 | 27 | -------------------------------------------------------------------------------- /sublime/snippets/typescriptreact-prismic-slice-simulator-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | { 11 | return ( 12 | ( 14 | 15 | )} 16 | state={state} 17 | /> 18 | ); 19 | }; 20 | 21 | export default SliceSimulatorPage; 22 | ]]> 23 | prismicSliceSimulatorScaffold 24 | source.tsx 25 | Yields a ready-to-use Slice Simulator scaffold 26 | 27 | -------------------------------------------------------------------------------- /schnipsel.config.ts: -------------------------------------------------------------------------------- 1 | import { defineSchnipselConfig } from "schnipsel"; 2 | 3 | export default defineSchnipselConfig({ 4 | input: { 5 | directory: "src", 6 | }, 7 | 8 | // Update or remove renderers according to desired result... 9 | renderers: [ 10 | { 11 | name: "vscode", 12 | options: { 13 | outputDirectory: "vscode/snippets", 14 | passthroughFileCopy: { 15 | "./README.md": "./vscode/README.md", 16 | "./CHANGELOG.md": "./vscode/CHANGELOG.md", 17 | "./LICENSE": "./vscode/LICENSE", 18 | }, 19 | packageJSON: "vscode/package.json", 20 | }, 21 | }, 22 | { 23 | name: "sublime", 24 | options: { 25 | outputDirectory: "sublime/snippets", 26 | }, 27 | }, 28 | { 29 | name: "intellij", 30 | options: { 31 | outputDirectory: "intellij/src/main/resources/liveTemplates", 32 | pluginXML: "intellij/src/main/resources/META-INF/plugin.xml", 33 | }, 34 | }, 35 | ], 36 | }); 37 | -------------------------------------------------------------------------------- /sublime/snippets/vue-prismic-slice-simulator-scaffold.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 26 | ]]> 27 | prismicSliceSimulatorScaffold 28 | text.html.vue 29 | Yields a ready-to-use Slice Simulator scaffold 30 | 31 | -------------------------------------------------------------------------------- /.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true, 6 | }, 7 | parserOptions: { 8 | parser: "@typescript-eslint/parser", 9 | ecmaVersion: 2020, 10 | }, 11 | extends: [ 12 | "plugin:@typescript-eslint/eslint-recommended", 13 | "plugin:@typescript-eslint/recommended", 14 | "plugin:prettier/recommended", 15 | ], 16 | plugins: ["eslint-plugin-tsdoc"], 17 | rules: { 18 | "no-console": ["warn", { allow: ["info", "warn", "error", "clear"] }], 19 | "no-debugger": "warn", 20 | "no-undef": "off", 21 | curly: "error", 22 | "prefer-const": "error", 23 | "padding-line-between-statements": [ 24 | "error", 25 | { blankLine: "always", prev: "*", next: "return" }, 26 | ], 27 | "@typescript-eslint/no-unused-vars": [ 28 | "error", 29 | { 30 | argsIgnorePattern: "^_", 31 | varsIgnorePattern: "^_", 32 | }, 33 | ], 34 | "@typescript-eslint/no-var-requires": "off", 35 | "tsdoc/syntax": "warn", 36 | }, 37 | }; 38 | -------------------------------------------------------------------------------- /.versionrc: -------------------------------------------------------------------------------- 1 | { 2 | "bumpFiles": [ 3 | { 4 | "filename": "package.json", 5 | "type": "json" 6 | }, 7 | { 8 | "filename": "package-lock.json", 9 | "type": "json" 10 | }, 11 | { 12 | "filename": "intellij/package.json", 13 | "type": "json" 14 | }, 15 | { 16 | "filename": "vscode/package.json", 17 | "type": "json" 18 | }, 19 | { 20 | "filename": "intellij/build.gradle", 21 | "updater": "intellij/bump-gradle.js" 22 | }, 23 | { 24 | "filename": "intellij/src/main/resources/META-INF/plugin.xml", 25 | "updater": "intellij/bump-plugin.js" 26 | } 27 | ], 28 | "types": [ 29 | { 30 | "type": "feat", 31 | "section": "Features" 32 | }, 33 | { 34 | "type": "fix", 35 | "section": "Bug Fixes" 36 | }, 37 | { 38 | "type": "refactor", 39 | "section": "Refactor" 40 | }, 41 | { 42 | "type": "docs", 43 | "section": "Documentation" 44 | }, 45 | { 46 | "type": "chore", 47 | "section": "Chore" 48 | } 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@prismicio/snippets", 3 | "version": "0.0.10", 4 | "description": "Prismic snippets for VS Code, Vim, Sublime, and IntelliJ", 5 | "private": true, 6 | "keywords": [ 7 | "typescript", 8 | "prismic", 9 | "vscode", 10 | "vim", 11 | "sublime", 12 | "intellij" 13 | ], 14 | "repository": { 15 | "type": "git", 16 | "url": "ssh://git@github.com/prismicio/prismic-snippets.git" 17 | }, 18 | "license": "Apache-2.0", 19 | "author": "Prismic (https://prismic.io)", 20 | "type": "module", 21 | "scripts": { 22 | "dev": "schnipsel --watch", 23 | "build": "cross-env DEBUG=schnipsel* schnipsel && npm run build --workspaces --if-present", 24 | "format": "prettier --write .", 25 | "prepare": "npm run build", 26 | "release": "npm run test && standard-version && git push --follow-tags && npm run build && npm run release --workspaces --if-present", 27 | "release:dry": "standard-version --dry-run", 28 | "lint": "eslint --ext .js,.ts .", 29 | "unit": "echo \"no unit test\"", 30 | "size": "echo \"no size test\"", 31 | "test": "npm run lint && npm run unit && npm run build && npm run size" 32 | }, 33 | "engines": { 34 | "node": ">=16.10.0" 35 | }, 36 | "devDependencies": { 37 | "@typescript-eslint/eslint-plugin": "^5.19.0", 38 | "@typescript-eslint/parser": "^5.19.0", 39 | "cross-env": "^7.0.3", 40 | "eslint": "^8.13.0", 41 | "eslint-config-prettier": "^8.5.0", 42 | "eslint-plugin-prettier": "^4.0.0", 43 | "eslint-plugin-tsdoc": "^0.2.16", 44 | "prettier": "^2.6.2", 45 | "prettier-plugin-jsdoc": "^0.3.38", 46 | "schnipsel": "^0.0.3", 47 | "standard-version": "^9.3.2" 48 | }, 49 | "workspaces": [ 50 | "intellij", 51 | "vscode" 52 | ] 53 | } 54 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 4 | 5 | ### [0.0.10](https://github.com/prismicio/prismic-snippets/compare/v0.0.9...v0.0.10) (2022-04-14) 6 | 7 | 8 | ### Bug Fixes 9 | 10 | * **deps:** escape non-variable ([3af9237](https://github.com/prismicio/prismic-snippets/commit/3af923724f8cd0ba09c9b5541fe1acd569c3f3c7)) 11 | 12 | ### [0.0.9](https://github.com/prismicio/prismic-snippets/compare/v0.0.8...v0.0.9) (2022-04-11) 13 | 14 | 15 | ### Refactor 16 | 17 | * migrate to schnipsel ([12cb255](https://github.com/prismicio/prismic-snippets/commit/12cb2551554ef97d7a81905c8d4c7eba3028ca7a)) 18 | 19 | 20 | ### Chore 21 | 22 | * **deps:** maintain dependencies ([8de9b67](https://github.com/prismicio/prismic-snippets/commit/8de9b673e5b94567adcc0d3225302d3dbbae634b)) 23 | * **deps:** maintain dependencies ([e87cefd](https://github.com/prismicio/prismic-snippets/commit/e87cefdc67af93c82ab2e2a73987e3cd6ae4a1c4)) 24 | * **intellij:** sort plugin.xml updates ([f3940c3](https://github.com/prismicio/prismic-snippets/commit/f3940c30e424dbc5effada080601b40e7d280db4)) 25 | 26 | 27 | ### Documentation 28 | 29 | * **intellij:** typo ([378a04e](https://github.com/prismicio/prismic-snippets/commit/378a04e6b1325fcd8157a8cb03f810a993c27ba6)) 30 | * style ([0c72ace](https://github.com/prismicio/prismic-snippets/commit/0c72ace8da81330c62cbd9f37eb5036e13769f90)) 31 | 32 | ### [0.0.8](https://github.com/prismicio/prismic-snippets/compare/v0.0.7...v0.0.8) (2022-04-05) 33 | 34 | 35 | ### Bug Fixes 36 | 37 | * use react snippets on javascript files also ([60a697b](https://github.com/prismicio/prismic-snippets/commit/60a697be6074aa52d9826bc74684a86e0c796c8d)) 38 | 39 | 40 | ### Documentation 41 | 42 | * add plugin description ([aa11958](https://github.com/prismicio/prismic-snippets/commit/aa1195890c6cac107a4e6c7c4ca37da6d00fea81)) 43 | 44 | ### [0.0.7](https://github.com/prismicio/prismic-snippets/compare/v0.0.6...v0.0.7) (2022-04-01) 45 | 46 | 47 | ### Features 48 | 49 | * **intellij:** support intellij ([48655c2](https://github.com/prismicio/prismic-snippets/commit/48655c2b2cbfd40261dea0d6d7c58b48505cde6a)) 50 | 51 | 52 | ### Chore 53 | 54 | * rename NPM package ([5a9e55c](https://github.com/prismicio/prismic-snippets/commit/5a9e55c7e63d343b368c0a3b089840a2fe884777)) 55 | * rename vscode/vim package ([e0e2f8e](https://github.com/prismicio/prismic-snippets/commit/e0e2f8e25255b9d800b9568cc1d79fa16a888313)) 56 | 57 | ### [0.0.6](https://github.com/prismicio/prismic-snippets/compare/v0.0.5...v0.0.6) (2022-03-30) 58 | 59 | 60 | ### Bug Fixes 61 | 62 | * **sublime:** escape description ([49786b1](https://github.com/prismicio/prismic-snippets/commit/49786b1315f26a4164250f369fd95e3fd313bb2e)) 63 | 64 | 65 | ### Documentation 66 | 67 | * add `coc-snippets` to Vim installation ([125e314](https://github.com/prismicio/prismic-snippets/commit/125e314196dd4924dfa0bcd99b732223f51482d1)) 68 | 69 | ### [0.0.5](https://github.com/prismicio/prismic-snippets/compare/v0.0.4...v0.0.5) (2022-03-30) 70 | 71 | 72 | ### Documentation 73 | 74 | * add badges back ([217c9f7](https://github.com/prismicio/prismic-snippets/commit/217c9f715864b308039455b7f16b54c9a8a82ead)) 75 | * update readme ([3b69b7a](https://github.com/prismicio/prismic-snippets/commit/3b69b7a7ca42d050f14ed417f16dd7d048da02b7)) 76 | 77 | ### [0.0.4](https://github.com/prismicio/prismic-snippets/compare/v0.0.3...v0.0.4) (2022-03-30) 78 | 79 | 80 | ### Refactor 81 | 82 | * bump `vscode/package.json` using standard version ([dff3516](https://github.com/prismicio/prismic-snippets/commit/dff3516e7e1d18f82ce09e30279ee103ac7e6a75)) 83 | 84 | ### [0.0.3](https://github.com/prismicio/prismic-snippets/compare/v0.0.2...v0.0.3) (2022-03-30) 85 | 86 | 87 | ### Documentation 88 | 89 | * update doc ([2f9941f](https://github.com/prismicio/prismic-snippets/commit/2f9941f42458da49d747fb6ac5c1af29f06d4629)) 90 | * update doc ([82f9443](https://github.com/prismicio/prismic-snippets/commit/82f9443e7b0ad0f5f1204e79ae248c0c4abde957)) 91 | * update doc ([2bfe602](https://github.com/prismicio/prismic-snippets/commit/2bfe602c7c9e78c9e98073a5150d23b629c651ef)) 92 | 93 | ### [0.0.2](https://github.com/prismicio/prismic-snippets/compare/v0.0.1...v0.0.2) (2022-03-30) 94 | 95 | 96 | ### Features 97 | 98 | * **sublime:** add sublime snippets ([5db6d48](https://github.com/prismicio/prismic-snippets/commit/5db6d48fda8345c90998d05ec1685dd2c13467fa)) 99 | * **vscode:** sort contributes object ([e95acb0](https://github.com/prismicio/prismic-snippets/commit/e95acb039330a901dd42cc77e936bb38e8ec3cf6)) 100 | 101 | 102 | ### Chore 103 | 104 | * **release:** 0.0.1 ([1172a94](https://github.com/prismicio/prismic-snippets/commit/1172a945e8fdfe80f51742f098642005201472ff)) 105 | 106 | 107 | ### Refactor 108 | 109 | * don't duplicate scope ([d37f9b5](https://github.com/prismicio/prismic-snippets/commit/d37f9b52b44dce1e35a9d3300599176d2be554cf)) 110 | 111 | ### 0.0.1 (2022-03-29) 112 | 113 | 114 | ### Features 115 | 116 | * add JavaScript/TypeScript snippets ([1b2fdad](https://github.com/prismicio/prismic-snippets/commit/1b2fdad35fc3cda57ca303b1876d998b1e2c9c06)) 117 | * add React snippets ([12ca395](https://github.com/prismicio/prismic-snippets/commit/12ca3950c8ea611242f170ddfcd8c82199644576)) 118 | * add Vue.js snippets ([a467486](https://github.com/prismicio/prismic-snippets/commit/a467486bbcf7ae965095cb63b98029bfe45e3267)) 119 | 120 | 121 | ### Chore 122 | 123 | * **deps:** remove deprecated package ([df6e8a0](https://github.com/prismicio/prismic-snippets/commit/df6e8a01947b71ebb27fd1a783c5754b9cc26c0d)) 124 | * fix root package json handling ([5bcdb7b](https://github.com/prismicio/prismic-snippets/commit/5bcdb7b47a00e00101329c8bc47b2bccaaf0a457)) 125 | * setup extension ([21afb04](https://github.com/prismicio/prismic-snippets/commit/21afb041d47231dc3c7c205e325d71c448e3979b)) 126 | * update license ([cbacb11](https://github.com/prismicio/prismic-snippets/commit/cbacb110672f1341dc9461d9d9d2ecfa9e5d0f82)) 127 | 128 | 129 | ### Refactor 130 | 131 | * group snippet is not a scaffold ([9e9cdcf](https://github.com/prismicio/prismic-snippets/commit/9e9cdcf027eb8761371b175eba200eef41d65ddb)) 132 | * update Vue.js snippets ([8f0db3d](https://github.com/prismicio/prismic-snippets/commit/8f0db3dd92c47acb7f5221bc10428497c13fa935)) 133 | 134 | 135 | ### Documentation 136 | 137 | * remove unused badges ([d287a4c](https://github.com/prismicio/prismic-snippets/commit/d287a4c14a4204d6dea8148c688b187c99bc90fe)) 138 | * update readme ([b91e879](https://github.com/prismicio/prismic-snippets/commit/b91e8795241d814e599b6db533ca47c28e73e7c0)) 139 | * update readme ([120961e](https://github.com/prismicio/prismic-snippets/commit/120961efeed78967914516bf9661978b47ac9a53)) 140 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # @prismicio/snippets 14 | 15 | [![npm version][npm-version-src]][npm-version-href] 16 | [![Github Actions CI][github-actions-ci-src]][github-actions-ci-href] 17 | [![Conventional Commits][conventional-commits-src]][conventional-commits-href] 18 | [![License][license-src]][license-href] 19 | 20 | 21 | 22 | [Prismic][prismic] snippets for VS Code, Vim, Sublime, and IntelliJ. 23 | 24 | 35 | 36 | - 📐  Template quickly Prismic data in React and Vue.js; 37 | - 🏗  Scaffold common Prismic structures in a blink: slices, resolvers, and more; 38 | - 🈂  JavaScript and TypeScript friendly. 39 | 40 | ## Install 41 | 42 | ### VS Code 43 | 44 | Install extension from [VS Code Marketplace][vs-code-marketplace-src]. 45 | 46 | ### Vim 47 | 48 | Install extension using [coc.nvim][coc-nvim-src]. 49 | 50 | ``` 51 | :CocInstall prismic-snippets coc-snippets 52 | ``` 53 | 54 | ### Sublime 55 | 56 | Install package from [Package Control][sublime-package-control-src]. 57 | 58 | ### IntelliJ 59 | 60 | Intall plugin from [JetBrains Marketplace][jetbrains-marketplace-src]. 61 | 62 | ## Documentation 63 | 64 | Every snippets are prefixed with `prismic(...)`. There are two categories of snippets: **templating snippets** and **scaffolding snippets**. 65 | 66 | ### Templating snippets 67 | 68 | **React & Vue** 69 | 70 | - `prismicText`: Yields a ready-to-use `` component 71 | - `prismicRichText`: Yields a ready-to-use `` component 72 | - `prismicLink`: Yields a ready-to-use `` component 73 | - `prismicSliceZone`: Yields a ready-to-use `` component 74 | - `prismicGroup`: Yields a ready-to-use Group field/Slice repeatable template 75 | 76 | **React only** 77 | 78 | - `prismicProvider`: Yields a ready-to-use `` component 79 | - `prismicToolbar`: Yields a ready-to-use `` component 80 | 81 | **Vue only** 82 | 83 | - `prismicImage`: Yields a ready-to-use `` component 84 | - `prismicEmbed`: Yields a ready-to-use `` component 85 | 86 | ### Scaffolding snippets 87 | 88 | **React & Vue** 89 | 90 | - `prismicSliceScaffold`: Yields a ready-to-use Slice components scaffold 91 | - `prismicSliceSimulatorScaffold`: Yields a ready-to-use Slice Simulator scaffold 92 | 93 | **JavaScript & TypeScript** 94 | 95 | - `prismicRouteResolverScaffold`: Yields a ready-to-use Route Resolver scaffold 96 | - `prismicLinkResolverScaffold`: Yields a ready-to-use Link Resolver scaffold 97 | - `prismicHTMLSerializerScaffold`: Yields a ready-to-use HTML Serializer scaffold 98 | 99 | --- 100 | 101 | To discover what's new on this package check out [the changelog][changelog]. For full documentation, visit the [official Prismic documentation][prismic-docs]. 102 | 103 | ## Contributing 104 | 105 | Whether you're helping us fix bugs, improve the docs, or spread the word, we'd love to have you as part of the Prismic developer community! 106 | 107 | **Asking a question**: [Open a new topic][forum-question] on our community forum explaining what you want to achieve / your question. Our support team will get back to you shortly. 108 | 109 | **Reporting a bug**: [Open an issue][repo-bug-report] explaining your application's setup and the bug you're encountering. 110 | 111 | **Suggesting an improvement**: [Open an issue][repo-feature-request] explaining your improvement or feature so we can discuss and learn more. 112 | 113 | **Submitting code changes**: For small fixes, feel free to [open a pull request][repo-pull-requests] with a description of your changes. For large changes, please first [open an issue][repo-feature-request] so we can discuss if and how the changes should be implemented. 114 | 115 | For more clarity on this project and its structure you can also check out the detailed [CONTRIBUTING.md][contributing] document. 116 | 117 | ## License 118 | 119 | ``` 120 | Copyright 2013-2022 Prismic (https://prismic.io) 121 | 122 | Licensed under the Apache License, Version 2.0 (the "License"); 123 | you may not use this file except in compliance with the License. 124 | You may obtain a copy of the License at 125 | 126 | http://www.apache.org/licenses/LICENSE-2.0 127 | 128 | Unless required by applicable law or agreed to in writing, software 129 | distributed under the License is distributed on an "AS IS" BASIS, 130 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 131 | See the License for the specific language governing permissions and 132 | limitations under the License. 133 | ``` 134 | 135 | 136 | 137 | [prismic]: https://prismic.io 138 | 139 | 140 | 141 | [prismic-docs]: https://prismic.io/docs 142 | [changelog]: ./CHANGELOG.md 143 | [contributing]: ./CONTRIBUTING.md 144 | [vs-code-marketplace-src]: https://marketplace.visualstudio.com/items?itemName=prismicio.prismic-snippets 145 | [coc-nvim-src]: https://github.com/neoclide/coc.nvim 146 | [sublime-package-control-src]: https://packagecontrol.io/packages/Prismic.io%20snippets 147 | [jetbrains-marketplace-src]: https://plugins.jetbrains.com/plugin/18884-prismic-io-snippets 148 | 149 | 150 | 151 | [forum-question]: https://community.prismic.io 152 | [repo-bug-report]: https://github.com/prismicio/prismic-snippets/issues/new?assignees=&labels=bug&template=bug_report.md&title= 153 | [repo-feature-request]: https://github.com/prismicio/prismic-snippets/issues/new?assignees=&labels=enhancement&template=feature_request.md&title= 154 | [repo-pull-requests]: https://github.com/prismicio/prismic-snippets/pulls 155 | 156 | 157 | 158 | [npm-version-src]: https://img.shields.io/npm/v/prismic-snippets/latest.svg 159 | [npm-version-href]: https://npmjs.com/package/prismic-snippets 160 | [github-actions-ci-src]: https://github.com/prismicio/prismic-snippets/workflows/ci/badge.svg 161 | [github-actions-ci-href]: https://github.com/prismicio/prismic-snippets/actions?query=workflow%3Aci 162 | [conventional-commits-src]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg 163 | [conventional-commits-href]: https://conventionalcommits.org 164 | [license-src]: https://img.shields.io/npm/l/prismic-snippets.svg 165 | [license-href]: https://npmjs.com/package/prismic-snippets 166 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Prismic 2 | 3 | This document is aimed at providing developers (mainly maintainers) documentation on this project and its structure. It is not intended to pass requirements for contributing to this project. 4 | 5 | For the latter, the [Quick Start](#quick-start) section below can help you. You are free to [open issues][repo-issue] and [submit pull requests][repo-pull-requests] toward the `master` branch directly without worrying about our standards. For pull requests, we will help you through our merging process. 6 | 7 | > For a Table of Contents, use GitHub's TOC button, top left of the document. 8 | 9 | ## Quick Start 10 | 11 | ```bash 12 | # First, fork the repository to your GitHub account if you aren't an existing maintainer 13 | 14 | # Clone your fork 15 | git clone git@github.com:/prismic-snippets.git 16 | 17 | # Create a feature branch with your initials and feature name 18 | git checkout -b / # e.g. `lh/fix-win32-paths` 19 | 20 | # Install dependencies with npm 21 | npm install 22 | 23 | # Test your changes 24 | npm run test 25 | 26 | # Commit your changes once they are ready 27 | # Conventional Commits are encouraged, but not required 28 | git add . 29 | git commit -m "short description of your changes" 30 | 31 | # Lastly, open a pull request on GitHub describing your changes 32 | ``` 33 | 34 | ## Processes 35 | 36 | Processes refer to tasks that you may need to perform while working on this project. 37 | 38 | ### Developing 39 | 40 | There is no development branch. The `master` branch refers to the latest [stable (living) version](#stable-xxx) of the project and pull requests should be made against it. 41 | 42 | If development on a [new major version](#iteration-cycle) has begun, a branch named after the major version will be created (e.g. `v2` for work on the future `v2.0.0` of the project). Pull requests targeting that new major version should be made against it. 43 | 44 | To develop locally: 45 | 46 | 1. **If you have maintainer access**:
[Clone the repository](https://help.github.com/articles/cloning-a-repository) to your local environment. 47 | 48 | **If you do no have maintainer access**:
[Fork](https://help.github.com/articles/fork-a-repo) and [clone](https://help.github.com/articles/cloning-a-repository) the repository to your local environment. 49 | 50 | 2. Create a new branch: 51 | 52 | ```bash 53 | git checkout -b / # e.g. `aa/graphql-support` 54 | ``` 55 | 56 | 3. Install dependencies with [npm][npm] (avoid using [Yarn][yarn]): 57 | 58 | ```bash 59 | npm install 60 | ``` 61 | 62 | 4. Start developing: 63 | 64 | ```bash 65 | npm run dev 66 | ``` 67 | 68 | 5. Commit your changes: 69 | 70 | If you already know the [Conventional Commits convention][conventional-commits], feel free to embrace it for your commit messages. If you don't, no worries; it can always be taken care of when the pull request is merged. 71 | 72 | ### Building 73 | 74 | Our build system is handled by [siroc][siroc], a near-zero-config build tool powered by [esbuild](https://github.com/evanw/esbuild). It takes care of: 75 | 76 | - Generating a [CommonJS (`.cjs`)](https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules) bundle and its source map; 77 | - Generating an [ECMAScript (`.mjs`)](https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules) bundle and its source map; 78 | - Generating a TypeScript declaration (`.d.ts`) file. 79 | 80 | To build the project: 81 | 82 | ```bash 83 | npm run build 84 | ``` 85 | 86 | The CI system will try to build the project on each commit targeting the `master` branch. The CI check will fail if the build does. 87 | 88 | ### Testing 89 | 90 | All projects have at least linting and unit tests. Linting is handled by [ESLint][eslint] with [Prettier][prettier] and unit tests are handled by [AVA][ava]. 91 | 92 | To run all tests: 93 | 94 | ```bash 95 | npm run test 96 | ``` 97 | 98 | If you'd like to run only the linter (note that it won't reformat your code; use the `format` script for that): 99 | 100 | ```bash 101 | npm run lint 102 | ``` 103 | 104 | If you'd like to run only the unit tests: 105 | 106 | ```bash 107 | npm run unit 108 | ``` 109 | 110 | If you'd like to run only the unit tests in watch mode (re-runs tests each time a file is saved): 111 | 112 | ```bash 113 | npm run unit -- --watch 114 | ``` 115 | 116 | When working on unit tests, you might want to update snapshots (be careful when doing so): 117 | 118 | ```bash 119 | npm run unit -- --update-snapshots 120 | ``` 121 | 122 | The CI system will run tests on each commit targeting the `master` branch. The CI check will fail if any test does. 123 | 124 | ### Publishing 125 | 126 | > ⚠  Only project maintainers with at least collaborator access to the related npm package can publish new versions. 127 | 128 | Publishing a package correctly involves multiple steps: 129 | 130 | - Writing a changelog; 131 | - [Building](#building) the project; 132 | - Publishing a new version tag to GitHub; 133 | - Publishing build artifacts to [npm][npm]. 134 | 135 | In order to make sure all these steps are consistently and correctly done, we use [Standard Version][standard-version] and build scripts. 136 | 137 | To release a new version of the project: 138 | 139 | ```bash 140 | npm run release 141 | ``` 142 | 143 | To release a new [alpha](#alpha-xxx-alphax) version of the project: 144 | 145 | ```bash 146 | npm run release:alpha 147 | ``` 148 | 149 | Those scripts will: 150 | 151 | - Run tests and try to build the project; 152 | - Figure out the new version number by looking at commit messages matching the [Conventional Commits convention][conventional-commits]; 153 | - Write the [changelog][changelog] for the new version after Conventional Commit messages; 154 | - Build the project for publishing; 155 | - Publish a new version tag to GitHub; 156 | - Publish build artifacts to [npm][npm]. 157 | 158 | Once a script has been run successfully, a new version of the package should have been published to npm. To complete the publishing process you only need to head to the repository's releases tab on GitHub to publish the new version tag that was created. 159 | 160 | If you ran any of those commands but happen not to have access to the related npm package, you can still ask a collaborator of the said package to publish it for you. 161 | 162 | Appending `:dry` (e.g. `release:dry`) to any of the above commands will dry-run the targeted release script and output the new changelog to the console. 163 | 164 | We consider maintaining project dependencies before publishing a new version a best practice. 165 | 166 | ### Maintaining 167 | 168 | Anyone can, and is welcome to, contribute to the project by opening bug reports and submitting feature requests. To remain focused and ensure we are able to respond to each contribution, we have adopted the following framework to maintain this package: 169 | 170 | **🚨  Bug reports** 171 | 172 | > **Note**: An automated reply is posted when a bug report is opened to explain our maintenance schedule. 173 | 174 | Every Wednesday is _bug squashing day_. During this day, we respond to and/or fix bug reports. 175 | 176 | At the end of each Wednesday (assuming there were issues to fix), or later during the week if reviews are required, a _patch_ version is [released](#publishing) containing any fixes that were needed. Releasing multiple patches during the same week should be avoided. 177 | 178 | Ideally, all opened bug reports are addressed each Wednesday. If a particular bug report is not able to be resolved in that timeframe, maintainers are free to continue working on the issue or to report back to it next Wednesday. Overall, while most issues should be closed within _7 days_, we consider up to _14 days_ to get back to and address an issue a reasonable delay. Beyond that threshold, an issue is considered problematic and will be given more attention. 179 | 180 | **🙋‍♀️  Feature requests** 181 | 182 | > **Note**: An automated message gets sent to people creating feature requests about this process. 183 | 184 | Every last week of a month is _feature week_. During this week, we implement new features. Discussing and coming up with implementation proposals can happen before that week, but implementations are targeted for the last week. 185 | 186 | At the end of the week (assuming there were features to implement), a _minor_ version is [released](#publishing) containing the new features. Releasing multiple minors during the same week should be avoided. 187 | 188 | Ideally, all opened feature requests are discussed each month and implemented if consensus was reached. Unlike bug reports, we do not consider delays to address feature requests as good or bad. Instead, those should essentially be driven by the community's demand on a per-request basis. 189 | 190 | **🏗  Updating the project structure** 191 | 192 | We actively maintain a [TypeScript template][template] with Prismic's latest open-source standards. Keeping every project in sync with this template is nearly impossible so we're not trying to immediately reflect changes to the template in every project. Instead we consider a best practice to manually pull changes from the template into the project whenever someone is doing project maintenance and has time for it, or wants to enjoy the latest standards from it. 193 | 194 | ## `@prismicio/snippets` in Prismic's Open-Source Ecosystem 195 | 196 | Prismic's Open-Source ecosystem is built around a 3-stage pyramid: 197 | 198 |

199 | Prismic open-source pyramid 200 |

201 | 202 | Where: 203 | 204 | - **Core**: Represents libraries providing core Prismic integration such as data fetching and content transformation, e.g. [`@prismicio/client`](https://github.com/prismicio/prismic-client); 205 | - **Integration**: Represents libraries to integration into UI libraries. They must be framework agnostic, e.g. [`@prismicio/react`](https://github.com/prismicio/prismic-react); 206 | - **Framework**: Represents libraries to integrate into frameworks, including data fetching and normalizing. They must follow frameworks' expected practices, e.g. [`@prismicio/next`](https://github.com/prismicio/prismic-next). 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | ## Iteration Cycle 215 | 216 | We break iteration cycle of a project's library into 4 phases: 217 | 218 | - **Pre-alpha** 219 | - **Alpha** 220 | - **Beta** 221 | - **Stable** 222 | 223 | ### Pre-alpha 224 | 225 | > At any point we might feel the need to introduce breaking changes to a project's library (getting rid of legacy APIs, embracing latest features from a framework, etc.). When such a need has been identified for a project, it will enter the pre-alpha phase. The project might also enter the pre-alpha phase for large, non-breaking changes that need more planning and thoughts. 226 | > 227 | > The goal of the pre-alpha phase is to design and share the new project's library API through an RFC. Under certain circumstances (e.g. the API has already been clearly defined in another language and only some adaptations have to be made), the project can skip the pre-alpha phase and enter the alpha phase directly. Skipping the pre-alpha phase should be treated as an exception. 228 | 229 | During the pre-alpha phase, the following will happen: 230 | 231 | **Documenting and understanding the library's current functionality:** 232 | 233 | Doing so leads to a better understanding of the library's current functionality and limitations. Reviewing GitHub Issues will provide insight into existing bugs and user requests. We want to reduce the number of breaking changes where possible while not being afraid to do so if necessary. 234 | 235 | **Sketching the API in code, examples, and written explanations:** 236 | 237 | The library should be written in concept before its concrete implementation. This frees us from technical limitations and implementation details. It also allows us to craft the best feeling API. 238 | 239 | **Writing the public RFC:** 240 | 241 | A formal RFC should be posted publicly once the initial brainstorming session is complete that focuses on new and changed concepts. This allows everyone to read and voice their opinions should they choose to. 242 | 243 | ### Alpha (`x.x.x-alpha.x`) 244 | 245 | > As soon as the RFC has been posted, the project enters the alpha phase. 246 | > 247 | > The goal of the alpha phase is to implement the new project's library API, to test it, and to document it. 248 | 249 | During the alpha phase, the following will happen: 250 | 251 | **Writing the implementation:** 252 | 253 | The implementation must be done in TypeScript and include extensive tests and in-code documentation. Generally the process goes as follows: 254 | 255 | 1. Writing the implementation in TypeScript; 256 | 2. Testing the implementation; 257 | 3. Documenting the implementation with TSDocs (at least all publicly exported APIs). 258 | 259 | **Publishing public alpha versions:** 260 | 261 | Publishing alpha versions of the library allows for easier internal testing. With alpha versions, users can test the library as it is published publicly, however those versions are not recommended or shared extensively as breaking changes are still very likely to occur and the library is still not documented. Alpha versions can be published as often as needed. 262 | 263 | **Adjusting per internal and external feedback:** 264 | 265 | An internal code review should be performed. As users use the alpha, issues will be opened for bugs and suggestions. Appropriate adjustments to the library should be made with a focus on doing what users expect while minimizing technical debt. For that purpose, breaking changes to the new API can be introduced. 266 | 267 | **Updating documentation:** 268 | 269 | Documentation for the library should be updated on [prismic.io][prismic-docs] and is treated as the primary source of documentation. Contributors will work closely with Prismic Education team to complete this. This involves updating related documentation and code examples as well, including any starter projects on GitHub. A migration guide should be included if necessary. 270 | 271 | ### Beta (`x.x.x-beta.x`) 272 | 273 | > As soon as the implementation is completed and the updated documentation is ready to be published, the project enters the beta phase. 274 | > 275 | > The goal of the beta phase is to test the updated library's API by publicly sharing it with the community and receiving early adopters' feedback. The beta phase is the last opportunity for breaking changes to be introduced. 276 | 277 | During the beta phase, the following will happen: 278 | 279 | **Publishing public beta versions and related documentation:** 280 | 281 | A first beta should be published along the related documentation that has been worked on during the alpha phase. This release should be announced and shared to users in order to get feedback from early adopters. Subsequent beta versions can be published as often as needed, but we have to keep in mind users are now expected to be using them. 282 | 283 | **Adjusting per internal and external feedback:** 284 | 285 | As users use the beta, issues will be opened for bugs and suggestions. Appropriate adjustments to the library should be made with a focus on doing what users expect while minimizing technical debt. For that purpose, breaking changes to the new API can still be introduced and documentation should be updated accordingly at the moment of publishing a new beta. 286 | 287 | ### Stable (`x.x.x`) 288 | 289 | > Once the beta phase has arrived to maturity (users seem to be happy with it, all issues and concerns have been addressed, etc.), the project enters the stable phase. 290 | > 291 | > The goal of the stable phase is to publish the new project version and to advocate it as Prismic's latest standard. During this "living" phase of the project bug fixes and new features will be added. If the need for breaking or large changes arises, the project will enter the pre-alpha phase and begin a new cycle. 292 | 293 | During the stable phase, the following will happen: 294 | 295 | **Publishing public stable versions and related documentation:** 296 | 297 | The first stable version should be published along the related documentation. This release should be announced and shared to users extensively in order to get them up to Prismic latest standard. Subsequent stable versions can be published as often as needed but a particular attention should be paid toward testing and avoiding regressions. 298 | 299 | **Implementing new features:** 300 | 301 | New features can be implemented during the stable phase following user suggestions and new use cases discovered. To be published, new features should be extensively tested. Ideally, documentation should be updated at the time of publishing, however a delay is tolerated here as it requires coordination with the Prismic Education team. 302 | 303 | **Adding new examples:** 304 | 305 | While examples can be added at any time, it's certainly during the stable phase that most of them will be added. Examples should be added whenever it feels relevant for a use case to be pictured with a recommended recipe, allowing for later shares of said examples. 306 | 307 | ## Project Structure 308 | 309 | > Prismic open-source projects have been structured around standards maintainers brought from their different background and agreed upon on. They are meant to implement the same sensible defaults allowing for a coherent open-source ecosystem. 310 | > 311 | > Any changes to this structure are welcome but they should be first discussed on our [TypeScript template][template-issue]. Common sense still applies on a per-project basis if one requires some specific changes. 312 | 313 | Project is structured as follows (alphabetically, folders first): 314 | 315 | ### 📁  `.github` 316 | 317 | This folder is used to configure the project's GitHub repository. It contains: 318 | 319 | **Issue templates (`ISSUE_TEMPLATE/*`)** 320 | 321 | Those are used to standardize the way issues are created on the repository and to help with their triage by making sure all needed information is provided. Issue templates are also used to redirect users to our [community forum][community-forum] when relevant. 322 | 323 | **Pull request templates (`PULL_REQUEST_TEMPLATE.md`)** 324 | 325 | This one is used to standardize the way pull requests are created on the repository and to help with their triage by making sure all needed information is provided. 326 | 327 | **CI configuration (`.github/workflows/ci.yml`)** 328 | 329 | Our CI workflow is configured to run against all commits and pull requests directed toward the `master` branch. It makes sure the project builds and passes all tests configured on it (lint, unit, e2e, etc.) Coverage and bundle size are also collected by this workflow. 330 | 331 | ### 📁  `dist` 332 | 333 | This folder is not versioned. It contains the built artifacts of the project after a successful build. 334 | 335 | ### 📁  `examples` 336 | 337 | This folder contains examples of how to use the project. Examples are meant to be written over time as new use cases are discovered. 338 | 339 | ### 📁  `playground` 340 | 341 | This folder might not be available in this project. If it is, it is meant to contain a playground for developers to try the project during the development process. 342 | 343 | Scripts such as `playground:dev` or `playground:build` might be available inside the project [package.json](#-packagejson) to interact with it easily. 344 | 345 | ### 📁  `src` 346 | 347 | This folder contains the source code of the project written in TypeScript. The `index.ts` file inside it should only contain exports made available by the project. It should not contain any logic. 348 | 349 | ### 📁  `test` 350 | 351 | This folder contains tests of the project written in TypeScript. It may contain the following subdirectory: 352 | 353 | **Fixtures (`__fixtures__`)** 354 | 355 | This folder contains [fixtures](https://en.wikipedia.org/wiki/Test_fixture) used to test the project. 356 | 357 | **Test Utils (`__testutils__`)** 358 | 359 | This folder contains utility functions used to test the project. 360 | 361 | **Snapshots (`snapshots`)** 362 | 363 | This folder contains snapshots generated by the test framework when using snapshot testing strategies. It should not be altered manually. 364 | 365 | ### 📄  `.editorconfig`, `.eslintrc.cjs`, `.prettierrc`, `.size-limit.json`, `.versionrc`, `ava.config.js`, `siroc.config.ts`, `tsconfig.json` 366 | 367 | These files contain configuration for their eponymous tools: 368 | 369 | - [EditorConfig][editor-config]; 370 | - [ESLint][eslint]; 371 | - [Prettier][prettier]; 372 | - [Size Limit][size-limit]; 373 | - [Standard Version][standard-version]; 374 | - [AVA][ava]; 375 | - [`siroc`][siroc]; 376 | - [TypeScript][typescript]. 377 | 378 | Any change to those files are welcome but they should be first discussed on our [TypeScript template][template-issue]. Common sense still applies if the project requires some specific changes. 379 | 380 | ### 📄  `.eslintignore`, `.gitignore`, `.prettierignore` 381 | 382 | These files contain ignore configuration for their eponymous tools. Ignore configuration should be based on the one available from `.gitignore` and extended from it. 383 | 384 | ### 📄  `.gitattributes` 385 | 386 | This file contains [attributes](https://git-scm.com/docs/gitattributes) used by Git to deal with the project's files. Our configuration makes sure all files use correct line endings and that lock files aren't subject to conflicts. 387 | 388 | ### 📄  `CHANGELOG.md` 389 | 390 | This file is automatically generated by [Standard Version](https://github.com/conventional-changelog/standard-version) according to commit messages following the [Conventional Commits specification][conventional-commits] whenever a release is made. 391 | 392 | ### 📄  `CONTRIBUTING.md`, `README.md` 393 | 394 | These files contain project's related information and developers (maintainers) documentation. 395 | 396 | ### 📄  `LICENSE` 397 | 398 | This file contains a copy of the project's Apache 2.0 license we use on this project. The Apache 2.0 license has a few more restrictions over the MIT one. Notably (not legal advice), any change by a third party to Apache 2.0 licensed code is required to be stated by the third party. Same applies for changes to the project name by a third party (still not legal advice). For full details refer to the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license text itself. 399 | 400 | ### 📄  `package-lock.json` 401 | 402 | This file is the lock file generated by [npm][npm] to represent the resolved dependencies used by the project. We use npm over [Yarn][yarn] to manage dependencies and only this lock file should be versioned (`yarn.lock` is even ignored to prevent mistakes). 403 | 404 | ### 📄  `package.json` 405 | 406 | The project's package definition file. 407 | 408 | **Scripts (`scripts`)** 409 | 410 | - `build`: Builds the project; 411 | - `dev`: Builds the project with watch mode enabled; 412 | - `playground:*`: Any command related to the project [playground](#-playground) if any; 413 | - `format`: Runs Prettier on the project; 414 | - `prepare`: npm life cycle script to make sure the project is built before any npm related command (`publish`, `install`, etc.); 415 | - `release`: creates and publishes a new release of the package, version is determined after commit messages following the [Conventional Commits specification][conventional-commits]; 416 | - `release:dry`: dry-run of the `release` script; 417 | - `release:alpha`: creates and publishes a new alpha release of the package; 418 | - `release:alpha:dry`: dry-run of the `release:alpha` script; 419 | - `lint`: Runs ESLint on the project; 420 | - `unit`: Runs AVA on the project; 421 | - `size`: Runs Size Limit on the project; 422 | - `test`: Runs the `lint`, `unit`, `build`, and `size` scripts. 423 | 424 | **Minimum Node version supported (`engines.node`)** 425 | 426 | The minimum Node version supported by the project is stated under the `engines` object. We aim at supporting the oldest Long Term Support (LTS) version of Node that has still not reached End Of Life (EOL): [nodejs.org/en/about/releases](https://nodejs.org/en/about/releases) 427 | 428 | 429 | 430 | [prismic-docs]: https://prismic.io/docs 431 | [community-forum]: https://community.prismic.io 432 | [conventional-commits]: https://conventionalcommits.org/en/v1.0.0 433 | [npm]: https://www.npmjs.com 434 | [yarn]: https://yarnpkg.com 435 | [editor-config]: https://editorconfig.org 436 | [eslint]: https://eslint.org 437 | [prettier]: https://prettier.io 438 | [size-limit]: https://github.com/ai/size-limit 439 | [standard-version]: https://github.com/conventional-changelog/standard-version 440 | [ava]: https://github.com/avajs/ava 441 | [siroc]: https://github.com/unjs/siroc 442 | [typescript]: https://www.typescriptlang.org 443 | [template]: https://github.com/prismicio/prismic-typescript-template 444 | [template-issue]: https://github.com/prismicio/prismic-typescript-template/issues/new/choose 445 | [changelog]: ./CHANGELOG.md 446 | [forum-question]: https://community.prismic.io 447 | [repo-issue]: https://github.com/prismicio/prismic-snippets/issues/new/choose 448 | [repo-pull-requests]: https://github.com/prismicio/prismic-snippets/pulls 449 | --------------------------------------------------------------------------------