@@ -23,7 +23,7 @@ const sharedPostinstall = path.join(
2323if ( isAppKitPackage ) {
2424 if ( fs . existsSync ( sharedBin ) ) {
2525 pkg . bin = pkg . bin || { } ;
26- pkg . bin [ " appkit" ] = "./bin/appkit.js" ;
26+ pkg . bin . appkit = "./bin/appkit.js" ;
2727 }
2828 if ( fs . existsSync ( sharedPostinstall ) ) {
2929 pkg . scripts = pkg . scripts || { } ;
@@ -51,22 +51,42 @@ if (isAppKitPackage) {
5151 }
5252}
5353
54- // Copy documentation from docs/build
54+ // Copy documentation from docs/build into tmp/docs/
5555const docsBuildPath = path . join ( __dirname , "../docs/build" ) ;
5656
57- // Copy llms.txt
58- fs . copyFileSync ( path . join ( docsBuildPath , "llms.txt" ) , "tmp/llms.txt" ) ;
57+ // Copy all .md files and docs/ subdirectory from docs/build to tmp/docs
58+ fs . mkdirSync ( "tmp/docs" , { recursive : true } ) ;
59+
60+ // Copy all files and directories we want, preserving structure
61+ const itemsToCopy = fs . readdirSync ( docsBuildPath ) ;
62+ for ( const item of itemsToCopy ) {
63+ const sourcePath = path . join ( docsBuildPath , item ) ;
64+ const stat = fs . statSync ( sourcePath ) ;
65+
66+ // Copy .md files and docs directory
67+ if ( item . endsWith ( '.md' ) || item === 'docs' ) {
68+ const destPath = path . join ( "tmp/docs" , item ) ;
69+ if ( stat . isDirectory ( ) ) {
70+ fs . cpSync ( sourcePath , destPath , { recursive : true } ) ;
71+ } else {
72+ fs . copyFileSync ( sourcePath , destPath ) ;
73+ }
74+ }
75+ }
76+
77+ // Process llms.txt (keep existing logic but update path replacement)
78+ const llmsSourcePath = path . join ( docsBuildPath , "llms.txt" ) ;
79+ let llmsContent = fs . readFileSync ( llmsSourcePath , "utf-8" ) ;
80+
81+ // Replace /appkit/ with ./docs/ to match new structure
82+ llmsContent = llmsContent . replace ( / \/ a p p k i t \/ / g, "./docs/" ) ;
83+
84+ fs . writeFileSync ( "tmp/llms.txt" , llmsContent ) ;
5985
6086// Copy llms.txt as CLAUDE.md and AGENTS.md (npm pack doesn't support symlinks)
6187fs . copyFileSync ( "tmp/llms.txt" , "tmp/CLAUDE.md" ) ;
6288fs . copyFileSync ( "tmp/llms.txt" , "tmp/AGENTS.md" ) ;
6389
64- // Copy markdown documentation structure
65- const docsPath = path . join ( docsBuildPath , "docs" ) ;
66- if ( fs . existsSync ( docsPath ) ) {
67- fs . cpSync ( docsPath , "tmp/docs" , { recursive : true } ) ;
68- }
69-
7090fs . copyFileSync ( path . join ( __dirname , "../README.md" ) , "tmp/README.md" ) ;
7191fs . copyFileSync ( path . join ( __dirname , "../LICENSE" ) , "tmp/LICENSE" ) ;
7292fs . copyFileSync ( path . join ( __dirname , "../DCO" ) , "tmp/DCO" ) ;
0 commit comments