File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,3 +80,4 @@ test/serviceAccountKey.json
8080.idea
8181.DS_Store
8282dist
83+ qa
Original file line number Diff line number Diff line change 1010> - :nail_care : [ Polish]
1111
1212---
13+ ## [ 1.6.0] - 2025-02-14
14+
15+ #### - :nail_care : [ Polish]
16+
17+ - Migrated build system to Vite
18+ - Added dual ESM/CJS module support
19+ - Improved minification using esbuild
20+ - Removed manual minification process
21+
1322## [ 1.5.0] - 2025-01-01
1423
1524#### - :nail_care : [ Polish]
Original file line number Diff line number Diff line change 11{
22 "name" : " firestore-export-import" ,
3- "version" : " 1.5 .0" ,
3+ "version" : " 1.6 .0" ,
44 "description" : " NPM package for backup and restore Firebase Firestore" ,
55 "type" : " module" ,
6- "main" : " ./dist/index.js" ,
7- "types" : " dist/index.d.ts" ,
6+ "main" : " ./dist/index.cjs" ,
7+ "module" : " ./dist/index.js" ,
8+ "types" : " ./dist/index.d.ts" ,
89 "files" : [
910 " readme.md" ,
10- " dist/*.*.*" ,
11- " dist/*.*"
11+ " dist/**/*"
1212 ],
1313 "scripts" : {
14- "build" : " tsc --skipLibCheck --noCheck && pnpm run minify" ,
15- "build:vite" : " vite build" ,
14+ "build" : " vite build" ,
1615 "test" : " vitest" ,
1716 "coverage" : " vitest run --coverage" ,
18- "typecheck" : " tsc --noEmit" ,
19- "minify" : " jsmin -o dist/index.js dist/index.js && jsmin -o dist/import.js dist/import.js && jsmin -o dist/export.js dist/export.js && jsmin -o dist/helper.js dist/helper.js"
17+ "typecheck" : " tsc --noEmit"
2018 },
2119 "devDependencies" : {
2220 "@types/node" : " ^20.11.5" ,
2624 "typescript" : " ^5.3.3" ,
2725 "vite" : " ^5.0.12" ,
2826 "vite-plugin-dts" : " ^3.7.1" ,
29- "vitest" : " ^1.2.1"
27+ "vitest" : " ^1.2.1" ,
28+ "terser" : " ^5.27.2"
3029 },
3130 "dependencies" : {
3231 "firebase-admin" : " ^13.0.2" ,
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ export const backupFromDocService = async <T>(
101101 return data as T
102102 } catch ( error ) {
103103 console . error ( error )
104- throw new Error ( error )
104+ throw new Error ( ( error as Error ) . message )
105105 }
106106}
107107
@@ -189,7 +189,7 @@ export const backupService = async <T>(
189189 ? await options . queryCollection ( collectionRef )
190190 : await collectionRef . get ( )
191191 const docs =
192- options ?. docsFromEachCollection > 0
192+ ( options ?. docsFromEachCollection ?? 0 ) > 0
193193 ? documents . docs . slice ( 0 , options ?. docsFromEachCollection )
194194 : documents . docs
195195
@@ -209,6 +209,6 @@ export const backupService = async <T>(
209209 return data as T
210210 } catch ( error ) {
211211 console . error ( error )
212- throw new Error ( error )
212+ throw new Error ( ( error as Error ) . message )
213213 }
214214}
Original file line number Diff line number Diff line change 1- // import { describe, it, expect } from 'vitest'
1+ import { describe , it , expect } from 'vitest'
22import { Firestore } from 'firebase-admin/firestore'
33import request from 'request-promise'
44import {
Original file line number Diff line number Diff line change 22 "compilerOptions" : {
33 "target" : " ES2022" ,
44 "module" : " ESNext" ,
5- "moduleResolution" : " Node" ,
6- "esModuleInterop" : true ,
5+ "moduleResolution" : " node" ,
76 "outDir" : " ./dist" ,
8- "rootDir " : " ./src " ,
7+ "declaration " : true ,
98 "strict" : true ,
9+ "esModuleInterop" : true ,
1010 "skipLibCheck" : true ,
11- "declaration" : true ,
12- "sourceMap" : true ,
13- "types" : [" node" , " vitest/globals" ],
14- "lib" : [" ES2022" ]
11+ "forceConsistentCasingInFileNames" : true ,
12+ "noImplicitAny" : false ,
1513 },
1614 "include" : [" src/**/*" ],
17- "exclude" : [" node_modules" , " dist" , " **/*.spec.ts " ]
15+ "exclude" : [" node_modules" , " dist" ]
1816}
Original file line number Diff line number Diff line change 1+ import { defineConfig } from 'vite' ;
2+ import dts from 'vite-plugin-dts' ;
3+ import { resolve } from 'path' ;
4+
5+ export default defineConfig ( {
6+ build : {
7+ lib : {
8+ entry : {
9+ index : resolve ( __dirname , 'src/index.ts' ) ,
10+ import : resolve ( __dirname , 'src/import.ts' ) ,
11+ export : resolve ( __dirname , 'src/export.ts' ) ,
12+ helper : resolve ( __dirname , 'src/helper.ts' )
13+ } ,
14+ formats : [ 'es' , 'cjs' ]
15+ } ,
16+ minify : 'esbuild' ,
17+ rollupOptions : {
18+ external : [
19+ 'firebase-admin' ,
20+ 'google-gax' ,
21+ 'uuid' ,
22+ 'events' ,
23+ 'fs' ,
24+ 'path' ,
25+ / ^ f i r e b a s e - a d m i n \/ .* / ,
26+ / ^ g o o g l e - g a x \/ .* / ,
27+ / ^ n o d e : .* /
28+ ] ,
29+ output : [
30+ {
31+ format : 'es' ,
32+ entryFileNames : '[name].js' ,
33+ preserveModules : true ,
34+ exports : 'named' ,
35+ interop : 'auto'
36+ } ,
37+ {
38+ format : 'cjs' ,
39+ entryFileNames : '[name].cjs' ,
40+ exports : 'named' ,
41+ interop : 'auto'
42+ }
43+ ]
44+ }
45+ } ,
46+ plugins : [
47+ dts ( {
48+ include : [ 'src/**/*' ] ,
49+ exclude : [ '**/*.spec.ts' ] ,
50+ outputDir : 'dist'
51+ } )
52+ ]
53+ } ) ;
You can’t perform that action at this time.
0 commit comments