Commit Graph

764 Commits

Author SHA1 Message Date
Naz
129bf04b0e Published new versions
- @tryghost/database-info@0.3.1
 - @tryghost/mw-error-handler@0.2.0
2022-04-08 14:30:50 +08:00
Naz
ee7655213e Added 406 response for outdated Ghost instance
refs https://github.com/TryGhost/Toolbox/issues/280

- When an outdated client receives a 404 as a response there's no clear way to act on it. Plain 404 says nothing about need to update.
- In such cases the resourceNotFound handler should return a 406 error indicating the Ghost instance needs an update.
2022-04-08 12:52:41 +08:00
Naz
88500e0704 Added 406 response for outdated API clients
refs https://github.com/TryGhost/Toolbox/issues/280

- When an outdated client receives a 404 as a response there's no clear way to act on it. Plain 404 says nothing about need to update.
- In such cases the resourceNotFound handler should return a 406 error indicating the client need to update.
2022-04-08 12:40:37 +08:00
Naz
d81accdebf Changed require declaration to be more readable
no issue

-  When adding more methods under test to this file the require statement will becom difficult to read in one long line. Multiline statement is way nicer to track in git history too
2022-04-08 11:24:03 +08:00
Renovate Bot
cca620cb35 Update dependency knex to v1.0.5 2022-04-04 21:38:20 +00:00
Sam Lord
c742848f57 Published new versions
- @tryghost/mw-error-handler@0.1.8
2022-04-04 17:16:15 +01:00
Sam Lord
5537942bdf Updated @tryghost/errors
no issue

Prevents errors with `hideStack: true` from displaying the stack
2022-04-04 17:13:13 +01:00
Daniel Lockyer
43f559690b Published new versions
- @tryghost/package-json@1.0.18
2022-04-01 14:13:28 +01:00
Daniel Lockyer
d29b8e65ec Fixed symlinked directories ignored when reading packages
refs bd6a295674

- earlier this week I refactored this block of code to get rid of
  explicit `stat` calls, to make the fs operations a little more
  lightweight
- I inadvertantly forgot that readdir doesn't follow symlinks, and we
  were previously use stat that does, so it was ignoring themes that were
  symlinked into `content/themes`
- instead of rolling back my change, I've added an if-statement to call
  `fs.stat` and check the origin of the symlink to see if it's a
  directory
- also added a test that fails without this change
2022-04-01 14:07:04 +01:00
Daniel Lockyer
22d13193e8 Deeleted unused module
- this was an experiment that didn't pan out, and I don't plan on using
  it again
2022-04-01 12:47:16 +01:00
Daniel Lockyer
a19fe06baf Published new versions
- @tryghost/knex-sqlite3@0.1.1
2022-03-29 08:44:38 +01:00
Daniel Lockyer
f39a1ce06c Added sqlite3 as an optional dependency
refs https://github.com/TryGhost/Toolbox/issues/213

- this bundles SQLite so it is abstracted away from consumers of this
  package
2022-03-29 08:43:29 +01:00
Daniel Lockyer
03ba3a4d43 Published new versions
- @tryghost/knex-sqlite3@0.1.0
2022-03-28 21:59:44 +01:00
Daniel Lockyer
cf334a6b57 Added @tryghost/knex-sqlite3 package
refs https://github.com/TryGhost/Toolbox/issues/213

- this package exports a custom dialect that extends `sqlite3` but uses
  the original `node-sqlite3` module
2022-03-28 21:59:18 +01:00
Daniel Lockyer
1a6eaff799 Published new versions
- @tryghost/database-info@0.3.0
 - @tryghost/image-transform@1.0.29
 - @tryghost/package-json@1.0.17
 - @tryghost/zip@1.1.22
2022-03-28 13:59:37 +01:00
Daniel Lockyer
aad55e83d9 Added helper methods for detecting database from config
refs https://github.com/TryGhost/Toolbox/issues/213

- this means we can remove some more hardcoded strings and refactor
  database code to be more abstract
