Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from glimmer.js to svelte #19

Merged
merged 81 commits into from Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
f9d7d8c
Bump bestzip from 1.1.4 to 2.1.7 in /chrome
dependabot[bot] May 6, 2021
c7941c9
Initial svelte commit
chadian Feb 28, 2022
0a93461
Migrate CountdownTimer component sans tests & styles
chadian Feb 28, 2022
f804236
Add component/unit test with jest and testing-library
chadian May 24, 2022
7b34a2d
Add extra tests and handle zero time cases
chadian May 24, 2022
fa34120
Relocate global styles and fonts
chadian May 24, 2022
5b1dfdf
Migrate storage and store
chadian May 24, 2022
e3858c3
Improve CountdownTimer handling of date and duration formats
chadian May 26, 2022
364e66a
Migrate additional styling and animation to CountdownTimer
chadian May 26, 2022
7807471
Abstract out additional helpers from CountdownTimer
chadian May 26, 2022
fa4bef5
(wip) Migration of Settings component
chadian May 26, 2022
673ca5d
Add "shell" wrapper to provide centering and base structure
chadian May 27, 2022
43cc869
Add Button component and use it in Settings
chadian May 27, 2022
3a0eeec
Add test for Settings component
chadian Jun 8, 2022
6440579
Fix ssr issues with window
Aug 17, 2022
d104fd0
Update svelte deps
Aug 17, 2022
df0b34c
Modernize sveltekit and deps
Aug 17, 2022
c5eb490
Wire up Settinigs page and route transitions
Aug 17, 2022
31be314
Tabs -> 2 spaces
Aug 17, 2022
82732c0
Add CountdownMessage component
Aug 18, 2022
19ec760
Add SettingsButton with gear icon
Aug 18, 2022
629c2b9
Remove some dead styles from the Settings component
Aug 18, 2022
fbbbea8
Set date value settings on blur
Aug 19, 2022
e520e04
Fix handling around async loading settings store
Aug 19, 2022
a730ea7
Speed up animation timings
Aug 19, 2022
2958fe6
Remove unneeded root Vorfreude component
Aug 19, 2022
86af8de
Move data manipulation outside of Settings component
Aug 22, 2022
4466c37
More timing tweaks
Aug 22, 2022
cf38716
Setup testing to work with slots
Aug 22, 2022
f8aeec7
Add Button component test
Aug 22, 2022
8201489
Add @babel/preset-typescript for testing with typescript
Aug 22, 2022
67ec4bd
Update Settings test with inline precompile
Aug 22, 2022
dcd8662
Add @testing-library/user-event
Aug 22, 2022
571c0f0
Fix string indentation
Aug 22, 2022
8e89218
Refactor and improve Settings component tests
Aug 22, 2022
017f9ea
Fix up CountdownMessage and has-date-past utility
Aug 23, 2022
fe27f59
Add testing with github actions
Aug 23, 2022
6f425df
Fix tsconfig.json based on ci error requiring extends
Aug 23, 2022
0447d9c
Fix playwright acceptance tests to run explicitly on port 3000
Aug 23, 2022
b4aaec5
Sync .svelte-kit (contains tsconfig) in github actions ci
Aug 23, 2022
b057251
Run browser install command for playwright in github actions ci
Aug 23, 2022
d00f7ff
Add static asset icons and update app.html
Aug 23, 2022
4cbc11a
Add basic acceptance test
Aug 25, 2022
8b5efb3
Add additional acceptance tests
Aug 26, 2022
9919d13
Update project README
Aug 26, 2022
5182c90
Remove text selection cursor from countdown message and timer
chadian Sep 2, 2022
2b11b66
Add Wallpaper component and migrate photo manager
chadian Sep 3, 2022
6595e53
Avoid initial photo load
chadian Sep 3, 2022
5c626f1
Set svelte static adapter to fallback with index.html
chadian Sep 6, 2022
687aacb
Tweak animation timings
chadian Sep 6, 2022
97baf9a
Add call to perform photo manager housecleaning
chadian Sep 6, 2022
1bfbb8e
Add missing ramda dependency
chadian Sep 6, 2022
52d0630
Remove of all the ember things
chadian Sep 6, 2022
deec15d
Move all the svelte things to root
chadian Sep 6, 2022
3a7f6c5
Update github actions ci to run from svelte things from root
chadian Sep 6, 2022
bbbc0cd
Tweak Wallpaper component
chadian Sep 7, 2022
b0b87f4
Load root <slot/> on top of Wallpaper component
chadian Sep 7, 2022
e66633d
Add acceptance test for wallpaper existing
chadian Sep 7, 2022
c44e910
Run prettier
chadian Sep 7, 2022
b30a309
Rewire build artifact symlinks from chrome directory to svelte build …
chadian Sep 7, 2022
6e17f2c
Upgrade rollup dependencies and config
chadian Sep 7, 2022
a7391bb
Fix up background.ts imports and linting
chadian Sep 7, 2022
29e3f10
Migrate ChromeStorageAdapter test from QUnit to jest
chadian Sep 7, 2022
257787a
Fix typing warning in fetcher.ts
chadian Sep 7, 2022
179a795
(wip) Fix svelte build to work as extension
chadian Sep 8, 2022
5d6c33a
Fix font path, swap from relative to absolute url
chadian Sep 8, 2022
4da52cf
Remove chrome manifest.json as its now generated
chadian Sep 8, 2022
a880044
Include settings.html in package zip
chadian Sep 8, 2022
1ad208f
Use hacky hash routing
chadian Sep 8, 2022
f20bdf7
Use dedicated settings.html page to redirect to index.html#settings
chadian Sep 8, 2022
7b066cc
Only build (prerender) index.html page
chadian Sep 8, 2022
bf0b83a
Update playwright config to build:app
chadian Sep 8, 2022
0e9d843
Update playwright acceptance tests with hash routes
chadian Sep 8, 2022
a982498
Fix isExtensionEnv to look for specific chrome extension global
chadian Sep 8, 2022
7c89c81
Tweak acceptance test edge cases
chadian Sep 8, 2022
643c567
Bump all the dependencies
chadian Sep 8, 2022
ea6ae39
Set root package.json package script to package from chrome folder
chadian Sep 8, 2022
36db2fe
Set background image to fallback gradient in app.html
chadian Sep 8, 2022
088add1
Update building, packaging release steps
chadian Sep 9, 2022
9a461fd
Add hacky index.html route
chadian Sep 11, 2022
8fbfda1
Improve image fetching and photo-manager usage
chadian Sep 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .babelrc
@@ -0,0 +1,7 @@
{
"presets": [
["@babel/preset-env", { "targets": { "node": "current" } }],
"@babel/preset-typescript"
],
"plugins": ["svelte-inline-compile"]
}
20 changes: 20 additions & 0 deletions .eslintrc.cjs
@@ -0,0 +1,20 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['svelte3', '@typescript-eslint'],
ignorePatterns: ['*.cjs'],
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
settings: {
'svelte3/typescript': () => require('typescript')
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020
},
env: {
browser: true,
es2017: true,
node: true
}
};
16 changes: 16 additions & 0 deletions .github/workflows/yarn-test.yml
@@ -0,0 +1,16 @@
name: Test Vorfreude

