ehmicky, to programming
@ehmicky@fosstodon.org avatar

We just released Execa 9, which is our biggest release so far.

If you're currently using Execa, you should check out the new features! Also, if you're currently using zx or Bun shell, you might be interesting in this alternative.

https://medium.com/@ehmicky/execa-9-release-d0d5daaa097f

pawelgrzybek, to programming
@pawelgrzybek@mastodon.social avatar

Node.js 20.13 brought great improvements. My highlights:

► Watch mode is considered stable now
► The util.styleText now accepts an array of modifiers

Of course, I have articles about both of those features! I just updated both of them to reflect new announcements.

“TIL — Node v18.11.0 comes with a watch mode, so you might not need nodemon”
https://pawelgrzybek.com/til-node-v18-11-0-comes-with-a-watch-mode-so-you-might-not-need-nodemon/

“Node.js added utility for text formatting — you may not need chalk anymore”
https://pawelgrzybek.com/node-js-added-utility-for-text-formatting-you-may-not-need-chalk-anymore/

aral, (edited ) to programming
@aral@mastodon.ar.al avatar

This is a niche one but it might help someone in the future:

How to include multiple directories from different places in the file system hierarchy in an archive without including the whole directory structure for any of them.

https://codeberg.org/aral/gists/src/branch/main/how-to-include-multiple-directories-from-different-places-in-the-file-system-hierarchy-in-an-archive-without-including-the-whole-directory-structure-for-any-of-them.md

TL; DR: use symlinks.

aral, to javascript
@aral@mastodon.ar.al avatar

Just published a minor update (version 5.1.1) to JavaScript Database (JSDB) that optimises the custom data type¹ serialisation code by removing a redundant return statement:

https://www.npmjs.com/package/@small-tech/jsdb

This change is backwards compatible and shouldn’t require and updates to your projects, including the ones you have in Kitten (which uses JSDB internally).

¹ https://codeberg.org/small-tech/jsdb#custom-data-types
² https://codeberg.org/kitten/app

#JavaScriptDatabase #JavaScript #database #JSDB #Kitten #SmallWeb #NodeJS #web #dev

tanepiper, to programming
@tanepiper@tane.codes avatar

Anyone else seeing more segfaults with 22 and

Going to have to go back to LTS as pipeline keep failing now when installing dependencies when using caching.

ecmascript_news, to javascript
@ecmascript_news@mastodon.online avatar
joelanman, to programming
@joelanman@hachyderm.io avatar

any opinions on Node.js logging libraries like Winston or Pino? Or do you just write your own logging functions?

aral, to javascript
@aral@mastodon.ar.al avatar
casraf, to typescript
@casraf@fosstodon.org avatar
leanpub, to programming
@leanpub@mastodon.social avatar

P4NR - IoT Programmer https://leanpub.com/b/p4nr-iotprogrammer by Klaus Landsdorf (Iniationware, P4NR), Joel Krec, and Maryam Jalil is the featured bundle on the Leanpub homepage! https://leanpub.com

aral, to programming
@aral@mastodon.ar.al avatar

JSDB 5.0.0 published 🎉

• Custom classes must have a constructor that accepts a parameter object as its only argument. Constructors are run during deserialisation.

• Custom classes can now safely extend other classes (e.g., EventEmitter).

• Properties that begin with an underscore (_) are treated as private and ignored.

• Objects with null prototypes are supported. i.e., objects created with Object.create(null, …).

Full details: https://codeberg.org/small-tech/jsdb#migrating-from-earlier-versions-of-jsdf

#JSDB #NodeJS #database

aral,
@aral@mastodon.ar.al avatar

JSDB 5.0.1 published 🎉

• Fixes #14: Crash if DataProxy getHandler() called on object with null prototype. (https://codeberg.org/small-tech/jsdb/issues/14)

To install update:

npm install @small/jsdb@5.0.1

Learn more about JSDB:

https://codeberg.org/small-tech/jsdb#javascript-database-jsdb

#JavaScriptDatabase #JavaScript #database JSDB #JSDB5 #NodeJS #SmallTech #SmallWeb #web #dev

aral,
@aral@mastodon.ar.al avatar

JSDB 5.1.0 published¹ 🎉

• Forgetting to pass a custom class that’s persisted in your database in your JSDB.open() call now throws instead of corrupting your database by falling back to using an untyped object.

• Added JSDF ver. 2 to 3 database migration script (i.e., JSDB version 2-4 to 5)²

To install update:

npm install @small/jsdb@5.1.0

¹ https://codeberg.org/small-tech/jsdb/releases

² https://codeberg.org/small-tech/jsdb#version-2-to-3

JSDB

veganstraightedge, to rails
@veganstraightedge@ruby.social avatar

buildpack question

AFAIK, my app doesn't want/need

How do I tell Heroku to not install install the buildpack at all?

(and remediate this WARNING on every deploy)


WARNING:

Installing a default version (20.9.0) of Node.js.
This version is not pinned and can change over time, causing unexpected failures.
Heroku recommends placing the heroku/nodejs buildpack in front of
heroku/ruby to install a specific version of node

aral, to javascript
@aral@mastodon.ar.al avatar

100% test coverage doesn’t mean your code’s bug free but it did just lead me to find and fix an issue in JavaScript Database (JSDB)¹ with a code path that wasn’t being hit that I would have otherwise missed because it was causing the relevant test to pass.

¹ JSDB is a zero-dependency, transparent, in-memory, streaming write-on-update JavaScript database for the Small Web that persists to a JavaScript transaction log (an append-only log).

https://codeberg.org/small-tech/jsdb

aral,
@aral@mastodon.ar.al avatar

To really drive home the above 👆 point that 100% test coverage does not mean ‘bug free’, just found a bug in JSDB¹ 5.0.0 where running JSON.stringify() on a complex custom object (actually: the automatic Proxy of the custom object created by JSDB) results in an error.

Already have a failing test and about to implement fix.

(It’s at this point where the test harness is invaluable.)

¹ https://codeberg.org/small-tech/jsdb

#JavaScriptDatabase #JavaScript #database #JSDB #JSDB5 #NodeJS #SmallWeb #SmallTech

jperkin, to programming
@jperkin@federate.me.uk avatar

We're hiring!

https://www.mnxsolutions.com/careers/senior-backend-developer

Come and help us maintain and enhance a fully open-source operating system and cloud stack that has been battle-tested in very large production environments.

There are plenty of interesting problems to solve, all the way from writing device drivers and debugging early boot issues, to writing new UIs in Rust.

I think we're a pretty friendly team to work alongside too ;)

Happy to answer any questions.

SceNtriC, to javascript Polish
@SceNtriC@101010.pl avatar

Pytanie do obeznanych z technologiami - czy kojarzycie jakiś framework, który w bardzo prosty sposób pozwala tworzyć CRUDy w celu budowania panelu administracyjnego/CMS-a dla istniejącej bazy (frontend i backend)?

aral, to javascript
@aral@mastodon.ar.al avatar

