Compare commits

..

14 Commits

Author SHA1 Message Date
github-actions[bot]
509a8d9115 Version Packages 2021-09-13 13:33:26 +02:00
Mathieu Puech
42418f2c00 fix: disable service worker for local development 2021-09-13 13:29:05 +02:00
Benny Powers
cadd8588b0 fix(blog): conditionally apply blog overview styles 2021-09-13 12:36:51 +02:00
Benny Powers
aabe011427 Update 30-articles.njk 2021-09-13 12:36:51 +02:00
qa46hx
e1089c5701 fix(blog): add title to blog page 2021-09-13 12:36:38 +02:00
Benny Powers
9f10386eb2 fix: hide 404 page from sitemap.xml 2021-08-10 23:57:52 +02:00
qa46hx
0987a41620 fix(mdjs-viewer): fix styling mdjs-viewer 2021-08-10 23:55:09 +02:00
Thomas Allmer
7301a0f354 feat(cli): enable conditional eleventy config 2021-08-01 16:49:20 +02:00
Thomas Allmer
5ac6aa6693 fix(cli): set the encoding of the simulator to utf8 2021-07-27 21:03:51 +02:00
github-actions[bot]
9f1633cccc Version Packages 2021-07-27 12:54:55 +02:00
Thijs Louisse
00f4a91550 fix(blog): alignment + spacings for article grids 2021-07-27 12:51:30 +02:00
Jorge del Casar
eb62dd9fd5 fix: use semver to lint versions 2021-07-21 20:42:22 +02:00
github-actions[bot]
bb07267289 Version Packages 2021-07-21 16:36:44 +02:00
Thomas Allmer
738941afdd feat(cli): add rollup config function to rocket config 2021-07-21 15:57:31 +02:00
34 changed files with 258 additions and 35 deletions

View File

@@ -19,6 +19,9 @@ html {
--primary-color: rgb(44, 62, 80);
--primary-lines-color: #ccc;
--primary-text-color: #2c3e50;
--primary-text-inverse-color: #eee;
--switch-unselected-color: #808080;
--switch-selected-color: #42b983;
}
@media (prefers-color-scheme: dark) {
@@ -45,6 +48,9 @@ html {
--rocket-search-highlight-color: #41ffb0;
--rocket-search-hover-background-color: #6b717a;
--rocket-search-fill-color: #fff;
--primary-text-inverse-color: #2c3e50;
--switch-unselected-color: #808080;
--switch-selected-color: #42b983;
/* Markdown */
--markdown-octicon-link: var(--primary-text-color);

View File

@@ -107,3 +107,60 @@ export default ({
});
```
<!-- prettier-ignore-end -->
## Advanced
Sometimes you need even more control over specific settings.
### Rollup
For example if you wanna add an `acron` plugin to rollup
<!-- prettier-ignore-start -->
```js
import { importAssertions } from 'acorn-import-assertions';
/** @type {import('rocket/cli').RocketCliConfig} */
export default ({
rollup: config => ({
...config,
acornInjectPlugins: [importAssertions],
}),
});
```
<!-- prettier-ignore-end -->
### Eleventy
For example to add custom filter you can access the eleventy config directly
<!-- prettier-ignore-start -->
```js
/** @type {import('rocket/cli').RocketCliConfig} */
export default ({
eleventy: eleventyConfig => {
eleventyConfig.addFilter('value', value => `prefix${value}`);
},
});
```
<!-- prettier-ignore-end -->
You even have access to the full rocketConfig if you for example want to create filters that behave differently during start/build.
<!-- prettier-ignore-start -->
```js
/** @type {import('rocket/cli').RocketCliConfig} */
export default ({
eleventy: (config, rocketConfig) => {
config.addFilter('conditional-resolve', value => {
if (rocketConfig.command === 'build') {
return `build:${value}`;
}
if (rocketConfig.command === 'start') {
return `start:${value}`;
}
});
},
});
```
<!-- prettier-ignore-end -->

View File

@@ -42,11 +42,13 @@ eleventyExcludeFromCollections: true
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% raw %}{% for page in collections.all %}
{%- if page.url !== '/404.html' -%}
<url>
<loc>{{ rocketConfig.absoluteBaseUrl }}{{ page.url | url }}</loc>
<lastmod>{{ page.date.toISOString() }}</lastmod>
<changefreq>{{ page.data.changeFreq if page.data.changeFreq else "monthly" }}</changefreq>
</url>
{%- endif -%}
{% endfor %}{% endraw %}
</urlset>
```

View File

@@ -1,5 +1,17 @@
# @rocket/blog
## 0.3.3
### Patch Changes
- e1089c5: add title to blog page
## 0.3.2
### Patch Changes
- 00f4a91: alignment + spacings for article grids
## 0.3.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/blog",
"version": "0.3.1",
"version": "0.3.3",
"publishConfig": {
"access": "public"
},

View File

@@ -20,6 +20,8 @@ body[layout='layout-blog-details'] #sidebar-nav li.anchor a:hover::before {
flex-wrap: wrap;
margin: calc(-1 * var(--gap)) 0 0 calc(-1 * var(--gap));
width: calc(100% + var(--gap));
align-items: flex-start;
}
.articles article {
@@ -32,6 +34,12 @@ body[layout='layout-blog-details'] #sidebar-nav li.anchor a:hover::before {
.articles article h2 {
margin: 0;
border: none;
padding-top: 1rem;
}
.articles article .thumbnail {
display: block;
height: 200px;
}
.articles article .read {
@@ -48,7 +56,7 @@ body[layout='layout-blog-details'] #sidebar-nav li.anchor a:hover::before {
}
@media screen and (min-width: 1024px) {
body[layout='layout-blog-details'] #sidebar {
body[layout='layout-blog-details'] #sidebar {
display: block;
}
}
}

