Commit Graph

98 Commits

Author SHA1 Message Date
Daniel Lockyer
bba95ce034 Enabled persistent filesystem caching for Ember builds
fixes https://github.com/TryGhost/DevOps/issues/123

- ember-auto-import supports webpack v5 and v5 supports persistent file
  caching
- this stores a cache of built files across warm boots, so Admin built
  via `yarn dev` should be faster next time
- also ensures that recursive `node_modules` folders are emptied upon
  `yarn fix`, as the webpack cache is stored in `node_modules` under
  `ghost/admin`
- locally, this speeds up a warm build by 2x (!)
2023-12-13 16:40:18 +01:00
Chris Raible
78b1d130a9
Fixed admin sourcemap fingerprinting for chunk files (#18920)
no issue

- The fingerprinting on chunk files was happening twice (once by ember
and once by webpack), resulting in the .js file and the .map file not
matching
- This change prevents ember from fingerprinting the chunk.*.map files,
so the resulting .map and .js files will have the same basename
- No real functional difference here, just a bit easier to find the
corresponding .map file for a given .js file
2023-11-08 23:15:11 +00:00
Chris Raible
cbba26dccd
Disabled babel sourcemaps in admin build (#18858)
no issue

- Reverting
a96224a152
because it didn't help but made admin builds slower
2023-11-03 03:32:34 +00:00
Chris Raible
a96224a152
Enabled babel sourcemaps in admin build (#18857)
no issue

- Somewhere along the process of building the admin app, the sourcemaps
are getting corrupted
- This commit is to test the theory that babel is the source of the
corruption, because it isn't generating sourcemaps, so we are missing a
step in the process
2023-11-02 17:28:42 -07:00
Chris Raible
f987ce3523
Added sourcesContent key to admin sourcemaps (#18855)
no issue

- The sourcemaps currently generated by the admin build do not include
the `sourcesContent` key
- This commit is to experiment with this change, in particular to see if
it improves the stacktraces available in Sentry from errors in the admin
app
- Currently the stacktraces in admin show the minified code — hopefully
this change will make the stacktraces show the original source code to
make it easier to debug issues from within Sentry
- Might thoroughly break the sourcemaps, in which case I will revert this
2023-11-02 15:18:30 -07:00
Kevin Ansfield
fa0b1c607b
Deleted all Admin code relating to the old editor (#18580)
no issue

- removed labs flag
- removed main editor component and all associated components
- switched usage of `<KoenigBasicHtmlInput>` and `<KoenigBasicHtmlTextarea>` over to use plain `textarea`, the only uses were in settings modals that have been replaced in AdminX
- cleaned up unused editor CSS
2023-10-12 13:17:39 +01:00
Daniel Lockyer
95682f6f94 Configured auto-imported assets to load from supplied URL
refs https://github.com/TryGhost/DevOps/issues/47

- this allows us to optionally configure a URL to set as the CDN URL in
  Admin
2023-07-14 16:29:59 +02:00
Daniel Lockyer
0616222d2e Added support for prepending CDN URLs to Admin assets
refs https://github.com/TryGhost/DevOps/issues/47

- this allows us to produce builds that use URLs from a CDN if the env
  var is provided
2023-07-14 12:27:37 +02:00
Daniel Lockyer
06a9e03f20 Added woff2 and mp4 file fingerprinting to Admin
refs https://ghost.slack.com/archives/C027S85FS/p1688984189646059?thread_ts=1688979558.123869&cid=C027S85FS

- this enables those file extensions to get fingerprinted so the
  filenames contain hashes
2023-07-14 10:50:18 +02:00
Daniel Lockyer
9a68187b8e Reformatted list of fingerprint-enabled file extensions
- this makes it easier to read the diff when you're adding extensions
2023-07-14 10:50:18 +02:00
Elena Baidakova
7ba40a92a1
Added @tryghost/kg-simplemde package (#16147)
refs TryGhost/Team#2427
2023-01-18 19:54:59 +04:00
Kevin Ansfield
df6de75c80 Disabled stripping of test selectors in all builds
no issue

- we want to run e2e tests against production Ghost instances and having test selectors available means much less brittle tests
- only real impact from keeping the selectors is extra file size in production builds but that is minimal (~6KB gzipped at time of commit)
2022-12-07 08:54:04 +00:00
Elena Baidakova
bbf6b95cbf
Added filtered events tables to the analytics page (#15669)
closes TryGhost/Team#2087
2022-10-21 12:31:25 +04:00
Daniel Lockyer
083391c995
Configured all Admin assets to contain fingerprint hash
refs https://github.com/TryGhost/Toolbox/issues/403

- as we're moving towards independent Admin releases, we want to make
  sure that we can bust cache when an asset is updated
- right now, svg, ttf and ico images aren't fingerprinted, so if they
  change, it'll require a browser cache clear to update them
- instead, we should add them to the list of fingerprinted file
  extensions to fix this issue
2022-09-12 10:54:10 +01:00
Kevin Ansfield
3ec8b4e9b3 Deleted react-editor experiment
no issue

- cleanup now that the experiments have finished
2022-09-08 17:35:59 +01:00
Sanne de Vries
bef49576ba Fixed svg titles appearing in tests
Refs 038600c350

- In the reference commit I update config so that svg titles are only removed in production. This causes them to show in tests which causes tests to fail. Config has now been updated to only include svg titles in development.
2022-08-31 16:10:23 +01:00
Sanne de Vries
038600c350 Prettified markup and added titles to all SVGs 2022-08-31 15:02:12 +01:00
Gabriel Csapo
ddfeb90fc6 Updated ember-auto-import@1 -> ember-auto-import@2 (#2252)
requires https://github.com/TryGhost/Ghost/pull/15128
refs https://github.com/TryGhost/Admin/pull/2252

- bumped `ember-auto-import` dependency
  - updated `autoImport` config to match new format
  - added dependencies for node packages that no longer have built-in polyfills in webpack@5
- updated `asset-delivery` to work with `ember-auto-import@2`
  - reverted to standard ember `index.html` to let `ember-auto-import` handle it's insertion of multiple JS chunk files
  - updated the `asset-delivery` addon to copy the the `index.html` and `/assets` to `core/built/admin/{development|production}/` directory rather than splitting the `index.html` file apart from the assets inside Ghost's directory structure
- switched to relative root URL in development/production
  - required because assets are served from the same directory the index file is served from in Ghost rather than from the root
  - Admin uses `/#/` URLs so it can be served from any subdirectory without requiring prior knowledge of that directory at build time

Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
2022-08-02 13:43:28 +01:00
Kevin Ansfield
50aa6f4877 Dropped app.import for react/react-dom in favor of ember-auto-import
refs a4a4136c2f (commitcomment-79676720)

- `ember-auto-import` does the right thing automatically so manual `app.import` is not necessary and avoids potential pitfalls with multiple copies of react being bundled
- added the `window.*` global attachments after importing so that our async loaded UMD components have access to our bundled React and ReactDOM instances
2022-08-02 09:42:25 +01:00
Kevin Ansfield
a4a4136c2f Fixed hooks not being usable inside of react components
no issue

- switched to using the `window.ReactDOM` instance that is created when importing the react/react-dom libraries
  - React stores state/component references inside of the ReactDOM instance when rendering so we need to make sure all renders use the same instance otherwise it loses track of which component a hook belongs to
- cleaned up unnecessary vendor shims and `prop-types` import
  - `react` and `react-dom` vendor shims are unused when using the globals instead of imports
  - `prop-types` import+shim is not required as it's part of the `@tryghost/koenig-react` build unlike the earlier direct import of `react-mobiledoc-editor`
2022-07-27 14:14:12 +01:00
Kevin Ansfield
896cd4888f Switched to dynamically loaded external react-mobiledoc-editor package
no issue

- dropped the bundled `react-mobiledoc-editor` package
- updated `<ReactMobiledocEditor>` component to pull in editor components dynamically
  - added a resource function to dynamically import the external module
  - added `Container` and `Editor` components that read from the resource function and wrap components of the same name from the external module
  - added `<Suspense>` around the `Container` and `Editor` components so that React will show a loading state whilst the external components are still being fetched
  - added `<ErrorHandler>` so we can show an error state if loading fails
2022-07-19 12:48:53 +01:00
Kevin Ansfield
d991da399c Added support for building/rendering react components
no issue

- updated ember-cli-build and eslint config to support jsx
- added `react` and `react-dom` libraries
  - included them in the build so the `React` and `ReactDom` globals are available for use by third party components
  - added vendor shims so we can do things like `import * from 'react'` where the imports are referenced directly to the already imported modules
- added `<ReactComponent>` component
  - designed to be extended from in specific react component classes
  - renders a div and calls `renderComponent()` action once inserted - this should be replaced in any extended classes in order to render a react component
  - handles react rendering and teardown
- added `<ReactMobiledocEditor>` react component that renders an editor composed of components provided by the `react-mobiledoc-editor` package
- added `<KoenigReactEditor>` ember component that renders `<ReactMobiledocEditor>` and handles pass-through of Ember arguments and handling of actions
- updated `<GhKoenigEditorReact>` to render `<KoenigReactEditor>` in place of `<KoenigEditor>`
2022-07-19 12:48:53 +01:00
Hannah Wolfe
51c1db079b Replaced white/black list terminology
refs 92986b77e3i

- found one more place where this has been missed
2022-05-09 12:23:20 +01:00
Kevin Ansfield
baf75c39cf Added auto-subscribe newsletter count when confirming newsletter creation
refs https://github.com/TryGhost/Team/issues/1528

- used the already-loaded newsletters list to pass the slugs of active newsletters to the confirm modal, this allows use of the `{{members-count-fetcher}}` resource with the query `/members/?filter=newsletters:[...slugs]` to fetch a member and full count metadata
- added inclusion of `{{join}}` helper from `ember-composable-helpers` addon
2022-04-19 21:56:13 +01:00
Kevin Ansfield
4565882941 Updated newsletter model and form for latest schema
refs https://github.com/TryGhost/Team/issues/1500

- `senderEmail` is now nullable with a fallback to `noreply@{site domain}`
- `senderName` is not nullable and has no fallback
  - updated preview and input placeholder to match real-world behaviour
  - inserted site title as the default value when creating a new newsletter to avoid friction with the sender name needing to be filled in when saving
- switched `senderReplyTo` input field to a select with "newsletter" and "support" options
  - added basic `<Inputs::Select>` component as `<OneWaySelect>` had re-rendering issues causing loss of selected value when the label of the newsletter email changed to reflect a custom newsletter email value
2022-04-12 14:01:41 +01:00
Thibaut Patel
a47b61c1d4 Added canceled subscriptions in member detail screen (#2287)
refs https://github.com/TryGhost/Team/issues/1141

Showing canceled subscriptions provide a more complete picture of the activity of a member.

- Given there is no `member.product` object when a subscription is canceled, use the `member.subscriptions.price.product` objects instead of `member.products`.
- applied boy-scout rule for linter errors and and code formatting
- removed `multipleTiers` flag conditionals as it's now GA
- set up subscriptions as a separate mirage resource so they are easier to work with
    - updated `PUT /members/:id/` endpoint to match real API's complimentary subscription behaviour
    - modified mirage member serializer to match API output

Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
2022-03-18 16:15:42 +00:00
Kevin Ansfield
5ce67c7892 Initial ember-promise-modals implementation
refs https://github.com/TryGhost/Team/issues/559

We want to get rid of our existing modals implementation because it doesn't play well with Glimmer compoments and the animation library it uses is now unmaintained and blocking our Ember.js upgrades.

- installed addon using customised fork
  - fork allows passthrough of `allowOutsideClick` to `focus-trap` so we can allow clicks on dropdowns and other wormholed content inside of a modal
- extended the `modals` service locally so we can customise click-outside-to-close behaviour and tie in with our `dropdowns` service
- set up styles in `modals-new.css`, mostly copied from `modals.css` with a few specific overrides
  - once all modals are converted we can drop the old `modals.css` and rename `modals-new.css`
2021-09-13 13:01:12 +01:00
Rishabh
8cfdd74fb9 Added nql-lang package for parsing nql filters
refs https://github.com/TryGhost/Team/issues/972

Applying a filter in the new members list updates URL and the filter dropdown contains the filters you've created. We want to keep the filters in filter dropdown on page refresh, which needs parsing nql filter from URL and re-building the filter list for the UI. This needs the `@nexes/nql-lang` package that parses the nql filters in JSON form.

Since `nql-lang` package had a dependency on `path`, `util` and `fs` node modules, this change needs a tweak in ember cli build using `ember-auto-import`, where we polyfill `path` and `util` package while using empty value for `fs` package.
2021-09-09 15:13:58 +05:30
Kevin Ansfield
04f3a4ae41 Enabled sourcemap build output in production
no issue

- production sourcemaps are needed to have reasonably readable stack traces in error reporting
- will be excluded from Ghost release zips by `.npmignore` rules
2021-05-27 18:54:25 +01:00
Kevin Ansfield
ab2dd14677 Pinned all postcss dependencies to v7 (#1830)
no issue

- due to various levels of sub-dependency support across our postcss dependencies we'd ended up with three different versions of postcss installed (6, 7, and 8)
- pinned our dependencies to versions that all use postcss@^7
- we can't upgrade to postcss@8 because we make heavy use of `color-mod` which is no longer in the CSS spec and so the dependency providing it has not been updated
- switched from `postcss-easy-import` to `postcss-import` to drop the postcss@6 sub dependency (we weren't using any of the features that postcss-easy-import added over postcss-import)
- initial tests show CSS compilation times to have roughly halved
- disabled renovate for css dependencies to reduce noise for updates we can't merge
2021-01-19 09:25:05 +00:00
Kevin Ansfield
c4ca317fb2 Switched from uglify to terser
refs https://github.com/TryGhost/Ghost-Admin/pull/1701

- swap `ember-cli-uglify` for `ember-cli-terser` to match ember-cli 3.21.1's generated package.json
- swap `broccoli-uglify-sourcemap` for `broccoli-terser-sourcemap` used manually in our production builds to keep dependencies the same across custom and built-in build artefacts
2020-09-21 17:13:00 +01:00
Kevin Ansfield
3e83675175 🐛 Fix author/tag management in post settings menu (dependency revert)
closes https://github.com/TryGhost/Ghost/issues/12198

- Revert "Switched from uglify to terser" (commit e5b4960170)
- Revert "Update dependency ember-cli to v3.21.1 (commit 7e64683836)"
- Revert "Update ember core (commit 9866a840c6)"
2020-09-10 16:01:51 +01:00
Kevin Ansfield
e5b4960170 Switched from uglify to terser
refs https://github.com/TryGhost/Ghost-Admin/pull/1701

- swap `ember-cli-uglify` for `ember-cli-terser` to match ember-cli 3.21.1's generated package.json
- swap `broccoli-uglify-sourcemap` for `broccoli-terser-sourcemap` used manually in our production builds to keep dependencies the same across custom and built-in build artefacts
2020-09-09 17:22:23 +01:00
Kevin Ansfield
d8a93d00fc Update dependency broccoli-uglify-sourcemap to v4
refs 51d44c76d8, fe30958a19

- re-applying dependency update with required changes to application code
2020-09-07 14:42:53 +01:00
Kevin Ansfield
055674af77 Fixed missing CSS styles in production builds
no issue

- some styles such as `border: none` inside `.gh-btn-white` were being stripped when ran through `clean-css` leading to visual differences between development and production
- disabled `ember-cli`'s default CSS minification as we already use `cssnano` for minification in our postcss pipeline for both dev and prod builds
2020-05-20 11:05:30 +01:00
Kevin Ansfield
d1bb99a805 Fixed conflicting svg ids
no issue

- enables `prefixIds` svgo option to guarantee all `id` attributes are unique across svgs
- disabled `cleanupIds` option so that it doesn't interfere with id uniqueness
- fixes instagram icon background not showing
2019-08-28 11:33:32 +01:00
Kevin Ansfield
ef69eb8610 🐛 Fixed syntax highlighting inside Code Injection inputs
no issue
- the CodeMirror and theme styles were not being correctly loaded
2019-04-29 17:57:41 +02:00
Kevin Ansfield
855fd7ae80 🐛 Fixed difficult to cancel webhook modal
closes https://github.com/TryGhost/Ghost/issues/10135
- `focusOut` events are fired before the `click` event is fired when clicking buttons whilst an input has focus, this has the effect of triggering our on-blur validations that can cause UI to jump which then results in the `mouseUp` being outside of the button which means no `click` event is fired
- stops `mouseDown` event from bubbling from modal cancel/close buttons so that `focusOut` validations aren't triggered
2019-03-15 14:38:54 +00:00
Kevin Ansfield
02f73bc44e Fixed Travis to exit early on lint failures and skip duplicate linting in ember tests
no issue
- Travis runs all `script` tasks even if an earlier one fails so moved to using `&&` so ember tests aren't run if linting errors
- Added `ember-cli-eslint` to the addons blacklist when building in Travis so that we aren't running linting twice (also reduces build log output)
2019-03-11 15:45:26 +00:00
Kevin Ansfield
c4d16d5d67 Bumped dependencies (#1108)
Bumped all non-ember-core dependencies that do not require significant work or that contain unresolvable inter-dependencies.

Skipped:
- `ember-drag-drop` - our usage needs re-working for closure actions
- `ember-infinity`, `ember-in-viewport` - one depends on the other and `ember-light-table` depends on a particular version of `ember-in-viewport` in a way that breaks if they are upgraded

Removed/bumped:
- removed ember-cli-es6-transform
- removed ember-cli-cjs-transform
- removed current-device
- removed ember-responsive
- bumped yarn.lock sub-dependencies
- bumped @ember/jquery
- bumped @tryghost/mobiledoc-kit
- bumped autoprefixer
- bumped broccoli-funnel
- bumped coveralls
- bumped ember-auto-import
- bumped ember-moment
- bumped ember-power-select
- bumped ember-simple-auth
- bumped broccoli-uglify-sourcemap
- bumped ember-cli-eslint and eslint-plugin-ghost with fixes for new rules
- bumped ember-cli-mirage
- bumped ember-cli-pretender
- bumped ember-power-calendar-moment
- bumped ember-power-datepicker
- bumped ember-composable-helpers
- bumped ember-concurrency
- bumped ember-load
- bumped eslint
- bumped walk-sync
- bumped ember-useragent
- bumped fs-extra
- bumped ember-resolver
- bumped @html-next/vertical-collection
- bumped ember-cli-babel
2019-03-05 17:34:00 +00:00
Kevin Ansfield
0d9bb4a07b Moved Spirit CSS library from external to internal 2019-02-24 11:19:22 +07:00
Kevin Ansfield
428153dcd5 Removed babel polyfill
no issue
- the polyfill is no longer required for latest browsers (tested on Chrome, FF, and Safari)
- Edge may have problems but it's not currently supported
- reduces build size. Before/after:
  - `vendor.min.js: 3.29 MB (706 KB gzipped)`
  - `vendor.min.js: 3.2 MB (672.92 KB gzipped)`
2019-01-22 14:03:27 +00:00
Kevin Ansfield
bc8d21e224 Fixed listing, removed unused broccoli-clean-css dependency 2019-01-22 09:30:28 +00:00
Kevin Ansfield
893a010a4f Lazy-load SimpleMDE dependency in MD card (reduces main bundle by 260KB)
no issue
- use broccoli-funnel to avoid polluting the `dist/` dir with unused build artefacts
- load codemirror and simplemde CSS up-front to avoid duplicate styles and specificity problems
- pull simplemde dependency out into a separate JS file and lazy-load in `{{gh-simplemde}}` component to reduce main bundle size. Before/after:
  - `vendor.min.js 3.58 MB (795.88 KB gzipped)`
  - `vendor.min.js 3.32 MB (710.66 KB gzipped)`
2019-01-21 16:06:25 +00:00
Kevin Ansfield
5993280f49 🐛 Koenig - Fixed Cmd+Backspace with special chars and Firefox triple-click behaviour
refs https://github.com/TryGhost/Ghost/issues/9724
- bump to custom build of mobiledoc-kit that includes unreleased fixes
  - cmd+backspace stopping on special chars: https://github.com/bustle/mobiledoc-kit/pull/632
  - Firefox triple-click then typing not replacing content: https://github.com/bustle/mobiledoc-kit/pull/593
2018-07-17 18:13:05 +01:00
Kevin Ansfield
0679eafa9f Koenig - Fix mobiledoc-kit imports
refs 87c2aa4d68
- remove the scoped package name from the import statements
2018-07-02 11:29:42 +01:00
Kevin Ansfield
7bd22a3b87 🐛 Fixed backspace deleting words and rich-text paste collapsing paragraphs
refs https://github.com/TryGhost/Ghost/issues/9623
- switch to custom `mobiledoc-kit` build
  - fixes top-level elements not being run through parser plugins (https://github.com/bustle/mobiledoc-kit/pull/627)
  - fixes <kbd>Alt</kbd> getting stuck and causing <kbd>Backspace</kbd> to delete whole words (https://github.com/bustle/mobiledoc-kit/pull/626)
  - fixes error that can occur when a paste results in blank insert (https://github.com/bustle/mobiledoc-kit/pull/620)
- add new `figureToImageCard` parser
  - replaces hacky workaround to detect an image+figcaption inside the `imgToCard` parser plugin
- remove wrapping of html in a `<div>...</div>` when pasting
  - no longer necessary now that top-level elements are parsed
  - fixes rich-text pastes where multiple paragraphs would be collapsed into a single paragraph
2018-06-18 18:48:32 +01:00
Kevin Ansfield
36b4727371 🐛 Koenig - Fix embedding of multiple FB Videos
refs https://github.com/TryGhost/Ghost/issues/9623
- wrap all embeds in an `<iframe>` so that their scripts are isolated (fixes FB Video)
- add `MutationObserver` implementation to adjust iframe height as embed's content is loaded
- add `noframe.js` to resize embedded iframes such as YouTube videos
2018-06-13 17:13:33 +01:00
Chris Thoburn
20d8c924a2 Don't fingerprint assets in development (dev perf fix) (#1018)
no issue
- doing so causes a double pass through asset-rewrite and forces both to take much longer. This cuts 3s off of rebuilds.  Using asset-rewrite as is done in dev mode is also suspicious, likely a better setup could be devised that doesnt require rewrite to interop with the local ghost server
2018-05-21 09:37:17 +01:00
Kevin Ansfield
6bff262849 Switch to packaged version of Spirit (#985)
no issue
- remove the manually copied Spirit CSS files
- remove the manually copied Spirit helpers
- install `ember-cli-ghost-spirit` addon
- remove manual postcss configuration
- update all `color()` functions in CSS to `color-mod()`
- fixed invalid `color-mod()` usage in `power-calendar.css`
- bump sub-dependencies
2018-04-03 11:52:18 +01:00