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
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.**
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
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
* 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
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.
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
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
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`
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
refs #9178
- we have to take care that we don't end up in circular dependencies
- e.g. API requires UrlService and UrlService needs to require the API (for requesting data)
- update the references
- we would like to get rid of the utils folder, this is/was the most complicated change
refs #9178
- move express apps to one place (called `web`)
- requires https://github.com/TryGhost/Ghost-Admin/pull/923
- any further improvements are not part of this PR
- this PR just moves the files and ensures the paths are up-to-date
refs https://github.com/mochajs/mocha/issues/3044
- there was a breaking change in mocha, which i have mentioned [here](ee7710ba68), but i thought it's not required, but it is
- it can happen that with mocha 4.x, travis does not complete a test run, because the process does not exit (maybe the test env does not shutdown everything completely)
- but it's hard to figure out why that happens, so we simply add `--exit` (this reflects the mocha 3.x behaviour)
- i've tested that failed tests are still counted and the build results in a red state
closes#8162
- remove `core/client/dist` from the `clean` task, Ghost-Admin takes care of this automatically
- run `clean:built` any time the following are run so that the built dir doesn't get _huge_ and cutting a release doesn't accidentally include tons of unused built files:
- `grunt dev`
- `grunt dev --client`
- `grunt release`
refs #9178
* Add eslint deps, remove old lint deps
* Add eslint config, remove old lint configs
* Config for server and tests are different
* Tweaked rules to suit us
* Fix linting in codebase - lots of indent changes.
* Fix a real broken test
refs #9178
* Moved app handling code into services/apps
- Apps is a service, that allows for the App lifecycle
- /server/apps = contains internal apps
- /server/services/apps = contains code for managing/handling app life cycle, providing the proxy, etc
* Split apps service tests into separate files
* Moved internal app tests into test folders
- Problem: Not all the tests in apps were unit tests, yet they were treated like they were in Gruntfile.js
- Unit tests now live in /test/unit/apps
- Route tests now live in /test/functional/routes/apps
- Gruntfile.js has been updated to match
* Switch api.read usage for settingsCache
* Add tests to cover the basic App lifecycle
* Simplify some of the init logic
no issue
- Upgraded ghost-ignition
- Use debug from ghost-ignition everywhere in the code base
- Remove debug dependency
- Fixed random typo in Gruntfile.js
closes#8829
- `grunt release` build the admin assets in the folder you execute the command
- the admin build generates the admin views
- we copy the production view for development to avoid another ember build
- the copy command has to happen before we prepare the build zip, otherwise the release tree is incomplete
- this will prevent missing the development view for npm
closes#6149
- speeds up and reduces size of releases by not building and including the development versions of Ghost-Admin
- ensures the server can still be run in both production and development by copying the admin `default-prod.html` file to `default.html` as part of the release task
- development builds aren't useful in release zips (especially when the sourcemaps are stripped from releases) - if deep debugging or changes are to be made in Ghost-Admin then it should be checked out from git (see https://docs.ghost.org/docs/working-with-the-admin-client)
closes#8599
- `grunt dev` was watching for changes to all config files
- added an ignore for config.testing.json
- now it won't restart constantly during tests
closes#8605
- This file has already been moved, might as well get the rename out of the way
- Especially as we don't migrate clients - everyone will now need to make just one change
refs #8235
Usage:
- for existing development setups: `grunt symlink` (will create the pre-commit symlink)
- for fresh development setups: `npm run init` (symlinking happens as part of the typical set up)
- ✨ Added pre-commit hook to handle submodules
- Checks to see if there are any submodules about to be committed
- Output matches closely to `git st` to make it easy to read
- Requires interaction from the committer to accept that this really should be committed
- ✨ Use grunt symlink to register githooks
- Grunt symlink will make a link to the pre-commit hook
- It ONLY does this if there isn't already a pre-commit hook, so won't overwrite anything
- It does this as part of npm run init, not grunt init, because a release repo would NEVER want this
- This is a dev tool, that configures the repo for development
refs #8235
- Use yarn to install top-level dependencies
- Change to use git submodule update --remote to update submodules to master rather than the pinned commit
- Clarify that the existing submodule update will update to the pinned commits by naming it 'pinned'
- Use `upstream` as default remote
- Support --upstream= or GHOST_UPSTEAM env var
- Output a log line telling the user where master was pulled from
refs #8221🔥 Remove ghost=true concept from asset url helper
✨💯 Introduce CSS minification with cssnano
- add new grunt-cssnano dependency
- wire up grunt task to minify public/ghost.css
🎨 Rename minification config & hash params
- Change minifyInProduction -> hasMinFile
- this means this asset should have a .min file available
- Change minifyAssets -> useMinFiles
- this means that in this env we want to serve .min files if available
🎨 Update public/ghost.css to serve .min for prod
- add the new `hasMinFile` property
🎨 Move minified asset handling to asset_url util
- this logic should be in the util, not the asset helper
- updated tests
📖 Error handler always needs asset helper
- this removes the TODO and adds a more sensible comment
- we also need to update our theme documentation around error templates
🔥 Don't use asset helper in ghost head
- use getAssetUrl util instead!
- removed TODO
📖 Update proxy docs
🎨 Simplify asset helper & add tests
- this refactor is a step prior to moving this from metadata to being a url util
- needed to skip some new tests
🐛 Add missing handler for css file
refs #8221
Instead of serving our shared assets from a `shared/` folder, we move the file, which are used server side to `server/public`.
Adds a new `config.paths` entry: `publicFilePath` and renames the middleware to serve the files to reflect the changes.
Adds `404-ghost.png` images to be used by the server side rendered default template `error.hbs`.
refs #8235
- add a new grunt command `dev-master`
- this command will bring back your working directory to latest master
- plus it will update your dependencies and checks your database health
- it won't build the client (!)
* 🛠 ✨ grunt dev-master
* fix jscs 💣
* change to grunt master
no issue
- use `yarn install` instead of `npm install` in grunt tasks
- remove `grunt deps` and `grunt shell:{shrinkwrap/prune/dedupe}` tasks as they are not needed when using `yarn`
- set `options.npmPath` to `yarn` for subgrunt so it doesn't use `npm install` automatically
- don't remove client contributors files in `grunt clean` - those files are now manually created and should be kept
* 🛠 switch to using yarn in our Grunt tasks
* 🛠 use yarn for `npm run init`, update README
refs #8235
- adds `grunt dev --server` which will start the express server and restart on server changes but will not rebuild or watch any client files (if client files are missing or out of date you can run `grunt build` first)
- adds `grunt dev --client` which will only start the client server and rebuilding/livereload - useful if you are experiencing issues with one or the other crashing because you can run server/client in separate tabs
refs https://github.com/TryGhost/Ghost/issues/8161, requires https://github.com/TryGhost/Ghost-Admin/pull/590
- adds a development-only route to the admin app that redirects to ember-cli's livereload script
- updates Gruntfile `watch` task to pass the `live-reload-base-url` param with subdirectory support
- updates Gruntfile `bgShell:client` task to filter potentially confusing output from `ember serve`
- removes `Livereload server on http://localhost:49153`
- removes `Serving on http://localhost:4200/`
With this and the required Ghost-Admin PR, when using `grunt dev` the admin screen will refresh any time a file is changed. It will also allow client tests to be run simultaneously by visiting http://localhost:4200/tests
refs TryGhost/Ghost#8140
refs TryGhost/Ghost-Admin#593
- now that the admin index page is just html, we don't need handlebars anymore
- as we can use res.sendFile to send the static HTML file, don't need to "render" it anymore
- remove the view engine, hbs and the use of helpers - it's all unneeded
- change the filenames to .html to reflect this
refs #8140✨ Support new default-prod.hbs template for admin
✨ Redirect ghost admin urls without a #
✨ Update admin urls to include #
🎨 Move the admin templates
🔥 Remove redirect to setup middleware
🚨 Tests for new middleware
* grunt docs did not work
- the option "extras" did not work
- https://github.com/jbt/docker/blob/v0.2.14/src/docker.js#L1280
- there is a bug in docker docs
- i removed it for now
* grunt watch-docs typo + remove old config
* remove client testing and client linting
* optimise grunt validate
- validate is just a wrapper command for `npm test`
- it will either run lint or the server tests
- no build - why should validate build ember?
* config updates
- we don't have a config.js anymore
- use new config notation
* Update grunt dev
- livereload for Ghost wasn't working correct, the server wasn't stopped correctly and after reload an address in use error was visibile
- that is because the "spawn" option has changed to "nospawn"
- add stdout/stderr info to the bgshell watch command
* 😱🚀🎨 tests: use truncate instead of delete the database
refs #7718, refs #7470
- should bring massive speed improvement
- could also fix random test failures (e.g. sqlite database is busy)
* gruntfile: add knex-migrator command in test-setup
no issue
- as part of a release, we run npm dedupe, npm prune and npm shrinkwrap. In certain cases this can change which dependencies are used
- with this change `grunt deps` will run those 3 tasks so it's easier to test what happens