objd_cli 0.0.1

objD CLI #

The objD CLI is an additional package to handle execution, building and deploying of your project. To activate the global package(will be available anywhere on your system), run this command:

pub global activate objd_cli

This will add the commands to your console. To run a command run:

objd [command] [args]

OR

pub global run objd:[command] [args]

If the objd command is not available, you have to add the pub cache to your system path. Follow this tutorial: https://www.dartlang.org/tools/pub/cmd/pub-global#running-a-script-from-your-path

Commands #

  • help - opens a help menu with all commands
  • new [project_name] - generates a new project from a boilerplate
  • run [project_root] - builds one project
  • serve [directory] [project_root] - watches the directory to change and builds the project on change
  • server inject [jar-file] - injects a server file(use bukkit with plugins to reload automatically) before starting the server(The file is not included in the package due to legal reasons)
  • server start [world_dir] - copies the world into the server directory and starts the server

Build Options #

You can use certain arguments to pass options to the build methods. This argument list can directly be edited in createProject:

createProject(
	Project(...),
	["arg1","arg2", ... ] // arguments as optional List
)

OR (what I recommend) you can just take the program arguments from main:

void main(List<String> args) {
  createProject(
    Project(...),
    args
  );
}

This allows you to use the arguments in the execution command, like:

  • dart index.dart arg1 --min
  • objd run index.dart arg1 --min
  • objd serve . index.dart --min

All Available Arguments:

  • --hotreload: Saves the state of your project and compares just the latest changes.
  • --full: Generates the full project(just for objd serve!).
  • --min: This minifies the file amount by ignoring the mcmeta and tag files
  • --prod: This creates a production build of your project and saves it into another datapack((prod) added). In Production Comments and line breaks are removed and every widget can access the prod value in Context to get notified.
  • --debug: This creates a debug json file in your project root, that lists all properties and other generated files

Hotreload #

The hotreload option is an experimental feature, that just looks at the things you changed since the last build. This can improve performance significantly especially for big projects with many generated mcfunctions.

This feature is enabled by default for objd serve, if you include the args. You can disable it with the -full option.

How it works:

objD saves a representation of your project in the objd.json file of your project. For each new build or reload it checks which parts of the project you changed and just generates the new necessary files to implement your change in the datapack.

0.0.1-beta.2 #

  • added Documentation
  • added hotreload shortcut -r
  • added proper version display with ascii logo

0.0.1-beta.1 #

  • Initial version, created by Stevertus

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate objd_cli

2. Use it

The package has the following executables:


$ objd

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  objd_cli: ^0.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:objd_cli/cli/build.dart';
import 'package:objd_cli/cli/new.dart';
import 'package:objd_cli/cli/run.dart';
import 'package:objd_cli/cli/serve.dart';
import 'package:objd_cli/cli/server.dart';
import 'package:objd_cli/server.dart';
import 'package:objd_cli/utils/copy.dart';
import 'package:objd_cli/utils/run_command.dart';
import 'package:objd_cli/utils/start_server.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
42
Learn more about scoring.

We analyzed this package on Sep 13, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Platform components identified in package: io, isolate.

Health suggestions

Fix bin/objd.dart. (-0.50 points)

Analysis of bin/objd.dart reported 1 hint:

line 49 col 29: DO use curly braces for all flow control structures.

Fix lib/cli/run.dart. (-0.50 points)

Analysis of lib/cli/run.dart reported 1 hint:

line 6 col 7: Use isEmpty instead of length

Format lib/cli/build.dart.

Run dartfmt to format lib/cli/build.dart.

Fix additional 7 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/cli/new.dart (Run dartfmt to format lib/cli/new.dart.)
  • lib/cli/serve.dart (Run dartfmt to format lib/cli/serve.dart.)
  • lib/cli/server.dart (Run dartfmt to format lib/cli/server.dart.)
  • lib/server.dart (Run dartfmt to format lib/server.dart.)
  • lib/utils/copy.dart (Run dartfmt to format lib/utils/copy.dart.)
  • lib/utils/run_command.dart (Run dartfmt to format lib/utils/run_command.dart.)
  • lib/utils/start_server.dart (Run dartfmt to format lib/utils/start_server.dart.)

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and objd_cli.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.4.0 <3.0.0
args ^1.5.2 1.5.2
http ^0.12.0+2 0.12.0+2
watcher ^0.9.7+12 0.9.7+12
Transitive dependencies
async 2.3.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
meta 1.1.7
path 1.6.4
pedantic 1.8.0+1
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6