View File

@@ -1,3 +1,6 @@
{% if title %}
<h1>{{title}}</h1>
{% endif %}
{% if cover_image %}
<img src="{{ cover_image | url }}" alt="">
{% endif %}

View File

@@ -3,8 +3,7 @@
{% if post.data.published %}
<article>
{% if post.data.cover_image %}
<a href="{{ post.url | url }}">
<img src="{{ post.data.cover_image | url }}" alt="">
<a href="{{ post.url | url }}" class="thumbnail" style="background-image: url({{ post.data.cover_image | url }});">
</a>
{% endif %}
<div class="content">

View File

@@ -1 +1,9 @@
<link rel="stylesheet" href="{{ '/_assets/rocket-blog.css' | asset | url }}">
{%- if layout == 'layout-blog-overview' -%}
<style>
.articles article .thumbnail {
background-size: cover;
background-position: center;
}
</style>
{%- endif -%}

View File

@@ -1,5 +1,31 @@
# @rocket/cli
## 0.9.11
### Patch Changes
- 7301a0f: Pass on rocketConfig to the eleventy function to enable conditional configurations/filters
- 42418f2: Disable the service worker for local development
- 5ac6aa6: Set the encoding of the simulator to utf8 via a html meta tag
## 0.9.10
### Patch Changes
- 738941a: In `rocket.config.js` you can now supply a rollup config function.
```js
export default {
rollup: config => {
// config will be the fully generated config object after all presets have been applied
if (config.plugins.includes('...')) {
// change some config options
}
return config;
},
};
```
## 0.9.9
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/cli",
"version": "0.9.9",
"version": "0.9.11",
"publishConfig": {
"access": "public"
},

View File

@@ -4,4 +4,6 @@
window.__rocketServiceWorkerUrl = '{{ rocketServiceWorkerUrl | url }}';
</script>
{% if rocketConfig.command == 'build' %}
<script type="module" inject-service-worker="" src="{{ '/_assets/scripts/registerServiceWorker.js' | asset | url }}"></script>
{% endif %}

View File

