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 -->
## 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
## 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.2",
"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

@@ -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: url({{ post.data.cover_image | url }});">
</a>
{% endif %}
<div class="content">

View File

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

View File

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

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

@@ -188,4 +188,23 @@ 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'),
);
});
});

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,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]) {