mirror of
https://github.com/modernweb-dev/rocket.git
synced 2026-03-21 08:51:18 +00:00
Compare commits
2 Commits
@mdjs/core
...
@rocket/cl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd4bc27f16 | ||
|
|
641c7e551c |
@@ -9,11 +9,8 @@ import { rocketLaunch } from '@rocket/launch';
|
||||
|
||||
export default {
|
||||
presets: [rocketLaunch()],
|
||||
build: {
|
||||
emptyOutputDir: true,
|
||||
pathPrefix: 'subfolder-only-for-build',
|
||||
serviceWorkerFileName: 'service-worker.js',
|
||||
},
|
||||
emptyOutputDir: true,
|
||||
pathPrefix: 'subfolder-only-for-build',
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import { absoluteBaseUrlNetlify } from '@rocket/core/helpers';
|
||||
|
||||
export default /** @type {Partial<import('@rocket/cli').RocketCliOptions>} */ ({
|
||||
presets: [rocketLaunch(), rocketBlog(), rocketSearch()],
|
||||
emptyOutputDir: false,
|
||||
absoluteBaseUrl: absoluteBaseUrlNetlify('http://localhost:8080'),
|
||||
});
|
||||
```
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @rocket/cli
|
||||
|
||||
## 0.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 641c7e5: Add a pathPrefix option to allow deployment to a subdirectory
|
||||
|
||||
## 0.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@rocket/cli",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
|
||||
@@ -9,6 +9,14 @@ import { metaConfigToWebDevServerConfig } from 'plugins-manager';
|
||||
export class RocketStart {
|
||||
commands = ['start'];
|
||||
|
||||
/**
|
||||
* @param {RocketCliOptions} config
|
||||
*/
|
||||
setupCommand(config) {
|
||||
delete config.pathPrefix;
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} options
|
||||
* @param {RocketCliOptions} options.config
|
||||
|
||||
@@ -203,35 +203,43 @@ describe('RocketCli e2e', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it.skip('can add a pathprefix for the build output', async () => {
|
||||
it('can add a pathprefix that will not influence the start command', async () => {
|
||||
cli = new RocketCli({
|
||||
argv: [
|
||||
'build',
|
||||
'start',
|
||||
'--config-file',
|
||||
path.join(__dirname, 'e2e-fixtures', 'content', 'eleventy.rocket.config.js'),
|
||||
path.join(__dirname, 'e2e-fixtures', 'content', 'pathprefix.rocket.config.js'),
|
||||
],
|
||||
});
|
||||
await execute();
|
||||
|
||||
// const indexHtml = await readOutput('index.html', {
|
||||
// type: 'start',
|
||||
// });
|
||||
// expect(indexHtml).to.equal("<p>Markdown in 'docs/page/index.md'</p>");
|
||||
const indexHtml = await readOutput('link/index.html', {
|
||||
type: 'start',
|
||||
});
|
||||
expect(indexHtml).to.equal(
|
||||
['<p><a href="../../">home</a></p>', '<p><a href="/">absolute home</a></p>'].join('\n'),
|
||||
);
|
||||
});
|
||||
|
||||
it.skip('works with an empty object in rocket.config.js', async () => {
|
||||
it('can add a pathPrefix that will be used in the build command', async () => {
|
||||
cli = new RocketCli({
|
||||
argv: [
|
||||
'build',
|
||||
'--config-file',
|
||||
path.join(__dirname, 'e2e-fixtures', 'content', 'empty.rocket.config.js'),
|
||||
path.join(__dirname, 'e2e-fixtures', 'content', 'pathPrefix.rocket.config.js'),
|
||||
],
|
||||
});
|
||||
await execute();
|
||||
|
||||
// const indexHtml = await readOutput('index.html', {
|
||||
// type: 'start',
|
||||
// });
|
||||
// expect(indexHtml).to.equal("<p>Markdown in 'docs/page/index.md'</p>");
|
||||
const indexHtml = await readOutput('link/index.html', {
|
||||
stripServiceWorker: true,
|
||||
stripToBody: true,
|
||||
});
|
||||
expect(indexHtml).to.equal(
|
||||
[
|
||||
'<p><a href="../../">home</a></p>',
|
||||
'<p><a href="/my-sub-folder/">absolute home</a></p>',
|
||||
].join('\n'),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
---
|
||||
layout: layout.njk
|
||||
---
|
||||
|
||||
[home](../index.md)
|
||||
|
||||
<a href="{{ '/' | url }}">absolute home</a>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @type {Partial<import("../../../types/main").RocketCliOptions>} */
|
||||
const config = {
|
||||
pathPrefix: 'my-sub-folder',
|
||||
pathPrefix: '/my-sub-folder/',
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -31,7 +31,7 @@
|
||||
"mdjs"
|
||||
],
|
||||
"dependencies": {
|
||||
"@mdjs/core": "^0.6.0",
|
||||
"@mdjs/core": "^0.6.1",
|
||||
"es-module-lexer": "^0.3.26",
|
||||
"unist-util-visit": "^2.0.3"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user