Skip to content

Commit 24b02f3

Browse files
Rename pagesDir -> routesDir
1 parent f03362e commit 24b02f3

File tree

6 files changed

+9
-11
lines changed

6 files changed

+9
-11
lines changed

examples/demo/wmr.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export default function (config) {
2-
config.pagesDir = 'public/pages2';
2+
config.routesDir = 'public/pages2';
33
return config;
44
}

packages/wmr/src/cli.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ prog
1818
.option('--public', 'Your web app root directory (default: ./public)')
1919
.option('--out', 'Where to store generated files (default: ./dist)')
2020
.option('--cwd', 'The working directory - equivalent to "(cd FOO && wmr)"')
21-
.option('--pagesDir', 'Directory for filesystem-based routes(default: <cwd>/pages)')
21+
.option('--routesDir', 'Directory for filesystem-based routes(default: <cwd>/routes)')
2222
// Setting env variables isn't common knowledege for many windows users. Much
2323
// easier to pass a flag to our binary instead.
2424
.option('--debug', 'Print internal debugging messages to the console. Same as setting DEBUG=true');
@@ -30,7 +30,6 @@ prog
3030
.option('--visualize', 'Launch interactive bundle visualizer')
3131
.action(opts => {
3232
opts.minify = opts.minify !== false && !/false|0/.test(opts.minify);
33-
console.log(opts);
3433
run(build(opts));
3534
});
3635

@@ -55,7 +54,6 @@ prog
5554
.option('--profile', 'Generate build statistics')
5655
.option('--reload', 'Switch off hmr and reload on file saves')
5756
.action(opts => {
58-
console.log(opts);
5957
opts.optimize = !/false|0/.test(opts.compress);
6058
opts.compress = bool(opts.compress);
6159
if (/true/.test(process.env.PROFILE || '')) opts.profile = true;

packages/wmr/src/lib/normalize-options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export async function normalizeOptions(options, mode, configWatchFiles = []) {
2727
options.output = [];
2828
options.middleware = [];
2929
options.features = { preact: true };
30-
options.pagesDir = join(options.cwd, options.pagesDir || 'pages');
30+
options.routesDir = join(options.cwd, options.routesDir || 'pages');
3131

3232
// `wmr` / `wmr start` is a development command.
3333
// `wmr build` / `wmr serve` are production commands.

packages/wmr/src/lib/plugins.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function getPlugins(options) {
4646
jsonPlugin({ cwd }),
4747
bundlePlugin({ inline: !production, cwd }),
4848
aliasesPlugin({ aliases, cwd: root }),
49-
fsRoutesPlugin({ pagesDir: options.pagesDir, cwd, root, publicPath: options.publicPath }),
49+
fsRoutesPlugin({ routesDir: options.routesDir, cwd, root, publicPath: options.publicPath }),
5050
fsRoutesPreactPlugin(),
5151
sucrasePlugin({
5252
typescript: true,

packages/wmr/src/plugins/fs-routes-plugin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ async function readRecursive(root, dir = root) {
3838
/**
3939
* Convert JSX to HTM
4040
* @param {object} options
41-
* @param {string} options.pagesDir Controls whether files are processed to transform JSX.
41+
* @param {string} options.routesDir Controls whether files are processed to transform JSX.
4242
* @param {string} options.cwd
4343
* @param {string} options.root
4444
* @param {string} options.publicPath
4545
* @returns {import('wmr').Plugin}
4646
*/
47-
export default function fsRoutesPlugin({ pagesDir, publicPath, root, cwd }) {
47+
export default function fsRoutesPlugin({ routesDir, publicPath, root, cwd }) {
4848
const PUBLIC = 'wmr:fs-routes';
4949
const INTERNAL = '\0wmr:fs-routes';
5050
return {
@@ -57,8 +57,8 @@ export default function fsRoutesPlugin({ pagesDir, publicPath, root, cwd }) {
5757
async load(id) {
5858
if (id !== INTERNAL) return;
5959

60-
const routes = await readRecursive(pagesDir);
61-
const base = toPosix(path.relative(cwd, path.join(root, pagesDir)));
60+
const routes = await readRecursive(routesDir);
61+
const base = toPosix(path.relative(cwd, path.join(root, routesDir)));
6262

6363
const routesStr = routes
6464
.map(route => {

packages/wmr/types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ declare module 'wmr' {
3535
host: string;
3636
port: number;
3737
root: string;
38-
pagesDir: string;
38+
routesDir: string;
3939
out: string;
4040
overlayDir: string;
4141
sourcemap: boolean;

0 commit comments

Comments
 (0)