Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(compat): update patch for typescript 4.4 #3297

Merged
merged 10 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
230 changes: 127 additions & 103 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion .yarn/sdks/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript",
"version": "4.3.2-sdk",
"version": "4.4.1-rc-sdk",
"main": "./lib/typescript.js",
"type": "commonjs"
}
25 changes: 25 additions & 0 deletions .yarn/versions/93771db7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
releases:
"@yarnpkg/cli": minor
"@yarnpkg/plugin-compat": minor

declined:
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-exec"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- vscode-zipfs
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
- "@yarnpkg/pnp"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"jest-junit": "^10.0.0",
"micromatch": "^4.0.2",
"tslib": "^1.13.0",
"typescript": "^4.3.2"
"typescript": "^4.4.1-rc"
},
"resolutions": {
"yoga-layout-prebuilt": "patch:[email protected]#./.yarn/patches/yoga-layout-prebuilt.patch"
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"typedoc": "next",
"typedoc-neo-theme": "^1.0.7",
"typedoc-plugin-yarn": "portal:./typedoc-plugin-yarn",
"typescript": "^4.3.2",
"typescript": "^4.4.1-rc",
"unescape-html": "^1.1.0",
"unfetch": "^4.1.0",
"unified": "^7.1.0",
Expand Down
132 changes: 78 additions & 54 deletions packages/plugin-compat/extra/typescript/gen-typescript-patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,71 @@ const IGNORED_VERSIONS = new Set([
`3.3.3333`,
]);

const SLICES = [{
from: `5d50de3`,
to: `426f5a7`,
onto: `e39bdc3`,
range: `>=3.2 <3.5`,
}, {
from: `5d50de3`,
to: `426f5a7`,
onto: `cf7b2d4`,
range: `>=3.5 <=3.6`,
}, {
from: `5d50de3`,
to: `426f5a7`,
onto: `cda54b8`,
range: `>3.6 <3.7`,
}, {
from: `5d50de3`,
to: `2f85932`,
onto: `e39bdc3`,
range: `>=3.7 <3.9`,
}, {
from: `5d50de3`,
to: `3af06df`,
onto: `551f0dd`,
range: `>=3.9 <4.0`,
}, {
from: `6dbdd2f`,
to: `6dbdd2f`,
onto: `56865f7`,
range: `>=4.0 <4.1`,
}, {
from: `746d79b`,
to: `746d79b`,
onto: `69972a3`,
range: `>=4.1 <4.2`,
}, {
from: `8e0e870`,
to: `58bf162`,
onto: `bfc55b5`,
range: `>=4.2 <4.3`,
}, {
from: `ef7f019`,
to: `ef7f019`,
onto: `28e3e6f`,
range: `>=4.3`,
}];
const SLICES = [
{
from: `5d50de3`,
to: `426f5a7`,
onto: `e39bdc3`,
range: `>=3.2 <3.5`,
},
{
from: `5d50de3`,
to: `426f5a7`,
onto: `cf7b2d4`,
range: `>=3.5 <=3.6`,
},
{
from: `5d50de3`,
to: `426f5a7`,
onto: `cda54b8`,
range: `>3.6 <3.7`,
},
{
from: `5d50de3`,
to: `2f85932`,
onto: `e39bdc3`,
range: `>=3.7 <3.9`,
},
{
from: `5d50de3`,
to: `3af06df`,
onto: `551f0dd`,
range: `>=3.9 <4.0`,
},
{
from: `6dbdd2f`,
to: `6dbdd2f`,
onto: `56865f7`,
range: `>=4.0 <4.1`,
},
{
from: `746d79b`,
to: `746d79b`,
onto: `69972a3`,
range: `>=4.1 <4.2`,
},
// https://github.com/merceyz/TypeScript/tree/merceyz/pnp-4.2
{
from: `8e0e8703b9c95013aec7819e4593d099cdf7763a`,
to: `545d5a8c5409dac447a668d4e7d315702fd115d6`,
onto: `bfc55b5762443c37ecdef08a3b5a4e057b4d1e85`,
range: `>=4.2 <4.3`,
},
// https://github.com/merceyz/TypeScript/tree/merceyz/pnp-4.3
{
from: `530aad19e4ac19d35cb6b200168c91ce86cb0050`,
to: `6d7d4d2ce0df8e65a2c86a20c014c053ef530ea3`,
onto: `28e3e6ff2f49f1dbf06d31809ec73dbe42f1aa63`,
range: `>=4.3 <4.4`,
},
// https://github.com/merceyz/TypeScript/tree/merceyz/pnp-4.4
{
from: `0fc83b4d571df33a3c40c20c0eba68965fb52aca`,
to: `10a61d069439e79c07890b519caf2cb7f3b6abdf`,
onto: `55dd850009603aafa6ef8cc88020fa30d217d5b6`,
range: `>=4.4`,
},
];

async function fetch(url) {
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -172,6 +191,7 @@ async function cloneRepository() {
if (!fs.existsSync(TS_REPO)) {
await execFile(`git`, [`clone`, `https://github.com/arcanis/typescript`, TS_REPO]);
await execFile(`git`, [`remote`, `add`, `upstream`, `https://github.com/microsoft/typescript`], TS_REPO_SPAWN);
await execFile(`git`, [`remote`, `add`, `upstream2`, `https://github.com/merceyz/typescript`], TS_REPO_SPAWN);
}

try {
Expand All @@ -183,6 +203,7 @@ async function cloneRepository() {

await execFile(`git`, [`fetch`, `origin`], TS_REPO_SPAWN);
await execFile(`git`, [`fetch`, `upstream`], TS_REPO_SPAWN);
await execFile(`git`, [`fetch`, `upstream2`], TS_REPO_SPAWN);
}

async function resetGit(hash) {
Expand Down Expand Up @@ -267,21 +288,24 @@ async function run({from, to, onto, range}) {
}

async function validate(version, patchFile) {
const code = Math.floor(Math.random() * 0x100000000).toString(16).padStart(8, `0`);
const tmpDir = path.join(TMP_DIR, `${code}`);

const data = await fetch(`https://registry.yarnpkg.com/typescript/-/typescript-${version}.tgz`);
const tarball = path.join(tmpDir, `typescript.tgz`);
const tmpDir = path.join(TMP_DIR, `v${version}`);
const tarball = path.join(tmpDir, `package.tgz`);

await fs.promises.mkdir(tmpDir, {recursive: true});
await fs.promises.writeFile(tarball, data);

if (!fs.existsSync(tarball)) {
const data = await fetch(`https://registry.yarnpkg.com/typescript/-/typescript-${version}.tgz`);
await fs.promises.writeFile(tarball, data);
}

if (!fs.existsSync(path.join(tmpDir, `package`)))
await execFile(`tar`, [`xvf`, tarball], {cwd: tmpDir});

let patch = await fs.promises.readFile(patchFile, `utf8`);
patch = patch.replace(/^semver .*\n/gm, ``);
await fs.promises.writeFile(path.join(tmpDir, `patch.diff`), patch);

await execFile(`tar`, [`xvf`, tarball], {cwd: tmpDir});
await execFile(`git`, [`apply`, `../patch.diff`], {cwd: path.join(tmpDir, `package`)});
await execFile(`git`, [`apply`, `--check`, `../patch.diff`], {cwd: path.join(tmpDir, `package`)});
}

async function main() {
Expand Down
Loading