Skip to content

Commit

Permalink
(feat): Add support for data-fetching and using getStaticProps and …
Browse files Browse the repository at this point in the history
…`getStaticPaths` in NextJS for integrating with CMS resources (#784)

* feat(nextjs static paths and props): nextjs static paths and props

Add the possibility for each page to define resources for static paths and props

* feat: fetch support

Add support for fetch requests and nextjs static paths and props

* Small change

* Small fix on template concat

* Small change

* Get the first item on details page - initial props

* Fix tests

* Add support for pagination on static paths/props (#749)

* Add support for pagination on static paths/props

* Small changes in cms project uidl

---------

Co-authored-by: Ionut Pasca <[email protected]>

* Add support for context

* Small change

* Primitive implementation for context support

* Primitive implementation for cms-list and item support

* Handle cms-list node individually

* Handle cms-list node individually

* Remove package.lock

* Fix tests

* Handle CMS project uidl in standalone test

* Add support for CMS list and CMS item inside nextjs generators

* Changes required for contentful support (#764)

* Changes required for contentful support

* Small changes

* Add possibility to use mapper functions for cms list/items & initialProps (#767)

Co-authored-by: Ionut Pasca <[email protected]>

---------

Co-authored-by: Ionut Pasca <[email protected]>

* Feat/dynamic links support for cms details pages (#765)

* Progress so far

* Progress so far

* aRemove type cast that was unnecesarry

* A better example

* Feat/contentful richtext (#768)

* Support for dynamic attributes from ctx

* Test and fix for contentful richtext node

* Remove console.log

* We dont use package.lock

* Bring back standalone

---------

Co-authored-by: Eliza Nitoi <[email protected]>
Co-authored-by: Ionut Pasca <[email protected]>

* Allow static values on component seo and meta tags (#772)

* Allow static values on component seo and meta tags

* Small change

---------

Co-authored-by: Ionut Pasca <[email protected]>

* Subselector support for classes (#770)

* Subselector support for classes

* Add explanation for &

* Support states and MQs for subselector classes as well

* Fix run standalone for next project with cms uidl

* Better debug for problematic context providers

* fix/THQ-2027 read-nested-data (#773)

* Check if node attributes have contexts

* Check if node attributes have contexts (#774)

Co-authored-by: Ionut Pasca <[email protected]>

* Some changes to fix the contentful normalisation

* Revert "Merge with better fetch"

This reverts commit 618b405.

* Use id as fallback for context if

* Add support for empty/error/loading states in cms list/item nodes (#779)

* Add support for empty/error/loading states in cms list/item nodes

* Changes after code review

---------

Co-authored-by: Ionut Pasca <[email protected]>

* Handle markdown node with external package

* Generate cms nodes only if they exist

* add element in cms-project.json to test

* Fix for missinng importAlias in decoders

* Fixing existing tests with defaults for the new values in pageOptions

* Allow lerna to run on this fetch branch

* chore(release): 'publish v0.27.3-alpha.0'

* Context name fix for dash-cases

* chore(release): 'publish v0.27.3-alpha.1'

* (fix): Handlig names for states in cms nodes (#789)

* Fix handlig names for states in cms nodes

* Fix prop ad state handling for naming convenntons

* Enforce the casing during UIDL resolution phase

* Fix remaning tests

* Resolve cms-list items referece for prop naming convention

* use parser instead of resolver for prop changes

* Fix bug with parsing for cms-list item

* Fix naming convention in parsing for UIDL parser

* Fix for name hanndling in node-to-jsx handler

* Fix for adding loading and error ast

* Generating loading states at parsing time in the UIDL

* Final fix for component reference style parsing

* chore(release): 'publish v0.27.3-alpha.2'

* Add support for wordpress - minor changes required (#790)

* (refactor): Refactor better fetch branch and UIDL

* Wrap resources with exports

* Refactor for resource responses

* Refactor passing params to resource fetcher functions

* (fix): Pass params from context to resource fetcher

* Use imported resouse for getStaticPaths AST

* WIP: Simplyfying cms and cms-list-node

* Add support for wordpress - minor changes required

* Merging better fetch with the refactoring chages

---------

Co-authored-by: JayaKrishnaNamburu <[email protected]>
Co-authored-by: Ionut Pasca <[email protected]>

* Revert "Add support for wordpress - minor changes required (#790)" (#792)

This reverts commit fefe05d.

* Add support for wordpress - minor changes required

* Mark totalCount as non optional property

* chore(release): 'publish v0.27.3-alpha.3'

* Fix cms project for this branch

* (refactor): normalization of UIDL and new changes for resource mappings (#795)

* normalization of UIDL and new changes for resource mappings

* Add support for cms-list using api and plugins

* Combine next and react fetch plugins into one

* Allow trace for logs

* Ability to handle cms-item and make the request post only when needed

* Add params only when needed in next apis

* Make mappers configurable and fix all the tests

* Pass content-type headers for nextjs fetch calls

* chore(release): 'publish v0.27.3-alpha.4'

* Add missing plugin-contexts in teleport-code-generator plugin

* fix use context from link ability (#793)

* fix use context from link ability (#797)

Co-authored-by: Eliza N <[email protected]>

* Params fix for keys and default validation for mappers

* Add naming convention for the resource imports

* chore(release): 'publish v0.27.3-alpha.6'

* chore(release): 'publish v0.27.5-alpha.0'

* Commit yarn.lock

* (feat): Add response type for resources (#800)

* (feat): Add response type for resources

* Add explanation for AST resposnse

* chore(release): 'publish v0.27.6-alpha.0'

* Use unique names for resource files (#803)

* chore(release): 'publish v0.27.7-alpha.0'

* Fix the route mapping for nested resources (#806)

* chore(release): 'publish v0.27.8-alpha.0'

* Allow page attribute to be taken from query params (#805)

Co-authored-by: Ionut Pasca <[email protected]>

* Add support for date-time nodes (#809)

Co-authored-by: Ionut Pasca <[email protected]>

* (refactor): `cms-list` and `cms-item` to use predefined primitives (#802)

* Refactor cms-list and cms-item to use predefned primitives

* Add attributes for cms nodes

* (refactor): Remove un-used contexts and inline-fetch implementation

* (refactor): Allow support for nodesLookup for cms-list and cms-item

* Add examples for nesting and inline fetch improvements

* Final changes for support for nested cms nodes

* fix tests

* Mirror the next wrapped API to reflect the original resource signature

* Add ability to add dynamic params to route links for page navigation

* Add examples for all use-cases with csm

* Refactor the path mapping for blogpost nodes

* Remove duplicate UIDL

* Add cms identifier to use the mapper

* Fix for resource name for wrapped next apis

* delete cms-list and cms-list-item components from react template

* (fix): drop react inline-fetch and fix valuePath and itemValuePath

* Update the sample for the cms-project

* Use expressions for renderprop child instead of dynamic nodes

* Add ability to set expressions for url and navlinks

* fix tests for the chnges for uidl navlink

* change the way params are passed to nested cms nodes

* Add router dependency for supporting pagination query params

* Fix typos for rosource names

* Delete react inline-fetch file

* chore(release): 'publish v0.28.0-alpha.0'

* (refactor): Refactor cms  to use new data-provider and repeater pattern (#811)

* (refactor): Refactor cms and cms-item to use new data-provider and repeater pattern

* Load DataProvder and Repeater from github

* add persistentForInitialRender flag for loading intialData

* fix tests for custom-files

* chore(release): 'publish v0.29.0-alpha.0'

* Add support for state values for cms dynamic data (#812)

Co-authored-by: Ionut Pasca <[email protected]>

* Add none response type so mappers can read headers and body both

* chore(release): 'publish v0.30.0-alpha.0'

* test push

* (feat): Add support for external resource fetchers

* (refactor): Improve import statements for getStaticProps and getStaticPaths

* Add support for external packages for inline fetch

* caisy rich text. fix custom headers

* Handle CMS list repeater separately from CMS list node (#818)

* Handle CMS list repeater separately from CMS list node

* V1 that will only in part be merged

* Improved version

* Use pagination from new normalizer

* Push test project

* Change resourceMappers to accept params

* chore(release): 'publish v0.31.0-alpha.0'

* Add support for importDefinitions inside conditional nodes. Caisy rich text renderer

* Allow namedImport for external resources

* (feat): Add support for ISR and on-demand cache validation in projects (#817)

* (feat): Add ability to handle cache validator for on demand ISR

* Upgrade next, react and react-dom

* Add teleport-config fil by default

* (fix): missing getStaticProps in listing and details pages

* calculate paths only in the handler

* Update script for revalidate

* (fix): switch back to next@12

* add dependency instead of creating a side effect with revalidate

* Use revalidate from the response and not from request

* Add new version of code-generation for web-hook system

* (feat): More advanced use-cases for cache configuration

* (fix): when secret is not sent to the plugin. Don't add any if conditions to check for the secret

* add optional chaining while reading resources

* rename next-cache plugin to revalidate-api

* chore(release): 'publish v0.32.0-alpha.0'

* Return only the actual data for cms items, without pagination meta (#821)

Co-authored-by: Ionut Pasca <[email protected]>

* Re-add pagination meta to static props (#824)

* (fix): Parse and use template literals

* Add missing @babel/types in the plugin-common package

* chore(release): 'publish v0.33.0-alpha.0'

* (fix): Fix grouping dependencies with multiple aliasies

* Add namedImport in react mapping and updated json

* Allow to import and use something from existing npm package

* uncomment code from standalone

* Add caisy uidl sample

* Use local for local resource dependencies

* fix import for additional importDefinitions

* refactor package.json versions

* Update the node version in CI to node 18

* (refactor): Add error logging for revalidate end point (#827)

* Fix and update CMS node parsing to not have ifs in a switch (#826)

* Fix and update CMS node parsing to not have ifs in a switch

* Remove initialData from repeater

* Use optional expressions instead of member expressions

* Use fallback: blocking on CMS pages for non-tiny datasets to work (#829)

* chore(release): 'publish v0.34.0-alpha.0'

* Remove unused import

* Update yarn.lock file

* Update @babl/types and fix template literals error

* chore(release): 'publish v0.35.0-alpha.0'

* (fix): transform component attributes for local components (#834)

* chore(release): 'publish v0.36.0-alpha.0'

* Use latest thq-react-component packages (#835)

* chore(release): 'publish v0.37.0-alpha.0'

* (fix): parse change change the value for state and prop modifiers (#836)

* (fix): parse change change the value for state and prop modifiers

* Fix tests for the events default behaviour

* chore(release): 'publish v0.37.1-alpha.0'

* fix/THQ-2643 Fix generated code for pagination cases (#837)

* chore(release): 'publish v0.38.0-alpha.0'

* (feat): Support expressions for resource params

* chore(release): 'publish v0.39.0-alpha.0'

* Add support for dynamic meta information for CMS pages

* (feat): Allow to send prop and state values to resource fetchers

* (refactor): Types refactoring and decoder check for not allowing states and props in initialProps

* Update yarn.lock

* Use id as data provider key for main cms items (#842)

Co-authored-by: Ionut Pasca <[email protected]>

* (feat): Extract root resources from the the cms-list and cms-item (#840)

* (feat): Extract root resources from the the cms-list and cms-item

* Inject the extracted resource from the cms-list and cms-item

* reset cms-project.json file

* Refactor valuePath and itemValuePath handling and add the handling for the cms-list and cms-item

* remove type handling

* Add proper check for valuePath and itemValuePath

* rever changes for the unnecessary files

* Add nullish check for getStaticPaths

* Add valuePath even when nothing is defined

* chore(release): 'publish v0.40.0-alpha.0'

* fix getStaticPaths calculation

* chore(release): 'publish v0.40.1-alpha.0'

* Redirect to 404 page if entity got from staticProps is falsy

* Catch errors and redirect to 404

* chore(release): 'publish v0.40.2-alpha.0'

* Build cms projects on git push

* (feat): Add nesting routing support for `cms` related projects (#847)

* (feat): Add support for nested routes (#845)

* (feat): Add support for nested routes

* Supported nested routes for html

* Revert changes for the project.json file

* Fix tests for the url links

* Fix tests for multiple runs

* fix nested file name issues

* chore(release): 'publish v0.29.2'

* Nested urls support for strapi

* Rever files that don"t need changes

* Update regex to follow the new dynamic page names

* Refactor workflow file

* fix bug for injecting extracted resources inside try block

* Add new cms workflow file

* Add flotiq examples

* Remove regular test workflow

* (fix): Inject extracted resource inside try block (#849)

* correct all UIDL to new syntax with navLinks

* chore(release): 'publish v0.41.0'

* chore(release): 'publish v0.42.0-alpha.0'

* Add Caisy UIDL

* (chore): Use `latest` version of the packages from npm

* Update UIDLs to use pacakges from npm

* update caisy uidl

* (refactor): Wrap `getStaticPaths` with try-catch to handle un-expected errors from the CMS providers (#851)

* chore(release): 'publish v0.42.1-alpha.0'

* Add source support for repeater node (#852)

Co-authored-by: Ionut Pasca <[email protected]>

* chore(release): 'publish v0.43.0-alpha.0'

* chore(release): 'publish v0.44.0-alpha.0'

* fix/THQ-2815 Replace MarkdownToJsx with ReactMarkdown (#860)

* mark cms releaes as alpha

* chore(release): 'publish v0.44.1-alpha.0'

* use lerna --dist-tag option for npm publish

* (feat): Add support for `cms-mixed-type` node. (#855)

* (feat): Add support for cms-mixed-type node

* Add mapping configuration for cms nodes

* Add support for cms-mixed-type with node configuration

* chore(release): 'publish v0.45.0-alpha.0'

* chore(release): 'publish v0.45.1-alpha.0'

* Insert links in cms mixed type elements

* chore(release): 'publish v0.45.2-alpha.0'

* (feat): Extract root resources for data fetching from external resources (#867)

* (feat): Extrtact root resources for caisy

* fix resource file name

* Fix resource names for extracted imports

* skip test workflow on better-fetch branch

* chore(release): 'publish v0.45.3-alpha.0'

* (fix): Parse mapping nodes for cms-mixed-type elements

* (fix): Use different identifiers for page and component names

* chore(release): 'publish v0.45.4-alpha.0'

* (fix): Resolve cms nodes w.r.t to mapped elements

* Revert changes for the cms standalone file

* chore(release): 'publish v0.45.5-alpha.0'

* (refactor): Extract all resource fetchers for cmsnodes and not only root nodes (#873)

* (refactor): Extract all resource fetchers for cmsnodes and not only root nodes

* use descriptive names for the nodes

* chore(release): 'publish v0.45.6-alpha.0'

* (fix): Add revalidate for extracted resources (#874)

* chore(release): 'publish v0.45.7-alpha.0'

* update yarn.lock file

* Update package version to 0.32.0

* (chore): Fix github workflows

* Delete a un-used workflow

---------

Co-authored-by: Ionut Pasca <[email protected]>
Co-authored-by: Eliza Nitoi <[email protected]>
Co-authored-by: Vlad Grecu <[email protected]>
Co-authored-by: Vlad Nicula <[email protected]>
Co-authored-by: TudorCe <[email protected]>
Co-authored-by: Vlad Nicula <[email protected]>
Co-authored-by: JayaKrishnaNamburu <[email protected]>
Co-authored-by: TudorCe <[email protected]>
  • Loading branch information
9 people authored Jan 10, 2024
1 parent 683d03b commit 08e6b6b
Show file tree
Hide file tree
Showing 162 changed files with 32,305 additions and 3,585 deletions.
1 change: 0 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- 'development'
- 'feat/better-fetch'

jobs:
publish:
Expand Down
45 changes: 43 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- '**'
- '!development'

jobs:
test:
Expand All @@ -21,4 +20,46 @@ jobs:
- run: yarn run test:coverage
- run: yarn run upload:coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Building cms projects
working-directory: packages/teleport-test
run: yarn cms
- name: Building Wordpress Project
env:
CMS_URL: ${{ secrets.WORDPRESS_URL }}
working-directory: packages/teleport-test/dist/teleport-project-wordpress-cms
run: |
yarn
yarn build
- name: Building Contentful Project
env:
CMS_URL: ${{ secrets.CONTENTFUL_URL }}
CMS_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_ACCESS_TOKEN }}
working-directory: packages/teleport-test/dist/teleport-project-contentful-cms
run: |
yarn
yarn build
- name: Building Strapi Porject
env:
CMS_URL: ${{ secrets.STRAPI_URL }}
CMS_ACCESS_TOKEN: ${{ secrets.STRAPI_ACCESS_TOKEN }}
working-directory: packages/teleport-test/dist/teleport-project-strapi-cms
run: |
yarn
yarn build
- name: Building Caisy Project
env:
CMS_URL: ${{ secrets.CAISY_URL }}
CMS_ACCESS_TOKEN: ${{ secrets.CAISY_ACCESS_TOKEN }}
working-directory: packages/teleport-test/dist/teleport-project-caisy-cms
run: |
yarn
yarn build
- name: Building Flotiq Project
env:
CMS_URL: ${{ secrets.FLOTIQ_URL }}
CMS_ACCESS_TOKEN: ${{ secrets.FLOTIQ_ACCESS_TOKEN }}
working-directory: packages/teleport-test/dist/teleport-project-flotiq-cms
run: |
yarn
yarn build
6 changes: 6 additions & 0 deletions examples/test-samples/project-sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@
"type": "element",
"content": {
"elementType": "Router",
"events": {},
"children": [
{
"type": "conditional",
"content": {
"node": {
"type": "element",
"content": {
"events": {},
"elementType": "container",
"children": [
{
Expand All @@ -150,6 +152,7 @@
"type": "element",
"content": {
"elementType": "container",
"events": {},
"children": [
{
"type": "static",
Expand All @@ -174,6 +177,7 @@
"type": "element",
"content": {
"elementType": "container",
"events": {},
"children": [
{
"type": "static",
Expand Down Expand Up @@ -416,6 +420,7 @@
"type": "element",
"content": {
"elementType": "text",
"events": {},
"children": [{
"type": "dynamic",
"content": {
Expand Down Expand Up @@ -527,6 +532,7 @@
"type": "element",
"content": {
"elementType": "container",
"events": {},
"children": [{
"type": "dynamic",
"content": {
Expand Down
Loading

0 comments on commit 08e6b6b

Please sign in to comment.