Skip to content

Commit

Permalink
Merge pull request #3 from N0tExisting/patch-1
Browse files Browse the repository at this point in the history
fix: add `"type": "module"`, use `exports` field & bump version
  • Loading branch information
aarondfrancis authored Jun 15, 2022
2 parents 14443b4 + f3f53ef commit 2e37e16
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 27 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import torchlight from './src/torchlight'
import Block from './src/block'
import torchlight from './src/torchlight.js'
import Block from './src/block.js'

export {
torchlight,
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@torchlight-api/torchlight-cli",
"version": "0.1.2",
"version": "0.1.3",
"description": "A CLI for Torchlight - the syntax highlighting API",
"main": "index.js",
"type": "module",
"exports": "./index.js",
"scripts": {
"test": "standard --env jest && jest",
"build": "babel src --out-dir lib --copy-files \"--ignore\" \"src/stubs/**/*\""
Expand Down
2 changes: 1 addition & 1 deletion src/bin/torchlight.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env node
import { makeProgram } from '../cli'
import { makeProgram } from '../cli.js'

makeProgram().parse()
4 changes: 2 additions & 2 deletions src/block.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import md5 from 'md5'
import guid from './support/guid'
import torchlight from './torchlight'
import guid from './support/guid.js'
import torchlight from './torchlight.js'

export default function Block (opts = {}) {
opts = {
Expand Down
10 changes: 5 additions & 5 deletions src/cli.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { program } from 'commander'
import torchlight from './torchlight'
import highlight from './commands/highlight'
import init from './commands/init'
import cacheClear from './commands/cache/clear'
import { makeConfig, makeCache } from './config'
import torchlight from './torchlight.js'
import highlight from './commands/highlight.js'
import init from './commands/init.js'
import cacheClear from './commands/cache/clear.js'
import { makeConfig, makeCache } from './config.js'

/**
* Configure the commander CLI application.
Expand Down
8 changes: 4 additions & 4 deletions src/commands/highlight.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import path from 'path'
import torchlight from '../torchlight'
import Block from '../block'
import torchlight from '../torchlight.js'
import Block from '../block.js'
import cheerio from 'cheerio'
import chokidar from 'chokidar'
import log from '../support/log'
import log from '../support/log.js'
import fs from 'fs-extra'
import { bus, FILE_WATCHING_COMPLETE } from '../support/bus'
import { bus, FILE_WATCHING_COMPLETE } from '../support/bus.js'

export default function (torchlight, options) {
options = {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/init.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs-extra'
import path from 'path'
import inquirer from 'inquirer'
import log from '../support/log'
import log from '../support/log.js'

function write (location) {
const source = path.resolve(path.join(__dirname, '../stubs/config.js'))
Expand Down
4 changes: 2 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs-extra'
import path from 'path'
import FileCache from './cache/file'
import MemoryCache from './cache/memory'
import FileCache from './cache/file.js'
import MemoryCache from './cache/memory.js'

/**
* @param {string|object} config
Expand Down
4 changes: 2 additions & 2 deletions src/torchlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import axios from 'axios'
import md5 from 'md5'
import get from 'lodash.get'
import chunk from 'lodash.chunk'
import log from './support/log'
import MemoryCache from './cache/memory'
import log from './support/log.js'
import MemoryCache from './cache/memory.js'

/**
* @constructor
Expand Down
6 changes: 3 additions & 3 deletions tests/highlight.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import torchlight from '../src/torchlight';
import {mockApi, fixture} from './support/helpers';
import log from '../src/support/log';
import torchlight from '../src/torchlight.js';
import {mockApi, fixture} from './support/helpers.js';
import log from '../src/support/log.js';

process.env.TORCHLIGHT_TOKEN = 'test'

Expand Down
6 changes: 3 additions & 3 deletions tests/support/helpers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { bus, FILE_WATCHING_COMPLETE } from '../../src/support/bus'
import { testCli } from '../../src/cli'
import { readFileSync } from 'fs-extra'
import torchlight from '../../src/torchlight'
import { bus, FILE_WATCHING_COMPLETE } from '../../src/support/bus.js'
import { testCli } from '../../src/cli.js'
import torchlight from '../../src/torchlight.js'

function fixture (file, callback, options = {}) {
options = {
Expand Down

0 comments on commit 2e37e16

Please sign in to comment.