squash commits
This commit is contained in:
commit
0f545c5e4d
611 files changed
+272565
No files matched your search
@@ -0,0 +1,34 @@
|
||||
const fs = require('fs');
|
||||
const THREE_REGEX = /three@[~^]?([\dvx*]+(?:[-.](?:[\dx*]+|alpha|beta))*)/gm;
|
||||
let NEW_THREE_VERSION;
|
||||
const THREE_PACKAGE_REGEX = /"three": ".*"/g;
|
||||
fs.readFile(
|
||||
'packages/model-viewer/package.json', {encoding: 'utf8'}, (err, data) => {
|
||||
NEW_THREE_VERSION = `three@${
|
||||
THREE_PACKAGE_REGEX.exec(data)[0].split(' ')[1].replaceAll('"', '')}`;
|
||||
console.log(NEW_THREE_VERSION);
|
||||
});
|
||||
|
||||
function updateThreeVersion(filePath) {
|
||||
fs.readFile(filePath, {encoding: 'utf8'}, (err, data) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
const OLD_THREE_VERSION = THREE_REGEX.exec(data)[0];
|
||||
if (!OLD_THREE_VERSION || !NEW_THREE_VERSION) {
|
||||
console.error(
|
||||
'Tried to replace ', OLD_THREE_VERSION, ' with ', NEW_THREE_VERSION);
|
||||
return;
|
||||
}
|
||||
data = data.replaceAll(OLD_THREE_VERSION, NEW_THREE_VERSION);
|
||||
fs.writeFile(filePath, data, {encoding: 'utf8'}, (err) => {
|
||||
if (err)
|
||||
console.log(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
updateThreeVersion('packages/model-viewer-effects/README.md');
|
||||
updateThreeVersion(
|
||||
'packages/modelviewer.dev/examples/postprocessing/index.html');
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CHANGED_TYPESCRIPT_FILES=$(git diff-index --diff-filter=d --cached --name-only HEAD | grep '.*\.ts')
|
||||
|
||||
if [ ! "$CHANGED_TYPESCRIPT_FILES" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
MESSAGE="Detected changes in the following staged TypeScript files:
|
||||
|
||||
$CHANGED_TYPESCRIPT_FILES
|
||||
|
||||
💁♂️These files will be auto-formatted before they are committed
|
||||
⚠️ Unstaged changes in these files will be pushed to git stash
|
||||
"
|
||||
|
||||
echo "$MESSAGE"
|
||||
|
||||
# Stash unstaged changes:
|
||||
git stash -k -- $CHANGED_TYPESCRIPT_FILES
|
||||
|
||||
for file in $CHANGED_TYPESCRIPT_FILES; do
|
||||
./node_modules/.bin/clang-format -i $file
|
||||
git add $file
|
||||
done
|
||||
Reference in new issue
Block a user