Skip to content

Commit

Permalink
Merge pull request #1 from hildjj/update
Browse files Browse the repository at this point in the history
Switch to es6.  Clean everything up
  • Loading branch information
hildjj committed Jul 1, 2023
2 parents deb0dab + 1efa225 commit 0f8e0ed
Show file tree
Hide file tree
Showing 112 changed files with 3,762 additions and 43,681 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js → .eslintrc.cjs
Expand Up @@ -2,5 +2,5 @@

module.exports = {
root: true,
extends: '@cto.af'
extends: '@cto.af/eslint-config/modules',
}
16 changes: 8 additions & 8 deletions .github/workflows/node.js.yml
Expand Up @@ -11,20 +11,20 @@ on:
jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 15.x]
node-version: [16, 18, 20]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Cache pnpm modules
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: cache-pnpm-modules
with:
Expand All @@ -34,9 +34,9 @@ jobs:
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- name: Install pnpm
uses: pnpm/action-setup@v1.2.1
uses: pnpm/action-setup@v2
with:
version: 5.18.1
version: 8.6.5
run_install: true
- name: Test ${{ matrix.node-version }}
run: npm run coverage
Expand All @@ -48,7 +48,7 @@ jobs:
parallel: true
finish:
needs: build
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -5,3 +5,4 @@
coverage/
node_modules/
TODO
pnpm-lock.yaml
20 changes: 0 additions & 20 deletions .jsdoc.conf

This file was deleted.

2 changes: 2 additions & 0 deletions .npmignore
Expand Up @@ -14,3 +14,5 @@ TODO
.github/
docs/
tutorials/
.eslintrc.cjs
tsconfig.json
1 change: 0 additions & 1 deletion .npmrc
@@ -1,2 +1 @@
engine-strict=true
package-lock=false
30 changes: 18 additions & 12 deletions bin/basura.js
@@ -1,21 +1,28 @@
#!/usr/bin/env node
'use strict'
/* eslint-disable no-console */

const Basura = require('../lib/index')
const fs = require('fs')
const util = require('util')
const pkg = require('../package.json')
const commander = require('commander')
import {Command, InvalidOptionArgumentError} from 'commander'
import {Basura} from '../lib/index.js'
import {fileURLToPath} from 'url'
import fs from 'fs'
import path from 'path'
import util from 'util'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'))

function myParseInt(value, dummyPrevious) {
const v = parseInt(value, 10)
if (isNaN(v)) {
throw new commander.InvalidOptionArgumentError('Not a number.')
throw new InvalidOptionArgumentError('Not a number.')
}
return v
}

const opts = commander.program
const program = new Command()
const opts = program
.version(pkg.version)
.usage('[options]')
.description('Generate a random JavaScript object')
Expand Down Expand Up @@ -55,6 +62,7 @@ function main() {
if (opts.type) {
const t = opts.type
delete opts.type
// eslint-disable-next-line no-useless-call
obj = g[`generate_${t}`].call(g)
} else {
obj = g.generate()
Expand All @@ -64,17 +72,15 @@ function main() {
JSON.stringify(obj, null, 2) :
util.inspect(obj, {
depth: Infinity,
colors: !opts.output && process.stdout.isTTY
colors: !opts.output && process.stdout.isTTY,
})
let out = process.stdout
if (opts.output) {
if (opts.output !== '-') {
out = fs.createWriteStream(opts.output)
}
if (!opts.json) {
out.write(`\
'use strict'
module.exports = `)
out.write('export default ')
str = Basura.quoteSymbols(str)
}
}
Expand Down
Binary file removed data/data.trie
Binary file not shown.
1 change: 1 addition & 0 deletions docs/.nojekyll
@@ -0,0 +1 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

0 comments on commit 0f8e0ed

Please sign in to comment.