Skip to content

Commit

Permalink
Remove desm
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Oct 23, 2024
1 parent a9c9d7a commit 0e7c53a
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 27 deletions.
3 changes: 1 addition & 2 deletions bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { resolve, join, relative } from 'node:path'
import { parseArgs } from 'node:util'
import { printHelpText } from 'argsclopts'
import readline from 'node:readline'
import desm from 'desm'
import process from 'process'
// @ts-ignore
import tree from 'pretty-tree'
Expand All @@ -26,7 +25,7 @@ import { askYesNo } from './lib/helpers/cli-prompt.js'
* @import { ArgscloptsParseArgsOptionsConfig } from 'argsclopts'
*/

const __dirname = desm(import.meta.url)
const __dirname = import.meta.dirname

async function getPkg () {
const pkgPath = resolve(__dirname, './package.json')
Expand Down
3 changes: 1 addition & 2 deletions lib/build-esbuild/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { writeFile } from 'fs/promises'
import { join, relative, basename } from 'path'
import esbuild from 'esbuild'
import { resolveVars } from '../build-pages/resolve-vars.js'
import desm from 'desm'

const __dirname = desm(import.meta.url)
const __dirname = import.meta.dirname
const TOP_BUN_DEFAULTS_PREFIX = 'top-bun-defaults'

/**
Expand Down
3 changes: 1 addition & 2 deletions lib/build-pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Worker } from 'worker_threads'
import desm from 'desm'
import { join } from 'path'
import pMap from 'p-map'
import { cpus } from 'os'
Expand All @@ -13,7 +12,7 @@ import { pageWriter } from './page-builders/page-writer.js'

const MAX_CONCURRENCY = Math.min(cpus().length, 24)

const __dirname = desm(import.meta.url)
const __dirname = import.meta.dirname

/**
* @typedef {{
Expand Down
3 changes: 1 addition & 2 deletions lib/build-pages/resolve-vars.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import tap from 'tap'
import desm from 'desm'
import { resolve } from 'path'

import { resolveVars } from './resolve-vars.js'

const __dirname = desm(import.meta.url)
const __dirname = import.meta.url

tap.test('resolve vars resolves vars', async (t) => {
const varsPath = resolve(__dirname, '../../test-cases/general-features/src/globals/global.vars.js')
Expand Down
3 changes: 1 addition & 2 deletions lib/identify-pages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { asyncFolderWalker } from 'async-folder-walker'
import assert from 'node:assert'
import desm from 'desm'
import { resolve, relative, join, basename } from 'path'
import { pageBuilders } from './build-pages/index.js'
import { TopBunDuplicatePageError } from './helpers/top-bun-error.js'
Expand All @@ -10,7 +9,7 @@ import { TopBunDuplicatePageError } from './helpers/top-bun-error.js'
* @import { TopBunWarning } from './helpers/top-bun-warning.js'
*/

const __dirname = desm(import.meta.url)
const __dirname = import.meta.dirname

const layoutSuffixs = ['.layout.js', '.layout.mjs', '.layout.cjs']
const layoutClientSuffixs = ['.layout.client.js', '.layout.client.mjs', '.layout.client.cjs']
Expand Down
3 changes: 1 addition & 2 deletions lib/identify-pages.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import tap from 'tap'
import desm from 'desm'
import { resolve } from 'path'

import { identifyPages } from './identify-pages.js'

const __dirname = desm(import.meta.url)
const __dirname = import.meta.dirname

tap.test('identifyPages works as expected', async (t) => {
const results = await identifyPages(resolve(__dirname, '../test-cases/general-features/src'))
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"chokidar": "^4.0.0",
"clean-deep": "^3.4.0",
"cpx2": "^8.0.0",
"desm": "^1.3.1",
"esbuild": "^0.24.0",
"handlebars": "^4.7.8",
"highlight.js": "^11.9.0",
Expand Down
3 changes: 1 addition & 2 deletions test-cases/build-errors/index.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import tap from 'tap'
import desm from 'desm'
import { TopBun } from '../../index.js'
import * as path from 'path'
import { rm } from 'fs/promises'

const __dirname = desm(import.meta.url)
const __dirname = import.meta.dirname

tap.test('build-errors', async (t) => {
const src = path.join(__dirname, './src')
Expand Down
3 changes: 1 addition & 2 deletions test-cases/conflict-pages/index.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import tap from 'tap'
import desm from 'desm'
import { TopBun } from '../../index.js'
import * as path from 'path'
import { rm } from 'fs/promises'

const __dirname = desm(import.meta.url)
const __dirname = import.meta.dirname

tap.test('conflict-pages', async (t) => {
const src = path.join(__dirname, './src')
Expand Down
3 changes: 1 addition & 2 deletions test-cases/default-layout/index.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import tap from 'tap'
import desm from 'desm'
import { TopBun } from '../../index.js'
import * as path from 'path'
import { rm } from 'fs/promises'

const __dirname = desm(import.meta.url)
const __dirname = import.meta.dirname

tap.test('default-layout', async (t) => {
const src = path.join(__dirname, './src')
Expand Down
3 changes: 1 addition & 2 deletions test-cases/drafts/index.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import tap from 'tap'
import desm from 'desm'
import { TopBun } from '../../index.js'
import * as path from 'path'
import { rm, stat, readFile } from 'fs/promises'
import * as cheerio from 'cheerio'
import { allFiles } from 'async-folder-walker'

const __dirname = desm(import.meta.url)
const __dirname = import.meta.dirname

tap.test('drafts', async (t) => {
const src = path.join(__dirname, './src')
Expand Down
3 changes: 1 addition & 2 deletions test-cases/general-features/index.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import tap from 'tap'
import desm from 'desm'
import { TopBun } from '../../index.js'
import * as path from 'path'
import { rm, stat, readFile } from 'fs/promises'
import * as cheerio from 'cheerio'
import { allFiles } from 'async-folder-walker'

const __dirname = desm(import.meta.url)
const __dirname = import.meta.dirname

tap.test('general-features', async (t) => {
const src = path.join(__dirname, './src')
Expand Down
3 changes: 1 addition & 2 deletions test-cases/nested-dest/index.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import tap from 'tap'
import desm from 'desm'
import { TopBun } from '../../index.js'
import * as path from 'path'
import { rm } from 'fs/promises'

const __dirname = desm(import.meta.url)
const __dirname = import.meta.dirname

tap.test('nested-dest', async (t) => {
const src = __dirname
Expand Down
3 changes: 1 addition & 2 deletions test-cases/page-build-errors/index.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import tap from 'tap'
import desm from 'desm'
import { TopBun } from '../../index.js'
import * as path from 'path'
import { rm } from 'fs/promises'

const __dirname = desm(import.meta.url)
const __dirname = import.meta.dirname

tap.test('build-errors', async (t) => {
const src = path.join(__dirname, './src')
Expand Down

0 comments on commit 0e7c53a

Please sign in to comment.