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

chore: bump nightly versions #279

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions docs/guides/docs/quickstart/building-a-smart-contract.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ fuelup default latest
<CodeTabs>

```sh
pnpm create [email protected]
pnpm create fuels@0.82.0
```

```sh
npm create [email protected]
npm create fuels@0.82.0
```

</CodeTabs>
Expand Down
2 changes: 1 addition & 1 deletion docs/nightly/builds/sway
Submodule sway updated 4158 files
2 changes: 1 addition & 1 deletion docs/nightly/fuels-rs
Submodule fuels-rs updated 318 files
2 changes: 1 addition & 1 deletion docs/nightly/fuels-ts
Submodule fuels-ts updated 438 files
2 changes: 1 addition & 1 deletion docs/nightly/fuels-wallet
Submodule fuels-wallet updated 175 files
2 changes: 1 addition & 1 deletion docs/nightly/sway
Submodule sway updated 603 files
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"private": true,
"scripts": {
"build": "next build",
"build:ci": "run-s docs:clean docs:sync generate:* patch:wallet build",
"build:ci": "run-s docs:sync docs:clean generate:* patch:wallet build",
"build:content": "contentlayer build",
"check": "run-s lint",
"check:prod": "run-s lint:prod",
"copy:icons": "cp -r ./node_modules/@fuel-ui/icons/dist/icons/sprite.svg ./public/icons",
"deps:update": "updates -gu",
"dev": "./scripts/dev.sh",
"docs:clean": "sh ./scripts/clean-build-files.sh",
"docs:clean": "node ./scripts/clean-build-files.mjs",
"docs:sync": "sh ./scripts/sync-repos.sh",
"docs:update": "node scripts/update-nightly/index.mjs",
"docs:update:nightly": "node scripts/update-nightly/index.mjs --nightly",
Expand Down
114 changes: 114 additions & 0 deletions scripts/clean-build-files.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import fs from 'fs';
import path from 'path';

// List of directories to delete unused files from
const targetDirs = [
'./docs/sway',
'./docs/nightly/sway',
'./docs/builds/sway',
'./docs/nightly/builds/sway',
'./docs/fuels-rs',
'./docs/nightly/fuels-rs',
'./docs/fuels-ts',
'./docs/nightly/fuels-ts',
'./docs/fuels-wallet',
'./docs/nightly/fuels-wallet',
'./docs/fuel-graphql-docs',
'./docs/nightly/fuel-graphql-docs',
// './docs/fuel-core',
];

// Exclusions for each type of directory
const exclusions = {
sway: [
'sway/Cargo.toml',
'sway/forc-pkg',
'sway/sway-lib-std',
'sway/docs/book/src',
'sway/examples',
'sway/master/book',
'sway/test/src/sdk-harness/test_projects/run_external_proxy',
'sway/test/src/sdk-harness/test_projects/run_external_target',
],
fuels_rs: [
'fuels-rs/Cargo.toml',
'fuels-rs/docs',
'fuels-rs/examples',
'fuels-rs/packages',
'fuels-rs/e2e',
],
fuels_ts: [
'fuels-ts/apps',
'fuels-ts/packages',
'fuels-ts/package.json',
'fuels-ts/demo-wallet-sdk-react',
],
fuels_wallet: ['fuels-wallet/package.json', 'fuels-wallet/packages'],
// fuel_core: ['fuel-core/deployment/scripts/chainspec', 'fuel-core/Cargo.toml'],
fuel_graphql_docs: [
'fuel-graphql-docs/docs',
'fuel-graphql-docs/examples',
'fuel-graphql-docs/src',
],
};

function main() {
for (const targetDir of targetDirs) {
if (!fs.existsSync(targetDir)) {
// console.log(`Directory ${targetDir} does not exist!`);
const basePath = process.cwd();
// console.log(`Current directory: ${basePath}`);
return;
}
// Change to the target directory
process.chdir(targetDir);
const dirBasename = path.basename(targetDir).replace(/-/g, '_');
const currentExclusions = exclusions[dirBasename];
cleanupFiles(currentExclusions, '.');
// console.log(`Cleanup done for ${targetDir}!`);
// Return to the original directory
let x = '../..';
if (process.cwd().includes('nightly')) {
x = `${x}/..`;
}
if (process.cwd().includes('builds')) {
x = `${x}/..`;
}
process.chdir(path.resolve(process.cwd(), x));
}
}

function cleanupFiles(currentExclusions, dirPath) {
// Read all items in directory
fs.readdirSync(dirPath).forEach((item) => {
let shouldDelete = true;
const basePath = process.cwd().split('/docs/')[1];
const thisFilePath = path
.join(basePath, dirPath, item)
.replace('builds/', '')
.replace('nightly/', '');
const subFilePath = `./${thisFilePath.split('/').slice(1).join('/')}`;

if (currentExclusions?.includes(thisFilePath)) {
shouldDelete = false;
// console.log('Excluding: ', thisFilePath);
} else if (
fs.existsSync(subFilePath) &&
fs.lstatSync(subFilePath).isDirectory()
) {
shouldDelete = false;
cleanupFiles(currentExclusions, subFilePath);
}

deleteFolder(shouldDelete, subFilePath);
});
}

function deleteFolder(shouldDelete, subFilePath) {
if (shouldDelete) {
// console.log('DELETING: ', subFilePath);
fs.rmSync(subFilePath, { recursive: true, force: true });
}
}

main();
57 changes: 0 additions & 57 deletions scripts/clean-build-files.sh

This file was deleted.

Loading