mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-08 02:52:39 -05:00
💡 Updated fixtures to make it easier to get started (#14299)
- Our old fixtures were designed as a guide to getting started to Ghost, but they got in the way - The old fixtures now live as part of ghost.org/resources - a living guide to starting with Ghost - These new fixtures mean the site is ready to go as soon as it's setup Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
This commit is contained in:
parent
f2c074ac59
commit
7172db74b0
5 changed files with 50 additions and 165 deletions
|
@ -49,6 +49,13 @@ module.exports = {
|
|||
|
||||
return auth.setup.setupUser(setupDetails);
|
||||
})
|
||||
.then((data) => {
|
||||
try {
|
||||
return auth.setup.doFixtures(data, api.products);
|
||||
} catch (e) {
|
||||
return data;
|
||||
}
|
||||
})
|
||||
.then((data) => {
|
||||
try {
|
||||
return auth.setup.doProduct(data, api.products);
|
||||
|
|
|
@ -126,11 +126,11 @@
|
|||
"type": "string"
|
||||
},
|
||||
"navigation": {
|
||||
"defaultValue": "[{\"label\":\"Home\",\"url\":\"/\"},{\"label\":\"About\",\"url\":\"/about/\"},{\"label\":\"Collection\",\"url\":\"/tag/getting-started/\"},{\"label\":\"Author\",\"url\":\"/author/ghost/\"},{\"label\":\"Portal\",\"url\":\"/portal/\"}]",
|
||||
"defaultValue": "[{\"label\":\"Home\",\"url\":\"/\"},{\"label\":\"About\",\"url\":\"/about/\"}]",
|
||||
"type": "array"
|
||||
},
|
||||
"secondary_navigation": {
|
||||
"defaultValue": "[{\"label\":\"Data & privacy\",\"url\":\"/privacy/\"},{\"label\":\"Contact\",\"url\":\"/contact/\"},{\"label\":\"Contribute →\",\"url\":\"/contribute/\"}]",
|
||||
"defaultValue": "[{\"label\":\"Sign up\",\"url\":\"#/portal/\"}]",
|
||||
"type": "array"
|
||||
},
|
||||
"meta_title": {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3,6 +3,7 @@ const config = require('../../../shared/config');
|
|||
const errors = require('@tryghost/errors');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const logging = require('@tryghost/logging');
|
||||
const moment = require('moment');
|
||||
const models = require('../../models');
|
||||
const mail = require('../mail');
|
||||
|
||||
|
@ -16,6 +17,11 @@ const messages = {
|
|||
failedThemeInstall: 'Theme {themeName} didn\'t install because of the error: {error}'
|
||||
};
|
||||
|
||||
const postSetupFixtures = {
|
||||
'coming-soon': '{"version":"0.3.1","atoms":[],"cards":[],"markups":[["a",["href","#/portal/"]]],"sections":[[1,"p",[[0,[],0,"This is {{site.title}}, a brand new site by {{author.name}} that\'s just getting started. Things will be up and running here shortly, but you can "],[0,[0],1,"subscribe"],[0,[],0," in the meantime if you\'d like to stay up to date and receive emails when new content is published!"]]]],"ghostVersion":"4.0"}',
|
||||
about: '{"version":"0.3.1","atoms":[],"cards":[["hr",{}]],"markups":[["a",["href","https://ghost.org"]]],"sections":[[1,"p",[[0,[],0,"{{site.title}} is an independent publication launched in {{date}} by {{author.name}}. If you subscribe today, you\'ll get full access to the website as well as email newsletters about new content when it\'s available. Your subscription makes this site possible, and allows {{site.title}} to continue to exist. Thank you!"]]],[1,"h3",[[0,[],0,"Access all areas"]]],[1,"p",[[0,[],0,"By signing up, you\'ll get access to the full archive of everything that\'s been published before and everything that\'s still to come. Your very own private library."]]],[1,"h3",[[0,[],0,"Fresh content, delivered"]]],[1,"p",[[0,[],0,"Stay up to date with new content sent straight to your inbox! No more worrying about whether you missed something because of a pesky algorithm or news feed."]]],[1,"h3",[[0,[],0,"Meet people like you"]]],[1,"p",[[0,[],0,"Join a community of other subscribers who share the same interests."]]],[10,0],[1,"h3",[[0,[],0,"Start your own thing"]]],[1,"p",[[0,[],0,"Enjoying the experience? Get started for free and set up your very own subscription business using "],[0,[0],1,"Ghost"],[0,[],0,", the same platform that powers this website."]]]],"ghostVersion":"4.0"}'
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns setup status
|
||||
*
|
||||
|
@ -126,6 +132,22 @@ async function doProduct(data, productsAPI) {
|
|||
return data;
|
||||
}
|
||||
|
||||
async function doFixtures(data) {
|
||||
const date = moment().format('MMMM YYYY');
|
||||
|
||||
_.each(postSetupFixtures, async (mobiledoc, key) => {
|
||||
// Using very simple find and replace because we control the fixtures
|
||||
mobiledoc = mobiledoc.replace(/{{site.title}}/g, data.userData.blogTitle);
|
||||
mobiledoc = mobiledoc.replace(/{{author.name}}/g, data.userData.name);
|
||||
mobiledoc = mobiledoc.replace(/{{date}}/, date);
|
||||
|
||||
const post = await models.Post.findOne({slug: key});
|
||||
await models.Post.edit({mobiledoc}, {id: post.id});
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function sendWelcomeEmail(email, mailAPI) {
|
||||
if (config.get('sendWelcomeEmail')) {
|
||||
const data = {
|
||||
|
@ -197,6 +219,7 @@ module.exports = {
|
|||
setupUser: setupUser,
|
||||
doSettings: doSettings,
|
||||
doProduct: doProduct,
|
||||
sendWelcomeEmail: sendWelcomeEmail,
|
||||
installTheme: installTheme
|
||||
installTheme: installTheme,
|
||||
doFixtures: doFixtures,
|
||||
sendWelcomeEmail: sendWelcomeEmail
|
||||
};
|
||||
|
|
|
@ -36,8 +36,8 @@ const validateRouteSettings = require('../../../../../core/server/services/route
|
|||
describe('DB version integrity', function () {
|
||||
// Only these variables should need updating
|
||||
const currentSchemaHash = '821b2327490e3bebdc62cd54d12932e0';
|
||||
const currentFixturesHash = 'c677d4991347eaaf0bb3f676dd077c53';
|
||||
const currentSettingsHash = '437d4c6da8759f5c35f11f811b86e5bc';
|
||||
const currentFixturesHash = '84be2bb1d62b384260b72ebfc20f81dc';
|
||||
const currentSettingsHash = '71fa38d0c805c18ceebe0fda80886230';
|
||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||
|
||||
// If this test is failing, then it is likely a change has been made that requires a DB version bump,
|
||||
|
|
Loading…
Add table
Reference in a new issue