2022-03-28 13:54:50 +01:00
Renovate Bot
446deab43b Update dependency fs-extra to v10 2022-03-28 11:32:09 +01:00
Daniel Lockyer
bd6a295674 Refactored to more efficient fs call for reading packages
- we don't need to do both a `fs.readdir` and a `fs.stat` because
  `fs.readdir` has the `withFileTypes` which returns the directory entry
  info and so this avoids an extra stat syscall
2022-03-28 11:31:45 +01:00
Daniel Lockyer
14a087536f Published new versions
- @tryghost/minifier@0.1.12
 - @tryghost/mw-error-handler@0.1.7
 - @tryghost/update-check-service@0.3.2
 - @tryghost/zip@1.1.21
2022-03-24 11:02:25 +00:00
Renovate Bot
6a805a436d Update dependency @tryghost/errors to v1 2022-03-24 10:39:08 +00:00
Daniel Lockyer
4b1db9d998 Unpinned dependencies
- libraries should have dependencies unpinned so we can rely on
  lockfiles and reduce duplicates
- this commit unpins a handful of dependencies
2022-03-24 10:31:31 +00:00
Daniel Lockyer
52365c6f99 Published new versions
- @tryghost/mw-error-handler@0.1.6
2022-03-24 10:10:26 +00:00
Daniel Lockyer
10e97cad23 Handled unknown errors when preparing user message
- in the event we get an unknown error bubble up, we don't handle the
  templating on the error name
- `@tryghost/tpl` throws an error because we pass an undefined string:
  `Cannot read properties of undefined (reading 'replace')`
- this commit adds handling to fallback to a different user message in
  that event so we don't cause a 500 error
2022-03-24 10:06:55 +00:00
Sam Lord
866c746455 Published new versions
- @tryghost/database-info@0.2.5
 - @tryghost/mw-error-handler@0.1.5
2022-03-21 09:38:38 +00:00
Sam Lord
d65ba072f9 Split prepareError from prepareStack
no issue

Change to error handling caused all theme errors to be reported in Sentry, this fix (and a respective fix in Ghost) allows the error to be prepared for sentry before replacing the stack
2022-03-21 09:38:05 +00:00
Renovate Bot
33948553e3 Update dependency knex to v1.0.4 2022-03-14 00:34:06 +00:00
Sam Lord
432ebed27c Published new versions
- @tryghost/job-manager@0.8.21
 - @tryghost/mw-error-handler@0.1.4
2022-03-11 10:48:00 +00:00
Sam Lord
51588c6a24 Ensure Sentry is triggered before replacing the stack trace
refs: https://github.com/TryGhost/Team/issues/1369

If we prepare the error for users to view before using Sentry, then the error passed to Sentry will have the stack trace removed for production environments.

@tryghost/errors@1.2.5 also made it so that the error is not mutated, but cloned and a new one is returned.
2022-03-11 10:47:26 +00:00
Renovate Bot
10e29837e5 Update dependency @sinonjs/fake-timers to v9.1.1 2022-03-07 01:24:01 +00:00
Daniel Lockyer
3675dbd3d7 Published new versions
- @tryghost/database-info@0.2.4
2022-03-02 14:31:00 +01:00
Daniel Lockyer
4acf78a08e Added basic tests for @tryghost/database-info
- these check a few of the imports and static functions
2022-03-02 14:29:16 +01:00
Daniel Lockyer
f77983061e Refactored exports into a class
- following internal feedback, a class with static methods makes more
  sense
2022-03-02 14:27:35 +01:00
Daniel Lockyer
ce5da19189 Published new versions
- @tryghost/database-info@0.2.3
2022-03-02 12:13:38 +01:00
Daniel Lockyer
032e9db2f1 Updated call signature of database-info lib
refs https://github.com/TryGhost/Toolbox/issues/174

- ok, iteration 3 on how this library should work
- 95% of my use cases just need to pass an knex instance and return if
  it's mysql/sqlite
- i don't want to have to initialize the class in this library to get
  that
- this commit reworks the public interface to return a function with
  some simple `is*` functions for those uses cases, or to return the
  class otherwise
