Commit Graph

402 Commits

Author SHA1 Message Date
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
Rishabh Garg
2764ed9ee3 Added tests to ghost release process (#10613)
no issue

- acceptance tests run on each build
- regression tests run once per day
- if we do a release, we have to ensure that we run all tests
- reduces the risk of releasing a new version with broken regression tests
2019-03-15 11:28:22 +01:00
Hannah Wolfe
9efc06255f Simplify lint build in travis & grunt
refs #9441

- We have logic in travis and in grunt and in package.json, this simplifies things.
- `grunt lint` is now just an alias
2019-03-11 16:25:56 +00:00
Kevin Ansfield
7e55715f3d Added circular dependency grunt dev build log filter
no issue
- ember-data 3.6.0 outputs some benign "Circular dependency" warnings which get shown in `grunt dev` build output and cause the "Building admin client..." messages to stop repeating
- adds a filter to ignore any lines containing "Circular dependency" to keep output clean and allow the repeating build message to continue
2019-03-06 09:03:14 +00:00
Fabien O'Carroll
52ad2711b7
Fixed grunt master to work with submodules correctly (#10566)
refs #9441

`grunt master` should only error if there are changes to tracked files which have not been committed - this ensures no work is lost.
2019-03-06 09:03:01 +01:00
Fabien O'Carroll
92621159a6
Errored if grunt master run in dirty working directory (#10476)
refs #9441 

* Refactored master script
* Added check for working directory
2019-02-11 17:25:25 +01:00
Fabien O'Carroll
bdd57b36cf
Moved grunt-eslint to npm script executing eslint (#10474)
refs #9441

* Updated top-level ids to use const
* Removed one layer of indentation
* Added .eslintignore files for server and test tasks
* Added npm scripts for eslint
* Fixed lint command in w/ grunt
* Uninstalled grunt-eslint
* Added eslint config
2019-02-11 13:26:06 +01:00
Katharina Irrgang
75fbd272c9
Separated test env into: acceptance, regression and unit tests (#10411)
refs #9178

`yarn test` only runs acceptance and unit tests.
We will setup a cronjob in Travis and run the regression tests once per day.
You can manually run them with `yarn test:regression`

This separation is just a first step into the right direction.
Travis will no longer run for 10-13minutes.
The goal is to run common API use cases and unit tests in Travis and locally by default.

## After this separation we still need to:

- re-work our test utility
- remove some tests
- define which tests are our common API use cases
- rewrite some tests
- make testing easier (starting/stopping Ghost, fixtures and resetting services or event listeners, it's a pain and takes sometimes ages to fix tests)


---

**Acceptance:**
- common/basic API use cases against the current **stable** API

**Unit:**
- all unit tests (no database access)
- proper mocking

**Regression:**
- packages we don't want to run for each PR or commit
- tests which protect Ghost from breaking components and behaviour
- it is wishful that regression tests are using Ghost's API's (frontend, apps, core)

---

**This PR requires an update to our docs.**
2019-01-22 17:54:50 +01:00
Katharina Irrgang
585eada1c3
Removed grunt-docker from dev dependencies (#10405)
no issue

- this npm package is very out-of-date
- it shows 5-6 security warnings
- i don't really know why this grunt command exists
- it was added 5 years ago: f84d3d32e5
2019-01-22 06:56:50 +01:00
Kevin Ansfield
26d567b948 Fixed high CPU usage of grunt dev
no issue
- exclude the `core/server/lib/members/static/auth` from the express reload watch task as it contains a large `node_modules` directory which caused `grunt-contrib-watch` to peg the CPU
- the directory only relates to static client-side files which do not require a server restart on change and ivereload is handled via the separate `preact watch` shell task
2019-01-02 13:30:37 +00:00
Fabien O'Carroll
a5ea34900b
Added members lib module (#10260)
* Added members library inc. gateway

refs #10213

* Added the auth pages and build steps for them

refs #10213

* Cleaned up logs

* Updated gruntfile to run yarn for member auth

* Design refinements on members popups

* UI refinements

* Updated backend call to trigger only if frontend validation passes

* Design refinements for error messages

* Added error message for email failure

* Updated request-password-reset to not attempt to send headers twice

* Updated preact publicPath to relative path

* Build auth pages on init
2018-12-11 13:47:44 +07:00
kirrg001
8d0595a73c Removed shell:dbhealth from grunt master
no issue

- since Ghost 2.0, the Ghost server takes care of executing `knex-migrator migrate` if needed
2018-10-16 10:24:02 +02:00
Katharina Irrgang
d2baf80d58
Optimised test folder structure (#9958)
refs #9866

- test/functional/
- test/functional/api
- test/functional/api/v0.1
- test/functional/api/v0.1/utils
- test/functional/api/v2
- test/functional/api/v2/admin
- test/functional/api/v2/admin/utils
- test/functional/api/v2/content
- test/functional/api/v2/content/utils

- updated grunt file
- instead of `grunt test-routes`, you now need to use `grunt test-functional` (docs are updated)

You can use `localUtils.API.getApiQuery('posts/')` and it will generate the correct API url.
2018-10-07 16:36:02 +02:00
kirrg001
f198343698 Removed test/functional/module/module_spec.js
no issue

- why? this is a unit test (!)
- we start+stop Ghost in the routing tests a lot, this implicit tested
- it has no priority for now to move this test to a unit test
- this was the only module test, removed related grunt tasks
2018-10-05 13:51:41 +02:00
Kevin Ansfield
3ec62499f5
Added --no-server-watch option to grunt-dev (#9719)
refs https://github.com/TryGhost/Ghost/issues/9718
- running `grunt dev --no-server-watch` will skip watching server and theme files
- reduces idle CPU usage from 20% to 0%
- useful for client-only development to save battery power
2018-07-09 10:12:33 +01:00
Kevin Ansfield
58aa531813 Cancel repeating client build log on build error
refs https://github.com/TryGhost/Ghost/pull/9611
- #9611 added a repeating message to `grunt dev` output whilst waiting for a successful build but there was no handling for failed builds
- modify bgShell config to cancel the repeating message when there is output on the `stderr` pipe from `ember-cli`
2018-05-03 13:03:29 +01:00
Kevin Ansfield
eef2d0bbb0 Log "Building client" message until client build finishes (#9611)
no issue

- display "Building admin client... (can take ~1min)" every 5 seconds when running `grunt dev` until the ember build finishes so that it's clear the command is still busy
2018-04-30 21:16:24 +02:00