diff --git a/.npmignore b/.npmignore index eee0faa..1b97f39 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,5 @@ src coverage test -tsconfig.json \ No newline at end of file +tsconfig.json +build.js \ No newline at end of file diff --git a/build.js b/build.js index 321d34d..57c93dd 100644 --- a/build.js +++ b/build.js @@ -5,7 +5,6 @@ esbuild entryPoints: ["./src/index.ts"], outfile: "dist/index.js", bundle: true, - // minify: false, treeShaking: true, platform: "node", format: "esm", @@ -13,5 +12,3 @@ esbuild plugins: [nodeExternalsPlugin()], }) .catch(() => process.exit(1)) - -// esbuild src/index.ts --bundle --outfile=dist/index.js --external:./node_modules/* --format=esm --platform=node diff --git a/test/__snapshots__/lib.test.js.snap b/test/__snapshots__/lib.test.js.snap new file mode 100644 index 0000000..d80e346 --- /dev/null +++ b/test/__snapshots__/lib.test.js.snap @@ -0,0 +1,26 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`createCollectionEnum creates enum of collection names 1`] = ` +"export enum Collections { + Book = "book", + Magazine = "magazine", +}" +`; + +exports[`createRecordType creates type definition for a record 1`] = ` +"export type BooksRecord = { + title?: string; +}" +`; + +exports[`generate generates correct output given db input 1`] = ` +"// Generated using pocketbase-typegen + +export enum Collections { + Books = "books", +} + +export type BooksRecord = { + title?: string; +}" +`;