Skip to content

Commit 19b25a5

Browse files
authored
💥 Rename asciidoctor.js to asciidoctor (#694)
* Rename asciidoctor.js to asciidoctor - Move everything to packages/core - Create a meta package named asciidoctor - Create a core package named @asciidoctor/core - Add an alias asciidoctor -> @asciidoctor/core * Update the release and publish tasks * Update README * Update the documentation
1 parent 493d1e0 commit 19b25a5

File tree

156 files changed

+10449
-7637
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+10449
-7637
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
/build/
21
/node_modules/
32
npm-debug.log

.travis.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,31 @@ jdk:
1818

1919
install:
2020
- npm ci
21+
- npm ci --prefix packages/core
22+
2123
# keep the npm cache around to speed up installs
2224
cache:
2325
directories:
2426
- "$HOME/.npm"
2527

2628
script:
2729
- npm run lint
28-
- npm run package
29-
- npm run docs
30-
- SKIP_BUILD=1 npm run examples
31-
- npm run test:graalvm # test against GraalVM
30+
- npm run test
31+
- npm run travis --prefix packages/core
3232

3333
jobs:
3434
include:
3535
- stage: release
3636
if: |
3737
repo = 'asciidoctor/asciidoctor.js' AND \
3838
tag IS present
39-
script: ./scripts/package.sh
39+
script:
40+
- ./scripts/package.sh
41+
- ./scripts/publish.sh
4042
deploy:
41-
- provider: npm
42-
skip_cleanup: true
43-
email: ${NPM_USER_EMAIL}
44-
api_key: ${NPM_USER_API_KEY}
45-
on:
46-
tags: true
4743
- provider: releases
4844
api_key: ${GITHUB_TOKEN}
49-
file: bin/asciidoctor.js.dist.*
45+
file: packages/core/bin/asciidoctor.js.dist.*
5046
skip_cleanup: true
5147
file_glob: true
5248
on:

CONTRIBUTING-CODE.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ Start by cloning the source from GitHub:
3535

3636
$ git clone https://github.com/asciidoctor/asciidoctor.js.git
3737

38-
Next, switch to the _asciidoctor.js_ directory and run npm's `install` command:
38+
Next, switch to the _asciidoctor.js/packages/core_ directory and run npm's `install` command:
3939

40-
$ cd asciidoctor.js
41-
npm install
40+
$ cd asciidoctor.js/packages/core
41+
npm i
4242

4343
You're now ready to build Asciidoctor.js.
4444

README.adoc

Lines changed: 25 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -29,79 +29,48 @@ Asciidoctor.js brings AsciiDoc to the JavaScript world!
2929
This project uses {uri-opal}[Opal] to transpile http://asciidoctor.org[Asciidoctor], a modern implementation of AsciiDoc, from Ruby to JavaScript to produce _asciidoctor.js_.
3030
The _asciidoctor.js_ script can be run on any JavaScript platform, including Node.js, GraalVM and, of course, a web browser.
3131

32-
IMPORTANT: Asciidoctor.js does _not_ use Semantic Versioning as the release versions are aligned on _Asciidoctor (Ruby)_. It's *highly recommended* to define the exact version in your `package.json` file (ie. without `^`). Please read the release notes when upgrading to the latest version as breaking changes can be introduced in non major release.
32+
== Quickstart
3333

34-
== Introduction
35-
36-
You can use Asciidoctor.js either for back-end development using {uri-nodejs}[Node.js] or front-end development using a browser.
37-
38-
== Front-end development
39-
40-
.Installing Asciidoctor.js with npm
41-
42-
$ npm install asciidoctor.js --save
43-
44-
Once the package is installed, you can add the following `script` tag to your HTML page:
45-
46-
```html
47-
<script src="node_modules/asciidoctor.js/dist/browser/asciidoctor.js"></script>
48-
```
34+
$ npm i asciidoctor --save
4935

5036
Here is a simple example that converts AsciiDoc to HTML5:
5137

5238
.sample.js
53-
54-
```javascript
55-
var asciidoctor = Asciidoctor(); // <1>
56-
var content = "http://asciidoctor.org[*Asciidoctor*] " +
57-
"running on https://opalrb.com[_Opal_] " +
58-
"brings AsciiDoc to the browser!";
59-
var html = asciidoctor.convert(content); // <2>
60-
console.log(html); // <3>
61-
```
62-
63-
<1> Instantiate the Asciidoctor.js library
64-
<2> Convert AsciiDoc content to HTML5 using Asciidoctor.js
65-
<3> Print the HTML5 output to the console
66-
67-
== Back-end development
68-
69-
.Installing Asciidoctor.js with npm
70-
71-
$ npm install asciidoctor.js --save
72-
73-
Once the package is installed, the first thing to do is to load the `asciidoctor.js` module using `require`, then you're ready to start using the API:
74-
75-
.sample.js
76-
77-
```javascript
78-
var asciidoctor = require('asciidoctor.js')(); // <1>
79-
var content = "http://asciidoctor.org[*Asciidoctor*] " +
80-
"running on https://opalrb.com[_Opal_] " +
81-
"brings AsciiDoc to Node.js!";
82-
var html = asciidoctor.convert(content); // <2>
83-
console.log(html); // <3>
84-
```
85-
39+
[source,javascript]
40+
----
41+
const asciidoctor = require('asciidoctor')() // <1>
42+
const content = 'http://asciidoctor.org[*Asciidoctor*] ' +
43+
'running on https://opalrb.com[_Opal_] ' +
44+
'brings AsciiDoc to Node.js!'
45+
const html = asciidoctor.convert(content) // <2>
46+
console.log(html) // <3>
47+
----
8648
<1> Instantiate the Asciidoctor.js library
8749
<2> Convert AsciiDoc content to HTML5 using Asciidoctor.js
8850
<3> Print the HTML5 output to the console
8951

90-
Save the file as `sample.js` and run it using the `node` command:
52+
Save the file as _sample.js_ and run it using the `node` command:
9153

9254
$ node sample.js
9355

9456
You should see the following output in your terminal:
9557

96-
[.output]
58+
[source.output,html]
59+
----
60+
<div class="paragraph">
61+
<p><a href="http://asciidoctor.org"><strong>Asciidoctor</strong></a> running on <a href="http://opalrb.com"><em>Opal</em></a> brings AsciiDoc to Node.js!</p>
62+
</div>
63+
----
9764

98-
<div class="paragraph">
99-
<p><a href="http://asciidoctor.org"><strong>Asciidoctor</strong></a> running on <a href="http://opalrb.com"><em>Opal</em></a> brings AsciiDoc to Node.js!</p>
100-
</div>
65+
It's also possible to use the following `script` tag directly into your HTML page:
66+
67+
```html
68+
<script src="node_modules/@asciidoctor/core/dist/browser/asciidoctor.js"></script>
69+
```
10170

102-
== Advanced topics
71+
== Learning
10372

104-
If you want to know more about _Asciidoctor.js_, please read the {uri-user-manual}[User Manual].
73+
If you want to learn more about _Asciidoctor.js_, please read the {uri-user-manual}[User Manual].
10574

10675
== Contributing
10776

appveyor.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ environment:
1212
ASCIIDOCTOR_CORE_VERSION: "master"
1313

1414
install:
15-
# Get the latest stable version of Node.js
16-
- ps: Install-Product node $env:nodejs_version
17-
- npm ci
15+
# Get the latest stable version of Node.js
16+
- ps: Install-Product node $env:nodejs_version
17+
- cd packages/core
18+
- npm ci
1819

1920
build_script:
2021
- node tasks/build.js

docs/modules/extend/pages/converter/custom-converter.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ In the example below we will use a custom converter to convert `paragraph` but t
157157

158158
[source,js]
159159
----
160-
const asciidoctor = require('asciidoctor.js')()
160+
const asciidoctor = require('asciidoctor')()
161161
162162
class SemanticParagraphConverter {
163163
constructor () {

docs/modules/extend/pages/extensions/block-macro-processor.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ include::example$extensions/lorem-block-macro.js[]
1919
== Usage
2020

2121
```js
22-
const asciidoctor = require('asciidoctor.js')()
22+
const asciidoctor = require('asciidoctor')()
2323
const registry = asciidoctor.Extensions.create()
2424
require('./lorem-block-macro.js')(registry)
2525

docs/modules/extend/pages/extensions/block-processor.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ include::example$extensions/shout-block.js[]
2121
== Usage
2222

2323
```js
24-
const asciidoctor = require('asciidoctor.js')()
24+
const asciidoctor = require('asciidoctor')()
2525
const registry = asciidoctor.Extensions.create()
2626
require('./shout-block.js')(registry)
2727

docs/modules/extend/pages/extensions/compile-ruby-extension.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Next we create a Node script to convert this document:
8181
.convert.js
8282
[source,javascript]
8383
----
84-
const asciidoctor = require('asciidoctor.js')()
84+
const asciidoctor = require('asciidoctor')()
8585
require('./tel-inline-macro.js') // <1>
8686
8787
const html = asciidoctor.convertFile('document.adoc', { 'to_file': false }) // <2>

docs/modules/extend/pages/extensions/docinfo-processor.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ include::example$extensions/love-footer-docinfo-processor.js[]
2323
== Usage
2424

2525
```js
26-
const asciidoctor = require('asciidoctor.js')()
26+
const asciidoctor = require('asciidoctor')()
2727
const registry = asciidoctor.Extensions.create()
2828
require('./love-footer-docinfo-processor.js')(registry)
2929

0 commit comments

Comments
 (0)