Browse Source

Update README.md and add all-os-compatible hard reset

master
meriadec 7 years ago
parent
commit
39eb6d4e33
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 10
      README.md
  2. 2
      package.json
  3. 22
      scripts/reset-files.sh

10
README.md

@ -120,12 +120,14 @@ yarn flow # launch flow
yarn test # launch unit tests yarn test # launch unit tests
``` ```
### Programmaically reset hard the app ### Programmatically reset app files
Stop the app and to clean accounts, settings, etc, run
```bash ```bash
rm -rf ~/Library/Application\ Support/Electron/ # clear the dev electron user data directory
# it remove sqlite db, accounts, settings
# useful to start from a fresh state
yarn reset-files
``` ```
## File structure ## File structure

2
package.json

@ -20,7 +20,7 @@
"release": "bash ./scripts/release.sh", "release": "bash ./scripts/release.sh",
"start": "bash ./scripts/start.sh", "start": "bash ./scripts/start.sh",
"storybook": "NODE_ENV=development STORYBOOK_ENV=1 start-storybook -s ./static -p 4444", "storybook": "NODE_ENV=development STORYBOOK_ENV=1 start-storybook -s ./static -p 4444",
"trans": "node scripts/trans" "reset-files": "bash ./scripts/reset-files.sh"
}, },
"electronWebpack": { "electronWebpack": {
"title": true, "title": true,

22
scripts/reset-files.sh

@ -0,0 +1,22 @@
#!/bin/bash
set -e
echo "> Getting user data folder..."
TMP_FILE=`mktemp`
cat <<EOF > $TMP_FILE
const { app } = require('electron')
console.log(app.getPath('userData'))
EOF
USER_DATA_FOLDER=`timeout --preserve-status 0.5 electron $TMP_FILE || echo` # echo used to ensure status 0
rm $TMP_FILE
read -p "> Remove folder \"$USER_DATA_FOLDER\"? (y/n) " -n 1 -r
echo
if [[ $REPLY == "y" ]]
then
rm -rf "$USER_DATA_FOLDER"
else
echo "> Nothing done. Bye"
fi
Loading…
Cancel
Save