Skip to content

Commit

Permalink
chore(v8/deps): Deduplicate yarn.lock (#15094)
Browse files Browse the repository at this point in the history
The `use-ts-version` script was only ever used for TypeScript 3.8, so to
keep things simple, I copied back the entire script and its usage from
the `develop` branch.

---------

Co-authored-by: Abhijeet Prasad <[email protected]>
  • Loading branch information
nwalters512 and AbhiPrasad authored Jan 21, 2025
1 parent 8b870ba commit 5f47fbb
Show file tree
Hide file tree
Showing 5 changed files with 294 additions and 2,760 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,8 @@ jobs:
node_version: ${{ matrix.node == 14 && '14' || '' }}

- name: Overwrite typescript version
if: matrix.typescript
run: node ./scripts/use-ts-version.js ${{ matrix.typescript }}
if: matrix.typescript == '3.8'
run: node ./scripts/use-ts-3_8.js
working-directory: dev-packages/node-integration-tests

- name: Run integration tests
Expand Down
2 changes: 1 addition & 1 deletion .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = [
path: 'packages/browser/build/npm/esm/index.js',
import: createImport('init', 'browserTracingIntegration', 'replayIntegration'),
gzip: true,
limit: '68 KB',
limit: '68.5 KB',
modifyWebpackConfig: function (config) {
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
Expand Down
39 changes: 39 additions & 0 deletions dev-packages/node-integration-tests/scripts/use-ts-3_8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* eslint-disable no-console */
const { execSync } = require('child_process');
const { join } = require('path');
const { readFileSync, writeFileSync } = require('fs');

const cwd = join(__dirname, '../../..');

// Newer versions of the Express types use syntax that isn't supported by TypeScript 3.8.
// We'll pin to the last version of those types that are compatible.
console.log('Pinning Express types to old versions...');

const packageJsonPath = join(cwd, 'package.json');
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));

if (!packageJson.resolutions) packageJson.resolutions = {};
packageJson.resolutions['@types/express'] = '4.17.13';
packageJson.resolutions['@types/express-serve-static-core'] = '4.17.30';

writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));

const tsVersion = '3.8';

console.log(`Installing typescript@${tsVersion}, and @types/node@14...`);

execSync(`yarn add --dev --ignore-workspace-root-check typescript@${tsVersion} @types/node@^14`, {
stdio: 'inherit',
cwd,
});

console.log('Removing unsupported tsconfig options...');

const baseTscConfigPath = join(cwd, 'packages/typescript/tsconfig.json');

const tsConfig = require(baseTscConfigPath);

// TS 3.8 fails build when it encounters a config option it does not understand, so we remove it :(
delete tsConfig.compilerOptions.noUncheckedIndexedAccess;

writeFileSync(baseTscConfigPath, JSON.stringify(tsConfig, null, 2));
23 changes: 0 additions & 23 deletions dev-packages/node-integration-tests/scripts/use-ts-version.js

This file was deleted.

Loading

0 comments on commit 5f47fbb

Please sign in to comment.