From 2399c6270f0c2a1cac75b90ee10ee93bbc92becf Mon Sep 17 00:00:00 2001 From: Rishi Kothari Date: Fri, 10 Jul 2020 19:17:04 -0400 Subject: [PATCH] Add scaffolder for JS (#1901) --- .../javascript/scripts/scaffold/scaffold.sh | 17 +++++++++ .../scripts/scaffold/template/.docs/after.md | 5 +++ .../scripts/scaffold/template/.docs/hints.md | 5 +++ .../scaffold/template/.docs/instructions.md | 5 +++ .../scaffold/template/.docs/introduction.md | 5 +++ .../scripts/scaffold/template/.eslintrc | 26 +++++++++++++ .../scripts/scaffold/template/.gitignore | 3 ++ .../scaffold/template/.meta/config.json | 9 +++++ .../scripts/scaffold/template/babel.config.js | 14 +++++++ .../scripts/scaffold/template/concept-name.js | 5 +++ .../scaffold/template/concept-name.spec.js | 5 +++ .../scripts/scaffold/template/example.js | 3 ++ .../scripts/scaffold/template/package.json | 37 +++++++++++++++++++ 13 files changed, 139 insertions(+) create mode 100644 languages/javascript/scripts/scaffold/scaffold.sh create mode 100644 languages/javascript/scripts/scaffold/template/.docs/after.md create mode 100644 languages/javascript/scripts/scaffold/template/.docs/hints.md create mode 100644 languages/javascript/scripts/scaffold/template/.docs/instructions.md create mode 100644 languages/javascript/scripts/scaffold/template/.docs/introduction.md create mode 100644 languages/javascript/scripts/scaffold/template/.eslintrc create mode 100644 languages/javascript/scripts/scaffold/template/.gitignore create mode 100644 languages/javascript/scripts/scaffold/template/.meta/config.json create mode 100644 languages/javascript/scripts/scaffold/template/babel.config.js create mode 100644 languages/javascript/scripts/scaffold/template/concept-name.js create mode 100644 languages/javascript/scripts/scaffold/template/concept-name.spec.js create mode 100644 languages/javascript/scripts/scaffold/template/example.js create mode 100644 languages/javascript/scripts/scaffold/template/package.json diff --git a/languages/javascript/scripts/scaffold/scaffold.sh b/languages/javascript/scripts/scaffold/scaffold.sh new file mode 100644 index 0000000000..ca21615290 --- /dev/null +++ b/languages/javascript/scripts/scaffold/scaffold.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +echo "Scaffolding '$1'" + +cp -r ./template ../../exercises/concept/$1 + +echo "Template '$1' created for JS." +cd ../../exercises/concept/$1 + +sed -i '' "s/---/$1/g" * + +mv concept-name.js $1.js +mv concept-name.spec.js $1.js + +echo "Final directory:" && ls + +echo "Remember to fill out all details in every file!" \ No newline at end of file diff --git a/languages/javascript/scripts/scaffold/template/.docs/after.md b/languages/javascript/scripts/scaffold/template/.docs/after.md new file mode 100644 index 0000000000..fe60820d9e --- /dev/null +++ b/languages/javascript/scripts/scaffold/template/.docs/after.md @@ -0,0 +1,5 @@ + diff --git a/languages/javascript/scripts/scaffold/template/.docs/hints.md b/languages/javascript/scripts/scaffold/template/.docs/hints.md new file mode 100644 index 0000000000..ee939e79d0 --- /dev/null +++ b/languages/javascript/scripts/scaffold/template/.docs/hints.md @@ -0,0 +1,5 @@ + diff --git a/languages/javascript/scripts/scaffold/template/.docs/instructions.md b/languages/javascript/scripts/scaffold/template/.docs/instructions.md new file mode 100644 index 0000000000..2fdbcf10fa --- /dev/null +++ b/languages/javascript/scripts/scaffold/template/.docs/instructions.md @@ -0,0 +1,5 @@ + diff --git a/languages/javascript/scripts/scaffold/template/.docs/introduction.md b/languages/javascript/scripts/scaffold/template/.docs/introduction.md new file mode 100644 index 0000000000..db2a9131e6 --- /dev/null +++ b/languages/javascript/scripts/scaffold/template/.docs/introduction.md @@ -0,0 +1,5 @@ + diff --git a/languages/javascript/scripts/scaffold/template/.eslintrc b/languages/javascript/scripts/scaffold/template/.eslintrc new file mode 100644 index 0000000000..2e5a5079a0 --- /dev/null +++ b/languages/javascript/scripts/scaffold/template/.eslintrc @@ -0,0 +1,26 @@ +{ + "root": true, + "parser": "babel-eslint", + "parserOptions": { + "ecmaVersion": 7, + "sourceType": "module" + }, + "env": { + "es6": true, + "node": true, + "jest": true + }, + "extends": [ + "eslint:recommended", + "plugin:import/errors", + "plugin:import/warnings" + ], + "rules": { + "linebreak-style": "off", + + "import/extensions": "off", + "import/no-default-export": "off", + "import/no-unresolved": "off", + "import/prefer-default-export": "off" + } +} diff --git a/languages/javascript/scripts/scaffold/template/.gitignore b/languages/javascript/scripts/scaffold/template/.gitignore new file mode 100644 index 0000000000..bdb912f98a --- /dev/null +++ b/languages/javascript/scripts/scaffold/template/.gitignore @@ -0,0 +1,3 @@ +node_modules +yarn-error.log + diff --git a/languages/javascript/scripts/scaffold/template/.meta/config.json b/languages/javascript/scripts/scaffold/template/.meta/config.json new file mode 100644 index 0000000000..4b2181b647 --- /dev/null +++ b/languages/javascript/scripts/scaffold/template/.meta/config.json @@ -0,0 +1,9 @@ +{ + "authors": [ + { + "github_username": "username", + "exercism_username": "username" + } + ], + "forked_from": [] +} diff --git a/languages/javascript/scripts/scaffold/template/babel.config.js b/languages/javascript/scripts/scaffold/template/babel.config.js new file mode 100644 index 0000000000..90111ec554 --- /dev/null +++ b/languages/javascript/scripts/scaffold/template/babel.config.js @@ -0,0 +1,14 @@ +module.exports = { + presets: [ + [ + '@babel/env', + { + targets: { + node: 'current', + }, + useBuiltIns: true, + }, + + ], + ], +}; diff --git a/languages/javascript/scripts/scaffold/template/concept-name.js b/languages/javascript/scripts/scaffold/template/concept-name.js new file mode 100644 index 0000000000..9ac3079a7d --- /dev/null +++ b/languages/javascript/scripts/scaffold/template/concept-name.js @@ -0,0 +1,5 @@ +/* + +This is the stub implementation file, which is the starting point for students to work on the exercise. + +*/ \ No newline at end of file diff --git a/languages/javascript/scripts/scaffold/template/concept-name.spec.js b/languages/javascript/scripts/scaffold/template/concept-name.spec.js new file mode 100644 index 0000000000..893371cc43 --- /dev/null +++ b/languages/javascript/scripts/scaffold/template/concept-name.spec.js @@ -0,0 +1,5 @@ +/* + +This is the exercise's test suite. + +*/ \ No newline at end of file diff --git a/languages/javascript/scripts/scaffold/template/example.js b/languages/javascript/scripts/scaffold/template/example.js new file mode 100644 index 0000000000..8523a2f915 --- /dev/null +++ b/languages/javascript/scripts/scaffold/template/example.js @@ -0,0 +1,3 @@ +/* +This is an example implementation that passes all the tests. +*/ \ No newline at end of file diff --git a/languages/javascript/scripts/scaffold/template/package.json b/languages/javascript/scripts/scaffold/template/package.json new file mode 100644 index 0000000000..01cf702497 --- /dev/null +++ b/languages/javascript/scripts/scaffold/template/package.json @@ -0,0 +1,37 @@ +{ + "name": "@exercism/---", + "description": "description", + "author": "author", + "version": "1.0.0", + "license": "MIT", + "private": true, + "repository": { + "type": "git", + "url": "https://github.com/exercism/v3.git", + "directory": "languages/javascript/exercises/concept/---" + }, + "devDependencies": { + "@babel/cli": "^7.8.4", + "@babel/core": "^7.9.6", + "@babel/preset-env": "^7.9.6", + "@types/jest": "^25.2.2", + "@types/node": "^14.0.1", + "babel-eslint": "^10.1.0", + "babel-jest": "^26.0.1", + "eslint": "^7.0.0", + "eslint-plugin-import": "^2.20.2", + "jest": "^26.0.1" + }, + "dependencies": {}, + "jest": { + "modulePathIgnorePatterns": [ + "package.json" + ] + }, + "scripts": { + "test": "jest --no-cache ./*", + "watch": "jest --no-cache --watch ./*", + "lint": "eslint .", + "lint-test": "eslint . && jest --no-cache ./* " + } +}