Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into np/feat/abi-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
nedsalk committed Dec 12, 2024
2 parents ed95764 + 5ec254d commit bff8061
Show file tree
Hide file tree
Showing 14 changed files with 138 additions and 99 deletions.
4 changes: 4 additions & 0 deletions .changeset/lucky-flies-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

chore: release deprecation script
6 changes: 6 additions & 0 deletions .changeset/proud-spoons-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@fuel-ts/versions": patch
"@internal/forc": patch
---

chore: updated forc version to `0.66.5`
29 changes: 29 additions & 0 deletions .github/workflows/release-deprecate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Deprecate Old Versions"

on:
workflow_dispatch:
inputs:
deprecate_versions:
type: boolean
description: Deprecate versions? Otherwise dry-run mode will be used.
default: false

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
deprecate-npm-versions:
name: Deprecate versions next, pr and rc
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- name: Checkout
uses: actions/checkout@v4

- name: CI Setup
uses: ./.github/actions/ci-setup

- name: Deprecate
run: pnpm release:deprecate
env:
DEPRECATE_VERSIONS: ${{ github.event.inputs.deprecate_versions }}
28 changes: 0 additions & 28 deletions .github/workflows/release-unpublish.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion internal/forc/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.66.4
0.66.5
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"changeset:update-changelog": "tsx ./scripts/changeset/update-changelog.mts",
"changeset:get-latest-release": "tsx ./scripts/changeset/get-latest-release.mts",
"changeset:dependabot": "./scripts/changeset/dependabot-changeset.sh",
"release:deprecate": "tsx ./scripts/release-deprecate.ts",
"forc:update": "tsx ./scripts/forc-update",
"forc:check": "./scripts/forc-check.sh",
"forc:format": "./scripts/forc-format.sh",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,17 @@ const abi = {
{
"name": "SHOULD_RETURN",
"concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903",
"offset": 2776
"offset": 2816
},
{
"name": "AN_OPTION",
"concreteTypeId": "2da102c46c7263beeed95818cd7bee801716ba8303dddafdcd0f6c9efda4a0f1",
"offset": 2752
"offset": 2792
},
{
"name": "A_GENERIC_STRUCT",
"concreteTypeId": "71df88006611ffff852cf617defb70f77adaf507305088cedd41d276c783aab0",
"offset": 2768
"offset": 2808
}
]
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ const abi = {
{
"name": "FEE",
"concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b",
"offset": 920
"offset": 936
},
{
"name": "ADDRESS",
"concreteTypeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b",
"offset": 888
"offset": 904
}
]
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const abi = {
{
"name": "SHOULD_RETURN",
"concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903",
"offset": 760
"offset": 768
}
]
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
contract;

mod data_structures;
mod equality;
mod utils;
pub mod data_structures;
pub mod equality;
pub mod utils;

use data_structures::*;
use equality::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ impl MyContract for Contract {
}

fn compute_predicate_address(bytecode: Vec<u8>) -> Address {
return Address::from(0x68fec7a57e48f4ec6467d7e09c27272bd8ca72b312ea553a470b98731475ccf3);
return Address::from(0x190c849d8d5fdc0ad9e87cdfa02dde8b4414cacb34ae277a49ec057e67b04c01);
}
}
2 changes: 1 addition & 1 deletion packages/versions/src/lib/getBuiltinVersions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Versions } from './types';

export function getBuiltinVersions(): Versions {
return {
FORC: '0.66.4',
FORC: '0.66.5',
FUEL_CORE: '0.40.1',
FUELS: '0.97.1',
};
Expand Down
86 changes: 86 additions & 0 deletions scripts/release-deprecate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { compare } from 'compare-versions';
import { exec } from 'node:child_process';
import { readFileSync, readdirSync } from 'node:fs';
import { join } from 'node:path';

const { log, error } = console;

const deprecateTags = /next|pr|rc/;
const { version: currentVersion } = JSON.parse(
readFileSync(join(process.cwd(), '/packages/fuels/package.json')).toString()
);
const deprecateVersions = process.env.DEPRECATE_VERSIONS === 'true';

const getPublicPackages = () => {
const packagesDir = join(__dirname, '../packages');
const packages = readdirSync(packagesDir, { withFileTypes: true });
const packagesNames = packages.map((p) => {
try {
const packageContent = readFileSync(join(packagesDir, p.name, 'package.json'), 'utf8');
const packageJson = JSON.parse(packageContent.toString());
return packageJson.private ? null : packageJson.name;
} catch (err) {
return null;
}
});
return packagesNames.filter((p) => !!p);
};

const getVersionsToDeprecate = async (packageName: string) => {
const { versions } = await fetch(`https://registry.npmjs.org/${packageName}`).then((resp) =>
resp.json()
);

// Only deprecate certain tags
const validVersions = Object.keys(versions).filter(
(version) => version.search(deprecateTags) > -1 && !compare(version, currentVersion, '>=')
);

// Remove the latest next tag from the deprecation list
const latestNextVersion = validVersions.filter((version) => version.search('next') > -1).pop();
return validVersions.filter((version) => version !== latestNextVersion);
};

const main = async () => {
const packages = getPublicPackages();
await Promise.allSettled(
packages.map(async (packageName) => {
const versionsToDeprecate = await getVersionsToDeprecate(packageName);

log('The following versions will be deprecated:');
log(versionsToDeprecate.map((v) => ` - ${v}`).join('\n'));

if (deprecateVersions) {
await Promise.allSettled(
versionsToDeprecate.map(
async (versionToDelete) =>
new Promise((resolve, reject) => {
exec(
`npm deprecate ${packageName}@${versionToDelete} "Version no longer supported."`,
(err, _stdout, stderr) => {
if (err) {
log(`❌ Error ${packageName}@${versionToDelete} not deprecated!\n`);
reject(err);
return;
}
if (stderr) {
log(`❌ Error ${packageName}@${versionToDelete} not deprecated!\n`);
reject(new Error(stderr));
return;
}
log(`✅ Package ${packageName}@${versionToDelete} deprecated!\n`);
resolve(true);
}
);
})
)
);
}
})
);
};

main().catch((err) => {
error(err);
process.exit(1);
});
59 changes: 0 additions & 59 deletions scripts/release-unpublish.js

This file was deleted.

0 comments on commit bff8061

Please sign in to comment.