@@ -5,10 +5,6 @@ const path = require("path")
55const production = process . argv . includes ( "--production" )
66const watch = process . argv . includes ( "--watch" )
77
8- const ROOT_DIR_RELATIVE = "../dist"
9- const ROOT_DIR = path . join ( __dirname , ROOT_DIR_RELATIVE )
10- const DIST_DIR = path . join ( ROOT_DIR , "dist" )
11-
128/**
139 * @type {import('esbuild').Plugin }
1410 */
@@ -33,7 +29,7 @@ const copyWasmFiles = {
3329 setup ( build ) {
3430 build . onEnd ( ( ) => {
3531 const nodeModulesDir = path . join ( __dirname , "node_modules" )
36- const distDir = DIST_DIR
32+ const distDir = path . join ( __dirname , "dist" )
3733
3834 fs . mkdirSync ( distDir , { recursive : true } )
3935
@@ -74,7 +70,7 @@ const copyWasmFiles = {
7470
7571function copyLocaleFiles ( ) {
7672 const srcDir = path . join ( __dirname , "i18n" , "locales" )
77- const destDir = path . join ( DIST_DIR , "i18n" , "locales" )
73+ const destDir = path . join ( path . join ( __dirname , "dist" ) , "i18n" , "locales" )
7874
7975 if ( ! fs . existsSync ( srcDir ) ) {
8076 throw new Error ( `Directory does not exist: ${ srcDir } ` )
@@ -153,91 +149,6 @@ const copyLocalesFiles = {
153149 } ,
154150}
155151
156- /**
157- * @type {import('esbuild').Plugin }
158- */
159- const copyAssets = {
160- name : "copy-assets" ,
161- setup ( build ) {
162- build . onEnd ( ( ) => {
163- const copyPaths = [
164- [ "assets/icons" , "assets/icons" ] ,
165- [ "assets/images" , "assets/images" ] ,
166- [ "integrations/theme/default-themes" , "src/integrations/theme/default-themes" ] ,
167- [ "node_modules/vscode-material-icons/generated" , "node_modules/vscode-material-icons/generated" ] ,
168- [ "node_modules/@vscode/codicons/dist" , "node_modules/@vscode/codicons/dist" ] ,
169- ]
170-
171- for ( const [ srcRelPath , dstRelPath ] of copyPaths ) {
172- const srcDir = path . join ( __dirname , srcRelPath )
173- const dstDir = path . join ( ROOT_DIR , dstRelPath )
174-
175- if ( ! fs . existsSync ( srcDir ) ) {
176- throw new Error ( `Directory does not exist: ${ srcDir } ` )
177- }
178-
179- fs . mkdirSync ( dstDir , { recursive : true } )
180- let count = 0
181-
182- function copyDir ( src , dest ) {
183- const entries = fs . readdirSync ( src , { withFileTypes : true } )
184-
185- for ( const entry of entries ) {
186- const srcPath = path . join ( src , entry . name )
187- const dstDir = path . join ( dest , entry . name )
188-
189- if ( entry . isDirectory ( ) ) {
190- fs . mkdirSync ( dstDir , { recursive : true } )
191- copyDir ( srcPath , dstDir )
192- } else {
193- fs . copyFileSync ( srcPath , dstDir )
194- count ++
195- }
196- }
197- }
198-
199- copyDir ( srcDir , dstDir )
200- console . log ( `[copy-assets] Copied ${ count } files from ${ srcDir } to ${ dstDir } ` )
201- }
202- } )
203- } ,
204- }
205-
206- /**
207- * @type {import('esbuild').Plugin }
208- */
209- const copyPackageJson = {
210- name : "copy-package-json" ,
211- setup ( build ) {
212- build . onEnd ( ( ) => {
213- const srcDir = __dirname
214- const srcPath = path . join ( srcDir , "package.json" )
215- const dstDir = ROOT_DIR
216-
217- if ( ! fs . existsSync ( dstDir ) ) {
218- throw new Error ( `Directory does not exist: ${ dstDir } ` )
219- }
220-
221- // Copy package.json to the dist directory and rename the extension to "roo-cline".
222- const packageJson = JSON . parse ( fs . readFileSync ( srcPath , "utf8" ) )
223- packageJson . name = "roo-cline"
224- fs . writeFileSync ( path . join ( dstDir , "package.json" ) , JSON . stringify ( packageJson , null , 2 ) , "utf8" )
225- console . log ( `[copy-package-json] Copied package.json to ${ dstDir } ` )
226-
227- // Copy all package.nls.* files to the dist directory.
228- const nlsFiles = fs . readdirSync ( srcDir ) . filter ( ( file ) => file . startsWith ( "package.nls." ) )
229- let count = 0
230-
231- for ( const nlsFile of nlsFiles ) {
232- fs . copyFileSync ( path . join ( srcDir , nlsFile ) , path . join ( dstDir , nlsFile ) )
233- count ++
234- }
235-
236- console . log ( `[copy-package-json] Copied ${ count } package.nls.*.json files to ${ dstDir } ` )
237- } )
238- } ,
239- }
240-
241152/**
242153 * @type {import('esbuild').BuildOptions }
243154 */
@@ -249,8 +160,6 @@ const extensionConfig = {
249160 plugins : [
250161 copyWasmFiles ,
251162 copyLocalesFiles ,
252- copyAssets ,
253- copyPackageJson ,
254163 esbuildProblemMatcherPlugin ,
255164 {
256165 name : "alias-plugin" ,
@@ -265,7 +174,7 @@ const extensionConfig = {
265174 format : "cjs" ,
266175 sourcesContent : false ,
267176 platform : "node" ,
268- outfile : ROOT_DIR_RELATIVE + "/ dist/extension.js",
177+ outfile : " dist/extension.js",
269178 external : [ "vscode" ] ,
270179}
271180
@@ -281,7 +190,7 @@ const workerConfig = {
281190 format : "cjs" ,
282191 sourcesContent : false ,
283192 platform : "node" ,
284- outdir : ROOT_DIR_RELATIVE + "/ dist/workers",
193+ outdir : " dist/workers",
285194}
286195
287196async function main ( ) {
0 commit comments