Shanedell commented on code in PR #232:
URL: https://github.com/apache/daffodil-vscode/pull/232#discussion_r923976541


##########
build/scripts/process_build.ts:
##########
@@ -18,39 +18,98 @@
 // @ts-nocheck <-- This is needed as this file is basically a JavaScript script
 //                 but with some TypeScript niceness baked in
 const fs = require('fs')
+const path = require('path')
+const glob = require('glob')
 const execSync = require('child_process').execSync
+const pkg_dir = 'dist/package'
+var fileCount = 0
 
-function prebuild() {
-  fs.renameSync('LICENSE', 'tmp.LICENSE')
-  fs.renameSync('NOTICE', 'tmp.NOTICE')
-  fs.copyFileSync('build/bin.NOTICE', 'NOTICE')
-  fs.copyFileSync('build/bin.LICENSE', 'LICENSE')
+function copyGlob(pattern, skipDirectory = false) {
+  glob(pattern, (error, files) => {
+    for (var i = 0; i < files.length; i++) {
+      let file = !skipDirectory
+        ? files[i]
+        : files[i].split('/')[files[i].split('/').length - 1]
+
+      let directory = path.join(pkg_dir, getDir(file))
+
+      if (!fs.existsSync(directory)) {
+        fs.mkdirSync(directory, { recursive: true })
+      }
+
+      fileCopy(file, `${pkg_dir}/${file}`)
+      fileCount++
+    }
+  })
+}
+
+function getDir(file) {
+  return file
+    .split('/')
+    .slice(0, file.split('/').length - 1)
+    .join('/')
+}
+
+function fileCopy(srcPath, destPath) {
+  if (fs.statSync(srcPath).isFile()) {
+    fs.copyFileSync(srcPath, destPath)
+  }
+}
+
+function create_package() {
+  // wait to run these commands till all files have been copied
+  while (fileCount < fs.readdirSync(pkg_dir).length) {

Review Comment:
   Yeah sorry messed up how this was placed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to