@@ -1,6 +1,7 @@
<html theme="light" platform="web" lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<style type="text/css">
body {
margin: 0;

View File

@@ -54,8 +54,8 @@ async function productionBuild(config) {
...config.setupBuildPlugins,
],
});
await buildAndWrite(mpaConfig);
const finalConfig = typeof config.rollup === 'function' ? config.rollup(mpaConfig) : mpaConfig;
await buildAndWrite(finalConfig);
const serviceWorkerSourcePath = path.resolve('docs/_merged_assets/service-worker.js');
if (fs.existsSync(serviceWorkerSourcePath)) {

View File

@@ -69,7 +69,7 @@ module.exports = function (eleventyConfig) {
}
if (config.eleventy) {
const returnValue = config.eleventy(eleventyConfig);
const returnValue = config.eleventy(eleventyConfig, config);
if (returnValue) {
const returnString = JSON.stringify(returnValue, null, 2);
const msg = [

View File

@@ -188,4 +188,39 @@ describe('RocketCli e2e', () => {
errorMatch: /Found 1 missing reference targets/,
});
});
it('can completely take over the rollup config', async () => {
cli = await executeBuild('e2e-fixtures/rollup-override/rocket.config.js');
const indexHtml = await readBuildOutput(cli, 'index.html', {
stripToBody: true,
formatHtml: true,
});
expect(indexHtml).to.equal(
[
'<h1 id="importing-foo">',
' <a aria-hidden="true" tabindex="-1" href="#importing-foo"><span class="icon icon-link"></span></a',
' >Importing foo',
'</h1>',
'',
'<script type="module" src="./7338509a.js" mdjs-setup=""></script>',
].join('\n'),
);
});
describe('can adjust the eleventy config while having access to the rocketConfig', () => {
it('testing start', async () => {
cli = await executeStart('e2e-fixtures/adjust-eleventy-config/rocket.config.js');
const indexHtml = await readStartOutput(cli, 'index.html');
expect(indexHtml).to.equal('<p><a href="start:/path/to/page/">link</a></p>');
});
it('testing build', async () => {
cli = await executeBuild('e2e-fixtures/adjust-eleventy-config/rocket.config.js');
const indexBuildHtml = await readBuildOutput(cli, 'index.html', {
stripToBody: true,
});
expect(indexBuildHtml).to.equal('<p><a href="build:/path/to/page/">link</a></p>');
});
});
});

View File

