enhance: Vite HMR while yarn dev, and more build tuning (#9361)
* enhance: Vite HMR while yarn dev, and more build tuning * use localhost Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
		
							parent
							
								
									b4b9d5d552
								
							
						
					
					
						commit
						2fe86fd869
					
				
					 15 changed files with 102 additions and 23 deletions
				
			
		
							
								
								
									
										5
									
								
								scripts/build-pre.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								scripts/build-pre.js
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
const fs = require('fs');
 | 
			
		||||
const meta = require('../package.json');
 | 
			
		||||
 | 
			
		||||
fs.mkdirSync(__dirname + '/../built', { recursive: true });
 | 
			
		||||
fs.writeFileSync(__dirname + '/../built/meta.json', JSON.stringify({ version: meta.version }), 'utf-8');
 | 
			
		||||
| 
						 | 
				
			
			@ -12,4 +12,5 @@ const fs = require('fs');
 | 
			
		|||
 | 
			
		||||
	fs.rmSync(__dirname + '/../built', { recursive: true, force: true });
 | 
			
		||||
	fs.rmSync(__dirname + '/../node_modules', { recursive: true, force: true });
 | 
			
		||||
	fs.rmSync(__dirname + '/../.yarn/cache', { recursive: true, force: true });
 | 
			
		||||
})();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
const execa = require('execa');
 | 
			
		||||
const fs = require('fs');
 | 
			
		||||
 | 
			
		||||
(async () => {
 | 
			
		||||
	await execa('yarn', ['clean'], {
 | 
			
		||||
| 
						 | 
				
			
			@ -7,6 +8,12 @@ const execa = require('execa');
 | 
			
		|||
		stderr: process.stderr,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	await execa('yarn', ['build-pre'], {
 | 
			
		||||
		cwd: __dirname + '/../',
 | 
			
		||||
		stdout: process.stdout,
 | 
			
		||||
		stderr: process.stderr,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	execa('yarn', ['dlx', 'gulp', 'watch'], {
 | 
			
		||||
		cwd: __dirname + '/../',
 | 
			
		||||
		stdout: process.stdout,
 | 
			
		||||
| 
						 | 
				
			
			@ -33,6 +40,9 @@ const execa = require('execa');
 | 
			
		|||
 | 
			
		||||
	const start = async () => {
 | 
			
		||||
		try {
 | 
			
		||||
			const exist = fs.existsSync(__dirname + '/../packages/backend/built/boot/index.js')
 | 
			
		||||
			if (!exist) throw new Error('not exist yet');
 | 
			
		||||
 | 
			
		||||
			await execa('yarn', ['start'], {
 | 
			
		||||
				cwd: __dirname + '/../',
 | 
			
		||||
				stdout: process.stdout,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue