File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ const analytics = require ( 'analytics' )
2+
3+ console . log ( analytics )
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " cjs-install-test" ,
3+ "version" : " 1.0.0" ,
4+ "description" : " " ,
5+ "main" : " index.js" ,
6+ "scripts" : {
7+ "test" : " node index.js"
8+ },
9+ "keywords" : [],
10+ "author" : " " ,
11+ "license" : " ISC" ,
12+ "dependencies" : {
13+ "analytics" : " file:../../../../packages/analytics"
14+ }
15+ }
Original file line number Diff line number Diff line change 1+ import Analytics from 'analytics'
2+
3+ console . log ( 'Analytics:' , Analytics )
4+ console . log ( 'Analytics type:' , typeof Analytics )
5+ console . log ( 'Analytics keys:' , Object . keys ( Analytics ) )
6+
7+ // Try the workaround
8+ try {
9+ const analytics = Analytics . default ( {
10+ app : 'awesome-app' ,
11+ plugins : [ ]
12+ } )
13+ console . log ( 'Success with Analytics.default!' )
14+ } catch ( error ) {
15+ console . error ( 'Failed with Analytics.default:' , error . message )
16+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " esm-install-test" ,
3+ "version" : " 1.0.0" ,
4+ "description" : " " ,
5+ "main" : " index.js" ,
6+ "type" : " module" ,
7+ "scripts" : {
8+ "test" : " node index.js"
9+ },
10+ "keywords" : [],
11+ "author" : " " ,
12+ "license" : " ISC" ,
13+ "dependencies" : {
14+ "analytics" : " file:../../../../packages/analytics"
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+
3+ const { execSync } = require ( 'child_process' )
4+ const path = require ( 'path' )
5+
6+ console . log ( '🧪 Running installation verification tests...\n' )
7+
8+ // Test CommonJS installation
9+ console . log ( '📦 Testing CommonJS installation...' )
10+ try {
11+ const cjsOutput = execSync ( 'npm test' , {
12+ cwd : path . join ( __dirname , 'cjs-test' ) ,
13+ encoding : 'utf8'
14+ } )
15+ console . log ( '✅ CommonJS test passed' )
16+ // console.log(cjsOutput)
17+ } catch ( error ) {
18+ console . log ( '❌ CommonJS test failed' )
19+ console . log ( error . stdout || error . message )
20+ process . exit ( 1 )
21+ }
22+
23+ // Test ESM installation
24+ console . log ( '\n📦 Testing ESM installation...' )
25+ try {
26+ const esmOutput = execSync ( 'npm test' , {
27+ cwd : path . join ( __dirname , 'esm-test' ) ,
28+ encoding : 'utf8'
29+ } )
30+ console . log ( '✅ ESM test passed' )
31+ // console.log(esmOutput)
32+ } catch ( error ) {
33+ console . log ( '❌ ESM test failed' )
34+ console . log ( error . stdout || error . message )
35+ process . exit ( 1 )
36+ }
37+
38+ console . log ( '\n🎉 All installation tests passed!' )
39+ console . log ( '📝 README install instructions are verified as correct.' )
You can’t perform that action at this time.
0 commit comments