Realised last night that JavaScript Database (JSDB) doesn’t run the constructor on persisted custom objects (https://codeberg.org/small-tech/jsdb#custom-data-types) when deserialising them because I didn’t know that you apparently have to define your constructor manually when using Object.create().

Will fix it today but it’s something to watch out for if you’re using Object.create() directly.

For more info, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create

ecmascript_news, to javascript
@ecmascript_news@mastodon.online avatar

Node.js 22: require() ESM modules, --run package scripts, --watch files, fs.glob() and more
@nodejs
https://nodejs.org/en/blog/announcements/v22-release-announce

leanpub, to devops
@leanpub@mastodon.social avatar

Learn Kubernetes & Docker - .NET Core, Java, Node.JS, PHP or Python by Arnaud Weil is free with a Leanpub Reader membership! Or you can buy it for $11.99! http://leanpub.com/k8s

kraktoos, to web
@kraktoos@fosstodon.org avatar

Has anyone here tried "wasp lang" (https://wasp-lang.dev/) for full stack dev? Leave some feedback on how it was!

joe, to ai

So far this week, we have looked at how to use Ollama from the CLI, how to use Ollama from the web service, and how to use Ollama from a phone or iPad. Today we are going to be using the Ollama JavaScript Library to write an application.

Install the Ollama Library

The first step is to run npm i ollama from the terminal.

https://i0.wp.com/jws.news/wp-content/uploads/2024/04/Screenshot-2024-04-21-at-8.30.04%E2%80%AFAM.png?resize=1024%2C728&ssl=1

That installs Ollama as a dependency in package.json.

Basic CLI example

At this point, we can start writing code. When we used the web service earlier this week, we used the generate endpoint and provided model, prompt, and stream as parameters. We set the stream parameter to false so that it would return a single response object instead of a stream of objects. When using the javascript library, the stream parameter isn’t necessary because it returns a single response object by default. We still provide it with a model and a prompt, though.

If you run it from the terminal, the response will look familiar.

https://i0.wp.com/jws.news/wp-content/uploads/2024/04/Screenshot-2024-04-21-at-9.19.38%E2%80%AFAM.png?resize=1024%2C728&ssl=1

Basic Web Application Example

The output is very similar to the node-fetch example from earlier this week. Last week, when we looked at how to dockerize a node app, we output an array as an unordered list. Let’s see if we can replicate that result using the output from Ollama.

If you npm install express to install express, you can host a simple HTTP page at port 8080 and with the magic of JSON.parse() and a for loop, you can build your unordered list.

So, what does the output look like?

https://i0.wp.com/jws.news/wp-content/uploads/2024/04/Screenshot-2024-04-21-at-8.03.57%E2%80%AFPM.png?resize=1024%2C796&ssl=1

Every time you load the page, it makes a server-side API call to Ollama, gets a list of large cities in Wisconsin, and displays them on the website. The list is never the same (because of hallucinations) but that is another issue.

Have any questions, comments, etc? Please feel free to drop a comment, below.

https://jws.news/2024/how-to-write-a-javascript-app-that-uses-ollama/

joelanman, to programming
@joelanman@hachyderm.io avatar
andros, to emacs
@andros@hostux.social avatar

I publish a new article: «Creating desktop applications using the Emacs core»
https://programadorwebvalencia.com/creating-desktop-applications-using-the-emacs-core/

In summary, I can use Emacs to create GUIs with an Elisp backend.

mjgardner,

@andros @marcolas The point is your architecture is the same as , replacing embedded and running with embedded running .

So every app using it has all of ’s disadvantages:
• lowest-common-denominator obviously foreign to the host OS
• non-portable shims to integrate with host OS features
• an individually bespoke runtime consuming storage, memory, and compute as if it were a separate virtual machine

mjgardner,

@boo_ @andros I didn’t foresee anyone turning Google’s browser engine V8 (2008) into the server (, 2009) and desktop (, 2013) runtimes that ate the world, but here we are.

And Electron was originally developed for ’s text editor (2008) before they were acquired by in 2018, subsequently discontinued in favor of in 2022.

Don’t tell me what you can’t see happening if you don’t remember what already did

  • All
  • Subscribed
  • Moderated
  • Favorites
  • anitta
  • kavyap
  • cisconetworking
  • thenastyranch
  • magazineikmin
  • hgfsjryuu7
  • DreamBathrooms
  • InstantRegret
  • Youngstown
  • slotface
  • PowerRangers
  • Durango
  • everett
  • rosin
  • normalnudes
  • vwfavf
  • modclub
  • ethstaker
  • khanakhh
  • tacticalgear
  • ngwrru68w68
  • osvaldo12
  • mdbf
  • tester
  • cubers
  • Leos
  • GTA5RPClips
  • provamag3
  • All magazines