Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Support being mounted on a path — fixes #180
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris authored Mar 17, 2018
1 parent a95ddee commit b94481b
Show file tree
Hide file tree
Showing 21 changed files with 236 additions and 457 deletions.
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ test/app/.sapper
test/app/app/manifest
test/app/export
test/app/build
*.js
*.js.map
*.ts.js
*.ts.js.map
sapper
runtime.js
dist
!rollup.config.js
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"compression": "^1.7.1",
"eslint": "^4.13.1",
"eslint-plugin-import": "^2.8.0",
"express": "^4.16.3",
"get-port": "^3.2.0",
"mocha": "^5.0.4",
"nightmare": "^3.0.0",
Expand Down
271 changes: 0 additions & 271 deletions runtime.js

This file was deleted.

5 changes: 3 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ prog.command('start [dir]')

prog.command('export [dest]')
.describe('Export your app as static files (if possible)')
.action(async (dest = 'export') => {
.option('--basepath', 'Specify a base path')
.action(async (dest = 'export', opts: { basepath?: string }) => {
console.log(`> Building...`);

process.env.NODE_ENV = 'production';
Expand All @@ -63,7 +64,7 @@ prog.command('export [dest]')
console.error(`\n> Built in ${elapsed(start)}. Crawling site...`);

const { exporter } = await import('./cli/export');
await exporter(dest);
await exporter(dest, opts);
console.error(`\n> Finished in ${elapsed(start)}. Type ${clorox.bold.cyan(`npx serve ${dest}`)} to run the app.`);
} catch (err) {
console.error(err ? err.details || err.stack || err.message || err : 'Unknown error');
Expand Down
2 changes: 1 addition & 1 deletion src/cli/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function build() {
if (serviceworker) {
create_serviceworker_manifest({
routes,
client_files: client_stats.toJson().assets.map((chunk: { name: string }) => `/client/${chunk.name}`)
client_files: client_stats.toJson().assets.map((chunk: { name: string }) => `client/${chunk.name}`)
});

serviceworker_stats = await compile(serviceworker);
Expand Down
2 changes: 1 addition & 1 deletion src/cli/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export async function dev(opts: { port: number, open: boolean }) {
fs.writeFileSync(path.join(dir, 'client_info.json'), JSON.stringify(info, null, ' '));
deferreds.client.fulfil();

const client_files = info.assets.map((chunk: { name: string }) => `/client/${chunk.name}`);
const client_files = info.assets.map((chunk: { name: string }) => `client/${chunk.name}`);

deferreds.server.promise.then(() => {
hot_update_server.send({
Expand Down
Loading

0 comments on commit b94481b

Please sign in to comment.