Skip to content

Commit

Permalink
fix: Fix book name
Browse files Browse the repository at this point in the history
  • Loading branch information
bebraw committed Nov 25, 2020
1 parent 769f6c2 commit d8d3bf2
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 41 deletions.
81 changes: 55 additions & 26 deletions antwar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,23 @@ module.exports = {
baseUrl: "https://survivejs.com/",
sections: ["blog"],
get: {
content: page => page.file.body,
date: page =>
content: (page) => page.file.body,
date: (page) =>
moment(page.file.attributes.date)
.utcOffset(0)
.format(),
title: page => page.file.attributes.title,
title: (page) => page.file.attributes.title,
},
}),
],
layout: () => require("./layouts/SiteBody").default,
paths: {
"/": {
content: () => require.context("./pages", false, /^\.\/.*\.md$/),
content: () =>
require.context("./pages", false, /^\.\/.*\.md$/),
index: () => {
const index = require("./layouts/SiteIndex").default;
const index = require("./layouts/SiteIndex")
.default;

index.title = "SurviveJS";
index.description =
Expand All @@ -51,18 +53,26 @@ module.exports = {
},
},
blog: {
content: () => require.context("./pages/blog", false, /^\.\/.*\.md$/),
content: () =>
require.context(
"./pages/blog",
false,
/^\.\/.*\.md$/
),
index: () => {
const index = require("./layouts/BlogIndex").default;
const index = require("./layouts/BlogIndex")
.default;

index.title = "Blog";
index.description = "";

return index;
},
layout: () => require("./layouts/BlogPage").default,
transform: pages =>
generateAdjacent(_.sortBy(pages, "file.attributes.date")).reverse(),
transform: (pages) =>
generateAdjacent(
_.sortBy(pages, "file.attributes.date")
).reverse(),
url: ({ sectionName, fileName }) =>
`/${sectionName}/${clean.chapterName(fileName)}/`,
redirects: require("./redirects/blog"),
Expand All @@ -88,7 +98,8 @@ module.exports = {
/^\.\/.*\.md$/
),
index: () => {
const index = require("./layouts/MaintenanceIndex").default;
const index = require("./layouts/MaintenanceIndex")
.default;

index.title = "SurviveJS - Maintenance";
index.description =
Expand All @@ -97,16 +108,20 @@ module.exports = {
return index;
},
layout: () => require("./layouts/BookPage").default,
transform: pages =>
transform: (pages) =>
generateAdjacent(
require("./books/maintenance-book/manuscript/Book.txt")
.split("\n")
.filter(name => path.extname(name) === ".md")
.map(fileName => {
.filter((name) => path.extname(name) === ".md")
.map((fileName) => {
const result = _.find(pages, { fileName });

if (!result) {
throw new Error("Failed to find", fileName, pages);
throw new Error(
"Failed to find",
fileName,
pages
);
}

return result;
Expand All @@ -118,9 +133,14 @@ module.exports = {
},
react: {
content: () =>
require.context("./books/react-book/manuscript", true, /^\.\/.*\.md$/),
require.context(
"./books/react-book/manuscript",
true,
/^\.\/.*\.md$/
),
index: () => {
const index = require("./layouts/ReactIndex").default;
const index = require("./layouts/ReactIndex")
.default;

index.title = "SurviveJS - React";
index.description =
Expand All @@ -129,16 +149,20 @@ module.exports = {
return index;
},
layout: () => require("./layouts/BookPage").default,
transform: pages =>
transform: (pages) =>
generateAdjacent(
require("./books/react-book/manuscript/Book.txt")
.split("\n")
.filter(name => path.extname(name) === ".md")
.map(fileName => {
.filter((name) => path.extname(name) === ".md")
.map((fileName) => {
const result = _.find(pages, { fileName });

if (!result) {
throw new Error("Failed to find", fileName, pages);
throw new Error(
"Failed to find",
fileName,
pages
);
}

return result;
Expand All @@ -155,25 +179,30 @@ module.exports = {
/^\.\/.*\.md$/
),
index: () => {
const index = require("./layouts/WebpackIndex").default;
const index = require("./layouts/WebpackIndex")
.default;

index.title = "SurviveJS - Webpack";
index.title = "SurviveJS Webpack";
index.description =
"Want to learn webpack? Get started for free and build webpack configuration.";

return index;
},
layout: () => require("./layouts/BookPage").default,
transform: pages =>
transform: (pages) =>
generateAdjacent(
require("./books/webpack-book/manuscript/Book.txt")
.split("\n")
.filter(name => path.extname(name) === ".md")
.map(fileName => {
.filter((name) => path.extname(name) === ".md")
.map((fileName) => {
const result = _.find(pages, { fileName });

if (!result) {
throw new Error("Failed to find", fileName, pages);
throw new Error(
"Failed to find",
fileName,
pages
);
}

return result;
Expand Down
3 changes: 1 addition & 2 deletions content/descriptions/webpack.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
**SurviveJS - Webpack** is meant for beginner to intermediate users of [webpack](https://webpack.github.io/). Webpack is a powerful bundler that can simplify the creation of complex web applications.
**SurviveJS Webpack 5** is meant for beginner to intermediate users of [webpack](https://webpack.github.io/). Webpack is a powerful bundler that can simplify the creation of complex web applications.

I designed this book to help you get up to speed with the tool. The book project started early 2015 from a small wiki effort and has since evolved into a complete guide to webpack.

During this process I have become a core developer of webpack while learning a lot about it. In this book I share what I have learned during these years with you.

Webpack, a module bundler, is a powerful tool that helps you to develop complex web applications. It enables techniques, such as **code splitting**. You could say it solves the fundamental problem of web development and it has allowed developers to reach new levels of productivity.

38 changes: 25 additions & 13 deletions layouts/SiteIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ const SiteIndex = ({ section }) => (
/>
<div
dangerouslySetInnerHTML={{
__html: require("../content/descriptions/maintenance.md").body,
__html: require("../content/descriptions/maintenance.md")
.body,
}}
/>
<SubHeading>What Will You Learn</SubHeading>
Expand All @@ -55,15 +56,17 @@ const SiteIndex = ({ section }) => (
<SubHeading>Getting the Book</SubHeading>
<div
dangerouslySetInnerHTML={{
__html: require("../content/gets/maintenance.md").body,
__html: require("../content/gets/maintenance.md")
.body,
}}
/>
</Book>
<Book>
<Heading>SurviveJS — React</Heading>
<div
dangerouslySetInnerHTML={{
__html: require("../content/descriptions/react.md").body,
__html: require("../content/descriptions/react.md")
.body,
}}
/>
<Cover
Expand All @@ -72,37 +75,42 @@ const SiteIndex = ({ section }) => (
/>
<div
dangerouslySetInnerHTML={{
__html: require("../content/descriptions/react-learn.md").body,
__html: require("../content/descriptions/react-learn.md")
.body,
}}
/>
<SubHeading>Getting the Book</SubHeading>
<div
dangerouslySetInnerHTML={{
__html: require("../content/gets/react.md").body,
__html: require("../content/gets/react.md")
.body,
}}
/>
</Book>
<Book>
<Heading>SurviveJS — Webpack</Heading>
<Heading>SurviveJS — Webpack 5</Heading>
<Cover
src={require("../assets/img/covers/webpack-cover.svg")}
alt="Webpack book cover"
/>
<div
dangerouslySetInnerHTML={{
__html: require("../content/descriptions/webpack.md").body,
__html: require("../content/descriptions/webpack.md")
.body,
}}
/>
<SubHeading>What Will You Learn</SubHeading>
<div
dangerouslySetInnerHTML={{
__html: require("../content/descriptions/webpack-learn.md").body,
__html: require("../content/descriptions/webpack-learn.md")
.body,
}}
/>
<SubHeading>Getting the Book</SubHeading>
<div
dangerouslySetInnerHTML={{
__html: require("../content/gets/webpack.md").body,
__html: require("../content/gets/webpack.md")
.body,
}}
/>
</Book>
Expand All @@ -112,29 +120,33 @@ const SiteIndex = ({ section }) => (
<Heading>About the Author</Heading>
<div
dangerouslySetInnerHTML={{
__html: require("../content/authors/juho.md").body,
__html: require("../content/authors/juho.md")
.body,
}}
/>
</Column>
<Column>
<Heading>Getting the Books</Heading>
<div
dangerouslySetInnerHTML={{
__html: require("../content/descriptions/gettingbooks.md").body,
__html: require("../content/descriptions/gettingbooks.md")
.body,
}}
/>
</Column>
<Column>
<Heading>Training</Heading>
<div
dangerouslySetInnerHTML={{
__html: require("../content/descriptions/training.md").body,
__html: require("../content/descriptions/training.md")
.body,
}}
/>
<Heading>Translations</Heading>
<div
dangerouslySetInnerHTML={{
__html: require("../content/descriptions/translations.md").body,
__html: require("../content/descriptions/translations.md")
.body,
}}
/>
</Column>
Expand Down

0 comments on commit d8d3bf2

Please sign in to comment.