Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ First, create a JSON file containing the data behind your tech radar. This data
[schema]: https://github.com/dprgarner/tech-radar-generator/blob/master/schema.json

The top-level JSON must contain the following properties:

- `title` - `string` - The title of the radar, which appears in the page title and the header of the page
- `quadrants` - `string[]` - An array of exactly four quadrant names in the radar, rendered anti-clockwise from the top-right
- `rings` - `string[]` - An array of up to four rings in the radar, from inner-most to outer-most
- `blips` - `blip[]` - An array of _blip_ objects determining the items appearing on the radar

Each blip object must contain the following properties:

- `name` - `string` - The name of the blip
- `quadrant` - `string` - The quadrant of the radar that the blip appears in. There should be exactly four different quadrants in the full list of blips.
- `ring` - `string` - The ring of the radar that the blip should appear in. This must take one of the provided ring values.
Expand Down Expand Up @@ -78,19 +80,21 @@ For example:
## Usage with the CLI

To use this JSON data with the CLI, install the library and run it against the JSON file. If this tool is being incorporated into an existing JavaScript project:
```bash

```shell
> yarn add tech-radar-generator
> yarn tech-radar-generator ./my-radar.json ./dist
```

If this tool is not being incorporated into a JavaScript project, the package can be run using npx:
```bash

```shell
> npx tech-radar-generator ./my-radar.json ./dist
```

The options for the CLI tool can be seen by running `npx tech-radar-generator --help`:

```bash
```shell
> npx tech-radar-generator --help
tech-radar-generator <input> <output>

Expand Down Expand Up @@ -133,7 +137,6 @@ Unlike the CLI, this function takes the source data as a JavaScript object, and

An example Dockerfile with an nginx config:


```dockerfile
# Dockerfile

Expand Down Expand Up @@ -188,33 +191,41 @@ This tool is powered by Webpack. Some commonly-used scripts are set in the npm-s

To run the webpack-dev-server:

yarn dev
```shell
yarn dev
```

To run the tests:

yarn test
```shell
yarn test
```

To run the linter:

yarn lint
```shell
yarn lint
```

To format the code using [standard][standard]:

yarn format
```shell
yarn format
```

[standard]: https://standardjs.com/

## Releasing

Releases to NPM are performed via Travis when tagged commits are pushed to the repo. Create a new tagged commit and bump the version in package.json with the npm version script:

```bash
```shell
npm version patch
```

and push the new commits and tags with:

