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

Port to Parcel bundler #1137

Merged
merged 18 commits into from
Oct 3, 2019
Merged

Port to Parcel bundler #1137

merged 18 commits into from
Oct 3, 2019

Commits on Sep 25, 2019

  1. client: move JS, CSS & lang files to assets/ directory

    This directory is not public facing, it contains assets used for building bundles.
    jtojnar committed Sep 25, 2019
    Configuration menu
    Copy the full SHA
    b8a152f View commit details
    Browse the repository at this point in the history

Commits on Sep 26, 2019

  1. Move sources to src/

    It makes the repository slightly cleaner and makes things like linting easier.
    jtojnar committed Sep 26, 2019
    Configuration menu
    Copy the full SHA
    779229c View commit details
    Browse the repository at this point in the history
  2. client: lint all js files

    jtojnar committed Sep 26, 2019
    Configuration menu
    Copy the full SHA
    4ae5480 View commit details
    Browse the repository at this point in the history
  3. build: Simplify npm scripts

    * Do not run `npm install` in assets twice when running `dist` script.
    * Install also PHP dependencies in post-install (re-use the `install-dependencies` target`).
    * Use node executable from NPM via environment variable, instead of relying for it to be on PATH (which is not the case since NPM 4, see https://docs.npmjs.com/cli/run-script).
    * Print filename of the generated archive in `dist` script.
    jtojnar committed Sep 26, 2019
    Configuration menu
    Copy the full SHA
    d6bc4e4 View commit details
    Browse the repository at this point in the history
  4. api: Version separately from selfoss

    Also follow semantic versioning so consumers are better informed about breakage.
    
    https://semver.org/
    jtojnar committed Sep 26, 2019
    Configuration menu
    Copy the full SHA
    74ee8f3 View commit details
    Browse the repository at this point in the history
  5. api: Add /api/about endpoint

    This will allow clients to obtain version of Selfoss and API, as well as the the instance configuration. The configuration options are not part of the public API yet, though.
    
    I put it under /api prefix, as we might move the rest of the API there in the future.
    
    Increases API version to 2.20.0 – new feature
    jtojnar committed Sep 26, 2019
    Configuration menu
    Copy the full SHA
    9e93e1f View commit details
    Browse the repository at this point in the history
  6. client: Load configuration using API

    We will try to load fresh configuration from the server each time selfoss is opened and cache it in the localStorage indefinitely.
    
    If configuration cannot be feched (e.g. in offline mode), the value from localStorage will be used.
    jtojnar committed Sep 26, 2019
    Configuration menu
    Copy the full SHA
    16f1cd6 View commit details
    Browse the repository at this point in the history

Commits on Sep 27, 2019

  1. Configuration menu
    Copy the full SHA
    baf7dac View commit details
    Browse the repository at this point in the history
  2. client: Move login form to frontend

    The use of template strings make this commit unusable in older browsers until we start transpiling with Parcel.
    It is not so bad: https://caniuse.com/#feat=template-literals
    jtojnar committed Sep 27, 2019
    Configuration menu
    Copy the full SHA
    167c4b7 View commit details
    Browse the repository at this point in the history
  3. client: Move mainui to client

    jtojnar committed Sep 27, 2019
    Configuration menu
    Copy the full SHA
    5f8a7cf View commit details
    Browse the repository at this point in the history
  4. Drop Windows 8 tiles support

    jtojnar committed Sep 27, 2019
    Configuration menu
    Copy the full SHA
    4ea236f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0428e0f View commit details
    Browse the repository at this point in the history
  6. templates: Make more metadata set in the client

    So that we can make the templates completely static.
    
    Also fix some invalid HTML and meta parity.
    jtojnar committed Sep 27, 2019
    Configuration menu
    Copy the full SHA
    de6558e View commit details
    Browse the repository at this point in the history
  7. Add support for bcrypt hashes

    These use their own salt so it will make them easier to generate on the client. We still support the old password scheme with separate salt so users did not have to rehash their passwords.
    jtojnar committed Sep 27, 2019
    Configuration menu
    Copy the full SHA
    addf3f4 View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2019

  1. client: Use translation helper

    Just like with the `selfoss.config` replacing the `data` attribute lookup, we should use the existing `selfoss.ui._` function. This will make changing the translation method easier in the future.
    jtojnar committed Oct 3, 2019
    Configuration menu
    Copy the full SHA
    53abdc6 View commit details
    Browse the repository at this point in the history
  2. Stop using <base>

    Setting `<base>` in the HTML files was not actually necessary, since we do not use subdirectories in our front-end routes. When we start using history API, it will not be necessary either, as long as we know the routes. The base URI is therefore only necessary for cookies and RSS feed.
    jtojnar committed Oct 3, 2019
    Configuration menu
    Copy the full SHA
    f4202aa View commit details
    Browse the repository at this point in the history
  3. Port to Parcel bundler

    Using asset bundler will allow us to switch to modern JavaScript, build user interface client-side more easily, and develop iteratively thanks to hot module replacement.
    
    We chose Parcel over Webpack for simplicity of set up.
    
    With this, selfoss no longer supports run-time minification of assets. Instead, developer will need to run `npm run build` to bundle all the dependencies and our files and copy them to the `public/` directory. This means the directory is no longer needed to be writeable at run time (useful for read only locations). Alternately, developer can run `npm run dev` command, which will start a program that will watch selfoss files, rebuild them in the background when changed, and then, refresh the opened page. For common users, there are prebuilt packages available, or they can use user.{css,js} for customization, as before.
    The routes `GET /` (without AJAX), `GET /password` and `GET /opml` were turned into primitive servers of static HTML files and all the magic is happening client-side. OPML is uploaded completely using XHR and even the password hash is generated client-side.
    
    We started using some EcmaScript 6 features like imports, which Parcel will automatically resolve.
    
    Languages are imported statically as well, to avoid having to copy them using `parcel-plugin-static-files-copy`. Unfortunately, it requires us to declare them explicitly for Parcel to be able to resolve them.
    
    We are using `parcel-plugin-sw-cache`, which uses `workbox` to generate ServiceWorker boilerplate. We do not use the Workbox library, though, as it is not possible to both load it locally (not from CDN) and customize the service worker – we just rely on it to get the list of files into the worker.
    jtojnar committed Oct 3, 2019
    Configuration menu
    Copy the full SHA
    cfe57ee View commit details
    Browse the repository at this point in the history
  4. client: Make user.{css,js} work off-line

    Since these are supposed to be editable by user any time and we do not want to require users to install development environment, we will need fetch these files manually and handle cache invalidation ourselves. As a key, we will use their mtimes, which we will pass through the configuration key of `/api/about` endpoint. This is re-fetched whenever selfoss is opened, so we can notice when the files are modified, and we will add them to browser's cache storage. Service worker will ignore those cache keys.
    jtojnar committed Oct 3, 2019
    Configuration menu
    Copy the full SHA
    717fcc8 View commit details
    Browse the repository at this point in the history