Skip to content

Commit

Permalink
deploy: include readme and license files
Browse files Browse the repository at this point in the history
  • Loading branch information
Danilqa committed Aug 11, 2023
1 parent cee30b4 commit 17d2c18
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 11 deletions.
File renamed without changes.
6 changes: 4 additions & 2 deletions dev/scripts/copy-files.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const fs = require('fs');
const fs = require('node:fs');

const target = 'dist';
['package.json'].forEach((file) => fs.copyFileSync(file, `${target}/${file}`));
['package.json', 'README.md', 'LICENSE'].forEach((file) =>
fs.copyFileSync(file, `${target}/${file}`)
);
4 changes: 4 additions & 0 deletions examples/published-package/api/products.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default function productsHandler(req, res) {
res.setHeader('Content-Type', 'text/html');
res.end('<h1>Products</h1>');
}
2 changes: 1 addition & 1 deletion examples/published-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"node": ">=14.8.0"
},
"dependencies": {
"node-file-router": "0.1.0"
"node-file-router": "0.1.3"
}
}
8 changes: 4 additions & 4 deletions examples/published-package/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/published-package/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as http from 'node:http';
import { initFileRouter } from 'node-file-router';

async function run() {
const useFileRouter = await initFileRouter({ baseDir: `${__filename}/api` });
const useFileRouter = await initFileRouter({});

const server = http.createServer((req, res) => {
useFileRouter(req, res);
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-file-router",
"version": "0.1.0",
"version": "0.1.3",
"description": "A file-based routing for Node.js",
"scripts": {
"build:esm": "cross-env BABEL_ENV=esm babel src --extensions '.ts' --out-dir 'dist/esm' --out-file-extension .mjs --source-maps",
Expand All @@ -17,7 +17,6 @@
"module": "./esm/file-router.mjs",
"main": "../cjs/file-router.js",
"types": "./types/file-router.d.ts",
"files": ["dist"],
"exports": {
"import": "./esm/file-router.mjs",
"require": "./cjs/file-router.js"
Expand Down
2 changes: 1 addition & 1 deletion src/file-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function initFileRouter({
baseDir = path.join(process.cwd(), '/api'),
ignoreFilesRegex,
adapter = httpAdapter
}: Options) {
}: Options = {}) {
const { getPathname, defaultNotFoundHandler, getMethod } = adapter;
const fileRouteResolver = new FileRouteResolver({
baseDir,
Expand Down

0 comments on commit 17d2c18

Please sign in to comment.