-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rename cli-plugin-sync-dependencies (#4441)
- Loading branch information
1 parent
7588daa
commit 76ed2a8
Showing
36 changed files
with
206 additions
and
12,589 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
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
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
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
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
File renamed without changes.
File renamed without changes.
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
8 changes: 3 additions & 5 deletions
8
...cli-plugin-sync-dependencies/package.json → ...ages/cli-plugin-dependencies/package.json
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 |
---|---|---|
@@ -1,29 +1,27 @@ | ||
{ | ||
"name": "@webiny/cli-plugin-sync-dependencies", | ||
"name": "@webiny/cli-plugin-dependencies", | ||
"version": "0.0.0", | ||
"main": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/webiny/webiny-js.git", | ||
"directory": "packages/cli-plugin-sync-dependencies" | ||
"directory": "packages/cli-plugin-dependencies" | ||
}, | ||
"author": "Webiny Ltd.", | ||
"contributors": [ | ||
"Bruno Zorić <[email protected]>" | ||
], | ||
"description": "A tool to generate sync files for Webiny dependencies.", | ||
"description": "A tool to generate and verify dependency sync files for Webiny.", | ||
"dependencies": { | ||
"@babel/runtime": "^7.26.0", | ||
"@webiny/cli": "0.0.0", | ||
"@webiny/cli-plugin-scaffold": "0.0.0", | ||
"get-yarn-workspaces": "^1.0.2", | ||
"glob": "^7.2.3", | ||
"load-json-file": "^6.2.0", | ||
"semver": "^7.6.3", | ||
"write-json-file": "^4.3.0" | ||
}, | ||
"devDependencies": { | ||
"@webiny/cli": "0.0.0", | ||
"@webiny/project-utils": "0.0.0", | ||
"execa": "^5.1.1", | ||
"prettier": "^2.8.8", | ||
|
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,79 @@ | ||
import path from "path"; | ||
import { CliCommandPlugin, CliCommandPluginArgs } from "@webiny/cli/types"; | ||
import { createDependencyTree } from "./references"; | ||
import { createReferenceFile } from "./references/createReferenceFile"; | ||
import { verifyDependencies } from "./references/verifyDependencies"; | ||
|
||
const getDirname = (): string => { | ||
let name = __dirname; | ||
if (name.endsWith("/dist")) { | ||
name = name.replace("/dist", ""); | ||
} | ||
return path.join(name, "../cli/files/"); | ||
}; | ||
|
||
const createReferenceFileCommandExecutor = ({ context }: Pick<CliCommandPluginArgs, "context">) => { | ||
return async () => { | ||
const dirname = getDirname(); | ||
const tree = createDependencyTree({ | ||
context, | ||
dirname | ||
}); | ||
|
||
createReferenceFile({ | ||
tree, | ||
dirname, | ||
context | ||
}); | ||
}; | ||
}; | ||
|
||
const verifyDependenciesFileCommandExecutor = ({ | ||
context | ||
}: Pick<CliCommandPluginArgs, "context">) => { | ||
return async () => { | ||
const dirname = getDirname(); | ||
const tree = createDependencyTree({ | ||
context, | ||
dirname | ||
}); | ||
|
||
verifyDependencies({ | ||
tree, | ||
dirname | ||
}); | ||
}; | ||
}; | ||
|
||
export default (): CliCommandPlugin[] => { | ||
return [ | ||
{ | ||
type: "cli-command", | ||
name: "cli-command-sync-dependencies", | ||
create({ yargs, context }) { | ||
yargs.command( | ||
"sync-dependencies", | ||
"Sync dependencies for all packages.", | ||
(yargs: Record<string, any>) => { | ||
yargs.example("$0 sync-dependencies"); | ||
}, | ||
createReferenceFileCommandExecutor({ context }) | ||
); | ||
} | ||
}, | ||
{ | ||
type: "cli-command", | ||
name: "cli-command-verify-dependencies", | ||
create({ yargs, context }) { | ||
yargs.command( | ||
"verify-dependencies", | ||
"Verify dependencies for all packages.", | ||
(yargs: Record<string, any>) => { | ||
yargs.example("$0 verify-dependencies"); | ||
}, | ||
verifyDependenciesFileCommandExecutor({ context }) | ||
); | ||
} | ||
} | ||
]; | ||
}; |
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
File renamed without changes.
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
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
File renamed without changes.
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...gin-sync-dependencies/tsconfig.build.json → ...i-plugin-dependencies/tsconfig.build.json
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
Oops, something went wrong.