Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Dec 30, 2023
2 parents 97a053c + 1507475 commit 21057c8
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,35 @@ class ModuleGenerator {
}
}

class fileUploader {
constructor(env) {
class FileUploader {
constructor(env, argv) {
this.env = env;
this.isWatching = false;
this.isWatch = argv.watch === true;
}

apply(compiler) {
if (this.env.beforeCompilation) {
// Directly perform upload here
upload(process.cwd(), ['../', '-w']);
}
if (this.isWatch) {

if (this.env.afterCompilation) {
compiler.hooks.emit.tapAsync('watchFiles', (compilation, callback) => {
if (!this.isWatching) {
this.isWatching = true;
upload(process.cwd(), ['../', '-w']);
}
callback();
});
if (this.env.beforeCompilation) {
// Directly perform upload here
upload(process.cwd(), ['../', '-w']);
}

if (this.env.afterCompilation) {
compiler.hooks.emit.tapAsync('watchFiles', (compilation, callback) => {
if (!this.isWatching) {
this.isWatching = true;
upload(process.cwd(), ['../', '-w']);
}
callback();
});
}
}
}
}


class SymlinkCreator {
constructor(options) {
// Store options if necessary, or just hard-code paths
Expand Down Expand Up @@ -116,4 +121,4 @@ class SymlinkCreator {
}
}

module.exports = { ModuleGenerator, fileUploader, SymlinkCreator };
module.exports = { ModuleGenerator, FileUploader, SymlinkCreator };
21 changes: 21 additions & 0 deletions src/replace-unicode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = function (source) {
return source.replace(/\$'/g, '\\u0024\'');

// const specialChars = /[\0\x08\x09\x1a\n\r"'\\\%\$]/g; // Add or remove characters based on your needs
// const replacements = {
// // "\0": "\\0",
// // "\x08": "\\b",
// // "\x09": "\\t",
// // "\x1a": "\\z",
// // "\n": "\\n",
// // "\r": "\\r",
// // "\"": "\\\"",
// // "'": "\\'",
// // "\\": "\\\\",
// // "%": "\\%",
// "$": "\\$" // Escape for MongoDB and others
// // ... add more replacements as needed for other databases
// };

// return source.replace(specialChars, (char) => (replacements[char] || char));
};

0 comments on commit 21057c8

Please sign in to comment.