```bash
```shell
git push && git push --tags
```

Expand Down
83 changes: 48 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"bin": "./bin/tech-radar-generator",
"scripts": {
"dev": "webpack-dev-server",
"dev": "webpack-dev-server --mode development",
"test": "istanbul cover jasmine",
"test:e2e": "jasmine --config=e2e.json",
"lint": "standard",
Expand All @@ -16,57 +16,70 @@
"email": "dprgarner@gmail.com",
"url": "https://github.com/dprgarner/tech-radar-generator"
},
"contributors": [
{
"name": "David Garner",
"email": "dprgarner@gmail.com",
"url": "https://github.com/dprgarner/tech-radar-generator"
},
{
"name": "Andrew McIntosh",
"email": "andrew@amcintosh.net",
"url": "https://github.com/amcintosh/tech-radar-generator"
}
],
"repository": {
"type": "git",
"url": "https://github.com/dprgarner/tech-radar-generator"
"url": "https://github.com/amcintosh/tech-radar-generator"
},
"keywords": [
"tech-radar"
],
"engines": {
"node": ">=8"
"node": ">=14"
},
"license": "AGPL-3.0",
"devDependencies": {
"istanbul": "^0.4.5",
"jasmine": "^3.3.1",
"jsdom": "^13.1.0",
"memory-fs": "^0.4.1",
"standard": "^12.0.1",
"tmp": "^0.1.0",
"webpack-dev-server": "^3.1.14"
"jsdom": "^22.1.0",
"memory-fs": "^0.5.0",
"standard": "^17.1.0",
"tmp": "^0.2.1",
"webpack-dev-server": "^4.15.1"
},
"dependencies": {
"@babel/core": "^7.2.2",
"ajv": "^6.10.2",
"babel-loader": "^8.0.4",
"@babel/core": "^7.22.5",
"ajv": "^8.12.0",
"babel-loader": "^9.1.2",
"babel-preset-env": "^1.7.0",
"chance": "^1.0.18",
"clean-webpack-plugin": "^3.0.0",
"css-loader": "^2.0.1",
"cssnano": "^4.1.7",
"d3": "^5.9.7",
"chance": "^1.1.11",
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.8.1",
"cssnano": "^6.0.1",
"d3": "^7.8.5",
"d3-tip": "^0.9.1",
"dotenv": "^5.0.1",
"expose-loader": "^0.7.5",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"jquery": "^3.4.0",
"jquery-ui": "^1.12.1",
"dotenv": "^16.1.4",
"expose-loader": "^4.1.0",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.5.3",
"jquery": "^3.7.0",
"jquery-ui": "^1.13.2",
"json-loader": "^0.5.7",
"lodash": "^4.17.11",
"mini-css-extract-plugin": "^0.5.0",
"node-sass": "^4.11.0",
"postcss-loader": "^3.0.0",
"postcss-preset-env": "^6.5.0",
"sanitize-html": "^1.20.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"tree-node-cli": "^1.2.5",
"val-loader": "^1.1.1",
"webpack": "^4.28.0",
"webpack-cli": "^3.3.7",
"yargs": "^13.3.0"
"lodash": "^4.17.21",
"mini-css-extract-plugin": "^2.7.6",
"node-sass": "^9.0.0",
"postcss-loader": "^7.3.3",
"postcss-preset-env": "^8.4.2",
"resolve-url-loader": "^5.0.0",
"sanitize-html": "^2.10.0",
"sass-loader": "^13.3.2",
"style-loader": "^3.3.3",
"tree-node-cli": "^1.6.0",
"val-loader": "^5.0.1",
"webpack": "^5.86.0",
"webpack-cli": "^5.1.4",
"yargs": "^17.7.2"
},
"standard": {
"env": [
Expand Down
2 changes: 1 addition & 1 deletion spec/models/blip-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const Blip = require('../../src/models/blip')
const Ring = require('../../src/models/ring')

describe('Blip', function () {
var blip
let blip

beforeEach(function () {
blip = new Blip(
Expand Down
8 changes: 4 additions & 4 deletions spec/models/quadrant-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ const Blip = require('../../src/models/blip')

describe('Quadrant', function () {
it('has a name', function () {
var quadrant = new Quadrant('My Quadrant')
const quadrant = new Quadrant('My Quadrant')

expect(quadrant.name()).toEqual('My Quadrant')
})

it('has no blips by default', function () {
var quadrant = new Quadrant('My Quadrant')
const quadrant = new Quadrant('My Quadrant')

expect(quadrant.blips()).toEqual([])
})

it('can add a single blip', function () {
var quadrant = new Quadrant('My Quadrant')
const quadrant = new Quadrant('My Quadrant')

quadrant.add(new Blip())

expect(quadrant.blips().length).toEqual(1)
})

it('can add multiple blips', function () {
var quadrant = new Quadrant('My Quadrant')
const quadrant = new Quadrant('My Quadrant')

quadrant.add([new Blip(), new Blip()])

Expand Down
24 changes: 12 additions & 12 deletions spec/models/radar-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const ExceptionMessages = require('../../src/util/exceptionMessages')

describe('Radar', function () {
it('has no quadrants by default', function () {
var radar = new Radar()
const radar = new Radar()

expect(radar.quadrants()[0].quadrant).not.toBeDefined()
expect(radar.quadrants()[1].quadrant).not.toBeDefined()
Expand All @@ -16,7 +16,7 @@ describe('Radar', function () {
})

it('sets the first quadrant', function () {
var quadrant, radar, blip
let quadrant, radar, blip

blip = new Blip('A', new Ring('First'))
quadrant = new Quadrant('First')
Expand All @@ -30,7 +30,7 @@ describe('Radar', function () {
})

it('sets the second quadrant', function () {
var quadrant, radar, blip
let quadrant, radar, blip

blip = new Blip('A', new Ring('First'))
quadrant = new Quadrant('Second')
Expand All @@ -44,7 +44,7 @@ describe('Radar', function () {
})

it('sets the third quadrant', function () {
var quadrant, radar, blip
let quadrant, radar, blip

blip = new Blip('A', new Ring('First'))
quadrant = new Quadrant('Third')
Expand All @@ -58,7 +58,7 @@ describe('Radar', function () {
})

it('sets the fourth quadrant', function () {
var quadrant, radar, blip
let quadrant, radar, blip

blip = new Blip('A', new Ring('First'))
quadrant = new Quadrant('Fourth')
Expand All @@ -72,7 +72,7 @@ describe('Radar', function () {
})

it('throws an error if too many quadrants are added', function () {
var quadrant, radar, blip
let quadrant, radar, blip

blip = new Blip('A', new Ring('First'))
quadrant = new Quadrant('First')
Expand All @@ -88,7 +88,7 @@ describe('Radar', function () {
})

it('throws an error if less than 4 quadrants are added', function () {
var quadrant, radar, blip
let quadrant, radar, blip

blip = new Blip('A', new Ring('First'))
quadrant = new Quadrant('First')
Expand All @@ -103,7 +103,7 @@ describe('Radar', function () {
})

describe('blip numbers', function () {
var firstQuadrant, secondQuadrant, radar, firstRing
let firstQuadrant, secondQuadrant, radar, firstRing

beforeEach(function () {
firstRing = new Ring('Adopt', 0)
Expand Down Expand Up @@ -138,10 +138,10 @@ describe('Radar', function () {

describe('alternatives', function () {
it('returns a provided alternatives', function () {
var radar = new Radar()
const radar = new Radar()

var alternative1 = 'alternative1'
var alternative2 = 'alternative2'
const alternative1 = 'alternative1'
const alternative2 = 'alternative2'

radar.addAlternative(alternative1)
radar.addAlternative(alternative2)
Expand All @@ -151,7 +151,7 @@ describe('Radar', function () {
})

describe('rings', function () {
var quadrant, radar, firstRing, secondRing, otherQuadrant
let quadrant, radar, firstRing, secondRing, otherQuadrant

beforeEach(function () {
firstRing = new Ring('Adopt', 0)
Expand Down
4 changes: 2 additions & 2 deletions spec/models/ring-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ const Ring = require('../../src/models/ring')

describe('Ring', function () {
it('has a name', function () {
var ring = Ring('My Ring')
const ring = Ring('My Ring')

expect(ring.name()).toEqual('My Ring')
})

it('has a order', function () {
var ring = new Ring('My Ring', 0)
const ring = new Ring('My Ring', 0)

expect(ring.order()).toEqual(0)
})
Expand Down
8 changes: 4 additions & 4 deletions spec/util/inputSanitizer-spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const InputSanitizer = require('../../src/util/inputSanitizer')

describe('InputSanitizer', function () {
var sanitizer, rawBlip, blip
let sanitizer, rawBlip, blip

beforeAll(function () {
sanitizer = new InputSanitizer()
var description = "<b>Hello</b> <script>alert('dangerous');</script>there <h1>heading</h1>"
const description = "<b>Hello</b> <script>alert('dangerous');</script>there <h1>heading</h1>"
rawBlip = {
name: "Hello <script>alert('dangerous');</script>there <h1>blip</h1>",
description: description,
description,
ring: '<a href="/asd">Adopt</a>',
quadrant: '<strong>techniques and tools</strong>',
isNew: 'true<br>'
Expand Down Expand Up @@ -50,7 +50,7 @@ describe('InputSanitizer', function () {
})

describe('Input Santizer for Protected sheet', function () {
var sanitizer, rawBlip, blip, header
let sanitizer, rawBlip, blip, header
beforeAll(function () {
sanitizer = new InputSanitizer()
header = [
Expand Down
Loading