Commit Graph

632 Commits

Author SHA1 Message Date
Renovate Bot
6f97bc9063 Update dependency date-fns to v2.27.0 2021-11-30 11:32:47 +00:00
Sam Lord
ffde968c47 Published new versions
- @tryghost/adapter-manager@0.2.19
 - @tryghost/errors@1.0.0
 - @tryghost/image-transform@1.0.19
 - @tryghost/job-manager@0.8.14
 - @tryghost/limit-service@1.0.1
 - @tryghost/minifier@0.1.2
 - @tryghost/package-json@1.0.7
 - @tryghost/release-utils@0.7.2
 - @tryghost/session-service@0.1.29
2021-11-30 11:31:51 +00:00
Sam Lord
ee7b1e4dc6 Combine @tryghost/ignition-errors with @tryghost/errors
refs: https://github.com/TryGhost/Toolbox/issues/147
2021-11-30 11:31:10 +00:00
Hannah Wolfe
a5559d44b6 Published new versions
- @tryghost/job-manager@0.8.13
 - @tryghost/minifier@0.1.1
2021-11-19 12:52:05 +00:00
Hannah Wolfe
0ffeee6712 🐛 Ensured directory exists before attempting write
- Currently, nothing happens if the file doesn't exist, the error is swallowed
- This module should ensure the directory exists at the point of write, else Ghost has to do too much
- TODO: improve the testing and error handling here as well
2021-11-19 12:50:54 +00:00
Renovate Bot
78559033cd Update dependency date-fns to v2.26.0 2021-11-19 08:48:53 +00:00
Sam Lord
57d3097c2a Published new versions
- @tryghost/mw-update-user-last-seen@0.1.1
2021-11-17 10:39:36 +00:00
Sam Lord
b6074c08f6 Empty change for version bump
no issue
2021-11-17 10:38:50 +00:00
Sam Lord
d931c9cf38 Published new versions
- @tryghost/mw-update-user-last-seen@0.1.0
2021-11-16 15:54:46 +00:00
Sam Lord
a92c61ab49 Add @tryghost/mw-update-user-last-seen
no issue
2021-11-16 15:48:52 +00:00
Naz
a5f304d9a7 Published new versions
- @tryghost/constants@1.0.0
2021-11-05 18:15:59 +04:00
Naz
1b15cd0f45 Added files url prefix
refs https://github.com/TryGhost/Toolbox/issues/114

- This new URL prefix is needed for generic files stored in Ghost
2021-11-05 18:14:36 +04:00
Daniel Lockyer
d03f9b4e90 Published new versions
- @tryghost/image-transform@1.0.18
 - @tryghost/job-manager@0.8.12
2021-11-05 12:03:16 +00:00
Daniel Lockyer
eef85bba90 Disabled Sharp's internal cache to improve memory usage
refs https://sharp.pixelplumbing.com/api-utility#cache

- Sharp has a 50MB cache by default, used within libvips, to increase
  the performance of transforming images
- this isn't relevant to us because we should never be optimizing the
  same image as we check if the optimized image already exists
- I presume there is also some extra overhead of using the cache because
  the memory doesn't seem to grow by 50MB
- the memory usage comparison in Ghost is pretty drastic - uploading 10
  images in serial w/ jemalloc:
  - with cache (default) = peak of 480MB, settles down to 330MB
  - disabling cache = peak of 270MB, settles down to 161MB
- this commit disables the cache
- also adds stubbing for the function in tests
2021-11-05 11:59:39 +00:00
Renovate Bot
5872147193 Update dependency @sinonjs/fake-timers to v8.1.0 2021-11-03 14:32:11 +00:00
Hannah Wolfe
e7f02da203 Published new versions
- @tryghost/minifier@0.1.0
2021-11-03 14:30:54 +00:00
Hannah Wolfe
5132b89aee Updated yarn test c8 command
- Since I started this package, our default command has changed to include cobertura reports for codecov
2021-11-03 14:27:39 +00:00
Hannah Wolfe
2a5d7f225c Reworked minifier to have 100% coverage
- As a library, minifier should be subject to 100% coverage
- minor change to the code combining globbing and file reading into a single function for error handling any case where the files can't be found or read
   - we could do more fine grained errors here, but that seems unnecessary given that the usecase is internal, not for user files at the moment
