Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mgthomas99 committed Apr 2, 2018
1 parent 3d2ba09 commit f6a920b
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# EditorConfig is awesome: http://EditorConfig.org

charset = utf-8
root = true

[**/*]
charset = utf-8
end_of_line = lf
indent_style = space

[**/*]
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
node_modules/
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src/
.editorconfig
.gitignore
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
12 changes: 12 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const gulp = require("gulp");
const typescript = require("gulp-typescript");

gulp.task("build", function () {
const ts_project = typescript.createProject("tsconfig.json");

return gulp.src("src/**/*.ts")
.pipe(ts_project())
.pipe(gulp.dest("dist/"));
});

gulp.task("default", ["build"]);
37 changes: 37 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "well-done",
"version": "1.0.0",
"description": "Generate random congratulations",
"author": "George Thomas",
"license": "MIT",
"homepage": "https://github.com/mgthomas99/well-done#readme",
"main": "dist/index.js",
"devDependencies": {
"gulp": "^3.9.1",
"gulp-typescript": "^4.0.2",
"npm-run-all": "^4.1.2",
"typescript": "^2.8.1"
},
"dependencies": {
"random-item": "^1.0.0"
},
"scripts": {
"build": "gulp build",
"clean:dist": "rimraf \"dist/\"",
"clean": "npm-run-all -s \"clean:dist\"",
"test": "echo \"Error: no test specified\"",
"prepublish": "npm-run-all -s \"clean\" \"build\" \"test\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/mgthomas99/well-done.git"
},
"keywords": [
"good",
"random",
"string"
],
"bugs": {
"url": "https://github.com/mgthomas99/well-done/issues"
}
}
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { wellDone } from "./well-done";

export * from "./well-done";
export default wellDone;
40 changes: 40 additions & 0 deletions src/well-done.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import * as randomItem from "random-item";

/**
* An array of strings whose content is a common congratulation. Each string
* begins with a capital letter followed by all other characters being
* lower-case (sentence case). Some strings contain punctuation, but none of
* them end with conclusive punctuation (i.e., none of the strings end with a
* full-stop).
*/
export const CONGRATULATIONS = [
"Beautiful",
"Congratulations",
"Excellent",
"Good going",
"Good job",
"Good work",
"Great",
"Keep it up",
"Muy bien",
"Neat",
"Nice going",
"Outstanding",
"Right on",
"Super",
"Terrific",
"That's it",
"Way to go",
"Well done",
"You've got it"
];

/**
* Returns a random congratulation from the `CONGRATULATIONS` array.
*
* @return {string}
* A random congratulative string.
*/
export function wellDone(): string {
return randomItem(CONGRATULATIONS);
}
9 changes: 9 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"moduleResolution": "node",
"module": "commonjs",
"target": "es2015",

"declaration": true
}
}

0 comments on commit f6a920b

Please sign in to comment.