@@ -35,31 +35,60 @@ function getPackedFiles(): string[] {
3535 . filter ( ( file ) : file is string => Boolean ( file ) )
3636}
3737
38+ function getNpmPackedFiles ( ) : string [ ] {
39+ const output = execSync ( 'npm pack --dry-run --json' , {
40+ cwd : root ,
41+ encoding : 'utf8' ,
42+ } )
43+ const [ pack ] = JSON . parse ( output ) as Array < { files : Array < { path : string } > } >
44+ return pack . files . map ( ( file ) => file . path )
45+ }
46+
3847describe ( 'package portability' , ( ) => {
3948 beforeAll ( ( ) => {
4049 ensureDistArtifacts ( )
4150 } )
4251
52+ const requiredPackageFiles = [
53+ 'dist/index.js' ,
54+ 'dist/index.mjs' ,
55+ 'dist/index.d.ts' ,
56+ 'dist/utils.js' ,
57+ 'dist/utils.mjs' ,
58+ 'dist/styles.css' ,
59+ 'dist/preload/preload.js' ,
60+ 'dist/vite.mjs' ,
61+ 'dist/vite.d.ts' ,
62+ 'dist/babel.cjs' ,
63+ 'README.md' ,
64+ 'LICENSE.md' ,
65+ ] as const
66+
4367 it ( 'ships required runtime artifacts in bun pack output' , ( ) => {
44- const files = getPackedFiles ( )
68+ expect ( getPackedFiles ( ) ) . toEqual ( expect . arrayContaining ( [ ...requiredPackageFiles ] ) )
69+ } )
70+
71+ it ( 'ships required runtime artifacts in npm pack output' , ( ) => {
72+ const files = getNpmPackedFiles ( )
4573 expect ( files ) . toEqual (
4674 expect . arrayContaining ( [
47- 'dist/index.js' ,
48- 'dist/index.mjs' ,
49- 'dist/index.d.ts' ,
50- 'dist/utils.js' ,
51- 'dist/utils.mjs' ,
52- 'dist/styles.css' ,
53- 'dist/preload/preload.js' ,
54- 'dist/vite.mjs' ,
55- 'dist/vite.d.ts' ,
56- 'dist/babel.cjs' ,
57- 'README.md' ,
58- 'LICENSE.md' ,
75+ ...requiredPackageFiles ,
76+ 'dist/cli.cjs' ,
77+ 'package.json' ,
5978 ] ) ,
6079 )
6180 } )
6281
82+ it ( 'can run npm publish dry-run without package metadata corrections' , ( ) => {
83+ const output = execSync ( 'npm publish --dry-run --tag latest 2>&1' , {
84+ cwd : root ,
85+ encoding : 'utf8' ,
86+ } )
87+
88+ expect ( output ) . toContain ( 'made-refine@' )
89+ expect ( output ) . not . toContain ( 'auto-corrected' )
90+ } )
91+
6392 it ( 'loads built cjs/esm/vite entrypoints' , async ( ) => {
6493 const cjsPath = path . join ( root , 'dist/index.js' )
6594 const esmPath = path . join ( root , 'dist/index.mjs' )
0 commit comments