- added error case tests to capture all the uncovered lines
2021-11-03 14:25:02 +00:00
Hannah Wolfe
19383f27f7 Switched uglify for terser + bugfixes
- Uglify was really slow and clunky, so replaced with terser which is fast and simple
- Ensured test cleanup works properly so we can be sure about the state of files during tests
- Changed the output from being the absolute path to just the "dest" value, as that is much more useful as absolute paths include local machine path names
- Fixed async/await issue that got the whole thing working 100%
2021-11-03 14:19:17 +00:00
Hannah Wolfe
03b1e9c3bd Minifier initial version
- wired up a basic minification package
- accepts config for css or js files and can concat and minify them into a single file for each type
- this will be used for generating merged css and js files for various cards, controlled by theme config
2021-11-03 14:16:49 +00:00
Naz
27cc7a06cb Published new versions
- @tryghost/limit-service@1.0.0
2021-10-26 15:52:50 +04:00
Naz
0b8d0feb87 Updated JSDocs for limit-service module
no issue
2021-10-26 15:51:15 +04:00
Naz
a61bf71a16 Added missing "should" imports
no issue
2021-10-26 15:50:43 +04:00
Naz
f6fbfe712a Added custom formatter to uploads limit
refs https://linear.app/tryghost/issue/CORE-121/create-a-video-storage-adapter

 - Provides readable bytes -> megabytes conversion for filesize limit
2021-10-26 15:49:59 +04:00
Naz
4172f993d4 Added custom formatter functionality to MaxLimit
refs https://linear.app/tryghost/issue/CORE-121/create-a-video-storage-adapter

 - Some variables (like file size) would be hard to comprehend with the default formatting. Instead allowed MaxLimit to be configured with a custom formatter
2021-10-26 15:49:26 +04:00
Naz
945e7ab520 Added "uploads" limit type
refs https://linear.app/tryghost/issue/CORE-121/create-a-video-storage-adapter

 - The limit is here to accomodate file size checks
 - An example configuration is in the README
2021-10-26 15:46:36 +04:00
Naz
91a2e54484 Added ability to pass in "currentCount" for limited resource
refs https://linear.app/tryghost/issue/CORE-121/create-a-video-storage-adapter

- When checking limits for a nondb-resource type (like file size) there is no way to "currentCountQuery", so the value has to be passed in directly into the limit to evaluate against configured "max" limit
2021-10-26 15:42:10 +04:00
Naz
9c695a363c Improved JSDocs in limit package
no issue

- There were a few errors and little inconsistencies that needed a cleanup
2021-10-26 11:23:42 +04:00
Naz
aef6c19933 Fixed uses ov currentCountQuery
no issue

- The currentCountQuery method takes in  no parameters!
2021-10-26 11:15:15 +04:00
Naz
d6d88d4f70 Improved JSDocs in limit package
no issue

- There were a few errors and little inconsistencies that needed a cleanup
2021-10-26 11:11:59 +04:00
Naz
3c6bb95234 Fixed typos 2021-10-26 10:52:09 +04:00
Naz
10e9c30b15 Added JSDoc with types to the Limit base constructor
no issue

- Improved type checking a little
2021-10-26 10:51:25 +04:00
Naz
bd4204dbc5 Fixed returned value type
no issue

- The return type was incorrectly declared thworing error during type checking
2021-10-26 10:48:27 +04:00
Naz
c8d840c211 Improved test coverage for limit-service module
no issue

- The aim is to achieve 100% unit test coverage for servies and small modules. This change covers few more bases brining limit-service's module coverage from 80% to 94%.
2021-10-25 18:18:04 +04:00
Naz
8520c8a746 Published new versions
- @tryghost/adapter-manager@0.2.18
 - @tryghost/bootstrap-socket@0.2.13
 - @tryghost/config-url-helpers@0.1.3
 - @tryghost/constants@0.1.12
 - @tryghost/errors@0.2.17
 - @tryghost/image-transform@1.0.17
 - @tryghost/job-manager@0.8.11
 - @tryghost/limit-service@0.6.5
 - @tryghost/moleculer-service-from-class@0.2.21
 - @tryghost/mw-session-from-token@0.1.26
 - @tryghost/package-json@1.0.6
 - @tryghost/pretty-cli@1.2.22
 - @tryghost/promise@0.1.13
 - @tryghost/release-utils@0.7.1
 - @tryghost/security@0.2.13
 - @tryghost/session-service@0.1.28
 - @tryghost/settings-path-manager@0.1.2
 - @tryghost/vhost-middleware@1.0.19
 - @tryghost/zip@1.1.18
2021-10-22 16:01:20 +04:00
Naz
a986da8aa8 Added images and media prefixes
refs https://linear.app/tryghost/issue/CORE-121/create-a-video-storage-adapter

- These paths are a bit painful to discover in URL utils and don't really have to live there. They should be used instead of the onse in @tryghost/url-utils
- the STATIC_IMAGES_URL_PREFIX comes form ef9ab5bd9e/packages/url-utils/lib/index.js (L37)
- the STATIC_MEDIA_URL_PREFIX is a new concept introduced for experimental "video" file support
2021-10-22 15:59:10 +04:00
Daniel Lockyer
81f566b44a Added codecov.io coverage uploader to CI
refs linear.app/tryghost/issue/CORE-74/improve-the-test-situation

