Skip to content

Commit

Permalink
sort glob output
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed Jul 3, 2024
1 parent 221d727 commit ab06dd5
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/abi-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const commandModule: CommandModule<Options, Options> = {
},

handler({ input }) {
const files = globSync(input);
const files = globSync(input).sort();

if (!files.length) {
console.error(`No files found for glob: ${input}`);
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/commands/set-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ const commandModule: CommandModule<Options, Options> = {
}

// Update all package.json below the current working directory (except in node_modules)
const packageJsons = globSync("**/package.json").filter((p) => !p.includes("node_modules"));
const packageJsons = globSync("**/package.json")
.sort()
.filter((p) => !p.includes("node_modules"));

for (const packageJson of packageJsons) {
updatePackageJson(packageJson, options);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/deploy/findLibraries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export function findLibraries(forgeOutDir: string): readonly {
readonly path: string;
readonly name: string;
}[] {
const artifacts = globSync(`${forgeOutDir}/**/*.json`, { ignore: "**/*.abi.json" }).map((path) =>
JSON.parse(readFileSync(path, "utf8")),
);
const artifacts = globSync(`${forgeOutDir}/**/*.json`, { ignore: "**/*.abi.json" })
.sort()
.map((path) => JSON.parse(readFileSync(path, "utf8")));

const libraries = artifacts.flatMap((artifact) => {
if (!artifact.metadata) return [];
Expand Down
10 changes: 6 additions & 4 deletions packages/cli/src/utils/getExistingContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { basename } from "path";
* Get a list of all contract paths/names within the provided src directory
*/
export function getExistingContracts(srcDir: string) {
return globSync(`${srcDir}/**/*.sol`).map((path) => ({
path,
basename: basename(path, ".sol"),
}));
return globSync(`${srcDir}/**/*.sol`)
.sort()
.map((path) => ({
path,
basename: basename(path, ".sol"),
}));
}
1 change: 1 addition & 0 deletions packages/cli/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const mudWorkspace = path.normalize(`${__dirname}/../..`);

const mudPackages: MudPackages = Object.fromEntries(
globSync(path.join(mudWorkspace, `packages/*/package.json`))
.sort()
.map((filename) => [
path.relative(mudWorkspace, path.dirname(filename)),
JSON.parse(readFileSync(filename, "utf8")),
Expand Down
10 changes: 6 additions & 4 deletions packages/world-modules/ts/scripts/worldgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ const clean = false;
const srcDir = await getSrcDirectory();

// Get a list of all contract names
const existingContracts = globSync(`${srcDir}/**/*.sol`).map((path) => ({
path,
basename: basename(path, ".sol"),
}));
const existingContracts = globSync(`${srcDir}/**/*.sol`)
.sort()
.map((path) => ({
path,
basename: basename(path, ".sol"),
}));

// Load and resolve the config
const mudConfig = (await loadConfig(configPath)) as WorldConfig;
Expand Down
6 changes: 3 additions & 3 deletions packages/world/src/codegen/interfaces/IBaseWorld.sol

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions packages/world/ts/scripts/worldgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ const clean = false;
const srcDir = await getSrcDirectory();

// Get a list of all contract names
const existingContracts = globSync(`${srcDir}/**/*.sol`).map((path) => ({
path,
basename: basename(path, ".sol"),
}));
const existingContracts = globSync(`${srcDir}/**/*.sol`)
.sort()
.map((path) => ({
path,
basename: basename(path, ".sol"),
}));

// Load and resolve the config
const mudConfig = (await loadConfig(configPath)) as WorldConfig;
Expand Down
2 changes: 1 addition & 1 deletion scripts/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async function getChanges(include: "diff" | "all") {
);
} else if (include === "all") {
// Load all current changesets from the .changeset dir
const changesetsToInclude = globSync(".changeset/*.md");
const changesetsToInclude = globSync(".changeset/*.md").sort();

// Load the contents of each changeset from file and metadata from git
changesetContents = await Promise.all(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { globSync } from "glob";
import ejs from "ejs";
import path from "path";

const tilemaps = globSync("./tilesets/*.tsx");
const tilemaps = globSync("./tilesets/*.tsx").sort();

enum PropertyName {
Name = "name",
Expand Down

0 comments on commit ab06dd5

Please sign in to comment.