-
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
Showing
14 changed files
with
176 additions
and
20 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
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
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
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
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
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,7 @@ | ||
# https://dart.dev/guides/libraries/private-files | ||
# Created by `dart pub` | ||
.dart_tool/ | ||
|
||
# Avoid committing pubspec.lock for library packages; see | ||
# https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
pubspec.lock |
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,14 @@ | ||
# tekartik_web_publish | ||
|
||
Web publish helper. | ||
|
||
## Setup | ||
|
||
```yaml | ||
dependencies: | ||
tekartik_web_publish: | ||
git: | ||
url: https://github.com/tekartik/app_build.dart | ||
ref: dart3a | ||
path: packages/web_publish | ||
``` |
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,6 @@ | ||
# tekartik analysis_options extension | ||
include: package:tekartik_lints/strict.yaml | ||
|
||
linter: | ||
rules: | ||
- public_member_api_docs |
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 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:path/path.dart'; | ||
import 'package:tekartik_deploy/fs_deploy.dart'; | ||
|
||
String _fixFolder(String path, String folder) { | ||
if (isAbsolute(folder)) { | ||
return normalize(folder); | ||
} | ||
return normalize(absolute(join(path, folder))); | ||
} | ||
|
||
/// Copy to deploy using deploy.yaml | ||
Future<void> webAppBuildToDeploy(String path, | ||
{ | ||
/// deploy dir from path | ||
required String deployDir, | ||
|
||
/// Build folder from path | ||
required String buildDir}) async { | ||
buildDir = _fixFolder(path, buildDir); | ||
deployDir = _fixFolder(path, deployDir); | ||
|
||
var deployFile = File(join(buildDir, 'deploy.yaml')); | ||
// ignore: avoid_slow_async_io | ||
if (!await deployFile.exists()) { | ||
throw StateError('Missing deploy.yaml file ($deployFile)'); | ||
} | ||
await fsDeploy( | ||
options: FsDeployOptions()..noSymLink = true, | ||
yaml: deployFile, | ||
src: Directory(buildDir), | ||
dst: Directory(deployDir)); | ||
} |
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,19 @@ | ||
import 'package:path/path.dart'; | ||
|
||
/// Web deploy options. | ||
abstract class WebAppDeployOptions {} | ||
|
||
/// Surge web app deployment. | ||
final surgeWebAppDeployDirDefault = join('deploy', 'surge'); | ||
|
||
/// Firebase web app deployment. | ||
final firebaseWebAppDeployDirDefault = join('deploy', 'firebase'); | ||
|
||
/// Surge web app deployment. | ||
class SurgeWebAppDeployOptions implements WebAppDeployOptions { | ||
/// Domain (domain.surge.sh). | ||
final String domain; | ||
|
||
/// Constructor. | ||
SurgeWebAppDeployOptions({required this.domain}); | ||
} |
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,22 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:process_run/shell.dart'; | ||
import 'package:tekartik_web_publish/src/deploy_common.dart'; | ||
|
||
/// Surge deployer | ||
class SurgeWebAppDeployer { | ||
/// The deploy path | ||
final String path; | ||
|
||
/// The deploy options. | ||
final SurgeWebAppDeployOptions options; | ||
|
||
/// Constructor. | ||
SurgeWebAppDeployer({required this.path, required this.options}); | ||
|
||
/// Deploy. | ||
Future<void> deploy() async { | ||
await Shell().cd(path).run('surge . --domain ${options.domain}'); | ||
stdout.writeln('Deployed to https://${options.domain}'); | ||
} | ||
} |
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,6 @@ | ||
export 'src/deploy_common.dart' | ||
show | ||
SurgeWebAppDeployOptions, | ||
surgeWebAppDeployDirDefault, | ||
firebaseWebAppDeployDirDefault; | ||
export 'src/surge_deploy.dart' show SurgeWebAppDeployer; |
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,2 @@ | ||
export 'src/build_to_deploy.dart' show webAppBuildToDeploy; | ||
export 'src/deploy_common.dart' show WebAppDeployOptions; |
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,26 @@ | ||
name: tekartik_web_publish | ||
description: Web publishing helpers | ||
version: 1.0.0 | ||
publish_to: none | ||
|
||
environment: | ||
sdk: ^3.4.0 | ||
|
||
# Add regular dependencies here. | ||
dependencies: | ||
path: '>=1.8.0' | ||
process_run: | ||
tekartik_deploy: | ||
git: | ||
url: https://github.com/tekartik/deploy.dart | ||
ref: dart3a | ||
version: '>=0.6.2' | ||
dev_dependencies: | ||
lints: '>=3.0.0' | ||
tekartik_lints: | ||
git: | ||
url: https://github.com/tekartik/common.dart | ||
ref: dart3a | ||
path: packages/lints | ||
|
||
test: '>=1.24.0' |