Svelte 3.52 and Typescript - svelte-3

Does anyone know how to run Typescript with Svelte 3.52?
It was bat file, but it wasn't anymore. Is it possible?

You should use svelte-ts instead svelte.
npm create vite#latest myapp -- --template svelte-ts

Related

How to run electron-packager offline without internet?

I have an Angular project. I want to convert him to Desktop application. For this i use Electron.js.
I can run
electron .
It works fine.
But now i want to make an exe.
For this i want to use electron-packager.
The problem:
I run:
electron-packager . --platform=win32
The error:
getaddrinfo EAI_AGAIN github.com
I understand that electron-packager needs github, but how to solve it?! Again i work offline(with jfrog artifactory) without internet.
Is there another electron package which can do the same without internet? (make an exe)
The problem is that electron-packager go to github.com to download electron.js.
So as #Alexander Leithner said to use electronZipDir option. (and also malept in electron channel in Discord)
The solution is simple, when you executed:
npm install electron
A zip file of the binaries of electron are cached in your computer.
The command for electron-packager looks like this:
npm install -D electron-packager
npx electron-packager . -- platform=win32 --electronZipDir=C:/Users/baruc/AppData/Local/electron/Cache/**some long string**
Thats all
Edit 25/7/2021
Theoretically, electron-packager has an option called "download" which you can pass to him a "cacheRoot" or "mirrorOptions" to download the electron.zip file.
By default you dont need to change the cacheRoot, but unfortunately both options of the download didnt work for me.
BTW, mirrorOptions got an object, not a string. So its not clear how to pass an object from the command line.
I saw that in the file artifact-utils.js of the #electron/get library, and there in the function called "mirrorVar" it search a special environment variables or the mirrorOptions which i tell before. If this function wont find them it will take the default which is github.
Solution when you have an artifactory:
Create in your project an .npmrc file and write there:
ELECTRON_MIRROR="http://my mirror site/electron/"
Be aware that it end with back slash.
Go to package.json file, and there to scripts write:
"pac": "electron-packager -- . --platform=win32"
3.execute it: npm run pac

D3 + VueJs + Typescript | How to import D3.js Library?

I have to create a Dashboard for my customer using VueJS + Typescript and D3.js.
They are using dotnet vue template: 'dotnet new –install Microsoft.AspNetCore.SpaTemplates::*' 'dotnet new vue'
Everything is setup on installation: Webpack, Typescript and VueJS
This Webpack setup does not accept <script lang="ts"></script> and most of the tutorials uses it to import D3.js library.
Is there any way to reconfigure webpack in this template to accept <script lang="ts"></script>?
Error after I install d3 and d3 typings
Best
I don't know why would you like to use <script> instead of the typical npm based approach. There are many examples/tutorial in the Internet on that topic. Normally, what you do is a few steps:
Install d3 as npm dependency: npm install --save d3
Since you're writing code in TypeScript, it's helpful to get some type support: npm install --save-dev #types/d3
In your typescript file import the types by adding the next line at the very top of it: import * as d3 from "d3";
Use it. d3.select(...)

How do I produce a node module using dotnet-fable

I have a project that I've created with dotnet fable new -n ProjectName and if I run it with webpack server everything works as expected. However I want to create an Express server. For that I thought I would simply create a node module and then run that. But when I look at the help text from dotnet fable --help I can't find a way to tell fable to just compile the js and to let me chose where those files should be placed. So question how do I tell dotnet-fable to produce js files (and do nothing else).
p.s. using the fable-cli results in a null reference (likely due to the project file structure) which is why I haven't just used that
I just wrestled with the same thing. When using the fable template, dotnet fable npm-run build just builds JS files for me. Try removing the devServer section from webpack.config.js, and changing your "start" script in package.json to say webpack && node bundle.js. (The devServer feature in webpack starts up its own simple express.js backend - something I just learned while building my own fable express app)

Compile and build chromium browser for electron

So I am developing an electron application. I know electron is running a chromium browser in its core.
One of the use cases I am currently working on involves changing the source code of Chromium. I have cloned the Chromium project and made the changes. Now is it possible to use my version of Chromium to build my electron application?
If yes, how can I do it? If no, what are the alternatives?
So I had to basically rebuild the entire electron code.
Get the libchromium source from here
To modify the code in content module of electron we have to write a patch in libchromium/patches.
And then build libchromiumcontent :
./scripts/bootstrap
./scripts/update
Compile and package libchromiumcontent with the following commands:
./script/build
./script/create-dist
After the build is done, take note of the hash from the libchromiumcontent commit that includes your patch and perform the following commands, replacing your operating system and architecture as appropriate:
# Use either win|linux|osx to reference the platform
mkdir -p osx/x64/<commit>
mv libchromiumcontent* osx/x64/<commit>
And then build Electron with our custom libchromiumcontent :
Clone electron if you have not done already
git clone https://github.com/atom/electron && cd electron
Bootstrap Electron with our custom libchromiumcontent:
./script/bootstrap.py -v --url file:///path/to/libchromiumcontent
And finally build Electron:
./script/build.py -c D

yeoman generator creating files in home directory

I am using the yeoman angular generator https://github.com/yeoman/generator-angular#readme. I am following the instructions to install using the command npm install -g grunt-cli bower yo generator-karma generator-angular and then created a directory inside which I run the command yo angular myApp but the files are generated inside the home directory i.e ~/ The only directory I see inside angular-app is only the node_modules. Please help me understand where I am going wrong and how to fix this.
Found the answer after hours of searching on internet. The Gruntfile.js was in the home directory and it was referring to it. I deleted the file inside my home directory and all of it started working again. Here is the link, which might be useful if someone face the same issue - Link

Resources