-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add simple mode version to github releases #560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,11 +8,14 @@ import { execSync } from 'child_process'; | |||||||||||||||||||||||||||||||||||
| const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8')); | ||||||||||||||||||||||||||||||||||||
| const version = packageJson.version; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| console.log(`📦 Building dist folder for version ${version}...`); | ||||||||||||||||||||||||||||||||||||
| const buildOutputDirName = process.env.BUILD_OUTPUT_DIR || 'dist'; | ||||||||||||||||||||||||||||||||||||
| console.log(`📦 Building ${buildOutputDirName} folder for version ${version}...`); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| const isSimpleMode = (buildOutputDirName === "dist-simple") ? true : false; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| // Run the build command | ||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||
| execSync('npm run build', { stdio: 'inherit' }); | ||||||||||||||||||||||||||||||||||||
| execSync(`SIMPLE_MODE=${isSimpleMode} npm run build`, { stdio: 'inherit' }); | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+14
to
+18
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify how SIMPLE_MODE is consumed (truthy/presence vs strict comparison).
rg -nP --type=ts --type=js -C3 'process\.env\.SIMPLE_MODE|SIMPLE_MODE'Repository: alam00000/bentopdf Length of output: 3454 Fix cross-platform env variable passing in build command. The inline Proposed fix-const isSimpleMode = (buildOutputDirName === "dist-simple") ? true : false;
+const isSimpleMode = buildOutputDirName === 'dist-simple';
try {
- execSync(`SIMPLE_MODE=${isSimpleMode} npm run build`, { stdio: 'inherit' });
+ execSync('npm run build', {
+ stdio: 'inherit',
+ env: {
+ ...process.env,
+ ...(isSimpleMode ? { SIMPLE_MODE: 'true' } : {}),
+ },
+ });
console.log('✅ Build completed successfully');
} catch (error) {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| console.log('✅ Build completed successfully'); | ||||||||||||||||||||||||||||||||||||
| } catch (error) { | ||||||||||||||||||||||||||||||||||||
| console.error('❌ Build failed:', error.message); | ||||||||||||||||||||||||||||||||||||
|
|
@@ -25,12 +28,12 @@ import { pipeline } from 'stream'; | |||||||||||||||||||||||||||||||||||
| import { promisify } from 'util'; | ||||||||||||||||||||||||||||||||||||
| import archiver from 'archiver'; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| const distDir = path.resolve('./dist'); | ||||||||||||||||||||||||||||||||||||
| const zipPath = path.resolve(`./dist-${version}.zip`); | ||||||||||||||||||||||||||||||||||||
| const buildOutputDir = path.resolve(`./${buildOutputDirName}`); | ||||||||||||||||||||||||||||||||||||
| const zipPath = path.resolve(`./${buildOutputDirName}-${version}.zip`); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| // Check if dist directory exists | ||||||||||||||||||||||||||||||||||||
| if (!existsSync(distDir)) { | ||||||||||||||||||||||||||||||||||||
| console.error('❌ dist directory does not exist. Please run build first.'); | ||||||||||||||||||||||||||||||||||||
| if (!existsSync(buildOutputDir)) { | ||||||||||||||||||||||||||||||||||||
| console.error(`❌ ${buildOutputDirName} directory does not exist. Please run build first.`); | ||||||||||||||||||||||||||||||||||||
| process.exit(1); | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
@@ -55,7 +58,7 @@ archive.on('error', (err) => { | |||||||||||||||||||||||||||||||||||
| archive.pipe(output); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| // Append the dist directory to the archive | ||||||||||||||||||||||||||||||||||||
| archive.directory(distDir, false); | ||||||||||||||||||||||||||||||||||||
| archive.directory(buildOutputDir, false); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| // Finalize the archive | ||||||||||||||||||||||||||||||||||||
| archive.finalize(); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set
SIMPLE_MODE=trueduring simple packaging, or the “simple” zip can contain default-mode output.npm run packagetriggers a build again, so at Line 48 the rebuild runs without simple mode and can overwritedist-simplewith default-mode assets before zipping.✅ Minimal fix
📝 Committable suggestion
🤖 Prompt for AI Agents