Compare commits

..

2 Commits

Author SHA1 Message Date
github-actions[bot]
d08692c7f3 Version Packages 2021-04-29 12:35:04 +02:00
Thomas Allmer
2b7f1ee719 fix: support pathprefix in cli, launch, mdjs, search 2021-04-29 12:30:47 +02:00
17 changed files with 102 additions and 17 deletions

View File

@@ -5,7 +5,7 @@ For that reason Rocket creates those automatically with the title, parent title,
It will look like this but with your logo:
<img src="{{ socialMediaImage }}" width="1200" height="630" alt="Social Media Image of this page" style="border: 1px solid #000" />
<img src="{{ socialMediaImage | url }}" width="1200" height="630" alt="Social Media Image of this page" style="border: 1px solid #000" />
There are multiple ways you can modify it.

View File

@@ -1,5 +1,13 @@
# @rocket/cli
## 0.6.3
### Patch Changes
- 2b7f1ee: Add support for pathprefix
- Updated dependencies [2b7f1ee]
- @rocket/eleventy-plugin-mdjs-unified@0.4.1
## 0.6.2
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/cli",
"version": "0.6.2",
"version": "0.6.3",
"publishConfig": {
"access": "public"
},
@@ -59,7 +59,7 @@
"@11ty/eleventy-img": "^0.7.4",
"@rocket/building-rollup": "^0.2.0",
"@rocket/core": "^0.1.2",
"@rocket/eleventy-plugin-mdjs-unified": "^0.4.0",
"@rocket/eleventy-plugin-mdjs-unified": "^0.4.1",
"@rocket/eleventy-rocket-nav": "^0.3.0",
"@rollup/plugin-babel": "^5.2.2",
"@rollup/plugin-node-resolve": "^11.0.1",

View File

@@ -1,7 +1,7 @@
<meta property="og:site_name" content="{{ site.name }}"/>
<meta property="og:type" content="website"/>
<meta property="og:image" content="{{ socialMediaImage }}"/>
<meta property="og:url" content="{{ page.url }}"/>
<meta property="og:image" content="{{ socialMediaImage | url }}"/>
<meta property="og:url" content="{{ page.url | url }}"/>
<meta name="twitter:card" content="summary_large_image"/>

View File

@@ -1,5 +1,13 @@
# @rocket/eleventy-plugin-mdjs-unified
## 0.4.1
### Patch Changes
- 2b7f1ee: Add support for pathprefix
- Updated dependencies [2b7f1ee]
- @mdjs/core@0.7.1
## 0.4.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/eleventy-plugin-mdjs-unified",
"version": "0.4.0",
"version": "0.4.1",
"publishConfig": {
"access": "public"
},
@@ -31,7 +31,7 @@
"mdjs"
],
"dependencies": {
"@mdjs/core": "^0.7.0",
"@mdjs/core": "^0.7.1",
"es-module-lexer": "^0.3.26",
"unist-util-visit": "^2.0.3"
},

View File

@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
const path = require('path');
const slash = require('slash');
const fs = require('fs');
const { mdjsProcess } = require('@mdjs/core');
const visit = require('unist-util-visit');
@@ -121,8 +122,12 @@ function eleventyUnified(pluginOptions) {
return plugins.map(plugin => {
if (plugin.options) {
plugin.options.page = eleventySettings.page;
plugin.options.rocketConfig = eleventySettings.rocketConfig;
} else {
plugin.options = { page: eleventySettings.page };
plugin.options = {
page: eleventySettings.page,
rocketConfig: eleventySettings.rocketConfig,
};
}
return plugin;
});
@@ -145,8 +150,19 @@ function eleventyUnified(pluginOptions) {
const newName = path.join(newFolder, '__mdjs-stories.js');
await fs.promises.mkdir(newFolder, { recursive: true });
await fs.promises.writeFile(newName, result.jsCode, 'utf8');
let scriptUrl = eleventySettings.page.url;
if (
eleventySettings.rocketConfig &&
eleventySettings.rocketConfig.command === 'build' &&
eleventySettings.rocketConfig.pathPrefix
) {
scriptUrl = slash(
path.join(eleventySettings.rocketConfig.pathPrefix, eleventySettings.page.url),
);
}
code += `
<script type="module" src="${eleventySettings.page.url}__mdjs-stories.js" mdjs-setup></script>
<script type="module" src="${scriptUrl}__mdjs-stories.js" mdjs-setup></script>
`;
}
return code;

View File

@@ -1,5 +1,11 @@
# @rocket/launch
## 0.4.2
### Patch Changes
- 2b7f1ee: Add support for pathprefix
## 0.4.1
### Patch Changes

View File

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

View File

@@ -1 +1 @@
<script type="module" src="{{ '/_assets/scripts/init-navigation.js' | asset }}"></script>
<script type="module" src="{{ '/_assets/scripts/init-navigation.js' | asset | url }}"></script>

View File

@@ -1,7 +1,7 @@
<meta property="og:site_name" content="{{ site.name }}"/>
<meta property="og:type" content="website"/>
<meta property="og:image" content="{{ socialMediaImage }}"/>
<meta property="og:url" content="{{ page.url }}"/>
<meta property="og:image" content="{{ socialMediaImage | url }}"/>
<meta property="og:url" content="{{ page.url | url }}"/>
<meta name="twitter:card" content="summary_large_image"/>

View File

@@ -1,5 +1,11 @@
# Change Log
## 0.7.1
### Patch Changes
- 2b7f1ee: Add support for pathprefix
## 0.7.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@mdjs/core",
"version": "0.7.0",
"version": "0.7.1",
"publishConfig": {
"access": "public"
},

View File

@@ -1,8 +1,43 @@
const path = require('path');
const slash = require('slash');
/** @typedef {import('vfile').VFileOptions} VFileOptions */
/** @typedef {import('unist').Node} Node */
/** @typedef {import('@mdjs/core/types/code').Story} Story */
function mdjsSetupCode({ rootNodeQueryCode = 'document', simulationSettings = {} } = {}) {
/**
* @typedef {Object} simulationSettings
* @property {string} [simulatorUrl]
*/
/**
* @typedef {Object} rocketConfig
* @property {string} [pathPrefix]
*/
/**
* @param {object} options
* @param {string} [options.rootNodeQueryCode]
* @param {simulationSettings} [options.simulationSettings]
* @param {rocketConfig} [options.rocketConfig]
* @returns
*/
function mdjsSetupCode({
rootNodeQueryCode = 'document',
simulationSettings = {},
rocketConfig = {},
} = {}) {
if (rocketConfig && rocketConfig.pathPrefix) {
if (simulationSettings && simulationSettings.simulatorUrl) {
const { simulatorUrl } = simulationSettings;
if (simulatorUrl[0] === '/' && !simulatorUrl.startsWith(rocketConfig.pathPrefix)) {
simulationSettings.simulatorUrl = slash(
path.join(rocketConfig.pathPrefix, simulationSettings.simulatorUrl),
);
}
}
}
/**
* @param {Node} tree
* @param {VFileOptions} file

View File

@@ -1,5 +1,11 @@
# @rocket/search
## 0.3.5
### Patch Changes
- 2b7f1ee: Add support for pathprefix
## 0.3.4
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/search",
"version": "0.3.4",
"version": "0.3.5",
"publishConfig": {
"access": "public"
},

View File

@@ -4,4 +4,4 @@
</svg>
</rocket-search>
<script type="module" src="{{ '/_assets/scripts/define-rocket-search.js' | asset }}"></script>
<script type="module" src="{{ '/_assets/scripts/define-rocket-search.js' | asset | url }}"></script>