From ceda879c1dd6c68c758b0fc3fc10922a651a8df1 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sat, 8 Oct 2022 15:56:30 -0500 Subject: [PATCH] fix: use module imports, upgrade js-utils to module --- package.json | 2 +- src/app.ts | 2 +- src/index.ts | 10 +++++----- src/lib.ts | 2 +- src/schema.ts | 8 ++++---- test/TestApp.ts | 2 +- test/type/TestEnv.ts | 7 +++---- test/type/TestInclude.ts | 2 +- test/type/TestRegexp.ts | 2 +- test/type/TestStream.ts | 2 +- yarn.lock | 8 ++++---- 11 files changed, 23 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 6429653..47d11eb 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "author": "ssube", "license": "MIT", "devDependencies": { - "@apextoaster/js-utils": "0.5.0-0", + "@apextoaster/js-utils": "0.5.0-1", "@istanbuljs/nyc-config-typescript": "1.0.2", "@istanbuljs/schema": "0.1.3", "@microsoft/api-documenter": "7.19.16", diff --git a/src/app.ts b/src/app.ts index 5de7868..6dec871 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,4 +1,4 @@ -import { VERSION_INFO } from './version'; +import { VERSION_INFO } from './version.js'; export async function main(argv: Array): Promise { /* eslint-disable-next-line no-console */ diff --git a/src/index.ts b/src/index.ts index 2c61fc2..33d475c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,8 +3,8 @@ export { createSchema, IncludeSchemaOptions, SchemaOptions, -} from './schema'; -export { envType } from './type/Env'; -export { createInclude, IncludeOptions } from './type/Include'; -export { regexpType } from './type/Regexp'; -export { streamType } from './type/Stream'; +} from './schema.js'; +export { envType } from './type/Env.js'; +export { createInclude, IncludeOptions } from './type/Include.js'; +export { regexpType } from './type/Regexp.js'; +export { streamType } from './type/Stream.js'; diff --git a/src/lib.ts b/src/lib.ts index a2e733a..cd2ab2c 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -1,4 +1,4 @@ -import { VERSION_INFO } from './version'; +import { VERSION_INFO } from './version.js'; export { VERSION_INFO, diff --git a/src/schema.ts b/src/schema.ts index 68d5529..e54ceac 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -1,10 +1,10 @@ import { mustDefault } from '@apextoaster/js-utils'; import { DEFAULT_SCHEMA, Schema } from 'js-yaml'; -import { envType } from './type/Env'; -import { createInclude, IncludeOptions } from './type/Include'; -import { regexpType } from './type/Regexp'; -import { streamType } from './type/Stream'; +import { envType } from './type/Env.js'; +import { createInclude, IncludeOptions } from './type/Include.js'; +import { regexpType } from './type/Regexp.js'; +import { streamType } from './type/Stream.js'; /** * @public diff --git a/test/TestApp.ts b/test/TestApp.ts index dd9820d..bda784a 100644 --- a/test/TestApp.ts +++ b/test/TestApp.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { main } from '../src/app'; +import { main } from '../src/app.js'; describe('main function', async () => { it('should exit 1', async () => expect(main([])).to.eventually.equal(1)); diff --git a/test/type/TestEnv.ts b/test/type/TestEnv.ts index 38a6c78..122f519 100644 --- a/test/type/TestEnv.ts +++ b/test/type/TestEnv.ts @@ -1,8 +1,7 @@ +import { NotFoundError } from '@apextoaster/js-utils'; import { expect } from 'chai'; -import { NotFoundError } from '@apextoaster/js-utils'; -import { envType } from '../../src/type/Env'; -import { VERSION_INFO } from '../../src/version'; +import { envType } from '../../src/type/Env.js'; describe('env config type', async () => { it('should throw on missing variables', async () => { @@ -16,6 +15,6 @@ describe('env config type', async () => { }); it('should construct a value from variables', async () => { - expect(envType.construct('CI_COMMIT_SHA')).to.equal(VERSION_INFO.git.commit); + expect(envType.construct('CI_COMMIT_SHA')).to.match(/[a-f0-9]+/); }); }); diff --git a/test/type/TestInclude.ts b/test/type/TestInclude.ts index 83dbd0a..2c6cf35 100644 --- a/test/type/TestInclude.ts +++ b/test/type/TestInclude.ts @@ -3,7 +3,7 @@ import { expect } from 'chai'; import { DEFAULT_SCHEMA } from 'js-yaml'; import { join } from 'path'; -import { createInclude, IncludeOptions } from '../../src/type/Include'; +import { createInclude, IncludeOptions } from '../../src/type/Include.js'; const TEST_ROOT = '../test/type'; diff --git a/test/type/TestRegexp.ts b/test/type/TestRegexp.ts index 1727717..222be32 100644 --- a/test/type/TestRegexp.ts +++ b/test/type/TestRegexp.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { regexpType } from '../../src/type/Regexp'; +import { regexpType } from '../../src/type/Regexp.js'; describe('regexp config type', async () => { it('match slashed strings', async () => { diff --git a/test/type/TestStream.ts b/test/type/TestStream.ts index ea7621b..027d503 100644 --- a/test/type/TestStream.ts +++ b/test/type/TestStream.ts @@ -1,7 +1,7 @@ import { NotFoundError } from '@apextoaster/js-utils'; import { expect } from 'chai'; -import { streamType } from '../../src/type/Stream'; +import { streamType } from '../../src/type/Stream.js'; describe('stream config type', async () => { it('should resolve existing streams', async () => { diff --git a/yarn.lock b/yarn.lock index cf962c6..beac4c7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@apextoaster/js-utils@0.5.0-0": - version "0.5.0-0" - resolved "https://artifacts.apextoaster.com/repository/group-npm/@apextoaster/js-utils/-/js-utils-0.5.0-0.tgz#6c94a3a8a2530b8b4b97aee21984e6ae15488daf" - integrity sha512-4uMjuogP86Z3OZVEu05PZTXBJi6YriNItfpZuQAgq4nqK8Vz3AIdHJoKGqycKmr22h3+/ASQzuWm+zcEJxrjUQ== +"@apextoaster/js-utils@0.5.0-1": + version "0.5.0-1" + resolved "https://artifacts.apextoaster.com/repository/group-npm/@apextoaster/js-utils/-/js-utils-0.5.0-1.tgz#c0060735df1b846e3f0f0c15b8181491cfb8ec5b" + integrity sha512-i1g8x2G2O/gHzmbuuSmqHJNbfGY4px4S3N6F/Cbb7u3opj5d3tvewlkubkl+CELrLllCxrhKxHZ8ZM8ajSwQdg== "@babel/code-frame@^7.0.0": version "7.5.5"