Skip to content

Commit 1c18b3a

Browse files
danielbankheadtonycoco
andauthoredOct 10, 2024··
feat!: Update typescript and other dependencies (#902)
* feat!: Update `typescript` and other dependencies * chore: `npm` types cleanup --------- Co-authored-by: Tony Coconate <[email protected]>
1 parent 1d28f92 commit 1c18b3a

File tree

4 files changed

+973
-320
lines changed

4 files changed

+973
-320
lines changed
 

‎package-lock.json

+954-301
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,30 +60,30 @@
6060
"write-file-atomic": "^4.0.0"
6161
},
6262
"devDependencies": {
63-
"@npm/types": "^1.0.1",
63+
"@npm/types": "^2.0.0",
6464
"@types/cross-spawn": "^6.0.2",
6565
"@types/eslint": "^8.0.0",
6666
"@types/fs-extra": "^11.0.0",
6767
"@types/inquirer": "^8.0.0",
6868
"@types/json5": "2.2.0",
6969
"@types/mocha": "^10.0.0",
7070
"@types/ncp": "^2.0.4",
71-
"@types/node": "20.12.7",
71+
"@types/node": "^22.7.5",
7272
"@types/rimraf": "^3.0.0",
7373
"@types/sinon": "^17.0.0",
7474
"@types/tmp": "^0.2.0",
7575
"@types/write-file-atomic": "^4.0.0",
76-
"c8": "^9.0.0",
76+
"c8": "^10.1.2",
7777
"cross-spawn": "^7.0.3",
7878
"fs-extra": "^11.0.0",
7979
"inline-fixtures": "^1.1.0",
8080
"js-green-licenses": "^4.0.0",
8181
"mocha": "^10.0.0",
8282
"sinon": "^17.0.0",
8383
"tmp": "0.2.3",
84-
"typescript": "^5.4.3"
84+
"typescript": "^5.6.3"
8585
},
8686
"peerDependencies": {
87-
"typescript": ">=3"
87+
"typescript": ">=5.6.3"
8888
}
8989
}

‎src/init.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ import {
3030
} from './util';
3131

3232
import {Options} from './cli';
33-
import {PackageJson} from '@npm/types';
33+
import {PackageJSON} from '@npm/types';
3434
import chalk = require('chalk');
3535

3636
// eslint-disable-next-line @typescript-eslint/no-var-requires
3737
const pkg = require('../../package.json');
3838

3939
const ncpp = util.promisify(ncp);
4040

41-
const DEFAULT_PACKAGE_JSON: PackageJson = {
41+
const DEFAULT_PACKAGE_JSON: PackageJSON = {
4242
name: '',
4343
version: '0.0.0',
4444
description: '',
@@ -76,7 +76,7 @@ async function query(
7676
}
7777

7878
export async function addScripts(
79-
packageJson: PackageJson,
79+
packageJson: PackageJSON,
8080
options: Options
8181
): Promise<boolean> {
8282
let edits = false;
@@ -119,7 +119,7 @@ export async function addScripts(
119119
}
120120

121121
export async function addDependencies(
122-
packageJson: PackageJson,
122+
packageJson: PackageJSON,
123123
options: Options
124124
): Promise<boolean> {
125125
let edits = false;
@@ -163,7 +163,7 @@ function formatJson(object: {}) {
163163
}
164164

165165
async function writePackageJson(
166-
packageJson: PackageJson,
166+
packageJson: PackageJSON,
167167
options: Options
168168
): Promise<void> {
169169
options.logger.log('Writing package.json...');

‎test/test-init.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import * as assert from 'assert';
2020
import * as fs from 'fs';
2121
import * as path from 'path';
2222
import {accessSync} from 'fs';
23-
import {PackageJson} from '@npm/types';
23+
import {PackageJSON} from '@npm/types';
2424
import {withFixtures, Fixtures} from 'inline-fixtures';
2525
import {describe, it, beforeEach, afterEach} from 'mocha';
2626

@@ -41,7 +41,7 @@ const OPTIONS_NO = Object.assign({}, OPTIONS, {no: true});
4141
const OPTIONS_YARN = Object.assign({}, OPTIONS_YES, {yarn: true});
4242
const MINIMAL_PACKAGE_JSON = {name: 'name', version: 'v1.1.1'};
4343

44-
function hasExpectedScripts(packageJson: PackageJson): boolean {
44+
function hasExpectedScripts(packageJson: PackageJSON): boolean {
4545
return (
4646
!!packageJson.scripts &&
4747
['lint', 'clean', 'compile', 'fix', 'prepare', 'pretest', 'posttest'].every(
@@ -50,7 +50,7 @@ function hasExpectedScripts(packageJson: PackageJson): boolean {
5050
);
5151
}
5252

53-
function hasExpectedDependencies(packageJson: PackageJson): boolean {
53+
function hasExpectedDependencies(packageJson: PackageJSON): boolean {
5454
return (
5555
!!packageJson.devDependencies &&
5656
['gts', 'typescript'].every(d => !!packageJson.devDependencies![d])
@@ -69,7 +69,7 @@ describe('init', () => {
6969
});
7070

7171
it('addScripts should add a scripts section if none exists', async () => {
72-
const pkg: PackageJson = {...MINIMAL_PACKAGE_JSON};
72+
const pkg: PackageJSON = {...MINIMAL_PACKAGE_JSON};
7373
const result = await init.addScripts(pkg, OPTIONS);
7474
assert.strictEqual(result, true); // made edits.
7575
assert.ok(pkg.scripts);
@@ -86,7 +86,7 @@ describe('init', () => {
8686
pretest: 'fake run compile',
8787
posttest: 'fake run lint',
8888
};
89-
const pkg: PackageJson = {
89+
const pkg: PackageJSON = {
9090
...MINIMAL_PACKAGE_JSON,
9191
scripts: {...SCRIPTS},
9292
};
@@ -105,7 +105,7 @@ describe('init', () => {
105105
pretest: 'fake run compile',
106106
posttest: 'fake run lint',
107107
};
108-
const pkg: PackageJson = {
108+
const pkg: PackageJSON = {
109109
...MINIMAL_PACKAGE_JSON,
110110
scripts: {...SCRIPTS},
111111
};
@@ -115,7 +115,7 @@ describe('init', () => {
115115
});
116116

117117
it('addDependencies should add a deps section if none exists', async () => {
118-
const pkg: PackageJson = {...MINIMAL_PACKAGE_JSON};
118+
const pkg: PackageJSON = {...MINIMAL_PACKAGE_JSON};
119119
const result = await init.addDependencies(pkg, OPTIONS);
120120
assert.strictEqual(result, true); // made edits.
121121
assert.ok(pkg.devDependencies);
@@ -127,7 +127,7 @@ describe('init', () => {
127127
typescript: 'or the other',
128128
'@types/node': 'or another',
129129
};
130-
const pkg: PackageJson = {
130+
const pkg: PackageJSON = {
131131
...MINIMAL_PACKAGE_JSON,
132132
devDependencies: {...DEPS},
133133
};
@@ -139,7 +139,7 @@ describe('init', () => {
139139

140140
it('addDependencies should edit existing deps on yes', async () => {
141141
const DEPS = {gts: 'something', typescript: 'or the other'};
142-
const pkg: PackageJson = {
142+
const pkg: PackageJSON = {
143143
...MINIMAL_PACKAGE_JSON,
144144
devDependencies: {...DEPS},
145145
};

0 commit comments

Comments
 (0)
Please sign in to comment.