1. 27 Dec, 2020 1 commit
    • silverwind's avatar
      Update JS dependencies and webpack (#14118) · 50a2dd52
      silverwind authored
      
      * Update JS dependencies
      
      - Update all JS dependencies
      - Adapt webpack config for version 5
      - Update to Less 4.0, adapting usage of removed mixin syntax
      - Enable new ESLint rules and fix discovered issues
      
      * update license-webpack-plugin to fix missing licenses
      
      * update license-webpack-plugin once more to get webpack into the license output
      
      * switch to license-checker-webpack-plugin again for performance
      
      * update deps again
      Co-authored-by: default avatarLauris BH <lauris@nix.lv>
      50a2dd52
  2. 29 Nov, 2020 1 commit
    • silverwind's avatar
      Update JS dependencies and misc tweaks (#13741) · e81edc02
      silverwind authored
      
      * Update JS dependencies and misc tweaks
      
      - Update all JS dependencies minus webpack
      - Adapt CodeMirrors styling to new CSS parent introduced by EasyMDE
      - Set eslint parser to latest and add new eslint 7.14 rule
      - Speed up npm install by disabling audit and fund checks
      - Move fomantic-ui to optional dependencies to further speed up npm
      - Enable syntax highlighting on GH for .eslintrc and .stylelintrc
      - Makefile cleanups
      
      * disable audit in npmrc
      
      * add missing dash
      Co-authored-by: default avatartechknowlogick <techknowlogick@gitea.io>
      e81edc02
  3. 27 Nov, 2020 1 commit
    • silverwind's avatar
      Enable linting of JS inside templates (#13708) · 7ab36335
      silverwind authored
      
      Indentation-related rules are disabled because indent templates with
      tabs but our lint rules expect spaces.
      
      Also had to exclude a few files where using template variables in the JS
      is causing syntax errors for the JS parser. I don't think there's a way
      to solve this otherwise.
      Co-authored-by: default avatarLauris BH <lauris@nix.lv>
      7ab36335
  4. 07 Nov, 2020 1 commit
    • silverwind's avatar
      Add Vue linting (#13447) · 7c47e240
      silverwind authored
      
      * Add Vue linting
      
      Turns out the .vue files were not linted at all, so I added that as well
      as re-indented the file to 2-space and fixed all reasonable issues that
      cam up except one case of a unintended side effect for which I have no
      idea how to fix it, so the rule was disabled.
      
      * misc tweaks
      
      * update lockfile
      
      * use overrides to include .vue files
      
      * treat warnings as errors on lint-frontend
      
      * also treat stylelint warnings as errors
      
      * use equal sign syntax
      Co-authored-by: default avatarLauris BH <lauris@nix.lv>
      Co-authored-by: default avatarLunny Xiao <xiaolunwen@gmail.com>
      7c47e240
  5. 21 Oct, 2020 1 commit
  6. 03 Sep, 2020 1 commit
    • silverwind's avatar
      Update JS dependencies (#12702) · 844d9b46
      silverwind authored
      - Added some new octicons
      - Add explicit less dependency as required by upstream
      - Enable es2021 environment in eslint
      844d9b46
  7. 29 Aug, 2020 1 commit
    • silverwind's avatar
      Update eslint config (#12609) · 7187fdbb
      silverwind authored
      - Remove unneeded "Tribute" global
      - Separate Node and Browser environments
      - Update environment to es2020 to enable new globals like "BigInt"
      7187fdbb
  8. 27 Jul, 2020 1 commit
  9. 26 Jul, 2020 1 commit
    • silverwind's avatar
      Rework 'make generate-images' (#12316) · 7cf23399
      silverwind authored
      * Rework 'make generate-images'
      
      - Remove external dependencies and replace it with a node script that
        does does the same.
      - Move detail removal from gitea-sm.png to favicon.png
      - Remove favicon.ico and its generation, it is unused and we already serve
        favicon.png in its place.
      
      Fixes: https://github.com/go-gitea/gitea/issues/12314
      
      * use proper centering value for preserveAspectRatio
      
      * fix lint
      
      * use fabric
      
      * better linting fix
      
      * fix typo
      
      * mention detail-remove class in docs
      7cf23399
  10. 08 Jul, 2020 1 commit
  11. 05 Jul, 2020 1 commit
  12. 03 Jul, 2020 1 commit
  13. 09 Jun, 2020 1 commit
    • silverwind's avatar
      rework eslint config (#11615) · 19db3f4f
      silverwind authored
      
      * rework eslint config
      
      - use explicit config that only enables rules
      - upgrade eslint to 7.1.0
      - add new plugins with selected rules enabled
      - fix discovered issues, remove global wipPrefixes
      
      * remove if
      
      * undo template change
      
      * add disabled rules as well for easier config updating
      
      * add missing disabled rule
      
      * update eslint and plugins
      
      * fix new violation
      
      * remove deprecated rules
      Co-authored-by: default avatarLauris BH <lauris@nix.lv>
      19db3f4f
  14. 24 May, 2020 1 commit
    • silverwind's avatar
      Fix serviceworker output file and misc improvements (#11562) · 3761bdb6
      silverwind authored
      * Fix serviceworker output file and misc improvements
      
      - Fix output file location for production build
      - Cache more asset types: fonts and worker variants
      - Parallelize a few tasks during initalization
      - Only invalidate caches starting with our prefix
      - Remove public/serviceworker.js before building
      - Remove font preloads, they cause strange cors issues
      - Misc eslint config adjustments
      
      * remove webpack output files on watch-frontend
      3761bdb6
  15. 22 May, 2020 1 commit
  16. 14 May, 2020 1 commit
    • silverwind's avatar
      Switch code editor to Monaco (#11366) · 9249c810
      silverwind authored
      
      * Switch code editor to Monaco
      
      This switches out CodeMirror for Monaco which is based on the same code
      base as VS code and should work pretty similar to it.
      
      It does add a few async chunks, totalling around 10MB to our build. It
      currently supports around 65 languages and in the default configuration,
      each language would emit one ugly [number].js chunk, so I opted to
      combine them all into a single file for now.
      
      CodeMirror is still being used under the hood by SimpleMDE so it can not
      be removed yet.
      
      * inline editorconfig, fix diff, use for markdown, remove more dead code
      
      * refactors, remove jquery usage
      
      * use tab_width
      
      * fix intellisense
      
      * rename function for clarity
      
      * misc tweaks, enable webpack progress display
      
      * only use --progress on dev build
      
      * remove useless borders in arc-green
      
      * fix typo
      
      * remove obsolete comment
      
      * small refactor
      
      * fix file creation and various refactors
      
      * unset useTabStops too when no editorconfig
      
      * small refactor
      
      * disable webpack's [big] warnings
      
      * remove useless await
      
      * fix dark theme check
      
      * rename chunk to 'monaco'
      
      * add to .gitignore and delete webpack dest before build
      
      * increase editor height
      
      * support more editorconfig properties
      
      * remove empty element filter
      
      * rename
      Co-authored-by: default avatarJohn Olheiser <john.olheiser@gmail.com>
      9249c810
  17. 28 Apr, 2020 1 commit
    • mrsdizzie's avatar
      Support unicode emojis and remove emojify.js (#11032) · 4563eb87
      mrsdizzie authored
      * Support unicode emojis and remove emojify.js
      
      This PR replaces all use of emojify.js and adds unicode emoji support to various areas of gitea.
      
      This works in a few ways:
      
      First it adds emoji parsing support into gitea itself. This allows us to
      
       * Render emojis from valid alias (😄)
       * Detect unicode emojis and let us put them in their own class with proper aria-labels and styling
       * Easily allow for custom "emoji"
       * Support all emoji rendering and features without javascript
       * Uses plain unicode and lets the system render in appropriate emoji font
       * Doesn't leave us relying on external sources for updates/fixes/features
      
      That same list of emoji is also used to create a json file which replaces the part of emojify.js that populates the emoji search tribute. This file is about 35KB with GZIP turned on and I've set it to load after the page renders to not hinder page load time (and this removes loading emojify.js also)
      
      For custom "emoji" it uses a pretty simple scheme of just looking for /emojis/img/name.png where name is something a user has put in the "allowed reactions" setting we already have. The gitea reaction that was previously hard coded into a forked copy of emojify.js is included and works as a custom reaction under this method.
      
      The emoji data sourced here is from https://github.com/github/gemoji which is the gem library Github uses for their emoji rendering (and a data source for other sites). So we should be able to easily render any emoji and :alias: that Github can, removing any errors from migrated content. They also update it as well, so we can sync when there are new unicode emoji lists released.
      
      I've included a slimmed down and slightly modified forked copy of https://github.com/knq/emoji to make up our own emoji module. The code is pretty straight forward and again allows us to have a lot of flexibility in what happens.
      
      I had seen a few comments about performance in some of the other threads if we render this ourselves, but there doesn't seem to be any issue here. In a test it can parse, convert, and render 1,000 emojis inside of a large markdown table in about 100ms on my laptop (which is many more emojis than will ever be in any normal issue). This also prevents any flickering and other weirdness from using javascript to render some things while using go for others.
      
      Not included here are image fall back URLS. I don't really think they are necessary for anything new being written in 2020. However, managing the emoji ourselves would allow us to add these as a feature later on if it seems necessary.
      
      Fixes: https://github.com/go-gitea/gitea/issues/9182
      Fixes: https://github.com/go-gitea/gitea/issues/8974
      Fixes: https://github.com/go-gitea/gitea/issues/8953
      Fixes: https://github.com/go-gitea/gitea/issues/6628
      Fixes: https://github.com/go-gitea/gitea/issues/5130
      
      
      
      * add new shared function emojiHTML
      
      * don't increase emoji size in issue title
      
      * Update templates/repo/issue/view_content/add_reaction.tmpl
      Co-Authored-By: default avatar6543 <6543@obermui.de>
      
      * Support for emoji rendering in various templates
      
      * Render code and review comments as they should be
      
      * Better way to handle mail subjects
      
      * insert unicode from tribute selection
      
      * Add template helper for plain text when needed
      
      * Use existing replace function I forgot about
      
      * Don't include emoji greater than Unicode Version 12
      
      Only include emoji and aliases in JSON
      
      * Update build/generate-emoji.go
      
      * Tweak regex slightly to really match everything including random invisible characters. Run tests for every emoji we have
      
      * final updates
      
      * code review
      
      * code review
      
      * hard code gitea custom emoji to match previous behavior
      
      * Update .eslintrc
      Co-Authored-By: default avatarsilverwind <me@silverwind.io>
      
      * disable preempt
      Co-authored-by: default avatarsilverwind <me@silverwind.io>
      Co-authored-by: default avatar6543 <6543@obermui.de>
      Co-authored-by: default avatarLauris BH <lauris@nix.lv>
      Co-authored-by: default avatarguillep2k <18600385+guillep2k@users.noreply.github.com>
      4563eb87
  18. 24 Apr, 2020 1 commit
  19. 13 Apr, 2020 1 commit
    • silverwind's avatar
      Move syntax highlighting to web worker (#11017) · 27e3cddf
      silverwind authored
      
      This should eliminate page freezes when loading big files/diff.
      `highlightBlock` is needed to preserve existing nodes when highlighting
      and for that, highlight.js needs access to the DOM API so I added a DOM
      implementation to make it work, which adds around 300kB to the output
      file size of the lazy-loaded `highlight.js`.
      Co-authored-by: default avatarLauris BH <lauris@nix.lv>
      27e3cddf
  20. 11 Mar, 2020 1 commit
  21. 09 Mar, 2020 1 commit
  22. 23 Feb, 2020 1 commit
  23. 12 Feb, 2020 1 commit
  24. 07 Feb, 2020 2 commits
  25. 28 Jan, 2020 1 commit
    • silverwind's avatar
      move highlight.js to npm/webpack (#10011) · b9690d7c
      silverwind authored
      
      - introduced window.config to help with js-based lazy-loading
      - adjusted webpack chunk naming to avoid 'vendors~name.js' that webpack
        defaults to for vendor chunks.
      - added theme class to html and prefixed all selectors. this is
        neccesary so that the theme styles win over the lazy-loaded ones.
      Co-authored-by: default avatarzeripath <art27@cantab.net>
      b9690d7c
  26. 21 Nov, 2019 1 commit
  27. 17 Nov, 2019 1 commit
    • silverwind's avatar
      enable lazy-loading of gitgraph.js (#9036) · f8bd90ba
      silverwind authored
      - moved gitgraph.js to web_src and made it importable and es6-compatible
      - created new webpack chunk for gitgraph
      - enabled CSS loader in webpack
      - enabled async/await syntax via regenerator-runtime
      - added script to ensure webpack chunks are loaded correctly
      - disable terser's comment extraction to prevent .LICENCE files
      
      gitgraph.js has many issues:
      
      1. it is incompatible with ES6 because of strict-mode violations
      1. it does not export anything
      1. it's css has weird styles like for `body`
      1. it is not available on npm
      
      I fixed points 1-3 in our version so it's now loadable in webpack. We should eventually consider alternatives.
      f8bd90ba
  28. 14 Nov, 2019 1 commit
    • silverwind's avatar
      modernize js and use babel (#8973) · 3621944c
      silverwind authored
      * modernize js and use babel
      
      - add babel toolchain to transform modern JS to ES5
      - extend eslint config for modern rules
      - fixes linting issues via `eslint --fix` and manual fixes
      
      * run 'make css' to satisfy CI
      
      * code style tweaks and set js indendation to 2 in .editorconfig
      
      * regenerate js
      3621944c
  29. 13 Nov, 2019 1 commit
  30. 16 Jul, 2019 1 commit
  31. 16 May, 2019 1 commit
    • silverwind's avatar
      add make targets for js and css, add js linter (#6952) · d9dcd093
      silverwind authored
      * add make targets for js,css, add javascript linter
      
      - add `make js`, deprecating `make javascripts`
      - add `make css`, deprecating `make generate-stylesheets` and
        `make stylesheets-check`
      - changed the unclean css check to only run on CI
      - add JS linting via eslint with basic configuration and fixed
        discovered issues
      - changed autoprefixer to use official `postcss-cli` avoiding the need
        to loop in the makefile
      - moved browserslist to package.json so other future tools can use it
        too.
      - update documentation for new make targets and added JS section
      
      * fix indentation
      
      * move functions used in html to 'exported' list
      
      * Run lessc binary without having to install anything to node_modules
      
      * use relative paths to node bin scripts, removing npx
      
      * Revert "use relative paths to node bin scripts, removing npx"
      
      This reverts commit 119b725525a8430b32ee7a6e6009b4ece544e39b.
      
      * fix lessc and postcss plugins
      
      * check for node_modules and use actual bin names
      d9dcd093