Play with nodejs
- Download npm with nodejs
- Download yarn
- TL;DR:
npm install --global yarn
- TL;DR:
- I don't know why Powershell cannot find
npmandyarn.
The project uses typescript with esmodule, which requires:
"type": "module"in package.json"module": "es2022"and optionally"esModuleInterop": truein tsconfig.json
When node or esbuild with esmodule, TypeScript's import statement needs to be altered as follows:
import a from './a->import a from './a.jsimport b from './bs->import a from './bs/index.js
When a.js is specified, TypeScript knows it is a.ts, but it still emits a.js in generated JavaScript code.
The project uses eslint to perform additional checking,
the common configuration is in packages/eslint-shared,
each package introduces configuration from this package with their own additional things.
The project uses vitest and ESBuild for testing and deployment.
- Copy any package to
packagefolder to create a new package. - Change folder name and
nameinpackage.json. yarn buildto build every packages.yarn testto run unit test instarter-vitest.yarn deployto deploystarter-lit-html.
Run the following packages in order for demo:
A TypeScript package with unit test in ESBuild.
npm run build and npm run test
An http server.
npm run build and npm run start and browse http://localhost:8080/.
An HTML page using lit-html as a browser side template.
npm run build and npm run deploy, you are able to use IIS to run starter-packages/starter-lit-html/lib/dist.
Download a website to a local folder.
npm run build and npm run start to download http://localhost:8080/ to starter-packages/starter-website-scraper/lib/dist.
It will be easier to do when IIS is hosting starter-lit-html.
At the end of the execution you are able to compare two different dist folders by yourself.