diff --git a/.changeset/great-kids-sell.md b/.changeset/great-kids-sell.md new file mode 100644 index 0000000..a628af1 --- /dev/null +++ b/.changeset/great-kids-sell.md @@ -0,0 +1,5 @@ +--- +"@jspsych/new-timeline": patch +--- + +This patch adds an executable to the new-timeline package so that it can be run via npx; fixes new-timeline js template to accomodate for non-jspsych-timelines uses. diff --git a/packages/new-timeline/package.json b/packages/new-timeline/package.json index 05455f3..4cd628f 100644 --- a/packages/new-timeline/package.json +++ b/packages/new-timeline/package.json @@ -3,6 +3,7 @@ "version": "0.0.1", "description": "CLI tool for creating new jsPsych timelines", "type": "module", + "bin": "./src/cli.js", "files": [ "src", "templates" @@ -21,7 +22,7 @@ "license": "MIT", "dependencies": { "@inquirer/prompts": "^5.3.8", - "del": "^7.1.0", + "del": "^8.0.0", "gulp": "^5.0.0", "gulp-rename": "^2.0.0", "gulp-replace": "^1.1.4", diff --git a/packages/new-timeline/src/cli.js b/packages/new-timeline/src/cli.js index 5064694..23205a4 100644 --- a/packages/new-timeline/src/cli.js +++ b/packages/new-timeline/src/cli.js @@ -201,14 +201,23 @@ async function processAnswers(answers) { function renameExampleTemplate() { return src(`${destPath}/examples/index.html`) - .pipe(replace("{name}", answers.name)) .pipe(replace("{globalName}", globalName)) + .pipe( + replace( + "{publishingComment}\n", + answers.isTimelinesRepo + ? // prettier-ignore + '\n' + : "" + ) + ) + .pipe(replace("{name}", answers.name)) .pipe(dest(`${destPath}/examples`)); } function renameDocsTemplate() { return src(`${destPath}/docs/docs-template.md`) - .pipe(rename(`${answers.name}.md`)) + .pipe(rename(`timeline-${answers.name}.md`)) .pipe(dest(`${destPath}/docs`)) .on("end", function () { deleteSync(`${destPath}/docs/docs-template.md`, { force: true }); @@ -228,7 +237,8 @@ async function processAnswers(answers) { replace( `## Loading`, answers.isTimelinesRepo - ? '## Loading\n\n### In browser\n\n```html\n - + {publishingComment} diff --git a/packages/new-timeline/templates/timeline-template-js/package.json b/packages/new-timeline/templates/timeline-template-js/package.json index 26a3343..3384194 100644 --- a/packages/new-timeline/templates/timeline-template-js/package.json +++ b/packages/new-timeline/templates/timeline-template-js/package.json @@ -1,5 +1,5 @@ { - "name": "@jspsych-timelines/{name}", + "name": "{npmPackageName}", "version": "0.0.1", "description": "{description}", "unpkg": "dist/index.browser.min.js", @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/jspsych/jspsych-timelines.git", + "url": "{gitRootUrl}", "directory": "packages/{name}" }, "author": { @@ -22,9 +22,9 @@ }, "license": "MIT", "bugs": { - "url": "https://github.com/jspsych/jspsych-timelines/issues" + "url": "{gitRootHttpsUrl}/issues" }, - "homepage": "https://github.com/jspsych/jspsych-timelines/tree/main/packages/{name}", + "homepage": "{documentationUrl}", "devDependencies": { "@jspsych/config": "^2.0.0", "jspsych": "^7.0.0" diff --git a/packages/new-timeline/templates/timeline-template-ts/examples/index.html b/packages/new-timeline/templates/timeline-template-ts/examples/index.html index 4ed3288..ab4b611 100644 --- a/packages/new-timeline/templates/timeline-template-ts/examples/index.html +++ b/packages/new-timeline/templates/timeline-template-ts/examples/index.html @@ -3,6 +3,7 @@ + {publishingComment}