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

added support for custom project name in add module command #990

Merged
merged 5 commits into from
Oct 19, 2023
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
16 changes: 12 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,25 @@ const commands = {
},
add: () => {
const args = arg({
"--source": String
"--source": String,
"--project": String
});
const modules = args._.slice(1);
if (!modules.length) {
invalid("please provide the name of the modules to be installed");
}
addModules(modules, args["--source"], "demo");
addModules(modules, args["--source"], args["--project"]);
},
remove: () => {
const args = arg({
"--source": String
"--source": String,
"--project": String
});
const modules = args._.slice(1);
if (!modules.length) {
invalid("please provide the name of the modules to be removed");
}
removeModules(modules, args["--source"], "demo");
removeModules(modules, args["--source"], args["--project"]);
},
create: () => {
const args = arg({
Expand Down Expand Up @@ -205,6 +207,12 @@ Remove one or modules from your demo app:
Install modules from other directory:
npx crowdbotics/modules add --source ../other-repository <module-name>

Install modules to other app that is not "demo":
npx crowdbotics/modules add --project ../other-project <module-name>

Remove modules from app that is not "demo":
npx crowdbotics/modules remove --project ../other-project <module-name>

Update a module definition from the demo app:
npx crowdbotics/modules commit <module-name>

Expand Down
2 changes: 1 addition & 1 deletion scripts/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const copy = (origin, target) => {
fse.copySync(origin, target, { filter: filterFiles });
};

export function addModules(modules, source = "modules", dir) {
export function addModules(modules, source = "modules", dir = "demo") {
const cwd = process.cwd();
const demoDir = path.join(cwd, dir);

Expand Down
2 changes: 1 addition & 1 deletion scripts/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from "path";
import find from "find";
import { execSync } from "child_process";

export function removeModules(modules, source = "modules", dir) {
export function removeModules(modules, source = "modules", dir = "demo") {
const cwd = process.cwd();
const demoDir = path.join(process.cwd(), dir);

Expand Down
Loading