-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
312e3fd
commit b1694de
Showing
20 changed files
with
6,310 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
compile-all: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup Java version | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'liberica' | ||
java-version: '17' | ||
- name: Check code format | ||
uses: jrouly/scalafmt-native-action@v1 | ||
with: | ||
version: "3.8.1" | ||
arguments: "-c .scalafmt.conf --test example urlopt4s" | ||
- uses: jodersky/setup-mill@v0.3.0 | ||
with: | ||
mill-version: 0.11.7 | ||
- name: Compile | ||
run: mill '__.compile' | ||
- name: Test | ||
run: mill '__.test' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
# scala output | ||
# scala | ||
out/ | ||
.bsp/ | ||
.metals/ | ||
.bloop/ | ||
|
||
# idea stuff | ||
# ide | ||
.idea/ | ||
|
||
# js | ||
node_modules/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Allows .md wrapping | ||
proseWrap: always | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
version = 3.8.1 | ||
|
||
maxColumn = 80 | ||
|
||
runner.dialect = scala213source3 | ||
preset = default | ||
|
||
indent.main = 2 | ||
indent.defnSite = 2 | ||
indent.caseSite = 2 | ||
indent.extendSite = 2 | ||
indent.withSiteRelativeToExtends = 2 | ||
indent.extraBeforeOpenParenDefnSite = 2 | ||
|
||
indentOperator.exemptScope = all | ||
|
||
align.preset = none | ||
|
||
newlines.source = unfold | ||
newlines.topLevelStatementBlankLines = [ | ||
{ | ||
blanks = 1 | ||
} | ||
] | ||
newlines.beforeTemplateBodyIfBreakInParentCtors = true | ||
newlines.beforeMultiline = fold | ||
newlines.beforeCurlyLambdaParams = multilineWithCaseOnly | ||
newlines.selectChains = unfold | ||
newlines.afterCurlyLambdaParams = squash | ||
newlines.implicitParamListModifierForce = [after] | ||
newlines.avoidForSimpleOverflow = [punct] | ||
newlines.avoidInResultType = true | ||
newlines.sometimesBeforeColonInMethodReturnType = false | ||
newlines.inInterpolation = oneline | ||
|
||
danglingParentheses.tupleSite = true | ||
|
||
runner.optimizer.forceConfigStyleMinSpan = 50 | ||
runner.optimizer.forceConfigStyleMinArgCount = 1 | ||
|
||
rewrite.rules = [ | ||
AvoidInfix, | ||
RedundantBraces, | ||
RedundantParens, | ||
SortModifiers, | ||
PreferCurlyFors, | ||
Imports | ||
] | ||
rewrite.redundantBraces.methodBodies = true | ||
rewrite.redundantBraces.includeUnitMethods = false | ||
rewrite.redundantBraces.ifElseExpressions = true | ||
rewrite.redundantBraces.stringInterpolation = true | ||
rewrite.imports.expand = true | ||
rewrite.imports.sort = scalastyle | ||
|
||
docstrings.style = Asterisk | ||
docstrings.removeEmpty = true | ||
docstrings.oneline = unfold | ||
docstrings.blankFirstLine = true | ||
docstrings.forceBlankLineBefore = true | ||
|
||
xmlLiterals.assumeFormatted = true | ||
|
||
rewriteTokens = { | ||
"⇒": "=>" | ||
"→": "->" | ||
"←": "<-" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Daniil Sivak | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This small library allows you to remove ad/tracking query params from a given URL. Initially it soundssdaasd adas das das das das dasdasd asd a | ||
|
||
``` | ||
mill --import ivy:com.lihaoyi::mill-contrib-bloop: mill.contrib.bloop.Bloop/install | ||
``` | ||
|
||
asdasd asda sda sdas das das das das da sdas das das das da asdasd as das dasd as das d asd as das d asd asdasd as das dasd as das d asd as das d asd | ||
asdasd as das dasd as das d asd as das d asd | ||
asda sd | ||
|
||
1. hhaha | ||
1. eeeee | ||
1. weqweqw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,114 @@ | ||
import mill._ | ||
import mill.scalalib._ | ||
import mill.scalalib.publish._ | ||
|
||
object urlopt4s extends ScalaModule { | ||
object Version { | ||
val scala212 = "2.12.18" | ||
val scala213 = "2.13.13" | ||
val scalaCross = Seq(scala212, scala213) | ||
|
||
def scalaVersion = "3.4.1" | ||
val cats = "2.10.0" | ||
val catsEffect = "3.5.1" | ||
|
||
val graalvm = "23.1.1" | ||
|
||
val scalaTest = "3.2.16" | ||
val scalaTestEffects = "1.5.0" | ||
|
||
val pprint = "0.7.0" | ||
} | ||
|
||
object Library { | ||
val catsCore = ivy"org.typelevel::cats-core::${Version.cats}" | ||
val catsEffectStd = ivy"org.typelevel::cats-effect-std::${Version.catsEffect}" | ||
val catsEffect = ivy"org.typelevel::cats-effect::${Version.catsEffect}" | ||
|
||
// graalvm | ||
val graalvmPolyglot = ivy"org.graalvm.polyglot:polyglot:${Version.graalvm}" | ||
val graalvmJs = ivy"org.graalvm.polyglot:js-community:${Version.graalvm}" | ||
|
||
// tests | ||
val weaverCats = ivy"com.disneystreaming::weaver-cats::0.8.4" | ||
val testkitScalaTest = ivy"io.7mind.izumi::distage-testkit-scalatest::1.2.8" | ||
val scalaTest = ivy"org.scalatest::scalatest::${Version.scalaTest}" | ||
val scalaTestEffects = | ||
ivy"org.typelevel::cats-effect-testing-scalatest::${Version.scalaTestEffects}" | ||
|
||
// examples | ||
val pprint = ivy"com.lihaoyi::pprint:${Version.pprint}" | ||
} | ||
|
||
trait BaseModule extends CrossScalaModule { | ||
|
||
override def scalacOptions = Seq( | ||
"-unchecked", | ||
"-deprecation", | ||
"-language:_", | ||
"-encoding", | ||
"UTF-8", | ||
"-feature", | ||
"-unchecked", | ||
"-Xlint:_", | ||
"-Wconf:cat=lint-byname-implicit:s", | ||
"-Ywarn-dead-code" | ||
) | ||
|
||
} | ||
|
||
object urlopt4s extends Cross[UrlOpt4sModule](Version.scalaCross) | ||
|
||
trait UrlOpt4sModule extends BaseModule with PublishModule { | ||
|
||
override def publishVersion: T[String] = "0.1.0" | ||
|
||
override def pomSettings = PomSettings( | ||
description = "Allows you to remove ad/tracking query params from a given URL", | ||
organization = "me.seroperson", | ||
url = "https://github.com/seroperson/urlopt4s", | ||
licenses = Seq(License.Common.MIT), | ||
versionControl = VersionControl.github("seroperson", "urlopt4s"), | ||
developers = Seq( | ||
Developer( | ||
"seroperson", | ||
"Daniil Sivak", | ||
"https://seroperson.me/" | ||
) | ||
) | ||
) | ||
|
||
override def ivyDeps = T { | ||
super.ivyDeps() ++ | ||
Agg( | ||
Library.catsCore, | ||
Library.catsEffectStd, | ||
Library.graalvmPolyglot, | ||
Library.graalvmJs | ||
) | ||
} | ||
|
||
object test extends ScalaTests with TestModule.ScalaTest { | ||
|
||
override def ivyDeps = T { | ||
super.ivyDeps() ++ Agg(Library.weaverCats, Library.catsEffect) | ||
} | ||
|
||
override def testFramework = "weaver.framework.CatsEffect" | ||
|
||
object test extends ScalaTests with TestModule.Munit { | ||
} | ||
|
||
} | ||
|
||
object example extends Module { | ||
|
||
object cats extends Cross[CatsModule](Version.scalaCross) | ||
|
||
trait CatsModule extends BaseModule { | ||
|
||
override def ivyDeps = T { | ||
super.ivyDeps() ++ Agg(Library.pprint, Library.catsEffect) | ||
} | ||
|
||
override def moduleDeps = super.moduleDeps ++ Seq(urlopt4s()) | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
example/cats/src/me/seroperson/urlopt4s/ExampleCatsApp.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package me.seroperson.urlopt4s | ||
|
||
import cats.effect.ExitCode | ||
import cats.effect.IO | ||
import cats.effect.IOApp | ||
import cats.implicits._ | ||
|
||
object ExampleCatsApp extends IOApp { | ||
|
||
override def run(args: List[String]): IO[ExitCode] = UrlOptimizer[IO]() | ||
.use { urlOptimizer => | ||
for { | ||
givenUrl <- args.headOption match { | ||
case Some(url) => IO.pure(url) | ||
case None => | ||
IO.raiseError(new IllegalArgumentException("No args supplied")) | ||
} | ||
result <- urlOptimizer.removeAdQueryParams(givenUrl) | ||
_ <- IO.println(result) | ||
} yield ExitCode.Success | ||
} | ||
|
||
} |
Oops, something went wrong.