Skip to content

Commit

Permalink
Develop zip-contents-collector-extension
Browse files Browse the repository at this point in the history
Add initial implementation of the zip-contents-collector-extension
code.
  • Loading branch information
philwebb committed Mar 19, 2024
0 parents commit e85de9a
Show file tree
Hide file tree
Showing 52 changed files with 10,638 additions and 0 deletions.
Empty file added .eslintignore
Empty file.
22 changes: 22 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "standard",
"rules": {
"array-callback-return": "off",
"arrow-parens": ["error", "always"],
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline"
}],
"max-len": ["error", {
"code": 120,
"ignoreStrings": true,
"ignoreUrls": true,
"ignoreTemplateLiterals": true
}],
"prefer-regex-literals": "off",
"spaced-comment": "off",
"radix": ["error", "always"]
}
}
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI
on:
workflow_dispatch:
push:
branches: ['**']
paths-ignore: ['*.adoc']
pull_request:
branches: [main]
paths-ignore: ['*.adoc']
schedule:
- cron: '45 2 * * TUE'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
activate:
if: >-
github.event_name == 'push' ||
(github.event_name == 'schedule' && github.repository_owner == 'spring-io') ||
(github.event_name == 'pull_request' && !startsWith(github.head_ref, 'docs/'))
runs-on: ubuntu-latest
steps:
- name: Proceed
run: echo ok go
build:
needs: activate
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Run linter
run: |
npm run lint
if [ -n "$(npm --silent run format && git --no-pager diff --name-only)" ]; then
echo 'Detected pending code style changes'
exit 1
fi
- name: Run tests with coverage
run: npm run coverage-strict
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release
run-name: ${{ github.workflow }} ${{ github.event.inputs.release-version }}
permissions:
contents: write
on:
workflow_dispatch:
inputs:
release-version:
description: Enter version to release (e.g., 1.0.1).
required: false
jobs:
perform:
if: github.event_name == 'workflow_dispatch' && github.repository_owner == 'spring-io'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Set up release environment
run: |
echo RELEASE_VERSION=${{ github.event.inputs.release-version }} >> $GITHUB_ENV
echo RELEASE_NPM_TOKEN=${{ secrets.NPM_TOKEN }} >> $GITHUB_ENV
- name: Build, tag, and publish npm package
run: ./npm/release.sh
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/.cache/
/.idea/
/.nyc_output/
/build/
/node_modules/
/packages/*/node_modules/
/reports/
/packages/antora-zip-contents-collector-extension/test/work/
3 changes: 3 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict'

module.exports = require('@springio/antora-zip-contents-collector-test-harness/config')
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fund=false
lockfile-version=3
omit=optional
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.11.1
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
9 changes: 9 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
= Antora Zip Contents Collector Extension Changelog
:url-repo: https://github.com/spring-io/antora-zip-contents-collector-extension

This is a summary of all notable changes to the Antora Zip Contents Collector Extension by release.
For a detailed view of what's changed, refer to the {url-repo}/commits[commit history] of this project.

== Unreleased

_Initial prerelease of the software._
156 changes: 156 additions & 0 deletions CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
:url-git: https://git-scm.com
:url-git-dl: {url-git}/downloads
:url-nodejs: https://nodejs.org
:url-nodejs-releases: https://github.com/nodejs/Release#release-schedule
:url-nvm: https://github.com/creationix/nvm
:url-nvm-install: {url-nvm}#installation
:url-project: https://github.com/spring-io/antora-zip-contents-collector-extension
:url-mocha: https://mochajs.org
:url-chai: http://chaijs.com/api/bdd/
:url-standardjs: https://standardjs.com/rules.html
:url-eslint: https://eslint.org
= Contributing
This section provides information on how to develop and contribute to the project.

== Prerequisites
To build this project and run the tests, you need the following software installed on your computer:

* {url-git}[git] (command: `git`)
* {url-nodejs}[Node.js] (commands: `node`, `npm`, and `npx`)



== git
First, make sure you have git installed.

[,console]
----
$ git --version
----

If not, {url-git-dl}[download and install] the git package for your system.



== Node.js
Next, make sure that you have Node.js installed (which also provides npm and npx).

[,console]
----
$ node --version
----

If this command fails with an error, you don't have Node.js installed.
If the command doesn't report an {url-nodejs-releases}[active LTS version] of Node.js, it means you don't have a suitable version of Node.js installed.

We strongly recommend that you use {url-nvm}[nvm] (Node Version Manager) to manage your Node.js installation(s).
Follow the {url-nvm-install}[nvm installation instructions] to set up nvm on your machine.

Once you've installed nvm, open a new terminal and install Node.js 16 using the following command:

[,console]
----
$ nvm install
----

You can switch to this version of Node.js at any time using the following command:

[,console]
----
$ nvm use
----

Now that you have git and Node.js installed, you're ready to start developing on this project.



=== Clone Project
Clone the project using git:

[,console,subs=attributes+]
----
$ git clone {url-project} && cd "`basename $_`"
----

The previous chained command clones the project then switches to the project folder on your filesystem.
Stay in this project folder when running all subsequent commands.



=== Install Dependencies
Use npm to install the project's dependencies inside the project.
In your terminal, run the following command:

[,console]
----
$ npm ci
----

This command installs the dependencies listed in [.path]_package-lock.json_ into the [.path]_node_modules/_ folder inside the project.
This folder should _not_ be committed to the source control repository.



=== Run Tests
This project uses {url-mocha}[mocha] to run the tests and the assertion library {url-chai}[chai] to assert outcomes.
To run the test suite, use:

$ npm test

By default, `npm test` will run all tests.
You can run the tests in a single test suite by passing the path of that test suite as the final argument:

[,console]
----
$ npm test test/partial-build-extension-test.js
----

You can also run a single test by adding `.only` to the `it` function (e.g., `it.only`).
If `it.only` is present, `npm test` will only run that test.

To generate a coverage report when running the tests (enabled by default in CI), run the `coverage` script instead:

[,console]
----
$ npm run coverage
----

A coverage report shows the lines, statements, and branches that the tests exercise.
You can view the coverage report by opening the HTML file [.path]_reports/lcov-report/index.html_ in your browser.



=== Verify Code Style
This project adheres to the {url-standardjs}[JavaScript Standard style] with some exceptions defined in [.path]_.eslintrc_.
The code style is verified using {url-eslint}[ESLint].

To verify that the style of the code is correct, run the following command:

[,console]
----
$ npm run lint
----

To format the code to adhere to the code style, run the following command:

[,console]
----
$ npm run format
----

The CI workflow will fail if there are pending code style changes, so be sure to run it before you push a change.



=== Use Project From Source
If you want to use the project locally before it is published, you can specify the path to the project as the version in [.path]_package.json_.

[,json]
----
"dependencies": {
"@springio/antora-extensions": "/path/to/project"
}
----

When you run `npm i` in that project, npm will set up a symlink to the location of this project.
Any changes to this project will take effect immediately.
Loading

0 comments on commit e85de9a

Please sign in to comment.