diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..f5f63a2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,12 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "build and run", + "type": "shell", + "command": "swift build && .build/debug/carton dev" + } + ] +} diff --git a/Package.resolved b/Package.resolved index de3356e..32756b4 100644 --- a/Package.resolved +++ b/Package.resolved @@ -2,12 +2,21 @@ "object": { "pins": [ { - "package": "SKQueue", - "repositoryURL": "https://github.com/daniel-pedersen/SKQueue.git", + "package": "async-http-client", + "repositoryURL": "https://github.com/swift-server/async-http-client.git", "state": { "branch": null, - "revision": "a52c15ea2a8f28fde607155cf75c1abe9ea000a7", - "version": "1.2.0" + "revision": "037b70291941fe43de668066eb6fb802c5e181d2", + "version": "1.1.1" + } + }, + { + "package": "SKQueue", + "repositoryURL": "https://github.com/MaxDesiatov/SKQueue.git", + "state": { + "branch": "master", + "revision": "448a61e772c5beb60ab035b2af140e3165f71b23", + "version": null } }, { @@ -27,6 +36,33 @@ "revision": "e876fb37410e0036b98b5361bb18e6854739572b", "version": "2.16.0" } + }, + { + "package": "swift-nio-extras", + "repositoryURL": "https://github.com/apple/swift-nio-extras.git", + "state": { + "branch": null, + "revision": "e0e76733600a2806b3dc4feae8cfebace858c1a2", + "version": "1.4.1" + } + }, + { + "package": "swift-nio-http2", + "repositoryURL": "https://github.com/apple/swift-nio-http2.git", + "state": { + "branch": null, + "revision": "82eb3fa0974b838358ee46bc6c5381e5ae5de6b9", + "version": "1.11.0" + } + }, + { + "package": "swift-nio-ssl", + "repositoryURL": "https://github.com/apple/swift-nio-ssl.git", + "state": { + "branch": null, + "revision": "ae213938e151964aa691f0e902462fbe06baeeb6", + "version": "2.7.1" + } } ] }, diff --git a/Package.swift b/Package.swift index 057e50c..3252f47 100644 --- a/Package.swift +++ b/Package.swift @@ -7,15 +7,21 @@ let package = Package( name: "carton", dependencies: [ .package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.0.5")), - .package(url: "https://github.com/apple/swift-nio.git", from: "2.16.0"), - .package(url: "https://github.com/daniel-pedersen/SKQueue.git", from: "1.2.0"), + .package(url: "https://github.com/apple/swift-nio-http2.git", from: "1.11.0"), + .package(url: "https://github.com/MaxDesiatov/SKQueue.git", .branch("master")), + .package(url: "https://github.com/swift-server/async-http-client.git", from: "1.1.1"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "carton", - dependencies: [] + dependencies: [ + .product(name: "ArgumentParser", package: "swift-argument-parser"), + .product(name: "NIOHTTP2Server", package: "swift-nio-http2"), + .product(name: "AsyncHTTPClient", package: "async-http-client"), + .product(name: "SKQueue", package: "SKQueue"), + ] ), .testTarget( name: "CartonTests", diff --git a/Sources/carton/Carton.swift b/Sources/carton/Carton.swift new file mode 100644 index 0000000..8898db1 --- /dev/null +++ b/Sources/carton/Carton.swift @@ -0,0 +1,9 @@ +import ArgumentParser + +struct Carton: ParsableCommand { + static var configuration = CommandConfiguration( + abstract: "📦 Watcher, bundler, and test runner for your SwiftWasm apps.", + subcommands: [Dev.self, Test.self, Prod.self], + defaultSubcommand: Dev.self + ) +} diff --git a/Sources/carton/Dev.swift b/Sources/carton/Dev.swift new file mode 100644 index 0000000..82629c7 --- /dev/null +++ b/Sources/carton/Dev.swift @@ -0,0 +1,7 @@ +import ArgumentParser + +struct Dev: ParsableCommand { + static var configuration = CommandConfiguration( + abstract: "Watch the current directory, host the app, rebuild on change." + ) +} diff --git a/Sources/carton/Prod.swift b/Sources/carton/Prod.swift new file mode 100644 index 0000000..8e923eb --- /dev/null +++ b/Sources/carton/Prod.swift @@ -0,0 +1,7 @@ +import ArgumentParser + +struct Prod: ParsableCommand { + static var configuration = CommandConfiguration( + abstract: "Produce a production app bundle ready for deployment." + ) +} diff --git a/Sources/carton/Test.swift b/Sources/carton/Test.swift new file mode 100644 index 0000000..d1f4d01 --- /dev/null +++ b/Sources/carton/Test.swift @@ -0,0 +1,5 @@ +import ArgumentParser + +struct Test: ParsableCommand { + static var configuration = CommandConfiguration(abstract: "Run the tests in a WASI environment.") +} diff --git a/Sources/carton/main.swift b/Sources/carton/main.swift index f7cf60e..2bdc8ad 100644 --- a/Sources/carton/main.swift +++ b/Sources/carton/main.swift @@ -1 +1 @@ -print("Hello, world!") +Carton.main()