Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript CLI and binary packages #308

Merged
merged 15 commits into from
Jan 18, 2020
Merged

Conversation

obilodeau
Copy link
Member

Making progress but doesn't work right now.

Created the PR to get assistance from @Mogztter.

Related to #259.

@obilodeau
Copy link
Member Author

I know there's a ton of crap in there. I'm trying to get it to work and then I'll cleanup.

Right now with --verbose I get:

$ npx asciidoctor-revealjs -v presentation.adoc 
require undefined
backend html5
doctype undefined
standalone true
section-numbers false
failure-level FATAL
quiet false
verbose true
timings false
trace false
base-dir undefined
destination-dir undefined
verbose-mode 2
attributes 
options {"backend":"html5","safe":"unsafe","standalone":true,"failure_level":4,"verbose":2,"timings":false,"trace":false,"mkdirs":true,"attributes":[]}
converting file presentation.adoc

backend is wrong, file is right but doesn't get converted

@obilodeau
Copy link
Member Author

@Mogztter you should read #259 for struggles with pkg. I made the comments at the wrong place.

Last thing I just realized: I don't like the fact that we need both npm/asciidoctor-revealjs and packages/asciidoctor-revealjs/bin/asciidoctor-revealjs that are identical because the former is used as the CLI with npm/npx and the latter is used to build binaries (different dependencies that we don't want to force on users for the former). A solution for that would be awesome!

@obilodeau obilodeau changed the title Javascript CLI Javascript CLI and binary packages Jan 15, 2020
@ggrossetie
Copy link
Member

Last thing I just realized: I don't like the fact that we need both npm/asciidoctor-revealjs and packages/asciidoctor-revealjs/bin/asciidoctor-revealjs that are identical because the former is used as the CLI with npm/npx and the latter is used to build binaries (different dependencies that we don't want to force on users for the former). A solution for that would be awesome!

On further consideration, I'm not sure we need to create an additional project to build the binary.
If we use a relative path to resolve the @asciidoctor/reveal.js dependency then we only need to install @asciidoctor/core.

Since we don't want to add @asciidoctor/core as a direct dependency, I guess we could install it just before we need to run pkg right?

package-bin.sh

npm i @asciidoctor/core
./node_modules/.bin/pkg -t "node12-linux-x64,node12-macos-x64,node12-win-x64" package.json --out-path dist/

@ggrossetie
Copy link
Member

I've created a pull request: obilodeau#1 (to your branch)

obilodeau and others added 2 commits January 16, 2020 23:12
Build the binary at the root
Co-Authored-By: Guillaume Grossetie <g.grossetie@gmail.com>
Copy link
Member Author

@obilodeau obilodeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything works! Awesome and a lot simpler. Only one remaining question.

I'm doing the docs and will update.

package.json Show resolved Hide resolved
README.adoc Show resolved Hide resolved
README.adoc Show resolved Hide resolved
@obilodeau obilodeau marked this pull request as ready for review January 17, 2020 05:23
@obilodeau
Copy link
Member Author

The plan is to squash merge this in a few hours (later tonight EST). Last chance for comments! Unless someone requests to hold on it for a little while.

HACKING.adoc Outdated Show resolved Hide resolved
HACKING.adoc Outdated Show resolved Hide resolved
HACKING.adoc Outdated Show resolved Hide resolved
obilodeau and others added 2 commits January 17, 2020 12:39
Co-Authored-By: Guillaume Grossetie <g.grossetie@gmail.com>
Co-Authored-By: Guillaume Grossetie <g.grossetie@gmail.com>
README.adoc Outdated Show resolved Hide resolved
README.adoc Outdated Show resolved Hide resolved
README.adoc Outdated Show resolved Hide resolved
Copy link
Member

@ggrossetie ggrossetie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
I left a few nitpicks but overall it's really good 👍

obilodeau and others added 2 commits January 17, 2020 22:02
Co-Authored-By: Guillaume Grossetie <g.grossetie@gmail.com>
See review discussion in asciidoctor#308 for more context.

Co-Authored-By: Guillaume Grossetie <g.grossetie@gmail.com>
Copy link
Member

@ggrossetie ggrossetie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@obilodeau
Copy link
Member Author

As a side note, we should probably update the Ruby binary bin/asciidoctor-revealjs to add the project name and version.

I got this to work (code from asciidoctor-pdf) but since I'm squash committing, I'm going to do a separate PR for this.

@obilodeau obilodeau merged commit 2efd36a into asciidoctor:master Jan 18, 2020
@ggrossetie
Copy link
Member

Woot woot awesome work @obilodeau 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants