Skip to content

Commit

Permalink
feat(project): re-structure project to be easy to work with going for…
Browse files Browse the repository at this point in the history
…ward
  • Loading branch information
MrYuion committed Aug 16, 2022
1 parent 354df1b commit 13d13ae
Show file tree
Hide file tree
Showing 30 changed files with 17,877 additions and 8,804 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#root = true

[*]
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_size = 4

[*.md]
trim_trailing_whitespace = false
5 changes: 5 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"no-restricted-globals": 0
}
}
16 changes: 11 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
bower_components
node_modules
.sass-cache
coverage
.nyc_output
.DS_Store
.tmp
npm-debug.log
*.zip
*.log
.vscode
.idea
dist
compiled
.awcache
.rpt2_cache
docs
*.tgz
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"tabWidth": 4,
"semi": true
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Place Technology

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
26 changes: 26 additions & 0 deletions build-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var fs = require('fs');

function cleanJavascriptFile(content) {
content = content.replace(/^.*export.*$/mi, ''); // Remove exports
content = content.replace(/^.*export.*$/mi, ''); // Remove exports
content = content.replace(/^.*export.*$/mi, ''); // Remove exports
content = content.replace(/^.*require.*$/mi, ''); // Remove reqires
content = content.replace(/md5_1\./g, ''); // Fix reference to Md5 class
content = content.replace(/\n\n/g, '\n'); // Reduce new lines
return content;
}

console.log("Loading javascript files...");

var file_hasher = fs.readFileSync('./dist/cjs/md5_file_hasher.js').toString();
var md5 = fs.readFileSync('./dist/cjs/md5.js').toString();
var worker = fs.readFileSync('./src/worker.js').toString();

console.log("Clean javascript files...");

file_hasher = cleanJavascriptFile(file_hasher);
md5 = cleanJavascriptFile(md5);

console.log("Creating worker javascript...");

fs.writeFileSync('./dist/md5_worker.js', file_hasher + md5 + worker);
24 changes: 24 additions & 0 deletions clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var fs = require('fs');

function deleteFolderRecursive(path) {
if (fs.existsSync(path) && fs.lstatSync(path).isDirectory()) {
fs.readdirSync(path).forEach(function(file, index){
var curPath = path + "/" + file;

if (fs.lstatSync(curPath).isDirectory()) { // recurse
deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
});

console.log(`Deleting directory "${path}"...`);
fs.rmdirSync(path);
}
};

console.log("Cleaning working tree...");

deleteFolderRecursive("./dist");

console.log("Successfully cleaned working tree!");
34 changes: 0 additions & 34 deletions dist/md5.d.ts

This file was deleted.

Loading

0 comments on commit 13d13ae

Please sign in to comment.