Commit Graph

17 Commits

Author SHA1 Message Date
Daniel Lockyer
6dd18d81d4 Enabled no-explicit-any for majority of packages
refs https://github.com/TryGhost/DevOps/issues/50

- we should default to keeping the rule on and so I've excluded lines
  that currently use `any` to avoid the need to go and fix them all up
2023-07-27 16:49:08 +02:00
Daniel Lockyer
c97cc08455 Updated ESLint config for React+Typescript packages
refs https://github.com/TryGhost/DevOps/issues/50

- `react-app` comes from `eslint-config-react-app`, which is a CRA package
- we're moving away from that so this commit switches the linting over
  to a more recently updated plugin
- once that was removed, we started using a newer version of
  `@typescript-eslint/eslint-plugin`, so there were plenty of
  updates/exemptions to make
2023-07-27 11:40:31 +02:00
Fabien "egg" O'Carroll
8d71841918 Mapped tag.deleted event to TagDeletedEvent
refs https://github.com/TryGhost/Arch/issues/61

Because the tags system is still written in the old way, the tag.deleted
bookshelf event needs to be mapped to the DomainEvents to bridge the gap with
the collections package.
2023-07-26 12:54:42 +02:00
Fabien "egg" O'Carroll
90f92ab2a4 Fixed usage of require in test file
We should be using the import syntax instead of require in our TypeScript files.
2023-07-26 12:54:42 +02:00
Daniel Lockyer
b0cf1f949a Switched TypeScript eslint config to custom plugin
refs https://github.com/TryGhost/DevOps/issues/50

- this switches the .eslint configs from `node` to `ts`, which is a new
  config to support eslint for TypeScript
- also makes minor changes to adhere to these new rules
2023-07-25 16:12:35 +02:00
Daniel Lockyer
bf53f8ba6f Added missing dependency definition
- `@tryghost/collections` is used within
  `@tryghost/model-to-domain-event-interceptor` but there wasn't a
  dependency on this package, so the build script wouldn't always build
  the dependency first
2023-07-25 15:56:46 +02:00
Naz
694ab1d32d Added support for expansions in collection filters
refs https://github.com/TryGhost/Arch/issues/46

- Similarly to post filters, collection filters now support both 'tag' and 'tags' nql filter keys when defining a filter for related tag slugs. For example, both `tag:avocado` and `tags:avocado` would both be valid collection filters that would filter by the same 'slug' property of the tags assigned to a post.
- Along with these changes had to rework the tags property of the collection posts to match the shape used in post resources. Moved from:
`tags: ['bacon', 'broc']`
to
`tags:[{slug: 'bacon'}, {slug: 'broc'}]`
2023-07-25 19:01:56 +08:00
Daniel Lockyer
bb4c3de992 Deduplicated ts-node and typescript dependencies
refs https://github.com/TryGhost/DevOps/issues/50

- this commit deduplicates where we define the versions of these
  packages to make them easier to maintain
2023-07-24 16:21:47 +02:00
Naz
04c92d2ca5 Removed CollectionResourceChangeEvent handling
refs https://github.com/TryGhost/Arch/issues/16

- The generic "UpdateAllCollections" logic should not be used as the mapped Post's delete/add/edit events should be sufficient in maintaining collection's state
2023-07-21 19:46:22 +08:00
Naz
eec610dc53 Added collection handling for post's tag attach events
refs https://github.com/TryGhost/Arch/issues/41

- When a tag is attached or detached to the post automatic collections matching  the tag filter should be updated.
2023-07-18 18:36:49 +08:00
Naz
9ce0c92597 Refactored model interceptor to use switch syntax
refs https://github.com/TryGhost/Arch/issues/41

- Having switch statement instead of lots of if/else is slightly more readable. Before adding 5 more event mappings it makes sense to cleanup before things get too messy :)
2023-07-18 18:36:49 +08:00
Daniel Lockyer
2aa7da3a0b Improved monorepo tooling setup
refs https://github.com/TryGhost/DevOps/issues/45

- this switches the monorepo over to using Nx instead of Lerna, because
  we don't currently need the versioning+publishing capabilities
- this also adds an `nx.json`, which allows us to enable task caching
- also adds `build:ts` to the TS projects, which is cached for fast execution
- how these interact with the dev.js script will hopefully soon be
  reworked to be a better experience
2023-07-12 16:27:39 +02:00
Daniel Lockyer
e893c92074 Deduplicated tsconfig.json files
refs https://github.com/TryGhost/DevOps/issues/45

- this moves the bulk of the tsconfig file to the `ghost/` folder and
  simply extends this file in each of the TS lib packages we currently
  have
- this makes it a lot easier to make single changes to our TS config
2023-07-12 09:34:00 +02:00
renovate[bot]
7e6c0ec87e Update dependency typescript to v5.1.6 2023-07-04 12:28:58 +02:00
Naz
87d644ef88
Cleaned up commented out debug code
refs a547ae4b68
2023-07-03 18:58:17 +08:00
Naz
a547ae4b68 Fixed TypeScript related no-unused-vars linting errors
no issue

- Function types in TypeScript can have what looks like an unused variable for the eslint. It's part of the TypeScript language and should be fully supported out of the box.
2023-07-03 18:47:27 +08:00
Naz
e22d8e8680 Extracted model event interceptor to separate package
refs https://github.com/TryGhost/Ghost/pull/17065

- This is a follow up cleanup work after introducing even mapper when working on collections refresh mechanism.
- This module manages interception of the Model events and maps/dispatches Domain events that could later be used in different libraries.
2023-07-03 18:47:27 +08:00