-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff5befa
commit 0130f12
Showing
9 changed files
with
123 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
|
Submodule sway
updated
4158 files
Submodule fuels-wallet
updated
175 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file was deleted.
Oops, something went wrong.