mirror of
https://github.com/modernweb-dev/rocket.git
synced 2026-03-21 15:54:57 +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 {
|
export default {
|
||||||
presets: [rocketLaunch()],
|
presets: [rocketLaunch()],
|
||||||
build: {
|
emptyOutputDir: true,
|
||||||
emptyOutputDir: true,
|
pathPrefix: 'subfolder-only-for-build',
|
||||||
pathPrefix: 'subfolder-only-for-build',
|
|
||||||
serviceWorkerFileName: 'service-worker.js',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import { absoluteBaseUrlNetlify } from '@rocket/core/helpers';
|
|||||||
|
|
||||||
export default /** @type {Partial<import('@rocket/cli').RocketCliOptions>} */ ({
|
export default /** @type {Partial<import('@rocket/cli').RocketCliOptions>} */ ({
|
||||||
presets: [rocketLaunch(), rocketBlog(), rocketSearch()],
|
presets: [rocketLaunch(), rocketBlog(), rocketSearch()],
|
||||||
emptyOutputDir: false,
|
|
||||||
absoluteBaseUrl: absoluteBaseUrlNetlify('http://localhost:8080'),
|
absoluteBaseUrl: absoluteBaseUrlNetlify('http://localhost:8080'),
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @rocket/cli
|
# @rocket/cli
|
||||||
|
|
||||||
|
## 0.1.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 641c7e5: Add a pathPrefix option to allow deployment to a subdirectory
|
||||||
|
|
||||||
## 0.1.1
|
## 0.1.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@rocket/cli",
|
"name": "@rocket/cli",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,6 +9,14 @@ import { metaConfigToWebDevServerConfig } from 'plugins-manager';
|
|||||||
export class RocketStart {
|
export class RocketStart {
|
||||||
commands = ['start'];
|
commands = ['start'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {RocketCliOptions} config
|
||||||
|
*/
|
||||||
|
setupCommand(config) {
|
||||||
|
delete config.pathPrefix;
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {object} options
|
* @param {object} options
|
||||||
* @param {RocketCliOptions} options.config
|
* @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({
|
cli = new RocketCli({
|
||||||
argv: [
|
argv: [
|
||||||
'build',
|
'start',
|
||||||
'--config-file',
|
'--config-file',
|
||||||
path.join(__dirname, 'e2e-fixtures', 'content', 'eleventy.rocket.config.js'),
|
path.join(__dirname, 'e2e-fixtures', 'content', 'pathprefix.rocket.config.js'),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
await execute();
|
await execute();
|
||||||
|
|
||||||
// const indexHtml = await readOutput('index.html', {
|
const indexHtml = await readOutput('link/index.html', {
|
||||||
// type: 'start',
|
type: 'start',
|
||||||
// });
|
});
|
||||||
// expect(indexHtml).to.equal("<p>Markdown in 'docs/page/index.md'</p>");
|
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({
|
cli = new RocketCli({
|
||||||
argv: [
|
argv: [
|
||||||
'build',
|
'build',
|
||||||
'--config-file',
|
'--config-file',
|
||||||
path.join(__dirname, 'e2e-fixtures', 'content', 'empty.rocket.config.js'),
|
path.join(__dirname, 'e2e-fixtures', 'content', 'pathPrefix.rocket.config.js'),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
await execute();
|
await execute();
|
||||||
|
|
||||||
// const indexHtml = await readOutput('index.html', {
|
const indexHtml = await readOutput('link/index.html', {
|
||||||
// type: 'start',
|
stripServiceWorker: true,
|
||||||
// });
|
stripToBody: true,
|
||||||
// expect(indexHtml).to.equal("<p>Markdown in 'docs/page/index.md'</p>");
|
});
|
||||||
|
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)
|
[home](../index.md)
|
||||||
|
|
||||||
|
<a href="{{ '/' | url }}">absolute home</a>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** @type {Partial<import("../../../types/main").RocketCliOptions>} */
|
/** @type {Partial<import("../../../types/main").RocketCliOptions>} */
|
||||||
const config = {
|
const config = {
|
||||||
pathPrefix: 'my-sub-folder',
|
pathPrefix: '/my-sub-folder/',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
"mdjs"
|
"mdjs"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mdjs/core": "^0.6.0",
|
"@mdjs/core": "^0.6.1",
|
||||||
"es-module-lexer": "^0.3.26",
|
"es-module-lexer": "^0.3.26",
|
||||||
"unist-util-visit": "^2.0.3"
|
"unist-util-visit": "^2.0.3"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user