Back to Script-Block,
I have recent memories of very regular python practices like:
I think you are conflating server-side with client-side.
Think of Script Blocks as client-side script running in the browser. In contrast Custom Blocks are server-bound; they are literally installed much like a server plugin would be installed into Apache, or ElasticSearch. As such, you will not soon see an ability to use NPM or NodeJS packages in Script Blocks.
Despite your recollection of a Python development environment on your PC, it is your PC that is playing the role of server. You install the scripting engine, then embellish it with packages, and then you execute the code. NodeJS works much the same and blends nicely when developing Custom Blocks on your local system and which can be deployed for use in Airtable.
In some cases you can use other script libraries, especially minified since there’s a ceiling on the size of script block code. You would just include it at the bottom of the block. How you execute it is dependent upon each library.
Best advice - unless your script blocks are simple utilities with the primary intent of manipulating data, best you move over to custom blocks to meet your development requorements.
I’d like to think that I’m not at that point anymore, but I tried to compact my words by writing in English, which is not my mother language, to the point of making this confusion appear in what I published.
Your explanations clarify me better on the role of Custom Block versus Script Block!
I will certainly seriously come back this Custom Block step, but I have not yet entered very deeply into it.
It still appears to me as a big challenge to raise because if I had well understood some previous readings in this section, the entirety of my Script (for Script-Block) is considered a Function ?
So I should understand how to “Functionalize” a whole external js code which was not necessarily designed this way ?
I very much appreciate your interventions here, your help.
Well, that’s difficult to assess because every library is designed differently. Some are function libraries and others may be class libraries. I think you have to assess these on a case-by-case basis and build your own wrappers or modify the library itself to get it to work in a script block.
But to be clear, most external libraries are likely too big to run in script blocks anyway, so if you have a deep need or dependence on them for your scripting solutions, it’s probably wise to move into a full-fledge development approach using Custom Blocks.
No. A script block is a script that may (or may not) contain functions; it is simply a program that starts on the first line and executes thereafter. It’s important to make the distraction that like other scripting environments for the web, it is a non-blocking script model which necessitates careful use of await and other asynchronous underpinnings.