Skip to content

Commit

Permalink
Merge pull request #13 from Tech-Nest-Ventures/12-time-tracking-inacc…
Browse files Browse the repository at this point in the history
…urate

fix: simplified time tracking logic to work within main thread. Added…
  • Loading branch information
timeowilliams authored Oct 13, 2024
2 parents a0899bb + 0b2ed10 commit 628fbcb
Show file tree
Hide file tree
Showing 18 changed files with 2,706 additions and 1,179 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ node_modules
.env
deepfocus.js
test-results
playwright-report
playwright-report
AuthKey_32R92U589C.p8
Mac OS X Provisioning Profile Signing.cer
forge.config.js
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,11 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
## Contact

Timeo Williams [@timeowilliams](https://twitter.com/timeowilliams) - [email protected]

Current Issues:

1. Need to persist Activity Data to backend properly.
2. Right now, I have 5 separate instances of VSCode open. But my logic for time tracking is adding all 5 instances together.
3. Test signing a basic electron app > and then running it locally.
4. I found it interesting how rize-io didnt really do the whole asar unpack thing, but instead had the entire app in a single folder.
5. Fix mocha tests for testing delay.
3 changes: 3 additions & 0 deletions build/entitlements.mac.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
Expand All @@ -10,5 +12,6 @@
<true/>
<key>com.apple.security.automation.apple-events</key>
<true/>

</dict>
</plist>
70 changes: 50 additions & 20 deletions electron-builder.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
appId: com.deepfocus.app
appId: com.electron.deepfocus
productName: Deep Focus
copyright: Copyright © 2024 Timeo Williams
directories:
output: dist
buildResources: build
Expand All @@ -20,39 +21,68 @@ extraResources:
- from: './resources/icon.png'
to: 'resources/icon.png'

forceCodeSigning: false
compression: 'store' # Change to 'maxium' to enable compression in PROD

asar: true
asarUnpack:
- 'resources/**'
- 'node_modules/@deepfocus/get-windows/main'
- 'node_modules/@deepfocus/get-windows'
- 'node_modules/node-mac-permissions'

mac:
entitlements: build/entitlements.mac.plist
entitlementsInherit: build/entitlements.mac.plist
identity: Timeo Williams (3Y4F3KTSJA)
provisioningProfile: "Mac\ OS\ X\ Provisioning\ Profile\ Signing.cer"
darkModeSupport: true
binaries:
- ./node_modules/@deepfocus/get-windows/main
extendInfo:
NSCameraUsageDescription: Application requests access to the device's camera.
NSMicrophoneUsageDescription: Application requests access to the device's microphone.
NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
NSAppleEventsUsageDescription: Please allow access to script browser applications to detect the current URL when triggering instant lookup.

NSCalendarsUsageDescription: Application needs access to calendars for productivity scheduling.
NSScreenCaptureUsageDescription: Application needs access to capture the screen for productivity monitoring.
NSAccessibilityUsageDescription: Application requires access to accessibility features to track and monitor window titles.
category: 'public.app-category.productivity'
notarize: true

dmg:
artifactName: ${name}-${version}.${ext}
win:
executableName: Deep Focus
nsis:
artifactName: ${name}-${version}-setup.${ext}
shortcutName: ${productName}
uninstallDisplayName: ${productName}
createDesktopShortcut: always
linux:
target:
- AppImage
- snap
- deb
maintainer: electronjs.org
category: Utility
artifactName: '${name}-${version}.${ext}' # Specify how your dmg file will be named

# win:
# # Removed invalid properties like shortcutName, uninstallDisplayName, and createDesktopShortcut
# target:
# - nsis
# artifactName: '${name}-${version}-setup.${ext}'
# icon: './resources/icon.ico'

# nsis:
# oneClick: false
# perMachine: true
# allowElevation: true
# allowToChangeInstallationDirectory: true
# installerIcon: './resources/icon.ico'
# uninstallerIcon: './resources/icon.ico'
# deleteAppDataOnUninstall: true
# createDesktopShortcut: true # This should be set in the `nsis` section
# createStartMenuShortcut: true

# linux:
# target:
# - AppImage
# - snap
# - deb
# maintainer: electronjs.org
# category: Utility

appImage:
artifactName: ${name}-${version}.${ext}
artifactName: '${name}-${version}.${ext}'

npmRebuild: false

publish:
provider: generic
url: https://example.com/auto-updates
11 changes: 10 additions & 1 deletion electron.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ export default defineConfig({
entryFileNames: '[name].js'
},
// Externalize unnecessary dependencies from the worker
external: ['electron', 'path', 'fs', 'dotenv', '@electron-toolkit/utils', 'electron-store']
external: [
'electron',
'path',
'fs',
'dotenv',
'@electron-toolkit/utils',
'electron-store',
'@deepfocus/get-windows',
'node-mac-permissions'
]
}
},
define: {
Expand Down
67 changes: 67 additions & 0 deletions forge.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// import { notarize } from '@electron/notarize';
// import dotenv from 'dotenv';

// dotenv.config(); // Load environment variables from .env file

// export default {
// packagerConfig: {
// icon: 'resources/icon.png',
// entitlements: 'build/entitlements.mac.plist',
// ignore: [
// /^\/src/,
// /(.eslintrc.json)|(.gitignore)|(electron.vite.config.ts)|(forge.config.cjs)|(tsconfig.*)/,
// ],
// osxSign: {
// identity: "Developer ID Application: Timeo Williams (3Y4F3KTSJA)",
// 'hardened-runtime': true, // Required for notarization
// entitlements: 'build/entitlements.mac.plist',
// 'entitlements-inherit': 'build/entitlements.mac.plist',
// 'gatekeeper-assess': false,
// // Ensure all files, including binaries, are signed
// optionsForFile: (filePath) => {
// console.log('Signing file:', filePath);
// if (filePath.endsWith('.node')) {
// return {
// entitlements: 'build/entitlements.mac.plist',
// 'hardened-runtime': true,
// };
// }
// }
// },
// osxNotarize: {
// tool: "notarytool",
// appleApiKey: process.env.APPLE_API_KEY,
// appleApiKeyId: process.env.APPLE_API_KEY_ID,
// appleApiIssuer: process.env.APPLE_API_ISSUER,
// },
// },
// rebuildConfig: {}, // Add any rebuild configurations if required
// makers: [
// {
// name: '@electron-forge/maker-zip',
// platforms: ['darwin'],
// }
// ],
// hooks: {
// // Notarize the app after it’s packaged
// postPackage: async (forgeConfig, options) => {
// if (process.platform === 'darwin') {
// const appPath = options.appPaths[0];
// console.log(`Notarizing app at ${appPath}`);

// try {
// await notarize({
// appBundleId: 'com.deepfocus.app',
// appPath: `${appPath}`,
// appleApiKey: process.env.APPLE_API_KEY,
// appleApiKeyId: process.env.APPLE_API_KEY_ID,
// appleApiIssuer: process.env.APPLE_API_ISSUER,
// });
// console.log('Notarization complete.');
// } catch (error) {
// console.error('Error during notarization:', error);
// }
// }
// },
// },
// };
46 changes: 30 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
"typecheck": "npm run typecheck:node && npm run typecheck:web",
"test": "vitest run 'tests/simulateData.test.ts'",
"test:watch": "vitest --watch",
"test:ui": "vitest --ui",
"coverage": "vitest run --coverage",
"test:e2e": "npx playwright test",
"start": "electron-vite preview",
"dev": "electron-vite dev -- --inspect ",
Expand All @@ -20,57 +24,67 @@
"build:unpack": "npm run build && electron-builder --dir",
"build:win": "npm run build && electron-builder --win",
"build:mac": "NODE_ENV=production electron-vite build && electron-builder --mac",
"build:linux": "electron-vite build && electron-builder --linux"
"build:linux": "electron-vite build && electron-builder --linux",
"package": "electron-vite build --outDir=dist && electron-forge package",
"make": "electron-vite build --outDir=dist && electron-forge make"
},
"dependencies": {
"@deepfocus/get-windows": "^1.0.19",
"@corvu/utils": "^0.4.2",
"@deepfocus/get-windows": "^1.0.20",
"@electron-toolkit/preload": "^3.0.1",
"@electron-toolkit/utils": "^3.0.0",
"@kobalte/core": "^0.13.6",
"@kobalte/core": "^0.13.7",
"@modular-forms/solid": "^0.23.0",
"@solidjs/router": "^0.14.7",
"@solidjs/router": "^0.14.8",
"chart.js": "^4.4.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"dayjs": "^1.11.13",
"dotenv": "^16.4.5",
"electron-store": "^10.0.0",
"electron-updater": "^6.3.4",
"electron-updater": "^6.3.9",
"gsap": "^3.12.5",
"node-addon-api": "^8.2.0",
"node-addon-api": "^8.2.1",
"node-mac-permissions": "^2.4.0",
"node-schedule": "^2.1.1",
"simple-plist": "^1.3.1",
"solid-chartjs": "^1.3.11",
"solid-js": "^1.9.1",
"tailwind-merge": "^2.5.2",
"solid-js": "^1.9.2",
"tailwind-merge": "^2.5.3",
"tailwindcss-animate": "^1.0.7",
"url": "^0.11.4"
},
"devDependencies": {
"@electron-forge/cli": "^7.5.0",
"@electron-forge/maker-deb": "^7.5.0",
"@electron-forge/maker-rpm": "^7.5.0",
"@electron-forge/maker-squirrel": "^7.5.0",
"@electron-toolkit/eslint-config-prettier": "^2.0.0",
"@electron-toolkit/eslint-config-ts": "^2.0.0",
"@electron-toolkit/tsconfig": "^1.0.1",
"@playwright/test": "^1.47.2",
"@types/node": "^22.7.4",
"@electron/notarize": "^2.5.0",
"@playwright/test": "^1.48.0",
"@types/node": "^22.7.5",
"autoprefixer": "^10.4.20",
"electron": "^32.1.2",
"electron-builder": "^25.0.5",
"chai": "^5.1.1",
"electron": "^32.2.0",
"electron-builder": "^25.1.8",
"electron-playwright-helpers": "^1.7.1",
"electron-vite": "^2.3.0",
"eslint": "^9.11.1",
"eslint": "^9.12.0",
"eslint-plugin-solid": "^0.14.3",
"playwright": "^1.47.2",
"playwright": "^1.48.0",
"postcss": "^8.4.47",
"postcss-loader": "^8.1.1",
"prettier": "^3.3.3",
"semantic-release": "^24.1.2",
"tailwindcss": "^3.4.13",
"ts-node": "^10.9.2",
"tsx": "^4.19.1",
"typescript": "^5.6.2",
"typescript": "^5.6.3",
"valibot": "^0.42.1",
"vinxi": "^0.4.3",
"vite": "^5.4.8",
"vitest": "^2.1.2",
"vite-plugin-solid": "^2.10.2"
},
"pnpm": {
Expand Down
Loading

0 comments on commit 628fbcb

Please sign in to comment.