#Improve deno tasks by integrating wireit

1 messages · Page 1 of 1 (latest)

stoic plover
#

We learned a lot from node/npm and the value of npm tasks. Ultimately it won over the other tasks managers because a lot of the work was moved over to bundlers (webpack and now vite) but as we add more code and moved to mono repo tooling we still need a bit more advanced task management features we lost.

Wireit developed by Google shows us yet another example of providing everything we learned from mono repo tooling and caching tasks. And I propose we increase the scope of deno tasks to merge this api. And can technically be backwards compatible by simply adding an object or not

{
"tasks": {
"build": "tsc",
"bundle: {
"command": "rollup -c",
"dependencies": ["build"]
}
}
}

https://github.com/google/wireit

GitHub

Wireit upgrades your npm/pnpm/yarn scripts to make them smarter and more efficient. - google/wireit

frail cargo
#

This is such a neat idea!

I'm not a fan of the wireit api, but having deps would already be an enormous improvement!

{
  "tasks": {
    "deps": "tsc",
    "bundle": {
      "command": "rollup -c",
      "deps": ["build"]
    }
  }
}
stoic plover
#

yeah if we only get that I think that will be huge

what about this

{
  "tasks": {
    "fmt: "deno fmt",
    "lint": "deno lint",
    "build": "tsc",
    "bundle": {
      "task": "rollup -c",
      "deps": ["build"]
    }
  }
}

I want to keep it the same but let anyone progressively upgrade once they need that requirement

#

here's an example of my npm tasks for one project

  "scripts": {
    "------- NODE VERSION -------": "",
    "__NODE_VERSION_CHECK__": "node -e \"if (parseInt(process.versions.node.split('.')[0]) < 20) { console.error('Node.js version 20.17.0 or higher is required.'); process.exit(1); }\"",
    "__PACKAGE_LOCK_CHECK__": "node -e \"const fs = require('fs'); fs.access('scripts/sharp.mjs', fs.constants.F_OK, (err) => { if (!err) { require('child_process').execSync('node --disable-warning=ExperimentalWarning scripts/sharp.mjs', { stdio: 'inherit' }); } });\"",
    "preinstall": "npm run __NODE_VERSION_CHECK__",
    "postinstall": "npm run __PACKAGE_LOCK_CHECK__",
    "predev": "npm run __NODE_VERSION_CHECK__",
    "prestart": "npm run __NODE_VERSION_CHECK__",
    "------- BUILD SCRIPTS -------": "",
    "build": "qwik build",
    "build.client": "node --env-file=.env ./node_modules/.bin/vite build",
    "build.preview": "node --env-file=.env ./node_modules/.bin/vite build --ssr src/entry.preview.tsx",
    "build.serverless": "node --env-file=.env ./node_modules/.bin/vite build -c adapters/lambda/vite.config.ts",
    "build.lambda": "npm run clean && npm run build.client && npm run build.serverless",
    "build.hono": "node --env-file=.env ./node_modules/.bin/vite build --ssr src/entry_aws-ecs.tsx",
    "build.ecs": "npm run clean && npm run build.client && npm run build.hono",
    "build.all": "npm run clean && npm run build.client",
    "clean": "npx rimraf dist",
    "ci.prebuild": "node scripts/remove-ci-mode-comment.mjs",
    "------- DEPLOYMENT SCRIPTS -------": "",
    "predeploy": "npm rum build.all",
    "deploy": "aws s3 cp dist/ s3://${VITE_S3_BUCKET_PATH}/${VITE_S3_FOLDER_PATH} --recursive",
    "deploy.folder": "node --env-file=.env -e \"console.log('my folder:', process.env.VITE_S3_BUCKET_PATH + '/' + process.env.VITE_S3_FOLDER_PATH)\"",
    "------- DEVELOPMENT SCRIPTS -------": "",
    "dev": "DEV_MODE=true VITE_CJS_TRACE=true node --env-file=.env ./node_modules/.bin/vite --host --mode ssr",
    "prelocal.lambda": "cp index.mjs dist",
    "local": "npm run local.lambda",
    "local.hono": "PORT=3008 npm run start.hono",
    "local.lambda": "node --env-file=.env ./local-lambda.mjs",
    "serve": "npm run build.lambda && node --env-file=.env ./node_modules/.bin/serverless offline",
    "dev.debug": "node --inspect-brk ./node_modules/.bin/vite --mode ssr --force",
    "------- RUN SCRIPTS -------": "",
    "start.hono": "node --env-file=.env ./dist/server/entry_aws-ecs.js",
    "------- FORMATTING & LINTING -------": "",
    "fmt": "prettier --write .",
    "fmt.check": "prettier --check .",
    "lint": "eslint \"src/**/*.ts*\"",
    "lint.fix": "eslint \"src/**/*.ts*\" --fix",
    "types": "tsc --incremental --noEmit",
    "------- PREVIEW  -------": "",
    "preview": "npm run build.preview && node --env-file=.env ./node_modules/.bin/vite preview --host --open",
    "start": "node --env-file=.env ./node_modules/.bin/vite --open --mode ssr",
    "------- TESTING -------": "",
    "test": "node --env-file=.env ./node_modules/.bin/vite components --run",
    "test.type.e2e": "npm run types && npm run test.e2e",
    "test.e2e": "node --env-file=.env ./node_modules/.bin/playwright test",
    "test.e2e.ui": "node --env-file=.env ./node_modules/.bin/playwright test --ui",
    "test.report": "node --env-file=.env ./node_modules/.bin/playwright show-report",
    "test.unit": "node --env-file=.env ./node_modules/.bin/vite components",
    "test.vitest": "node --env-file=.env ./node_modules/.bin/vitest",
    "test.unit.ui": "node --env-file=.env ./node_modules/.bin/vite --ui components",
    "------- MISC SCRIPTS -------": "",
    "qwik": "node --env-file=.env ./node_modules/.bin/qwik",
    "-----------------------------": ""
  },

(some of the tasks are old or don't work anymore) yes I use fake tasks for comments otherwise how else do you organize these

stoic plover
#

well I guess the deno version is "tags", "options", "include" to match fmt/lint configs

merry zealot
#

@stoic plover could you please open a feature request in Deno repo for this?

stoic plover
#

Oh yeah np. Someone mentioned to open it here. I’ll move it to GitHub

merry zealot