Commit Graph

418 Commits

Author SHA1 Message Date
Matt Hanley
1033e7be21 Fixed minified CSS not reflecting latest changes
- CSS was updated previously, but the minified version wasn't
- as a result the private site landing page was visually broken
- minified CSS is built as part of `grunt prod`, called during `grunt release`
2022-03-17 14:47:21 +00:00
Hannah Wolfe
592d02fd23 🐛 Fixed perms error when building public assets
closes: https://github.com/TryGhost/Ghost/issues/13739

- Ghost cannot write to the core folder in correctly configured production installations
- Built assets therefore need to be written to the content directory
- Ghost does not overwrite anything in the content folder as part of an upgrade, therefore static files that are provided by Ghost
  must still live inside /core
- So as a result, we now have core/frontend/public and content/public
2021-11-19 11:36:45 +00:00
Kevin Ansfield
7e2af0910e Added server reload for injected CSS file changes when running yarn dev
no issue

- CSS is rebuilt on theme activation which is annoying to trigger manually whilst developing
- adding whole server reload also triggers theme activation + injected CSS/JS rebuild so it gives us the same reload behaviour as other server-side file changes
2021-11-09 11:07:28 +00:00
Hannah Wolfe
fdf38ba8c6
Initial card asset service implementation
- Requires the new @tryghost/minifier package
- Adds a new service that will handle taking config from the theme and optionally including assets for Koenig editor cards
- It supports both css and js as cards may need one or both
- For any given config, the tool can find the matching files to include and concat and minify them into one file per type
- Currently has an override in place so that this is not yet customisable in the theme - will remove this override when we're ready for the feature
2021-11-04 11:34:40 +00:00
Hannah Wolfe
2ae1afe1b2
Finished moving public to frontend
refs: ae33c89707

