| 
						
						
						
					 | 
					@ -1,22 +1,35 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					#!/usr/bin/env node
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					/* eslint-disable @typescript-eslint/no-var-requires */ | 
					 | 
					 | 
					/* eslint-disable @typescript-eslint/no-var-requires */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					const path = require('path'); | 
					 | 
					 | 
					const path = require('path'); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					const fs = require('fs-extra'); | 
					 | 
					 | 
					const fs = require('fs-extra'); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					const { lessLoader } = require('esbuild-plugin-less'); | 
					 | 
					 | 
					const { lessLoader } = require('esbuild-plugin-less'); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					const outfile = path.join(__dirname, 'template/dist/app.bundle.js'); | 
					 | 
					 | 
					// build @imove/core first, if in imove repo
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
					const CORE_DIR = path.join(__dirname, '../../../../core'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					// if builded and NOT force re-build, exit
 | 
					 | 
					 | 
					if (fs.pathExistsSync(CORE_DIR)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					if (fs.existsSync(outfile) && process.argv.indexOf('--force') < 0) { | 
					 | 
					 | 
					  require('child_process').execSync(`cd ${CORE_DIR} && rollup -c`); | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					  console.log('imove editor alredy builded'); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  return; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					// build js and css for editor
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					const OUT_FILE = path.join(__dirname, 'template/dist/app.bundle.js'); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					require('esbuild') | 
					 | 
					 | 
					require('esbuild') | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  .build({ | 
					 | 
					 | 
					  .build({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    bundle: true, | 
					 | 
					 | 
					    bundle: true, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    entryPoints: [path.join(__dirname, 'template/app.jsx')], | 
					 | 
					 | 
					    entryPoints: [path.join(__dirname, 'template/app.jsx')], | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    outfile, | 
					 | 
					 | 
					    outfile: OUT_FILE, | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					    plugins: [ | 
					 | 
					 | 
					    plugins: [ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        name: 'resolve-multi-react', | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        setup: (build) => { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          build.onResolve({ filter: /^react$/, namespace: 'file' }, () => { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            return { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					              path: require.resolve('react'), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					              watchFiles: undefined, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            }; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      // fix import('antd/dist/antd.less')
 | 
					 | 
					 | 
					      // fix import('antd/dist/antd.less')
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      { | 
					 | 
					 | 
					      { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        name: 'resolve-antd-dist-less', | 
					 | 
					 | 
					        name: 'resolve-antd-dist-less', | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |