Skip to content

Commit

Permalink
feat: move to template-oss (npm#84)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: this drops support for node10 and non-LTS versions of
node 12 and 14

* chore: move files to lib/docs
* feat: install template-oss
* deps: gauge@4.0.0
* fix: require gauge theme properly
* chore: remove @npmcli/lint
  • Loading branch information
wraithgar committed Nov 16, 2021
1 parent 04183c9 commit 864c60c
Show file tree
Hide file tree
Showing 16 changed files with 1,315 additions and 2,955 deletions.
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This file is automatically added by @npmcli/template-oss. Do not edit.

const { readdirSync: readdir } = require('fs')

const localConfigs = readdir(__dirname)
.filter((file) => file.startsWith('.eslintrc.local.'))
.map((file) => `./${file}`)

module.exports = {
extends: [
'@npmcli',
...localConfigs,
],
}
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @npm/cli-team
54 changes: 54 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

name: Bug
description: File a bug/issue
title: "[BUG] <title>"
labels: [Bug, Needs Triage]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please [search here](./issues) to see if an issue already exists for your problem.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Current Behavior
description: A clear & concise description of what you're experiencing.
validations:
required: false
- type: textarea
attributes:
label: Expected Behavior
description: A clear & concise description of what you expected to happen.
validations:
required: false
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
value: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: false
- type: textarea
attributes:
label: Environment
description: |
examples:
- **npm**: 7.6.3
- **Node**: 13.14.0
- **OS**: Ubuntu 20.04
- **platform**: Macbook Pro
value: |
- npm:
- Node:
- OS:
- platform:
validations:
required: false

3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

blank_issues_enabled: true
54 changes: 32 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,54 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

name: CI

on: [push, pull_request]
on:
pull_request:
push:
branches:
- main
- latest

jobs:
build:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
cache: npm
- run: npm i --prefer-online -g npm@latest
- run: npm ci
- run: npm run lint

test:
strategy:
fail-fast: false
matrix:
node-version: [10.0.x, 10.x, 12.0.x, 12.x, 14.0.x, 14.x, 15.x, 16.x]
node-version: [12.13.0, 12.x, 14.15.0, 14.x, 16.13.0, 16.x]
platform:
- os: ubuntu-latest
shell: bash
- os: macos-latest
shell: bash
- os: windows-latest
shell: bash
- os: windows-latest
shell: cmd
- os: windows-latest
shell: powershell

runs-on: ${{ matrix.platform.os }}
defaults:
run:
shell: ${{ matrix.platform.shell }}

steps:
- name: Checkout Repository
uses: actions/checkout@v1.1.0

- name: Use Nodejs ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Update npm
run: npm i -g npm@latest

- name: Install dependencies
run: npm ci

- name: Run Tap Tests
run: npm test

- name: List dependencies
run: npm ls -a
cache: npm
- run: npm i --prefer-online -g npm@latest
- run: npm ci
- run: npm test --ignore-scripts
- run: npm ls -a
25 changes: 22 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
node_modules
npm-debug.log
.nyc_output
# This file is automatically added by @npmcli/template-oss. Do not edit.

# ignore everything in the root
/*

# keep these
!/.eslintrc*
!/.github
!**/.gitignore
!/package.json
!/package-lock.json
!/docs
!/bin
!/lib
!/map.js
!/tap-snapshots
!/test
!/scripts
!/README*
!/LICENSE*
!/SECURITY*
!/CHANGELOG*
15 changes: 0 additions & 15 deletions LICENSE

This file was deleted.

20 changes: 20 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- This file is automatically added by @npmcli/template-oss. Do not edit. -->

ISC License

Copyright npm, Inc.

Permission to use, copy, modify, and/or distribute this
software for any purpose with or without fee is hereby
granted, provided that the above copyright notice and this
permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
USE OR PERFORMANCE OF THIS SOFTWARE.
3 changes: 3 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- This file is automatically added by @npmcli/template-oss. Do not edit. -->

Please send vulnerability reports through [hackerone](https://hackerone.com/github).
39 changes: 39 additions & 0 deletions docs/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
var log = require('./log.js')

log.heading = 'npm'

console.error('log.level=silly')
log.level = 'silly'
log.silly('silly prefix', 'x = %j', { foo: { bar: 'baz' } })
log.verbose('verbose prefix', 'x = %j', { foo: { bar: 'baz' } })
log.info('info prefix', 'x = %j', { foo: { bar: 'baz' } })
log.http('http prefix', 'x = %j', { foo: { bar: 'baz' } })
log.warn('warn prefix', 'x = %j', { foo: { bar: 'baz' } })
log.error('error prefix', 'x = %j', { foo: { bar: 'baz' } })
log.silent('silent prefix', 'x = %j', { foo: { bar: 'baz' } })

console.error('log.level=silent')
log.level = 'silent'
log.silly('silly prefix', 'x = %j', { foo: { bar: 'baz' } })
log.verbose('verbose prefix', 'x = %j', { foo: { bar: 'baz' } })
log.info('info prefix', 'x = %j', { foo: { bar: 'baz' } })
log.http('http prefix', 'x = %j', { foo: { bar: 'baz' } })
log.warn('warn prefix', 'x = %j', { foo: { bar: 'baz' } })
log.error('error prefix', 'x = %j', { foo: { bar: 'baz' } })
log.silent('silent prefix', 'x = %j', { foo: { bar: 'baz' } })

console.error('log.level=info')
log.level = 'info'
log.silly('silly prefix', 'x = %j', { foo: { bar: 'baz' } })
log.verbose('verbose prefix', 'x = %j', { foo: { bar: 'baz' } })
log.info('info prefix', 'x = %j', { foo: { bar: 'baz' } })
log.http('http prefix', 'x = %j', { foo: { bar: 'baz' } })
log.warn('warn prefix', 'x = %j', { foo: { bar: 'baz' } })
log.error('error prefix', 'x = %j', { foo: { bar: 'baz' } })
log.silent('silent prefix', 'x = %j', { foo: { bar: 'baz' } })
log.error('404', 'This is a longer\n' +
'message, with some details\n' +
'and maybe a stack.\n' +
new Error('a 404 error').stack)
log.addLevel('noise', 10000, { beep: true })
log.noise(false, 'LOUD NOISES')
39 changes: 0 additions & 39 deletions example.js

This file was deleted.

18 changes: 9 additions & 9 deletions log.js → lib/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@ log.useColor = function () {

log.enableColor = function () {
colorEnabled = true
this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled})
this.gauge.setTheme({ hasColor: colorEnabled, hasUnicode: unicodeEnabled })
}
log.disableColor = function () {
colorEnabled = false
this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled})
this.gauge.setTheme({ hasColor: colorEnabled, hasUnicode: unicodeEnabled })
}

// default level
log.level = 'info'

log.gauge = new Gauge(stream, {
enabled: false, // no progress bars unless asked
theme: {hasColor: log.useColor()},
theme: { hasColor: log.useColor() },
template: [
{type: 'progressbar', length: 20},
{type: 'activityIndicator', kerning: 1, length: 1},
{type: 'section', default: ''},
{ type: 'progressbar', length: 20 },
{ type: 'activityIndicator', kerning: 1, length: 1 },
{ type: 'section', default: '' },
':',
{type: 'logline', kerning: 1, default: ''},
{ type: 'logline', kerning: 1, default: '' },
],
})

Expand All @@ -62,12 +62,12 @@ var unicodeEnabled

log.enableUnicode = function () {
unicodeEnabled = true
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: unicodeEnabled })
}

log.disableUnicode = function () {
unicodeEnabled = false
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: unicodeEnabled })
}

log.setGaugeThemeset = function (themes) {
Expand Down
Loading

0 comments on commit 864c60c

Please sign in to comment.