Skip to content

Commit

Permalink
small build-process
Browse files Browse the repository at this point in the history
  • Loading branch information
jschwind committed Jun 4, 2024
1 parent 01acee8 commit d0e4436
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 55 deletions.
28 changes: 28 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const fs = require('fs');

if (process.argv.length < 3) {
console.error('Please provide the file path as an argument.');
process.exit(1);
}

const filePath = process.argv[2];

if (!fs.existsSync(filePath)) {
console.error(`The file ${filePath} does not exist.`);
process.exit(1);
}

fs.readFile(filePath, 'utf8', (err, data) => {
if (err) {
console.error(`Error reading file ${filePath}: ${err}`);
return;
}

const result = data.replace(/class /g, 'export class ');

fs.writeFile(filePath, result, 'utf8', err => {
if (err) {
console.error(`Error writing file ${filePath}: ${err}`);
}
});
});
71 changes: 68 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"url": "https://github.com/avalynx/avalynx-table/issues"
},
"scripts": {
"test": "jest"
"test": "jest",
"build": "shx rm -rf dist; shx mkdir -p dist/js/; shx cp src/js/avalynx-table.js dist/js/avalynx-table.js; shx cp src/js/avalynx-table.js dist/js/avalynx-table.esm.js; node build.js dist/js/avalynx-table.esm.js; shx mkdir -p dist/css/; shx cp src/css/avalynx-table.css dist/css/avalynx-table.css"
},
"dependencies": {
"bootstrap": ">=5.3"
Expand All @@ -47,6 +48,8 @@
"@babel/preset-env": "^7",
"babel-jest": "^29",
"jest": "^29",
"jest-environment-jsdom": "^29"
"jest-environment-jsdom": "^29",
"shelljs": "^0",
"shx": "^0"
}
}
50 changes: 0 additions & 50 deletions src/js/avalynx-table.esm.js

This file was deleted.

0 comments on commit d0e4436

Please sign in to comment.