- I forgot to do all the meta tasks to cleanup the move of public 🙈
2021-10-19 12:33:46 +01:00
Hannah Wolfe
0f9e3ea8df
Removed grunt-mocha-cli
- we no longer rely on grunt for any testing, and call mocha directly
2021-07-07 09:19:13 +01:00
Hannah Wolfe
7e6800b2b8
Improved dev tooling (#13118)
This commit achieves a few things:

- ☑️  No longer having to remember whether a command is yarn something or grunt something
- ☑️  Simplification of tools hopefully making them easier to remember and use 
- ☑️  Complete removal of the need for grunt from our test tooling

Several of the tools still use grunt under the hood, but the **entrypoint** should aways be `yarn xxx`.

- `grunt main` -> `yarn main`
- `grunt dev` -> `yarn dev`
- `grunt build` -> `yarn build`
- `grunt test:file-or-folder` -> `yarn test file-or-folder`
- `grunt test-unit` -> `yarn test:unit`
- `grunt test-acceptance` -> `yarn test:acceptance`
- `grunt test-regression` -> `yarn test:regression`
- `grunt validate` -> removed due to lack of use

There is now also `yarn test:all` to run all 3 classes of tests

This PR also reorders & restructures the Gruntfile extensively so that:

- The remaining useful commands are all at the top of the file
- Config and other blah happens after all the useful commands
- All release-only config happens in the release task at the very end of the file

---

DONE:

* Removed all references to npm/bower
* Removed all references to lint / deprecated command
* Moved debug to yarn dev:debug
* Removed all references to travis
* Removed broken help task + useless comment
* Removed unused knex-migrator and clean:test setup tasks
* Added new test commands, removed grunt validate
* Moved stubClientFiles to test utility and use in the few tests that need it
* Used mocha in yarn directly except grunt test:x
* Swapped grunt test for yarn test
* extensive cleanup and reshuffling
2021-07-05 20:02:22 +01:00
Hannah Wolfe
6aafb735b1
Added config-url-helpers to config
- getSubdir, getSiteUrl & getAdminUrl were currently part of @tryghost/url-utils
- They have been split out into their own library, and refactored so that they expect to be bound to nconf
- With this commit we can do e.g. config.getSubdir() rather than needing @tryghost/url-utils
- These functions will be passed to url-utils via DI
- This is the first step in breaking down url-utils into smaller pieces
- This commit only does a single change in Gruntfile.js to use the new funtions - this will be rolled out slowly
2021-06-18 20:05:00 +01:00
Hannah Wolfe
c47bc35b0f
Switched test order so acceptance is last
- This highlights slowness as the thing that sits staring at you uncomfortably in your terminal window
2021-06-04 19:51:04 +01:00
Hannah Wolfe
78cdd3fe13 Added core root files to grunt watch list properly
- We no longer have a core/index.js file
- Instead we have a small set of root core files that should all trigger a watch reload
2021-05-04 17:13:09 +01:00
Hannah Wolfe
66490d4f0a Added --trace-warnings to tests
- We've been getting warnings in our tests for some time now, but without --trace-warnings they are impossible to trackdown
- Add this flag for all tests so that we can see stack traces and maybe fix some of the issues
2021-03-10 17:23:30 +00:00
Hannah Wolfe
dbfddf545d Removed overrides from Gruntfile.js
- nothing in Gruntfile.js uses bluebird or mocha
- they ARE seperately required by mocha-cli ahead of our tests in the config
2021-02-05 12:05:09 +00:00
Daniel Lockyer
5405e6adc0
Updated grunt master to be an alias of grunt main
- switches all code references to `main` but keeps `master` as an alias
2021-02-02 18:17:42 +00:00
Aileen Nowak
8e4d58ddfe Updated ghost.org links 2021-01-19 13:28:36 +13:00
Daniel Lockyer
46574de3c5
Fixed check of git remote
- for some reason, that git remote check wasn't working in a bash expansion, and
  then I couldn't get variables updating properly
- this one seems to work and maintains the functionality we want
2021-01-14 13:37:06 +00:00
Daniel Lockyer
2bdb9c5d0a
Added fallback remote for grunt master
no issue

- our docs do not tell the user to set up an `upstream` remote for Casper, so
  running `grunt master` will fail as it expects `upstream` to exist
- this commit adds detection for if `upstream` exists, and falls back to
  `origin` if not
2021-01-14 12:28:55 +00:00
Daniel Lockyer
1ecaac99b7 Removed grunt-contrib-uglify dependency
- the only bit of code that needed this, the minification of `members.js`, was
  removed in 3.37.0 so we no longer need this plugin
2020-11-03 14:13:00 +00:00
Rishabh Garg
8ad11fe082
Enabled Portal (#12317)
no refs

[Portal](https://github.com/TryGhost/Portal) is a new drop-in script to make the bulk of Ghost membership features work on any theme out of the box, which was under a developer flag so far. This release removes the flag for Portal and makes it included as default for any members-enabled Ghost site. The Portal script is backward compatible with old public members script and existing Members-enabled themes should notice no change.

- Removes Portal config flag as Portal is now enabled by default
- Removes old members script as Portal is backward compatible with it
- Changes `{{content}}` helper to show default CTA in case of restricted content access
- `accent_color` setting is no more behind the dev experiment flag and included by default
- Adds migration to switch off Portal button setting for all existing sites which don't have Portal enabled in beta
2020-11-03 14:36:21 +05:30
Daniel Lockyer
1cc58c1f95 Added GitHub Actions workflow to build the latest code
- we want to allow people to download and run the latest code in Ghost
  and Ghost-Admin from Ghost-CLI without going through the process of
  cloning the repos
- this GitHub Actions will generate a release zip and upload it as an
  artifact
- we then have a tool to download the latest artifact, which can be used
  in Ghost-CLI
2020-10-28 16:20:42 +00:00
Hannah Wolfe
e4ab28b70f Prevent grunt from exiting without letting express stop 2020-08-09 17:40:38 +01:00
Kevin Ansfield
b2798fef96 Removed mocha retries config
no issue

Retries can result in bogus error messages for any non-idempotent tests with multiple assertions, causing frustrating test debug experiences.

An example:

1. Members import test runs
2. Import succeeds, count assertions pass, assertion for "import label" presence fails
3. Mocha re-runs the test
4. "Imported member" count assertions now fail because the importer won't import duplicates and the db is not cleared for each individual test for performance
5. Mocha reports a test failure as the imported count being incorrect rather than the missing label
2020-07-22 18:16:36 +01:00
Daniel Lockyer
ff3f8b2489 Removed unused mochacli variable
no issue
2020-06-03 08:12:30 +01:00
Daniel Lockyer
d32101fd92 Fixed typo in Gruntfile
no issue
2020-05-28 18:19:13 +01:00
Vikas Potluri
15d9a77092
Moved config from server to shared (#11850)
* moved `server/config` to `shared/config`
* updated config import paths in server to use shared
* updated config import paths in frontend to use shared
* updated config import paths in test to use shared
* updated config import paths in root to use shared
* trigger regression tests
* of course the rebase broke tests
2020-05-27 18:47:53 +01:00
Hannah Wolfe
515d6936f0 Updated watch to cover all server JS files
- watch wasn't restarting the dev env if you edit the index.js or core/index.js
- these files aren't changed often, but it's still important that Ghost restarts when they do!
2020-05-01 18:00:57 +01:00
Hannah Wolfe
22e13acd65 Updated var declarations to const/let and no lists
- All var declarations are now const or let as per ES6
- All comma-separated lists / chained declarations are now one declaration per line
- This is for clarity/readability but also made running the var-to-const/let switch smoother
- ESLint rules updated to match

How this was done:

- npm install -g jscodeshift
- git clone https://github.com/cpojer/js-codemod.git
- git clone git@github.com:TryGhost/Ghost.git shallow-ghost
- cd shallow-ghost
- jscodeshift -t ../js-codemod/transforms/unchain-variables.js . -v=2
- jscodeshift -t ../js-codemod/transforms/no-vars.js . -v=2
- yarn
- yarn test
- yarn lint / fix various lint errors (almost all indent) by opening files and saving in vscode
- grunt test-regression
- sorted!
2020-04-29 16:51:13 +01:00
Hannah Wolfe
0fe0e09d62 Moved express init + sentry to a shared util
- added core/shared to watched folders in grunt
- moved sentry to shared
- moved express initialisation to a shared file
- always set trust proxy + sentry error handler
- use this new express init everywhere, and remove duplicate trust proxy and sentry error handler code
2020-04-27 18:17:50 +01:00
Daniel Lockyer
09e8474261 Switched to custom GitHub Action for a release
no issue
2020-04-03 13:37:33 +01:00
Daniel Lockyer
5989400df7 Removed unused chalk dependency
no issue

- left over from removing the stable branch warning from the Gruntfile
- it's not used anywhere else
2020-04-01 19:02:55 +01:00
Daniel Lockyer
dfb2995922 Removed stable branch warning from Gruntfile
no issue

- the `stable` branch no longer exists
2020-04-01 18:53:08 +01:00
Hannah Wolfe
e4404f9b9a Removed unnecessary dependency matchdep
- Don't really need a dependency here, can work without it
- matchdep hasn't been updated in 3 years, and has a web of potentially insecure dependencies
- Unlikely to affect us, but safer to go without
2020-04-01 17:50:03 +01:00
Daniel Lockyer
f5bf2673be Removed testing step from Grunt release task
no issue
2020-04-01 16:33:14 +01:00
Daniel Lockyer
02bf8773b9 Automated the release process
no issue
2020-04-01 15:17:52 +01:00
Hannah Wolfe
a4175ff218 Swapped grunt-cssnano for grunt-postcss+cssnano
- The grunt-cssnano plugin is old and no longer maintained
- It uses insecure dependencies that don't really impact us, but we want to get rid of warnings
- Swapping for grunt-postcss+cssnano is a more up-to-date way of sorting this out
2020-04-01 13:17:49 +01:00
Daniel Lockyer
5ef8e0241f Simplified some release code in Gruntfile
no issue
2020-03-31 16:19:16 +01:00
Hannah Wolfe
7f1d3ebc07
Move tests from core to root (#11700)
- move all test files from core/test to test/
- updated all imports and other references
- all code inside of core/ is then application code
- tests are correctly at the root level
- consistent with other repos/projects

Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
2020-03-30 16:26:47 +01:00
Hannah Wolfe
11682bb8a7 Added frontend acceptance tests
- Basic set of tests checks that our default behaviour works as expected
- Moved current acceptance tests to api-acceptance, and added this in frontend-acceptance
- This reduces nesting, and will help when we eventually separate the frontend out entirely
2020-03-20 10:40:22 +00:00
Daniel Lockyer
7b32bf9ca5 Switched tests to GitHub Actions
no issue
2020-03-05 09:50:14 +00:00
Nazar Gargol
258bcc71bf Added minified members.js file handling
refs 91984b54ca

- For request effieciency we should be using a minified file just like we did previously with `ghost-sdk.js`
- Modified 'max-age' caching header to 1 year  for both minified and non-minified files as thay won't affect dev environment and should be beneficial for self-hosting instances that don't use minification
- Along the way corrected an extra 301 redirect because `/public/member.js` path wasn't using a bakslach in the end.
2020-02-26 14:08:10 +08:00
Daniel Lockyer
e978b176cf Increased Mocha timeout to 60s
no issue

- allow for random platform delays in tests
2020-01-29 11:49:08 +00:00
Daniel Lockyer
e04f55cce3 Set Mocha to retry failed tests 3 times
no issue

- we occasionally see random errors which fail tests
- this is a problem because it's blocking us seeing which tests are
  really failing
- for now, retry the tests 3 times to overcome the intermittent problem
  until a better solution is found
2020-01-29 11:49:08 +00:00
Kevin Ansfield
4da73f3a32
Updated Gruntfile to handle new ember-cli logging format (#11253)
refs https://github.com/TryGhost/Ghost-Admin/pull/1335

- ember-cli now has a build progress spinner and some updated messages
- updates Gruntfile stdout/stderr handling to ignore certain error output so that we continue to output the periodic "building admin client..." notifications
2020-01-20 09:42:50 +00:00
Naz Gargol
91984b54ca
🔥 Removed ghost-sdk client for v0.1 API (#11100)
no issue

- As v0.1 API is dropped there is no need to keep an API client around
- Removed references to ghost-sdk in regression test suite
- Removed routes to /public/ghost-sdk.js
- Removed reference to ghost-sdk in grunt build process
2019-09-10 17:15:53 +02:00
Hannah Wolfe
97afc8aa28 Added frontend folder to watch task
- without this grunt dev doesn't restart when making changes to the frontend
2019-07-18 15:31:04 +01:00
Hannah Wolfe
ca7dfe0932 Remove unused doc-related grunt tasks
refs: 585eada1c3 (diff-b9cfc7f2cdf78a7f4b91a753d10865a2)

- doc-related tasks were left even though we removed the dep & generation task
2019-07-18 15:28:27 +01:00
Naz Gargol
df7e64fafa
Extracted frontend folder (#10780)
refs #10790

- Moved /core/apps into core/frontend
- Moved /core/server/helpers to /core/frontend/helpers along with /core/server/services/themes
- Changed helper location in overrides
- Moved /core/server/services/routing to /core/frontend/services
- Moved /core/server/services/url to /core/frontend/services
- Moved /core/server/data/meta to /core/frontend/meta
- Moved /core/server/services/rss to /core/frontend/services
- Moved /core/server/data/xml to /core/frontend/services
2019-06-19 11:30:28 +02:00
Fabien O'Carroll
e82f625a15 Removed members references in Gruntfile
refs #10739

These leftover references were causing issues when running grunt
commands, now that the files are no longer there.
2019-05-13 10:15:29 +02:00
Fabien O'Carroll
3f52c404d4 Removed coverage tasks from Gruntfile
refs #9441
2019-04-08 18:23:35 +02:00
Kevin Ansfield
36511f5a6d Fixed never ending "Building admin client" messages using grunt dev
no issue
- ember-cli stopped outputting the "Build successful" text that we were looking for as an indication of completion
2019-04-04 09:48:19 +01:00
Nazar Gargol
cea6b6c837 Improved grunt express/casper watchers
closes #9718

- fs.fileWatch that is used internally by 'gase' in 'grunt-contrib-watch', is having 100ms pooling default (07828a6845/lib/gaze.js (L36)). This is causing hight CPU usage for large amount of files.
- As suggested in https://github.com/gruntjs/grunt-contrib-watch#why-is-the-watch-devouring-all-my-memorycpu the watch interval was set to higher 500ms because the recommended default of 5s (https://github.com/gruntjs/grunt-contrib-watch/issues/145#issuecomment-20526067) was visible in the development flow
2019-04-02 14:16:26 +08:00