T2721 - migrate module-starter to esbuild

for those new commands, add also tsconfig.json src/back ans src/front? also the project has no sealgen installed

Just to make sure: T2721 is about module-starter – a repository we use when starting new libraries. It’s like sealious playground, but for small utils like tempstream. The repository is here: Module Starter · module-starter

from Login

“So we need to have the build and typecheck scripts running using raw eslint. You can use this commit for inspiration - it contains an esbuild.js script that gets most of the work done.”

which commit?

Sorry, forgot to paste 🤦‍♂

This commit - rPLAYc64a950746b6

1 Like

I would like to clarify some issues with project:

  1. I had a problem with installing dependencies, so I copied “dependencies” and “devDependencies” from your commit. but when I run npm install there is an errror:
 ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: module-starter@0.0.1
npm ERR! Found: esbuild@0.14.54
npm ERR! node_modules/esbuild
npm ERR!   dev esbuild@"^0.14.10" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer esbuild@"^0.19.4" from esbuild-sass-plugin@2.16.1
npm ERR! node_modules/esbuild-sass-plugin
npm ERR!   dev esbuild-sass-plugin@"^2.0.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
  1. module starter which script commands should run like in sealious? not start I guess, we don’t specify docker file yet. Also, in a diff comment you mentioned lint
"scripts": {
		"start": "docker-compose up -d db && node .",
		"typecheck:back": "tsc --noEmit -p src/back",
		"typecheck:front": "tsc --noEmit -p src/front",
		"build": "node ./esbuild.js",
		"watch": "multiple-scripts-tmux \"npm run typecheck:back --watch\"  \"SEALIOUS_PORT=$SEALIOUS_PORT SEALIOUS_BASE_URL=$SEALIOUS_BASE_URL nodemon --enable-source-maps .\" \"npm run build -- --watch\" \"npm run typecheck:front --watch\" ",
		"test": "mocha",
		"prepare": "npm run build",
		"clean-coverage": "rm -rf coverage .nyc_output .xunit",
		"coverage": "npm run clean-coverage && nyc mocha",
		"test-reports": "npm run clean-coverage && nyc --reporter clover mocha --reporter xunit --reporter-option output=.xunit",
		"coverage-html": "npm run test-reports && nyc report --reporter lcov && xdg-open coverage/lcov-report/index.html"
	},

You can remove the sass plugin from dependencies - we won’t be building scss in this project. Let’s focus only on building TS in the scope of this task.

Not sure I understand the question. What do you mean “to run like in sealious”? The goal of module starter is to have a quick foundation for creating libraries - ones that may not have a “start” entrypoint.

1 Like

so I added esbuild, some dependencies and script commands. But how the project should work? Should I add some tests , or server to run on 8080 port? How to verify if migration is successfull?

Here are some checks you can run:

  1. npm install && npm run build don’t throw errors
  2. You can put some TS code in src dir and after running npm run build it appears in the lib directory as transpiled js files, ready to run.
  3. Adding a console.log to src/index.ts, building, and then running node . should run that console.log
  4. Changes to types in src should be reflected in .d.ts files in the @types directory. Add a method to the Example class in index.ts. Run build. Does the new method appear in the @types directory?
  5. npm run test passes with output ending with:
  Example
    example
      âś” should equal 'example'


  1 passing (5ms)

Remember that module-starter is a bare-bones template for starting a typescript library or a small project, that might not use an HTTP server

so at least partially it works so far :slight_smile: i will check this all

1 Like

D1390 to cr

1 Like

Ready to land!

1 Like