Compare commits

...

5 Commits

Author SHA1 Message Date
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
15 changed files with 110 additions and 9 deletions

View File

@@ -107,3 +107,23 @@ export default ({
}); });
``` ```
<!-- prettier-ignore-end --> <!-- prettier-ignore-end -->
## Advanced
Sometimes you need even more control over the build process. In these cases you can take full control over the rollup config.
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 -->

View File

@@ -1,5 +1,11 @@
# @rocket/blog # @rocket/blog
## 0.3.2
### Patch Changes
- 00f4a91: alignment + spacings for article grids
## 0.3.1 ## 0.3.1
### Patch Changes ### Patch Changes

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,23 @@
# @rocket/cli # @rocket/cli
## 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 ## 0.9.9
### Patch Changes ### Patch Changes

View File

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

View File

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

View File

@@ -188,4 +188,23 @@ describe('RocketCli e2e', () => {
errorMatch: /Found 1 missing reference targets/, 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'),
);
});
}); });

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; start?: RocketStartConfig;
// advanced // advanced
rollup?: (config: any) => void; // TODO: improve
devServer?: DevServerConfig; devServer?: DevServerConfig;
eleventy?: (eleventyConfig: any) => void; // TODO: improve eleventy?: (eleventyConfig: any) => void; // TODO: improve
plugins?: RocketPlugin[]; plugins?: RocketPlugin[];

View File

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