Skip to content

Commit

Permalink
fix cli prompt for author url; fix template package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
cherriechang committed Aug 13, 2024
1 parent e798c0b commit 781a7ea
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 22 deletions.
6 changes: 4 additions & 2 deletions packages/extension-device-motion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
"url": "git+https://github.com/jspsych/jspsych-contrib.git",
"directory": "packages/extension-device-motion"
},
"author": "Pedro Neto",
"authorGitHub": "https://github.com/pasoneto",
"author": {
"name": "Pedro Neto",
"url": "https://github.com/pasoneto"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/jspsych/jspsych-contrib/issues"
Expand Down
6 changes: 4 additions & 2 deletions packages/extension-mediapipe-face-mesh/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
"url": "git+https://github.com/jspsych/jspsych-contrib.git",
"directory": "packages/extension-mediapipe-face-mesh"
},
"author": "C. Martin Grewe",
"authorGitHub": "https://github.com/mgrewe",
"author": {
"name": "C. Martin Grewe",
"url": "https://github.com/mgrewe"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/jspsych/jspsych-contrib/issues"
Expand Down
6 changes: 4 additions & 2 deletions packages/extension-touchscreen-buttons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
"url": "git+https://github.com/jspsych/jspsych-contrib.git",
"directory": "packages/extension-touchscreen-buttons"
},
"author": "Younes Strittmatter",
"authorGitHub": "https://github.com/younesStrittmatter",
"author": {
"name": "Younes Strittmatter",
"url": "https://github.com/younesStrittmatter"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/jspsych/jspsych-contrib/issues"
Expand Down
11 changes: 5 additions & 6 deletions templates/cli/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ async function runPrompts() {
required: true,
});

const authorGitHub = await input({
message: `Enter a profile URL for the author(s), e.g. a link to a GitHub profile [Optional]:`,
const authorUrl = await input({
message: `Enter a profile URL for the author, e.g. a link to a GitHub profile [Optional]:`,
});

return {
Expand All @@ -96,7 +96,7 @@ async function runPrompts() {
name: name,
description: description,
author: author,
authorGitHub: authorGitHub,
authorUrl: authorUrl,
};
}

Expand All @@ -122,6 +122,7 @@ async function processAnswers(answers) {
)
)
.pipe(replace("{description}", answers.description))
.pipe(replace("{authorUrl}", answers.authorUrl))
.pipe(replace("_globalName_", globalName))
.pipe(replace("{globalName}", globalName))
.pipe(replace("{camelCaseName}", camelCaseName))
Expand Down Expand Up @@ -151,9 +152,7 @@ async function processAnswers(answers) {
.pipe(
replace(
`{authorInfo}`,
answers.authorGitHub
? `[${answers.author}](${answers.authorGitHub})`
: `${answers.author}`
answers.authorUrl ? `[${answers.author}](${answers.authorUrl})` : `${answers.author}`
)
)
.pipe(dest(`${repoRoot}/packages/${destPath}`));
Expand Down
5 changes: 4 additions & 1 deletion templates/extension-template-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"url": "git+https://github.com/jspsych/jspsych-contrib.git",
"directory": "packages/extension-{name}"
},
"author": "{author}",
"author": {
"name": "{author}",
"url": "{authorUrl}"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/jspsych/jspsych-contrib/issues"
Expand Down
5 changes: 4 additions & 1 deletion templates/extension-template-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
"url": "git+https://github.com/jspsych/jspsych-contrib.git",
"directory": "packages/extension-{name}"
},
"author": "{author}",
"author": {
"name": "{author}",
"url": "{authorUrl}"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/jspsych/jspsych-contrib/issues"
Expand Down
5 changes: 4 additions & 1 deletion templates/plugin-template-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"url": "git+https://github.com/jspsych/jspsych-contrib.git",
"directory": "packages/plugin-{name}"
},
"author": "{author}",
"author": {
"name": "{author}",
"url": "{authorUrl}"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/jspsych/jspsych-contrib/issues"
Expand Down
5 changes: 4 additions & 1 deletion templates/plugin-template-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
"url": "git+https://github.com/jspsych/jspsych-contrib.git",
"directory": "packages/plugin-{name}"
},
"author": "{author}",
"author": {
"name": "{author}",
"url": "{authorUrl}"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/jspsych/jspsych-contrib/issues"
Expand Down
10 changes: 4 additions & 6 deletions update-readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function getPackageInfo(packageDir) {
return {
name: packageJson.name,
description: packageJson.description,
author: packageJson.author,
authorGitHub: packageJson.authorGitHub,
author: packageJson.author.name,
authorUrl: packageJson.author.url,
};
}

Expand Down Expand Up @@ -56,7 +56,7 @@ function updateRootReadme() {
if (info.name.match(/^\@jspsych-contrib\/plugin-/g)) {
const pluginName = info.name.replace(/^\@jspsych-contrib\/plugin-/g, "");
pluginList = pluginList.concat(
`[${pluginName}](${packageReadmeLink}) | [${info.author}](${info.authorGitHub}) | ${
`[${pluginName}](${packageReadmeLink}) | [${info.author}](${info.authorUrl}) | ${
info.description ? info.description : "foo"
} \n`
);
Expand All @@ -65,16 +65,14 @@ function updateRootReadme() {
extensionList = extensionList.concat(
`[${info.name.replace(/^\@jspsych-contrib\/extension-/g, "")}](${packageReadmeLink}) | [${
info.author
}](${info.authorGitHub}) | ${info.description ? info.description : "foo"} \n`
}](${info.authorUrl}) | ${info.description ? info.description : "foo"} \n`
);
}
});

const pluginTable = [pluginListHead, pluginList, extensionListHead];
const extensionTable = [extensionListHead, extensionList, guidelinesHead];

console.log(pluginTable);

function generatePluginTable() {
return src(`${__dirname}/README.md`)
.pipe(replace(/### Plugins[\s\S]*?### Extensions/g, pluginTable.join("")))
Expand Down

0 comments on commit 781a7ea

Please sign in to comment.