Skip to content

Commit

Permalink
feat: deps, Node 20.12+
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Jul 19, 2024
1 parent d2608af commit 6435132
Show file tree
Hide file tree
Showing 4 changed files with 434 additions and 368 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
if: "!contains(github.event.head_commit.message, 'skip ci')"
env: { NODE_OPTIONS: '--max-old-space-size=3200' }
steps:
- { uses: actions/checkout@v3, with: { persist-credentials: true } }
- { uses: actions/setup-node@v3, with: { node-version: 18, cache: 'yarn' } }
- { uses: actions/checkout@v4, with: { persist-credentials: true } }
- { uses: actions/setup-node@v4, with: { node-version: 'lts/*', cache: 'yarn' } }

# Cache for npm/npx in ~/.npm
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.npm
key: npm-v1-${{ runner.os }}
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "@naturalcycles/cli",
"scripts": {
"prepare": "husky install",
"prepare": "husky",
"debug": "tsn ./src/bin/tsn.ts",
"tsn-debug": "tsc && CLI_DEBUG=1 node ./dist/bin/tsn.js testscript.ts",
"tsn-debug-esbuild": "tsc && CLI_DEBUG=1 TSN_ESBUILD=1 node ./dist/bin/tsn.js testscript.ts"
},
"dependencies": {
"@naturalcycles/nodejs-lib": "^13.0.1",
"chalk": "^4.0.0",
"dotenv": "^16.0.0",
"ts-node": "^10.0.0",
"tslib": "^2.6.2",
Expand Down Expand Up @@ -39,7 +38,7 @@
"url": "https://github.com/NaturalCycles/cli"
},
"engines": {
"node": ">=18.12.0"
"node": ">=20.12.0"
},
"version": "1.2.5",
"description": "CLI utils to be installed globally via 'npm i -g'",
Expand Down
24 changes: 20 additions & 4 deletions src/bin/tsn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Symbol.asyncDispose ??= Symbol('Symbol.asyncDispose')

import fs from 'node:fs'
import path from 'node:path'
import { styleText } from 'node:util'
import type nodejsLib from '@naturalcycles/nodejs-lib'
import c from 'chalk'

const projectDir = path.join(__dirname, '../..')
const cfgDir = `${projectDir}/cfg`
Expand Down Expand Up @@ -103,7 +103,7 @@ function main(): void {
const { NODE_OPTIONS = 'not defined' } = process.env
const { node } = process.versions

console.log(`${c.dim.grey(`node ${node}, NODE_OPTIONS: ${NODE_OPTIONS}`)}`)
console.log(dimGrey(`node ${node}, NODE_OPTIONS: ${NODE_OPTIONS}`))

// Resolve path
const dotTS = scriptPathOriginal.endsWith('.ts')
Expand Down Expand Up @@ -131,7 +131,7 @@ function main(): void {
console.log(
[
'',
`${c.bold.red('tsn')} script not found: ${c.bold.white(scriptPathOriginal)}`,
`${boldRed('tsn')} script not found: ${boldWhite(scriptPathOriginal)}`,
'',
`cwd: ${cwd}`,
'',
Expand Down Expand Up @@ -173,8 +173,24 @@ function ensureProjectTsconfigScripts(): string {
outputDir: './scripts',
})

console.log(`${c.bold.grey('scripts/tsconfig.json')} file is automatically added`)
console.log(`${boldGrey('scripts/tsconfig.json')} file is automatically added`)
}

return projectTsconfigPath
}

function boldGrey(s: string): string {
return styleText(['bold', 'grey'], s)
}

function boldWhite(s: string): string {
return styleText(['bold', 'white'], s)
}

function boldRed(s: string): string {
return styleText(['bold', 'red'], s)
}

function dimGrey(s: string): string {
return styleText(['dim', 'grey'], s)
}
Loading

0 comments on commit 6435132

Please sign in to comment.