Skip to content

Commit

Permalink
ES Modules
Browse files Browse the repository at this point in the history
  • Loading branch information
platypii committed Jun 6, 2024
1 parent 1dc5942 commit 4d46051
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Hyperparam CLI",
"license": "MIT",
"main": "src/cli.js",
"type": "module",
"bin": {
"hyperparam": "./src/cli.js"
},
Expand Down
6 changes: 2 additions & 4 deletions src/chat.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const http = require('http') // TODO: https
import http from 'http' // TODO: https

const systemPrompt = 'You are a machine learning web application named "hyperparam". ' +
'You assist users with building high quality ML models by introspecting on their training set data. ' +
Expand Down Expand Up @@ -54,7 +54,7 @@ function write(...args) {
args.forEach(s => process.stdout.write(s))
}

function chat() {
export function chat() {
process.stdin.setEncoding('utf-8')

const colors = {
Expand Down Expand Up @@ -85,5 +85,3 @@ function chat() {
write(colors.system, 'question: ', colors.normal)
})
}

module.exports = { chat }
2 changes: 1 addition & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

if (process.argv[2] === 'chat') {
require('./chat').chat()
import('./chat.js').then(({ chat }) => chat())
} else {
console.log('usage: hyperparam chat')
}
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"module": "nodenext",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"strict": true
},
"include": ["src", "test"]
}

0 comments on commit 4d46051

Please sign in to comment.