Skip to content

Commit

Permalink
fix: deleted manual store update on webrtc detach (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyco97 authored Jan 22, 2025
1 parent f91107e commit 6566e21
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,9 @@ As you can see the app/component can be built in two ways.

- The component library built with Rollup
- The widget files built with Parcel

```
npm build-pack
```

It's useful to create a new local version of phone-island that could be imported in any project with some debug command
29 changes: 29 additions & 0 deletions bump-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const fs = require('fs');
const { execSync } = require('child_process');

// Script for automatic version bumping of Phone-island component
// Path to package.json
const packageJsonPath = './package.json';

// Read package.json content
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));

// Increment version number
// Split version into major.minor.patch and convert to numbers
const currentVersion = packageJson.version;
const [major, minor, patch] = currentVersion.split('.').map(Number);
const newVersion = `${major}.${minor}.${patch + 1}`;

// Update version in package.json object
packageJson.version = newVersion;

// Write the new version back to package.json
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
console.log(`Version updated: ${currentVersion} -> ${newVersion}`);

// Regenerate package-lock.json to ensure dependency consistency
console.log('Updating package-lock.json...');
execSync('npm install --package-lock-only', { stdio: 'inherit' });

console.log('Process completed.');

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@
"build-storybook": "storybook build -s public",
"release": "npm publish",
"release:widget": "np patch",
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc"
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc",
"bump": "node bump-version.js",
"build-pack": "npm run bump && npm run build && npm pack"
},
"browserslist": {
"production": [
Expand Down
1 change: 0 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export const PhoneIsland: FC<PhoneIslandProps> = ({

useEventListener('phone-island-detach', (data) => {
detach()
store.dispatch.currentUser.updateCurrentDefaultDevice(data?.deviceInformationObject)
eventDispatch('phone-island-detached', {})
})

Expand Down

0 comments on commit 6566e21

Please sign in to comment.