2022-03-02 12:11:18 +01:00
Daniel Lockyer
3e9c584589 Published new versions
- @tryghost/database-info@0.2.2
2022-03-01 16:07:02 +01:00
Daniel Lockyer
d8d77ed0ba Added connection method to database info lib
- this allows you to pass in a different DB instance than the one that
  the library is initialized with
2022-03-01 16:05:27 +01:00
Daniel Lockyer
bb04fc49da Published new versions
- @tryghost/database-info@0.2.1
2022-03-01 09:05:02 +01:00
Daniel Lockyer
52eb3181ee Fixed undefined variable references
- this was missed during the previous refactoring
2022-03-01 09:04:05 +01:00
Daniel Lockyer
3324ffc788 Published new versions
- @tryghost/adapter-manager@0.2.28
 - @tryghost/bootstrap-socket@0.2.17
 - @tryghost/config-url-helpers@0.1.5
 - @tryghost/constants@1.0.2
 - @tryghost/database-info@0.2.0
 - @tryghost/image-transform@1.0.28
 - @tryghost/job-manager@0.8.20
 - @tryghost/limit-service@1.0.10
 - @tryghost/minifier@0.1.11
 - @tryghost/moleculer-service-from-class@0.2.23
 - @tryghost/mw-error-handler@0.1.3
 - @tryghost/mw-session-from-token@0.1.28
 - @tryghost/mw-update-user-last-seen@0.1.3
 - @tryghost/package-json@1.0.16
 - @tryghost/pretty-cli@1.2.24
 - @tryghost/promise@0.1.15
 - @tryghost/release-utils@0.7.12
 - @tryghost/security@0.2.15
 - @tryghost/session-service@0.1.38
 - @tryghost/settings-path-manager@0.1.4
 - @tryghost/vhost-middleware@1.0.22
 - @tryghost/zip@1.1.20
2022-03-01 08:40:52 +01:00
Daniel Lockyer
fbc2fc7f65 Altered function usage of @tryghost/database-info
refs https://github.com/TryGhost/Toolbox/issues/174

- this exposes `isMySQL` and `isSQLite` functions which can be used
  within Ghost to figure out which DB we are using
- also cleans up public properties of the class
2022-03-01 08:37:06 +01:00
Daniel Lockyer
3259994e4f Added --all flag to c8 commands
refs https://github.com/TryGhost/Toolbox/issues/203

- without `--all`, c8 will ignore files that aren't covered in tests, so
  they won't pull the test coverage down
- this means we have artificially high coverage scores
- this commit adds `--all` where previously missing
2022-02-21 12:50:26 +01:00
Renovate Bot
b7af869669 Update dependency express to v4.17.3 2022-02-17 03:48:16 +00:00
Daniel Lockyer
5bdc756dec Moved @tryghost/errors to Framework monorepo
refs https://github.com/TryGhost/Toolbox/issues/212

- we've moved `@tryghost/errors` to the Framework monorepo so this
  commit deletes the remaining files in Utils
2022-02-16 09:14:03 +01:00
Renovate Bot
14f37b4932 Update dependency sharp to ^0.30.0 2022-02-16 07:16:50 +01:00
Renovate Bot
3da7577a3a Update dependency folder-hash to v4.0.2 2022-02-16 00:22:11 +00:00
Daniel Lockyer
cfb1ded0d0 Published new versions
- @tryghost/job-manager@0.8.19
 - @tryghost/release-utils@0.7.11
 - @tryghost/update-check-service@0.3.1
 - @tryghost/vhost-middleware@1.0.21
2022-02-04 14:27:23 +01:00
Daniel Lockyer
81458ab4be Updated default changelog content if no emojis exist
no issue

- taken from internal feedback
2022-02-04 14:25:44 +01:00
Renovate Bot
30527371fc Update dependency @sinonjs/fake-timers to v9.1.0 2022-02-03 12:13:52 +00:00
Renovate Bot
6885cdbc90 Update dependency @sinonjs/fake-timers to v9 2022-01-28 14:08:17 +00:00
Daniel Lockyer
636d884322 Moved @tryghost/update-check-service from Core monorepo
no issue

- this packages belongs in here and means we can archive the Core repo
  once complete
2022-01-20 15:25:00 +00:00