-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: basic leanpub generation (#317)
* feat: basic leanpub generation * fix: correct links * build: deploy preview on PR * fix: correct URLs * build: update checkout actions * build: lightweight build for preview * build: fix build * build: fix build * build: fix build * build: fix build
- Loading branch information
Showing
20 changed files
with
540 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
## TODO: Structure for Jill and Bill | ||
|
||
three bullet summary - really emphasise the practical chapters | ||
1. by definition starts off slow | ||
2. gets really practical on text manip | ||
3. slows a bit for scripts | ||
4. then really digs into making the environment your ownhttps://effective-shell.com/ | ||
|
||
- [ ] Chapter by chapter go through the outline; pass that to Bill + Jill | ||
- [ ] each chapter should be useful hands on experiments | ||
- [ ] each chapter what is the differentiator and fresh skill you will learn | ||
- [ ] clear summary for Bill and Jill - who the book is for, the intro | ||
|
||
## Lean=pub | ||
|
||
|
||
{sample: true, community: true} | ||
|
||
## TODO monday's blast out | ||
|
||
ycombinator | ||
r/programming | ||
mckinsey slacks | ||
|
||
## TODO: Donate | ||
|
||
- [ ] Create donate button | ||
- [ ] Create donate page | ||
- [ ] Create cancel page | ||
- [ ] Create thanks page | ||
- [ ] Create share page | ||
- [ ] Test | ||
- [ ] Add GA funnel and goals | ||
- [ ] Setup Task for integrated button (on page experience?) | ||
|
||
No need for leanpub - it generates a manu and I have that | ||
However, markdown to manu could easily generate text for leanpub, most of leanpub is just markdown, except for | ||
|
||
{aside category='warning'} | ||
whatever | ||
{/aside} | ||
|
||
However, why bother with this, if it's online reading people will want, just create a donate page and offer a PDF download for minimum donations. | ||
|
||
- Donation could be a sliding bar, showing how much the author gets | ||
- Create a donate page, suggested minimum and maximum | ||
- track this as a goal in GA | ||
- share the book more widely | ||
- integrate 'donate' links or a 'donate' popup some time | ||
- collect feedback when donating | ||
- [ ] leanpub style slider: https://codesandbox.io/s/leanpub-pricing-slider-clone-8mr9692nl?file=/src/Slider/index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
docs/01-transitioning-to-the-shell/index.md → ...01-transitioning-to-the-shell/00-index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
--- | ||
title: 'Part 1 - Transitioning to the Shell' | ||
slug: '/part-1-transitioning-to-the-shell/' | ||
leanpub_header: |- | ||
{mainmatter} | ||
{sample: true} | ||
{class: part} | ||
--- | ||
|
||
These are the key skills which everyone should know. Without them, you might struggle to perform certain tasks at all. Experienced users can probably skip this section, or just review the summary. But if you are new to the shell, this is the best place to start! This section focuses on helping you quickly get up to speed with how to perform the same kind of tasks you might have performed in a GUI (Graphical User Interface) with the shell. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
docs/02-core-skills/index.md → docs/02-core-skills/00-index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Good Scripts to write as exercises | ||
|
||
- `recent` - a better version of `history`, which deduplicates and sorts based on the most commonly used items | ||
- `quickman` - a quick link to the most common man pages | ||
- `options` - show and interactively toggle options | ||
- `phonetic` - take a sequence of letters/numbers and spell it out using NATO phonetic alphabet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
The shell, in particular the Bourne-Again Shell has been popular for many years. But what does the future hold? With the advent of the Linux Subsystem for Windows, new shells like Nushell, and the latest version of MacOS switching from Bash to Z-Shell, we finish off by looking at some of the trends which might shape how we use shells in the future. | ||
|
||
Scattered notes so far: | ||
|
||
- [A Terminal for the Graphical Age](https://medium.com/the-graphical-terminal/a-terminal-for-the-graphical-age-87ab7aaa2749) - Great article on an ASCII terminal with modern features. Very interesting project. | ||
- Another interesting project is Nu: https://github.com/nushell/nushell | ||
- There's a great podcast about Nu here: https://changelog.com/podcast/363 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
title: Markdown | ||
--- | ||
|
||
The contents of this book are primarily written in MDX. Some key concepts to be aware of: | ||
|
||
- [MDX](https://github.com/mdx-js/specification) is the language that most files in the `./doc` folder are written in | ||
- [Commonmark](https://commonmark.org/) is the standard markdown spec that MDX is based on | ||
- [GitHub Flavored Markdown](https://github.github.com/gfm/) is also based on Commonmark | ||
- [Markua](https://leanpub.com/markua/read) is used internally for the Leanpub distribution | ||
|
||
Essentially this means that for the book to render properly in Docusaurus, preview nicely in GitHub, and be able to be transformed into a format for use with Leanpub, some specific rules should be followed. | ||
|
||
## Links | ||
|
||
TODO: links should be explicit e.g. `00-index.md` rather than `index.md` | ||
|
||
## Emphasis | ||
|
||
TODO: Use *single stars for italics* and **double stars for bold** - because Markua confusingly uses _single underscores for underline_. | ||
|
||
## Asides / Admonitions / Blurbs | ||
|
||
TODO | ||
|
||
## Markua Tags | ||
|
||
TODO | ||
|
||
`frontmatter` marks content that is considered part of the introduction or preface. It is numbered in the manuscript with numerals such as *i*, *ii*, *xii*. | ||
|
||
`mainmatter` indicates content that is part of the main book, it is numbered with numerals. | ||
|
||
`backmatter` todo | ||
|
||
## Titles | ||
|
||
Frontmatter | ||
|
||
## Images | ||
|
||
TODO image names must be unique | ||
|
||
## Images | ||
|
||
:::info Not in Use | ||
|
||
Ideal Image is not currently enabled as it appears to clash with native Docusaurus lazy-loading. | ||
|
||
::: | ||
|
||
The [`@docusaurus/plugin-ideal-image`](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-ideal-image) is used to allow lazy loading and zoom of images. | ||
|
||
Use the `Image` tag as shown: | ||
|
||
```markdown | ||
import Image from '@theme/IdealImage'; | ||
<Image img={require('./images/vim-cheatsheet.png')} /> | ||
``` | ||
|
||
This will render an image as shown below: | ||
|
||
::: warn Currently Disabled | ||
|
||
``` | ||
<Image img={require('./images/vim-cheatsheet.png')} /> | ||
``` | ||
|
||
::: | ||
|
||
## Diagrams | ||
|
||
Render a Draw.io diagram like so: | ||
|
||
``` | ||
import Drawio from '@theme/Drawio' | ||
import asymmetricEncryption from '!!raw-loader!./images/asymmetric-encryption.drawio'; | ||
<Drawio content={asymmetricEncryption} /> | ||
``` | ||
|
||
This would render as below: | ||
|
||
import asymmetricEncryption from '!!raw-loader!./images/asymmetric-encryption.drawio'; | ||
|
||
<Drawio content={asymmetricEncryption} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# leanpub | ||
|
||
Limitations: | ||
|
||
- Sorting is the natural order of the files, so: | ||
|
||
``` | ||
docs/00-index.mdx # works, comes first | ||
docs/01-part1/00-index.md # works | ||
docs/index.mdx # doesn't work, comes too late | ||
``` | ||
|
||
Basic script to test the validity of names of E2E suites and steps, as well as provide some metrics on reports. Can also be used in CI to fail PRs that do not have valid test names. | ||
|
||
**This is a script** - it's not production grade code, it's for quick diagnostics and CI processes. It does not have tests, adhere to standard linting patterns and so on. If we want to industrialise this, we should extract it into it's own repo, module, and put a CLI around it. | ||
|
||
## Quickstart | ||
|
||
Run the script, providing the path to the test files: | ||
|
||
From the `Lingo` folder run: | ||
|
||
```bash | ||
npm run e2e-test-report | ||
``` | ||
|
||
Or manually run the script, providing the path to the test files: | ||
|
||
```bash | ||
node report.js "../tests/specs" | ||
# debug with... | ||
node --inspect --inspect-brk report.js "../tests/specs" | ||
``` | ||
|
||
This will: | ||
|
||
1. Recursively find all files matching the pattern `*.spec.ts` | ||
2. Go through each file and validate top-level `describe` calls to ensure that they match the test name requirements | ||
3. Go through each file and validate the `it` calls to ensure that they match the step name requirements | ||
4. Write a report to `report.csv` for quick analysis | ||
5. Write a summary to the console for quick review | ||
6. Exit wit a non-zero code if any tests or steps do not match the requirements | ||
|
||
## Test and Step Requirements | ||
|
||
- `\d+_RN\:\d+` - tests have a requirement number and protocol id | ||
- `^Step\s?[\d\.]+` steps are clearly named and numbered | ||
|
||
## CSV Report output | ||
|
||
The follow columns are written: | ||
|
||
| Column | Description | | ||
| ------------- | ------------------------------------------------------------- | | ||
| Path | The path to the test file | | ||
| ValidProtocol | TRUE if the test name correctly links to a protocol | | ||
| ValidSteps | TRUE if the names of the steps in the test are named properly | | ||
| NumberOfSteps | The number of steps in the test | | ||
| Name | The actual name of the test | | ||
|
||
## Developer Guide | ||
|
||
Format the code with: | ||
|
||
```bash | ||
npx prettier --write | ||
``` | ||
|
||
Run tests with: | ||
|
||
```bash | ||
npx jest *.spec.js | ||
``` | ||
|
||
Test the build pipeline with: | ||
|
||
```bash | ||
act -s NPM_AUTH -s NPM_USER_EMAIL -W .github/workflows/ci.yml | ||
``` | ||
|
||
See "Testing Pipelines" in the developer guide for how to setup `act`. |
Oops, something went wrong.