mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-13 11:35:28 +00:00
put everything in __sapper__
This commit is contained in:
@@ -33,7 +33,7 @@ prog.command('build [dest]')
|
||||
.option('--bundler', 'Specify a bundler (rollup or webpack, blank for auto)')
|
||||
.option('--legacy', 'Create separate legacy build')
|
||||
.example(`build custom-dir -p 4567`)
|
||||
.action(async (dest = 'build', opts: {
|
||||
.action(async (dest = '__sapper__/build', opts: {
|
||||
port: string,
|
||||
legacy: boolean,
|
||||
bundler?: string
|
||||
@@ -80,12 +80,12 @@ prog.command('start [dir]')
|
||||
prog.command('export [dest]')
|
||||
.describe('Export your app as static files (if possible)')
|
||||
.option('--build', '(Re)build app before exporting', true)
|
||||
.option('--build-dir', 'Specify a custom temporary build directory', '.sapper/prod')
|
||||
.option('--build-dir', 'Specify a custom temporary build directory', '__sapper__/build')
|
||||
.option('--basepath', 'Specify a base path')
|
||||
.option('--timeout', 'Milliseconds to wait for a page (--no-timeout to disable)', 5000)
|
||||
.option('--legacy', 'Create separate legacy build')
|
||||
.option('--bundler', 'Specify a bundler (rollup or webpack, blank for auto)')
|
||||
.action(async (dest = 'export', opts: {
|
||||
.action(async (dest = '__sapper__/export', opts: {
|
||||
build: boolean,
|
||||
legacy: boolean,
|
||||
bundler?: string,
|
||||
|
||||
@@ -7,5 +7,5 @@ export const locations = {
|
||||
src: () => path.resolve(process.env.SAPPER_BASE || '', process.env.SAPPER_SRC || 'src'),
|
||||
static: () => path.resolve(process.env.SAPPER_BASE || '', process.env.SAPPER_STATIC || 'static'),
|
||||
routes: () => path.resolve(process.env.SAPPER_BASE || '', process.env.SAPPER_ROUTES || 'src/routes'),
|
||||
dest: () => path.resolve(process.env.SAPPER_BASE || '', process.env.SAPPER_DEST || `.sapper/${dev() ? 'dev' : 'prod'}`)
|
||||
dest: () => path.resolve(process.env.SAPPER_BASE || '', process.env.SAPPER_DEST || `__sapper__/${dev() ? 'dev' : 'build'}`)
|
||||
};
|
||||
@@ -10,7 +10,7 @@ export function create_main_manifests({ bundler, manifest_data, dev_port }: {
|
||||
manifest_data: ManifestData;
|
||||
dev_port?: number;
|
||||
}) {
|
||||
const manifest_dir = path.join(locations.src(), '__sapper__');
|
||||
const manifest_dir = '__sapper__';
|
||||
if (!fs.existsSync(manifest_dir)) fs.mkdirSync(manifest_dir);
|
||||
|
||||
const path_to_routes = path.relative(manifest_dir, locations.routes());
|
||||
@@ -55,7 +55,7 @@ export function create_serviceworker_manifest({ manifest_data, client_files }: {
|
||||
export const routes = [\n\t${manifest_data.pages.map((r: Page) => `{ pattern: ${r.pattern} }`).join(',\n\t')}\n];
|
||||
`.replace(/^\t\t/gm, '').trim();
|
||||
|
||||
write_if_changed(`${locations.src()}/__sapper__/service-worker.js`, code);
|
||||
write_if_changed(`__sapper__/service-worker.js`, code);
|
||||
}
|
||||
|
||||
function generate_client(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Store } from 'svelte/store.js';
|
||||
import * as sapper from './__sapper__/client.js';
|
||||
import * as sapper from '../__sapper__/client.js';
|
||||
|
||||
window.init = () => {
|
||||
return sapper.start({
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<button class='prefetch' on:click='prefetch("blog/why-the-name")'>Why the name?</button>
|
||||
|
||||
<script>
|
||||
import { prefetch } from '../__sapper__/client.js';
|
||||
import { prefetch } from '../../__sapper__/client.js';
|
||||
|
||||
export default {
|
||||
methods: {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { resolve } from 'url';
|
||||
import express from 'express';
|
||||
import serve from 'serve-static';
|
||||
import { Store } from 'svelte/store.js';
|
||||
import * as sapper from './__sapper__/server.js';
|
||||
import * as sapper from '../__sapper__/server.js';
|
||||
|
||||
let pending;
|
||||
let ended;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { files, shell, timestamp, routes } from './__sapper__/service-worker.js';
|
||||
import { files, shell, timestamp, routes } from '../__sapper__/service-worker.js';
|
||||
|
||||
const ASSETS = `cachetimestamp`;
|
||||
|
||||
|
||||
@@ -37,10 +37,7 @@ describe('sapper', function() {
|
||||
process.chdir(path.resolve(__dirname, '../app'));
|
||||
|
||||
// clean up after previous test runs
|
||||
rimraf.sync('export');
|
||||
rimraf.sync('build');
|
||||
rimraf.sync('.sapper');
|
||||
rimraf.sync('start.js');
|
||||
rimraf.sync('__sapper__');
|
||||
|
||||
this.timeout(process.env.CI ? 30000 : 15000);
|
||||
|
||||
@@ -74,7 +71,7 @@ function testExport({ basepath = '' }) {
|
||||
});
|
||||
|
||||
it('export all pages', () => {
|
||||
const dest = path.resolve(__dirname, '../app/export');
|
||||
const dest = path.resolve(__dirname, '../app/__sapper__/export');
|
||||
|
||||
// Pages that should show up in the extraction directory.
|
||||
const expectedPages = [
|
||||
@@ -181,10 +178,10 @@ function run({ mode, basepath = '' }) {
|
||||
base = `http://localhost:${port}`;
|
||||
if (basepath) base += basepath;
|
||||
|
||||
const dir = mode === 'production' ? 'build' : '.sapper';
|
||||
const dir = mode === 'production' ? '__sapper__/build' : '__sapper__/dev';
|
||||
|
||||
if (mode === 'production') {
|
||||
assert.ok(fs.existsSync('build/index.js'));
|
||||
assert.ok(fs.existsSync('__sapper__/build/index.js'));
|
||||
}
|
||||
|
||||
proc = require('child_process').fork(`${dir}/server.js`, {
|
||||
|
||||
Reference in New Issue
Block a user