Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b3f4774
Monorepo-izing part 1 with Rollup.
johnrom Nov 16, 2021
c254fd6
monorepoizing part 2, still need to finish website
johnrom Nov 16, 2021
d6d38f3
Getting the build system just right, evolving naming conventions, tri…
johnrom Nov 17, 2021
1615f69
Update gitignore, update tspaths on website, remove generated graphql…
johnrom Nov 17, 2021
fd07b05
Transpile ESM-only packages to CJS for compatibility with CJS environ…
johnrom Nov 18, 2021
ad3808c
Add custom remark-code-import using basePath. See https://github.com/…
johnrom Nov 18, 2021
5bada5a
Setting up gatsby plugins, updating gatsby, and fixing some regexes. …
johnrom Nov 18, 2021
f367579
Start writing tests.
johnrom Nov 19, 2021
1d6c644
Removed "remover" plugins, those can be folded right into the normal …
johnrom Nov 23, 2021
1897417
Removed "remover" plugins, those can be folded right into the normal …
johnrom Nov 23, 2021
3dc3993
Merge branch 'johnrom/monorepoize' of https://github.com/nimblelight/…
johnrom Nov 23, 2021
916f07e
Finished testing remark plugin, starting to create mocks for gatsby p…
johnrom Nov 23, 2021
98c6332
Finalize unit tests, fix build and website.
johnrom Nov 29, 2021
05f8235
Set up prepublish scripts.
johnrom Nov 29, 2021
0f54403
Remove prerelease from lerna.json.
johnrom Nov 29, 2021
a9e24ad
Set initial lerna version to 0 to make first release 1.
johnrom Nov 29, 2021
95ad5b4
More testing with yarn version semver.
johnrom Nov 29, 2021
ac3ce5b
v1.0.0-beta.0
johnrom Nov 29, 2021
2dc8dea
Set up correct package dependencies. This makes a lot of sense.
johnrom Nov 29, 2021
6d67eba
Test switching to MDX but it hurts.
johnrom Nov 29, 2021
96f16af
Allow disabling errors on missing snippets, add an automatic watch ta…
johnrom Nov 30, 2021
e20dcec
Add styles back and ignore gatsby-config.js (it is built by a task).
johnrom Nov 30, 2021
c1cf1e7
Autolink, syntax highlighting, docs fixes.
johnrom Nov 30, 2021
7f1db1e
Merge pull request #5 from nimblelight/johnrom/publish
johnrom Nov 30, 2021
fe35537
Rename packages. TypeScriptify Gatsby Config. Add `setup` npm scripts…
johnrom Mar 18, 2022
8a870e8
Finish renaming packages (had to do this in separate commit so the re…
johnrom Mar 18, 2022
aaef546
Fix small TS bug. More launch task fixes.
johnrom Mar 18, 2022
50c7320
Update package.json.
johnrom Mar 18, 2022
9a06b5d
Reset for changeset.
johnrom Mar 18, 2022
d586dd9
Removed old website config watch task.
johnrom Mar 18, 2022
ad77a4b
Fixed a test.
johnrom Mar 18, 2022
c26fa83
Added Jest extension to extension recommendations.
johnrom Mar 18, 2022
b45f188
Release Initial Beta.
johnrom Mar 18, 2022
6e8ad73
Use default exports because they just work in the remark config world…
johnrom Apr 23, 2022
dfa0e5c
Generate changeset for default exports.
johnrom Apr 23, 2022
c5f4990
Commit changeset version.
johnrom Apr 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
8 changes: 8 additions & 0 deletions .changeset/beige-balloons-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@nmbl/code-snippets': major
'@nmbl/code-snippets-gatsby-remark-plugin': major
'@nmbl/code-snippets-remark-plugin': major
'@nmbl/code-snippets-website': major
---

Switch to default exports since they just work in Remark world.
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.7.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
8 changes: 8 additions & 0 deletions .changeset/new-bugs-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@nmbl/code-snippets': major
'@nmbl/code-snippets-gatsby-remark-plugin': major
'@nmbl/code-snippets-remark-plugin': major
'@nmbl/code-snippets-website': major
---

First iteration of code snippets along with docs website and remark / gatsby plugins.
14 changes: 14 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"mode": "pre",
"tag": "beta",
"initialVersions": {
"@nmbl/code-snippets": "0.0.1",
"@nmbl/code-snippets-gatsby-remark-plugin": "0.0.1",
"@nmbl/code-snippets-remark-plugin": "0.0.1",
"@nmbl/code-snippets-website": "0.0.1"
},
"changesets": [
"beige-balloons-protect",
"new-bugs-buy"
]
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
dist/
dist/
.generated/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fixtures/
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"csstools.postcss",
"bradlc.vscode-tailwindcss",
"Orta.vscode-jest"
]
}
48 changes: 48 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"configurations": [
{
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"request": "attach",
"skipFiles": ["<node_internals>/**"],
"type": "pwa-node"
},
{
"command": "npm run build",
"name": "Build All Packages",
"request": "launch",
"type": "node-terminal",
"autoAttachChildProcesses": false
},
{
"command": "npm run start:website",
"name": "Develop Website",
"request": "launch",
"type": "node-terminal"
},
{
"command": "npm run serve",
"name": "Serve Built Website",
"request": "launch",
"type": "node-terminal"
},
{
"type": "node",
"name": "vscode-jest-tests",
"request": "launch",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"cwd": "${workspaceFolder}",
"runtimeExecutable": "yarn",
"args": [
"run",
"test",
"--runInBand",
// when filtering, every package not matching will have no tests
"--passWithNoTests",
"--testTimeout=9999"
]
}
]
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"editor.formatOnSave": true
"editor.formatOnSave": true,
"jest.jestCommandLine": "yarn run test:vscode"
}
21 changes: 19 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,28 @@
"tasks": [
{
"type": "typescript",
"tsconfig": "./test/fixtures/tsconfig.json",
"tsconfig": "./helpers/tsconfig.watch.json",
"option": "watch",
"problemMatcher": ["$tsc-watch"],
"group": "none",
"label": "tsc: watch - test/fixtures/tsconfig.json",
"label": "tsc: watch - helpers",
"options": {
"shell": {
"executable": "cmd.exe",
"args": ["/d", "/c"]
}
},
"runOptions": {
"runOn": "folderOpen"
}
},
{
"type": "typescript",
"tsconfig": "./fixtures/tsconfig.watch.json",
"option": "watch",
"problemMatcher": ["$tsc-watch"],
"group": "none",
"label": "tsc: watch - fixtures",
"options": {
"shell": {
"executable": "cmd.exe",
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
slug: '/'
title: 'Nmbl Code Snippets - Home'
---

# Nmbl Code Snippets

## Metadocumenting voraciously

Try reading the [docs](docs).
71 changes: 71 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
slug: '/docs'
---

# Welcome to Nmbl Code Snippets

What is a code snippet? Well, it's a snippet of code, but that's not all.

> Code snippets should be testable, tested and maintained.

Shots fired. That's right, code snippets should be living, breathing... code. Real code. Library owners, contributors, and evangelists write hundreds of examples, deploy them to the docs sites, chat rooms, sandboxes and issue trackers of the world, and forget about them. Then, a developer like me comes along, tries out 100 examples, and they are all broken. WHY!

Because code snippets aren't testable, tested, or maintained. *But they should be! HOW?!*

This project is how. I'm writing in a markdown document right now, and I'm about to write a code snippet. Not just any code snippet, but a code snippet which is integrated into the build process of this very project. If the code doesn't compile, these snippets never make it to production, and you *don't read this documentation*. Sound too good to be true? If you're reading this, think again!

## The Header snippet

I've created a snippet surrounding the header of the docs website for this project. The documentation of this snippet can't be wrong, because if it is, the build will fail, and the documentation will never be deployed. If I ever remove the header of the website, `@nmbl/code-snippets` will throw an error, and again the documentation will never be deployed.

### The Source ([with snippets preserved](preserving-snippets)):

[comment]: # "@snippet:start preserve-snippets"

```tsx file=./src/header/header.tsx preserve-snippets
import * as React from 'react';

export const Header = () => (
// @snippet:start header
<header className="main-header">
<h1>Nmbl Code Snippets</h1>
</header>
// @snippet:end header
);
```

[comment]: # "@snippet:end preserve-snippets"

### The Markdown:

````md
```tsx file=./src/header/header.tsx snippet=header

```
````

### The Output:

```tsx file=./src/header/header.tsx snippet=header
<header className="main-header">
<h1>Nmbl Code Snippets</h1>
</header>
```

If you're reading this on an actual website (not the source code, silly), and there is output above, then I have proven my point. Convinced? Here's some further reading:

* [Installing](installing)
* [Preserving Snippets](preserving-snippets)

Not convinced? That's ok, too. Here's a llama:

> ```plaintext
> \\
> l'>
> ll
> llama~
> || ||
> '' ''
> ```
>
> Source: https://ascii.co.uk/art/llama
Loading