From 0bd81958bb9625fa964342238293406face99310 Mon Sep 17 00:00:00 2001 From: Tony Coconate Date: Tue, 26 Mar 2024 12:57:46 -0400 Subject: [PATCH] build: test on node 18 (#866) --- .github/workflows/ci.yaml | 12 ++++++------ .github/workflows/release.yaml | 2 +- package-lock.json | 13 +------------ package.json | 8 +------- src/init.ts | 6 +++--- src/util.ts | 2 -- 6 files changed, 12 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5739dbfd..1e47eb1d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,6 @@ on: push: - branches: [ $default-branch ] + branches: [$default-branch] pull_request: name: ci jobs: @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - node: [14, 16, 18] + node: [14, 16, 18, 20, 21] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - uses: actions/setup-node@v4 @@ -29,7 +29,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 20 - run: npm ci - run: npm run system-test system_test: @@ -38,7 +38,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 20 - run: npm ci - run: npm run system-test lint: @@ -47,7 +47,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 20 - run: npm ci - run: npm run lint license_check: @@ -56,6 +56,6 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 20 - run: npm ci - run: npm run license-check diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0386dbb7..22eda9c0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 20 registry-url: 'https://wombat-dressing-room.appspot.com' - run: npm ci - run: npm publish diff --git a/package-lock.json b/package-lock.json index bdd4b9d1..23b15bbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,6 @@ "@types/mocha": "^10.0.0", "@types/ncp": "^2.0.4", "@types/node": "20.11.30", - "@types/prettier": "^3.0.0", "@types/rimraf": "^3.0.0", "@types/sinon": "^17.0.0", "@types/tmp": "^0.2.0", @@ -54,7 +53,7 @@ "typescript": "~5.4.3" }, "engines": { - "node": ">=14" + "node": ">=18" }, "peerDependencies": { "typescript": ">=3" @@ -620,16 +619,6 @@ "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==" }, - "node_modules/@types/prettier": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-3.0.0.tgz", - "integrity": "sha512-mFMBfMOz8QxhYVbuINtswBp9VL2b4Y0QqYHwqLz3YbgtfAcat2Dl6Y1o4e22S/OVE6Ebl9m7wWiMT2lSbAs1wA==", - "deprecated": "This is a stub types definition. prettier provides its own type definitions, so you do not need this installed.", - "dev": true, - "dependencies": { - "prettier": "*" - } - }, "node_modules/@types/responselike": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.3.tgz", diff --git a/package.json b/package.json index 8493a08d..f0680d6b 100644 --- a/package.json +++ b/package.json @@ -34,12 +34,7 @@ "engines": { "node": ">=14" }, - "keywords": [ - "typescript", - "linter", - "formatter", - "google" - ], + "keywords": ["typescript", "linter", "formatter", "google"], "author": "Google Inc.", "license": "Apache-2.0", "dependencies": { @@ -69,7 +64,6 @@ "@types/mocha": "^10.0.0", "@types/ncp": "^2.0.4", "@types/node": "20.11.30", - "@types/prettier": "^3.0.0", "@types/rimraf": "^3.0.0", "@types/sinon": "^17.0.0", "@types/tmp": "^0.2.0", diff --git a/src/init.ts b/src/init.ts index a0a2d945..dd813ded 100644 --- a/src/init.ts +++ b/src/init.ts @@ -19,12 +19,12 @@ import * as inquirer from 'inquirer'; import * as path from 'path'; import {ncp} from 'ncp'; import * as util from 'util'; +import * as writeFileAtomic from 'write-file-atomic'; import { getPkgManagerCommand, readFilep as read, readJsonp as readJson, - writeFileAtomicp as write, Bag, DefaultPackage, } from './util'; @@ -168,7 +168,7 @@ async function writePackageJson( ): Promise { options.logger.log('Writing package.json...'); if (!options.dryRun) { - await write('./package.json', formatJson(packageJson)); + await writeFileAtomic('./package.json', formatJson(packageJson)); } const preview = { scripts: packageJson.scripts, @@ -216,7 +216,7 @@ async function generateConfigFile( if (writeFile) { options.logger.log(`Writing ${filename}...`); if (!options.dryRun) { - await write(filename, contents); + await writeFileAtomic(filename, contents); } options.logger.log(contents); } diff --git a/src/util.ts b/src/util.ts index 28c19287..dc44df18 100644 --- a/src/util.ts +++ b/src/util.ts @@ -19,12 +19,10 @@ import * as path from 'path'; import * as rimraf from 'rimraf'; import {promisify} from 'util'; import * as ncp from 'ncp'; -import * as writeFileAtomic from 'write-file-atomic'; import * as JSON5 from 'json5'; export const readFilep = promisify(fs.readFile); export const rimrafp = promisify(rimraf); -export const writeFileAtomicp = promisify(writeFileAtomic); export const ncpp = promisify(ncp.ncp); export interface Bag {