Skip to content

Commit

Permalink
fix: smol-toml imports (#10764)
Browse files Browse the repository at this point in the history
**Problem**
There is no default export from the `smol-toml` package and so usage
such as that shown below does not quite work.
```ts
import toml from 'smol-toml'
toml.parse(...)
```
Instead the easiest change is to adopt:
```ts
import * as toml from 'smol-toml'
toml.parse(...)
```
which was already being used within a test file.

**Changes**
1. Uses namespace imports for the smol toml package where that package
is used.

**Update**
It is somewhat confusing that the `import toml from 'smol-toml'` does
not appear to be working given that the documentation for the package
says that you should be able to do things that way. I'll see if this
change fixes the bug that I believe is happening. We can easily revert
or update the usage here when we understand better.
  • Loading branch information
Josh-Walker-GM committed Jun 9, 2024
1 parent 31853bc commit 547f377
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/cli-helpers/src/lib/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from 'node:fs'
import * as path from 'node:path'

import dotenv from 'dotenv'
import toml from 'smol-toml'
import * as toml from 'smol-toml'

import type { Config } from '@redwoodjs/project-config'
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/deploy/baremetal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path'
import boxen from 'boxen'
import fs from 'fs-extra'
import { Listr } from 'listr2'
import toml from 'smol-toml'
import * as toml from 'smol-toml'
import { env as envInterpolation } from 'string-env-interpolation'
import terminalLink from 'terminal-link'
import { titleCase } from 'title-case'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path'
import { getSchema, getConfig } from '@prisma/internals'
import fs from 'fs-extra'
import { Listr } from 'listr2'
import toml from 'smol-toml'
import * as toml from 'smol-toml'

import {
colors as c,
Expand Down
2 changes: 1 addition & 1 deletion packages/project-config/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs'

import merge from 'deepmerge'
import toml from 'smol-toml'
import * as toml from 'smol-toml'
import { env as envInterpolation } from 'string-env-interpolation'

import { getConfigPath } from './configPath.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/structure/src/model/RWTOML.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import toml from 'smol-toml'
import * as toml from 'smol-toml'
import { Range } from 'vscode-languageserver-types'

import { FileNode } from '../ide'
Expand Down

0 comments on commit 547f377

Please sign in to comment.