@@ -19,7 +19,7 @@ describe('RocketCli preset', () => {
}
});
it('offers a default layout (with head, header, content, footer, bottom) and raw layout', async () => {
it.only('offers a default layout (with head, header, content, footer, bottom) and raw layout', async () => {
cli = await executeStart('preset-fixtures/default/rocket.config.js');
const rawHtml = await readStartOutput(cli, 'raw/index.html');
@@ -86,12 +86,6 @@ describe('RocketCli preset', () => {
' </div>',
'',
' <footer id="main-footer"></footer>',
'',
' <script',
' type="module"',
' inject-service-worker=""',
' src="/_merged_assets/scripts/registerServiceWorker.js"',
' ></script>',
' </body>',
'</html>',
].join('\n'),

View File

@@ -31,7 +31,7 @@ describe('RocketCli e2e', () => {
}
});
it('will add a script to inject the service worker', async () => {
it.only('will add a script to inject the service worker', async () => {
cli = await executeBuild('e2e-fixtures/service-worker/rocket.config.js');
const indexHtml = await readStartOutput(cli, 'index.html');
const indexInject = getInjectServiceWorker(indexHtml);

View File

@@ -0,0 +1,5 @@
---
layout: layout-raw
---
<a href="{{ '/path/to/page/' | conditional-resolve }}">link</a>

View File

@@ -0,0 +1,15 @@
/** @type {Partial<import("../../../types/main").RocketCliOptions>} */
const config = {
eleventy: (config, rocketConfig) => {
config.addFilter('conditional-resolve', value => {
if (rocketConfig.command === 'build') {
return `build:${value}`;
}
if (rocketConfig.command === 'start') {
return `start:${value}`;
}
});
},
};
export default config;

View File

@@ -0,0 +1 @@
**/*.njk

View File

@@ -0,0 +1,11 @@
---
layout: layout-raw
---
# Importing foo
```js script
import { foo } from './not-foo.js';
console.log(foo);
```

View File

@@ -0,0 +1 @@
export const notFoo = 'not-foo';

View File

@@ -0,0 +1,11 @@
// @ts-no-check
/** @type {Partial<import("../../../types/main").RocketCliOptions>} */
const config = {
rollup: config => ({
...config,
shimMissingExports: true,
}),
};
export default config;

View File

@@ -40,6 +40,7 @@ export interface RocketCliOptions extends Pick<RocketPreset, PresetKeys> {
start?: RocketStartConfig;
// advanced
rollup?: (config: any) => void; // TODO: improve
devServer?: DevServerConfig;
eleventy?: (eleventyConfig: any) => void; // TODO: improve
plugins?: RocketPlugin[];

View File

@@ -1,5 +1,11 @@
# @rocket/launch
## 0.5.6
### Patch Changes
- 0987a41: Fix styling in darkmode
## 0.5.5
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/launch",
"version": "0.5.5",
"version": "0.5.6",
"publishConfig": {
"access": "public"
},

View File

@@ -5,6 +5,7 @@ html {
--primary-color-accent: #cee5f6;
--primary-text-color: #2c3e50;
--primary-lines-color: #ccc;
--primary-text-inverse-color: #eee;
/* Contrast colors */
--contrast-color-light: #fff;
@@ -19,6 +20,10 @@ html {
--primary-font-family: 'Open Sans', sans-serif;
--secondary-font-family: 'Montserrat', sans-serif;
--monospace-font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', 'Courier', monospace;
/* controls */
--switch-unselected-color: #808080;
--switch-selected-color: #42b983;
}
html.dark {
@@ -27,6 +32,7 @@ html.dark {
--primary-color-darker: #a22831;
--primary-color-accent: #cee5f6;
--primary-text-color: #eee;
--primary-text-inverse-color: #2c3e50;
/* Contrast colors */
--contrast-color-light: #fff;
@@ -39,6 +45,10 @@ html.dark {
/* typography */
--text-color: white;
/* controls */
--switch-unselected-color: #808080;
--switch-selected-color: #42b983;
/* markdown */
--markdown-octicon-link: white;
--markdown-syntax-background-color: #a0a0a0;

View File

@@ -19,7 +19,7 @@ describe('RocketLaunch preset', () => {
}
});
it('sets layout-sidebar as default', async () => {
it.only('sets layout-sidebar as default', async () => {
cli = await executeStart('fixtures/layout-sidebar/rocket.config.js');
const indexHtml = await readStartOutput(cli, 'page/index.html', {
@@ -244,12 +244,6 @@ describe('RocketLaunch preset', () => {
' </footer>',
'',
' <script type="module" src="/_merged_assets/scripts/init-navigation.js"></script>',
'',
' <script',
' type="module"',
' inject-service-worker=""',
' src="/_merged_assets/scripts/registerServiceWorker.js"',
' ></script>',
' </body>',
'</html>',
].join('\n'),

View File

@@ -1,5 +1,12 @@
# @mdjs/mdjs-preview
## 0.5.2
### Patch Changes
- 0987a41: - Make [slot="content"] selector more specific
- 0987a41: Fix styling in darkmode
## 0.5.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@mdjs/mdjs-preview",
"version": "0.5.1",
"version": "0.5.2",
"publishConfig": {
"access": "public"
},

View File

@@ -652,7 +652,7 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
[part='copy-button']:hover {
background-color: var(--primary-color, #3f51b5);
color: #fff;
color: var(--primary-text-inverse-color, #eee);
}
.switch {
@@ -668,7 +668,7 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
[part='switch-button'] {
display: inline-block;
width: 44px;
background: #808080;
background: var(--switch-unselected-color, #808080);
height: 25px;
border-radius: 15px;
position: relative;
@@ -687,7 +687,7 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
}
.switch.selected [part='switch-button'] {
background: var(--primary-color, #008000);
background: var(--switch-selected-color, #42b983);
}
.switch.selected [part='switch-button']::after {
@@ -699,7 +699,7 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
margin: -5px 0 10px 0;
text-align: right;
font-size: 12px;
color: #333;
color: var(--primary-text-color, #2c3e50);
}
.settings-wrapper {
@@ -748,7 +748,7 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
.simulation-toggle:hover {
background-color: var(--primary-color, #3f51b5);
color: #fff;
color: var(--primary-text-inverse-color, #eee);
}
h3[slot='invoker'] button {
@@ -759,6 +759,7 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
border: none;
border-bottom: 1px solid #bbb;
width: 100%;
color: var(--primary-text-color, #2c3e50);
background: none;
text-align: left;
font-weight: bold;
@@ -780,7 +781,7 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
border-bottom: none;
}
[slot='content'] {
.options > [slot='content'] {
border-bottom: 1px solid #bbb;
padding: 10px;
}
@@ -820,7 +821,7 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
.segmented-control label.selected span {
background: var(--primary-color, #3f51b5);
color: #fff;
color: var(--primary-text-inverse-color, #eee);
}
.segmented-control label:focus-within span {

View File

@@ -1,5 +1,6 @@
/* eslint-disable */
import { readdirSync, existsSync, readFileSync } from 'fs';
import semver from 'semver';
const getDirectories = source =>
readdirSync(source, { withFileTypes: true })
@@ -35,7 +36,12 @@ function compareVersions(versionsA, versionsB) {
let output = '';
const newVersions = { ...versionsA };
Object.keys(versionsB).forEach(dep => {
if (versionsA[dep] && versionsB[dep] && versionsA[dep] !== versionsB[dep]) {
if (
versionsA[dep] &&
versionsB[dep] &&
versionsA[dep] !== versionsB[dep] &&
!semver.satisfies(versionsA[dep], versionsB[dep])
) {
output += ` - "${dep}" should be "${versionsA[dep]}" but is "${versionsB[dep]}"\n`;
}
if (!newVersions[dep]) {