- this commit adds the codecov GitHub Action into CI so we can upload
  coverage reports
- the coverage files need to be in XML for them to work with
  codecov, so this commit also adds cobertura (XML) as a reporter
2021-10-20 11:56:20 +02:00
Renovate Bot
ebe62e27c1 Update dependency mocha to v9.1.3 2021-10-15 08:26:58 +00:00
Renovate Bot
dee321eebc Update dependency c8 to v7.10.0 2021-10-06 23:39:01 +00:00
Renovate Bot
5ac4596a30 Update dependency date-fns to v2.25.0 2021-10-05 09:01:07 +00:00
Daniel Lockyer
fd94548b1e Published new versions
- @tryghost/adapter-manager@0.2.17
 - @tryghost/bootstrap-socket@0.2.12
 - @tryghost/constants@0.1.11
 - @tryghost/errors@0.2.16
 - @tryghost/image-transform@1.0.16
 - @tryghost/job-manager@0.8.10
 - @tryghost/limit-service@0.6.4
 - @tryghost/moleculer-service-from-class@0.2.20
 - @tryghost/mw-session-from-token@0.1.25
 - @tryghost/package-json@1.0.5
 - @tryghost/pretty-cli@1.2.21
 - @tryghost/promise@0.1.12
 - @tryghost/release-utils@0.7.0
 - @tryghost/security@0.2.12
 - @tryghost/session-service@0.1.27
 - @tryghost/vhost-middleware@1.0.18
 - @tryghost/zip@1.1.17
2021-10-01 16:57:18 +01:00
Daniel Lockyer
e1887f2df4 Exposed getFinalChangelog helper
no issue

- this is needed so I can generate the release changelog for the Slack
  notifications in action-ghost-release
2021-10-01 16:53:40 +01:00
Daniel Lockyer
d1c58466b5 Updated repository links
no issue

- this repo changes from `master` to `main` a while back, but the
  repository links needed updating too
2021-10-01 14:34:06 +01:00
Daniel Lockyer
669ef01d1b Moved @tryghost/tpl to Framework repo
refs 3cc8da4a7c

- the package has been moved into the framework repo in the referenced
  commit, so the files can be deleted here
2021-10-01 14:28:07 +01:00
Naz
20aad599fd Published new versions
- @tryghost/settings-path-manager@0.1.1
2021-09-30 20:15:02 +02:00
Naz
98f4f90b19 Added getBackupFilePath to settings-path-manager module
refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings

- getBackupFilePath is yet another utility function tha's used often with Ghost config files like so:
- ca149f2c0e/core/server/services/redirects/settings.js (L147-L151)
- ca149f2c0e/core/server/services/route-settings/route-settings.js (L42-L45)
2021-09-30 20:14:21 +02:00
Naz
8f4c4f66b5 Published new versions
- @tryghost/adapter-manager@0.2.16
 - @tryghost/bootstrap-socket@0.2.11
 - @tryghost/config-url-helpers@0.1.2
 - @tryghost/constants@0.1.10
 - @tryghost/errors@0.2.15
 - @tryghost/image-transform@1.0.15
 - @tryghost/job-manager@0.8.9
 - @tryghost/limit-service@0.6.3
 - @tryghost/moleculer-service-from-class@0.2.19
 - @tryghost/mw-session-from-token@0.1.24
 - @tryghost/package-json@1.0.4
 - @tryghost/pretty-cli@1.2.20
 - @tryghost/promise@0.1.11
 - @tryghost/release-utils@0.6.17
 - @tryghost/security@0.2.11
 - @tryghost/session-service@0.1.26
 - @tryghost/settings-path-manager@0.1.0
 - @tryghost/tpl@0.1.5
 - @tryghost/vhost-middleware@1.0.17
 - @tryghost/zip@1.1.16
2021-09-30 19:23:46 +02:00
Naz
a2a2a7c7be Added settings-path-manager module
refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings

- The module is a tiny path resolver for settings used in Ghost. A first obvious place it's used is for routes.yaml settings files. With a little bit of tweaking it should also be adopted by redirects services
2021-09-30 19:22:09 +02:00
Hannah Wolfe
c886738bbc Added README.md and one extra test
- Try to make sure it's clear how to make interpolation work when working with handlebars helpers
2021-09-30 16:17:56 +01:00
Renovate Bot
c9b4504bab Update dependency @sinonjs/fake-timers to v8.0.1 2021-09-27 14:36:36 +00:00