From 781a7ea2bd7882abfda1839aef430496b9397c71 Mon Sep 17 00:00:00 2001 From: cchang-vassar <79338042+cchang-vassar@users.noreply.github.com> Date: Tue, 13 Aug 2024 12:14:12 -0400 Subject: [PATCH] fix cli prompt for author url; fix template package.json --- packages/extension-device-motion/package.json | 6 ++++-- packages/extension-mediapipe-face-mesh/package.json | 6 ++++-- packages/extension-touchscreen-buttons/package.json | 6 ++++-- templates/cli/src/index.js | 11 +++++------ templates/extension-template-js/package.json | 5 ++++- templates/extension-template-ts/package.json | 5 ++++- templates/plugin-template-js/package.json | 5 ++++- templates/plugin-template-ts/package.json | 5 ++++- update-readme.js | 10 ++++------ 9 files changed, 37 insertions(+), 22 deletions(-) diff --git a/packages/extension-device-motion/package.json b/packages/extension-device-motion/package.json index fdadc17c..5f9fb45e 100644 --- a/packages/extension-device-motion/package.json +++ b/packages/extension-device-motion/package.json @@ -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" diff --git a/packages/extension-mediapipe-face-mesh/package.json b/packages/extension-mediapipe-face-mesh/package.json index 60e7a244..090f55e4 100644 --- a/packages/extension-mediapipe-face-mesh/package.json +++ b/packages/extension-mediapipe-face-mesh/package.json @@ -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" diff --git a/packages/extension-touchscreen-buttons/package.json b/packages/extension-touchscreen-buttons/package.json index 2ca310dc..850adf51 100644 --- a/packages/extension-touchscreen-buttons/package.json +++ b/packages/extension-touchscreen-buttons/package.json @@ -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" diff --git a/templates/cli/src/index.js b/templates/cli/src/index.js index 04b1b211..e1afca6c 100644 --- a/templates/cli/src/index.js +++ b/templates/cli/src/index.js @@ -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 { @@ -96,7 +96,7 @@ async function runPrompts() { name: name, description: description, author: author, - authorGitHub: authorGitHub, + authorUrl: authorUrl, }; } @@ -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)) @@ -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}`)); diff --git a/templates/extension-template-js/package.json b/templates/extension-template-js/package.json index 209cd9b1..8eb972b6 100644 --- a/templates/extension-template-js/package.json +++ b/templates/extension-template-js/package.json @@ -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" diff --git a/templates/extension-template-ts/package.json b/templates/extension-template-ts/package.json index 81fb76a1..1d1f9890 100644 --- a/templates/extension-template-ts/package.json +++ b/templates/extension-template-ts/package.json @@ -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" diff --git a/templates/plugin-template-js/package.json b/templates/plugin-template-js/package.json index 8d7ccbc6..6220d952 100644 --- a/templates/plugin-template-js/package.json +++ b/templates/plugin-template-js/package.json @@ -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" diff --git a/templates/plugin-template-ts/package.json b/templates/plugin-template-ts/package.json index 591ed3d8..a23a450b 100644 --- a/templates/plugin-template-ts/package.json +++ b/templates/plugin-template-ts/package.json @@ -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" diff --git a/update-readme.js b/update-readme.js index 393d5325..8323a762 100644 --- a/update-readme.js +++ b/update-readme.js @@ -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, }; } @@ -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` ); @@ -65,7 +65,7 @@ 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` ); } }); @@ -73,8 +73,6 @@ function updateRootReadme() { 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("")))