1- #!/usr/bin/env node
2-
3- /**
4- * Build script for npm package
5- * Prepares the package for publishing by verifying required files
6- */
7-
8- const fs = require ( 'fs' ) ;
9- const path = require ( 'path' ) ;
10-
11- console . log ( 'DoPlan CLI: Building npm package...' ) ;
12-
13- // Verify required files exist
14- const requiredFiles = [
15- 'bin/doplan.js' ,
16- 'scripts/postinstall.js' ,
17- 'scripts/prepublish.js' ,
18- 'README.md' ,
19- 'LICENSE'
20- ] ;
21-
22- let hasErrors = false ;
23-
24- for ( const file of requiredFiles ) {
25- const filePath = path . join ( __dirname , '..' , file ) ;
26- if ( ! fs . existsSync ( filePath ) ) {
27- console . error ( `Error: Required file missing: ${ file } ` ) ;
28- hasErrors = true ;
29- } else {
30- console . log ( `✓ Found: ${ file } ` ) ;
31- }
32- }
33-
34- // Verify bin/doplan.js is executable (on Unix systems)
35- const binPath = path . join ( __dirname , '..' , 'bin' , 'doplan.js' ) ;
36- if ( fs . existsSync ( binPath ) ) {
37- try {
38- // Check if file has shebang
39- const content = fs . readFileSync ( binPath , 'utf8' ) ;
40- if ( ! content . startsWith ( '#!/usr/bin/env node' ) ) {
41- console . warn ( 'Warning: bin/doplan.js missing shebang line' ) ;
42- }
43- } catch ( error ) {
44- console . warn ( `Warning: Could not read bin/doplan.js: ${ error . message } ` ) ;
45- }
46- }
47-
48- if ( hasErrors ) {
49- console . error ( '\nBuild failed. Please fix the errors above.' ) ;
50- process . exit ( 1 ) ;
51- }
52-
53- console . log ( '\n✅ Build completed successfully!' ) ;
54- console . log ( 'Package is ready for publishing.' ) ;
55-
1+ // scripts/build.js
2+ console . log ( "Build script running." ) ;
0 commit comments