on: [push]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 16
- run: yarn
- run: yarn svelte-kit sync
- run: yarn playwright install
- run: yarn test
16 changes: 13 additions & 3 deletions .gitignore
@@ -1,5 +1,15 @@
node_modules
tmp/*
dist
# svelte defaults
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
/test-results/
/playwright-report/
/playwright/.cache/

# extension build artifact
/chrome/vorfreude.zip
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
engine-strict=true
6 changes: 6 additions & 0 deletions .prettierrc
@@ -0,0 +1,6 @@
{
"useTabs": false,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100
}
29 changes: 17 additions & 12 deletions README.md
Expand Up @@ -7,32 +7,37 @@

## Prerequisites

You will need the following things properly installed on your computer.
You will need the following things installed on your computer.

* [Git](https://git-scm.com/)
* [Node.js](https://nodejs.org/) (with NPM)
* [Node.js](https://nodejs.org/) (see package.json "engines" for required version)
* [Yarn](https://yarnpkg.com/en/)
* [Ember CLI](https://ember-cli.com/)

## Installation

* `git clone <repository-url>` this repository
* `cd vorfreude`
* `yarn`

## Running / Development
## Local Development

* `yarn start`
* Visit your app at [http://localhost:4200](http://localhost:4200).
* `yarn dev`
* Visit the locally running app at the listed outputted in the terminal.

### Building & Relasing
## Tests

1. `yarn release` (create the release)
2. `yarn build` (create build)
3. `yarn package` (create zip package of build for stores)
* Unit and Component Tests (`yarn test:unit`) use [jest](https://jestjs.io/) and [Testing Library](https://testing-library.com/)
* Acceptance Tests (`yarn test:acceptance`) use [Playwright](https://playwright.dev/)
* Playwright runs tests in the browser and these need to be installed first. This can be done by running `yarn playwright install`
* Both unit/component and acceptance tests can be ran with `yarn test`

### Building / Package / Release

1. `yarn version` (bump version)
2. `yarn build` (create build, both svelte and the extension)
3. `yarn package` (create zip package for upload to extension/addon stores)
4. Upload zip to chrome and firefox stores

## Further Reading / Useful Links

* [glimmerjs](http://github.com/tildeio/glimmer/)
* [ember-cli](https://ember-cli.com/)
* This project is built using [Svelte](https://svelte.dev/) and [SvelteKit](https://kit.svelte.dev/)
3 changes: 2 additions & 1 deletion chrome/.gitignore
@@ -1,5 +1,6 @@
# background.js is built an artifact by rollup in this directory
# built artifacts
background.js
manifest.json

# rollup typescript plugin build
.rpt2_cache/
Expand Down
1 change: 1 addition & 0 deletions chrome/app
1 change: 0 additions & 1 deletion chrome/app.css

This file was deleted.

1 change: 0 additions & 1 deletion chrome/app.js

This file was deleted.

10 changes: 6 additions & 4 deletions chrome/background.ts
@@ -1,15 +1,17 @@
import { replenish } from '../src/utils/lib/manager/fetcher';
import { Replenisher } from '../src/photo-manager/replenisher'

chrome.runtime.onMessage.addListener(function(message) {
if (message.operation === 'replenishBacklog') {
let { searchTerms, downloadBatchSize } = message;
const { searchTerms, downloadBatchSize } = message;

return replenish(searchTerms, downloadBatchSize);
const replenisher = new Replenisher(searchTerms);
replenisher.downloadBatchSize = downloadBatchSize;
replenisher.replenish();
}
});

function openVorfreudeTab() {
let vorfreudeUrl = chrome.extension.getURL('window.html');
const vorfreudeUrl = chrome.extension.getURL('index.html');
chrome.tabs.create({ url: vorfreudeUrl });
}

Expand Down
29 changes: 29 additions & 0 deletions chrome/build-manifest.js
@@ -0,0 +1,29 @@
const { readFileSync, writeFileSync } = require('fs');

function readManiestBluePrint() {
const manifestBlueprint = readFileSync('manifest.blueprint.json').toString();
return manifestBlueprint;
}

function readHtmlCspMeta() {
const htmlContents = readFileSync('index.html').toString();
const [, cspDirectives] = htmlContents.match(/<meta http-equiv="content-security-policy" content="(.+)">/);
return cspDirectives;
}

function generateManifest(blueprint, { csp }) {
const blueprintCspToken = '{{ContentSecurityPolicy}}';
const processed = blueprint.replace(blueprintCspToken, csp);
return processed;
}

function writeManifest(contents) {
writeFileSync('manifest.json', contents);
}

const blueprint = readManiestBluePrint();
const csp = readHtmlCspMeta();
const manifest = generateManifest(blueprint, { csp });
writeManifest(manifest);

console.log('🙌 Generated manifest.json');
2 changes: 1 addition & 1 deletion chrome/fonts
2 changes: 1 addition & 1 deletion chrome/images
1 change: 1 addition & 0 deletions chrome/index.html
5 changes: 3 additions & 2 deletions chrome/manifest.json → chrome/manifest.blueprint.json
Expand Up @@ -13,11 +13,12 @@
"128": "images/icon128.png"
},
"options_ui": {
"page": "window.html#settings",
"page": "settings.html",
"open_in_tab": true
},
"content_security_policy": "{{ContentSecurityPolicy}}",
"chrome_url_overrides": {
"newtab": "window.html"
"newtab": "index.html"
},
"background": {
"scripts": [
Expand Down
19 changes: 10 additions & 9 deletions chrome/package.json
Expand Up @@ -6,16 +6,17 @@
"author": "Chad Carbert",
"license": "MIT",
"scripts": {
"build": "rollup -c rollup.config.js",
"package": "bestzip vorfreude.zip app.css app.js background.js manifest.json fonts images window.html"
"build": "yarn build-js && yarn build-manifest",
"build-js": "rollup -c rollup.config.js",
"build-manifest": "node build-manifest.js",
"package": "bestzip vorfreude.zip index.html settings.html background.js manifest.json app fonts images"
},
"dependencies": {
"@types/chrome": "^0.0.69",
"bestzip": "^2.1.7",
"rollup": "^0.62.0",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-terser": "^1.0.1",
"rollup-plugin-typescript2": "^0.15.1"
"bestzip": "^2.2.1",
"rollup": "^2.79.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.33.0"
}
}
4 changes: 2 additions & 2 deletions chrome/rollup.config.js
Expand Up @@ -11,12 +11,12 @@ export default {
plugins: [
commonjs(),
typescript({
rollupCommonJSResolveHack: true,
include: ['**/*.ts', '../src/**/*.ts'],
exclude: ['**/*.test.ts'],
tsconfigOverride: {
types: ["chrome"],
compilerOptions: {
"lib": ["es2015", "DOM"],
"lib": ["ESNext", "DOM"],
inlineSources: false
}
}
Expand Down
4 changes: 4 additions & 0 deletions chrome/settings.html
@@ -0,0 +1,4 @@
<script>
document.location = "index.html#settings";
</script>

1 change: 0 additions & 1 deletion chrome/window.html

This file was deleted.