Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
committed Dec 16, 2022
0 parents commit b270b51
Show file tree
Hide file tree
Showing 19 changed files with 290 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Files and directories created by pub.
.dart_tool/
.packages

# Conventional directory for build outputs.
build/

# Omit committing pubspec.lock for library packages; see
# https://dart.dev/guides/libraries/private-files#pubspeclock.
pubspec.lock

flutter_web/
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.0.0

- Initial version.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Azka Full Snack Developer:)

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.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Webify

Webify adalah framework web menggunakan bahasa dart dengan feature class dan syntax mirip flutter


### Quickstart

```dart
// ignore_for_file: non_constant_identifier_names
import 'package:webify/webify.dart';
void main(List<String> arguments) {
runApp(
port: 8080,
bindIp: "0.0.0.0",
app: MyApp(),
);
}
String MyApp() {
return Container(height: 512, width: 512, child: Center(child: Text("Azka dev Webify framework")));
}
```
30 changes: 30 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.

include: package:lints/recommended.yaml

# Uncomment the following section to specify additional rules.

# linter:
# rules:
# - camel_case_types

# analyzer:
# exclude:
# - path/to/excluded/files/**

# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints

# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options
22 changes: 22 additions & 0 deletions bin/webify.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// import 'alfre';
import 'dart:io';

import "package:alfred/alfred.dart";
import 'package:webify/webify.dart';

void main(List<String> args) async {
Alfred app = Alfred(logLevel: LogType.error);
app.all("/", (req, res) {
res.headers.contentType = ContentType.html;
return """
<html>
<body>
${Container(height: 512, width: 512, child: Text("Azka ya ini"))}
</body>
</html>
""";
});
await app.listen();

print(app.server!.address.address);
}
6 changes: 6 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Files and directories created by pub.
.dart_tool/
.packages

# Conventional directory for build output.
build/
3 changes: 3 additions & 0 deletions example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.0.0

- Initial version.
2 changes: 2 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
A sample command-line application with an entrypoint in `bin/`, library code
in `lib/`, and example unit test in `test/`.
30 changes: 30 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.

include: package:lints/recommended.yaml

# Uncomment the following section to specify additional rules.

# linter:
# rules:
# - camel_case_types

# analyzer:
# exclude:
# - path/to/excluded/files/**

# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints

# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options
14 changes: 14 additions & 0 deletions example/bin/example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// ignore_for_file: non_constant_identifier_names

import 'package:webify/webify.dart';

void main(List<String> arguments) {
runApp(
port: 8080,
bindIp: "0.0.0.0",
app: MyApp(),
);
}
String MyApp() {
return Container(height: 512, width: 512, child: Center(child: Text("Azka dev Webify framework")));
}
3 changes: 3 additions & 0 deletions example/lib/example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int calculate() {
return 6 * 7;
}
18 changes: 18 additions & 0 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: example
description: A sample command-line application.
version: 1.0.0
# homepage: https://www.example.com
publish_to: none
environment:
sdk: '>=2.18.5 <3.0.0'

dependencies:
webify:
path: ../
# path: ^1.8.0

dev_dependencies:
lints: ^2.0.0
test: ^1.16.0


8 changes: 8 additions & 0 deletions example/test/example_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'package:example/example.dart';
import 'package:test/test.dart';

void main() {
test('calculate', () {
expect(calculate(), 42);
});
}
6 changes: 6 additions & 0 deletions lib/src/webify_base.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// TODO: Put public facing types in this file.

/// Checks if you are awesome. Spoiler: you are.
class Awesome {
bool get isAwesome => true;
}
36 changes: 36 additions & 0 deletions lib/webify.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/// Support for doing something awesome.
///
/// More dartdocs go here.
library webify;

// import 'alfre';
import 'dart:io';

import "package:alfred/alfred.dart";
import 'package:webify/webify.dart';

export 'src/webify_base.dart';

// TODO: Export any libraries intended for clients of this package.
part "widget/container.dart";

void runApp({
int port = 3000,
dynamic bindIp = '0.0.0.0',
dynamic app,
}) async {
Alfred alfred = Alfred(logLevel: LogType.error);
alfred.all("/", (req, res) {
res.headers.contentType = ContentType.html;
return """
<html>
<body>
${app}
</body>
</html>
""";
});
await alfred.listen(port, bindIp);

print(alfred.server!.address.address);
}
23 changes: 23 additions & 0 deletions lib/widget/container.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
part of webify;

String Container({double height = 0, double width = 0, dynamic child}) {
return """
<div style="height:${height}px; width:${width}px; background: #666;">
${child}
</div>
""";
}

String Text(String text) {
return "${text}";
}


String Center({
dynamic child
}){
return """
<center>${child}</center>
""";
}
16 changes: 16 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: webify
description: A starting point for Dart libraries or applications.
version: 1.0.0
# homepage: https://www.example.com

environment:
sdk: '>=2.18.5 <3.0.0'

# dependencies:
# path: ^1.8.0

dev_dependencies:
lints: ^2.0.0
test: ^1.16.0
dependencies:
alfred: ^1.0.0+1
16 changes: 16 additions & 0 deletions test/webify_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:webify/webify.dart';
import 'package:test/test.dart';

void main() {
group('A group of tests', () {
final awesome = Awesome();

setUp(() {
// Additional setup goes here.
});

test('First Test', () {
expect(awesome.isAwesome, isTrue);
});
});
}

0 comments on commit b270b51

Please sign in to comment.