From 035436155bf932890d99785d3c6261d7db934e4d Mon Sep 17 00:00:00 2001 From: Claas Ahlrichs Date: Mon, 28 Jan 2019 15:16:29 +0100 Subject: [PATCH] init. git repo --- package-lock.json | 221 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + src/hello-world.ts | 2 + src/index.ts | 20 +++- 4 files changed, 242 insertions(+), 2 deletions(-) create mode 100644 src/hello-world.ts diff --git a/package-lock.json b/package-lock.json index b86d234..eea5bf9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -72,11 +72,35 @@ "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" }, + "async-lock": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/async-lock/-/async-lock-1.1.4.tgz", + "integrity": "sha512-9vsVXt+mIvb8rV0G6V1x68Bvp/VksPJoZJxF/n/l9N60chNJ44opPr9WdZZfAV3leUdXt4xNvfyNWyY/j5enBA==" + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, + "base64-js": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.2.tgz", + "integrity": "sha1-Ak8Pcq+iW3X5wO5zzU9V7Bvtl4Q=" + }, + "benchmark": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-1.0.0.tgz", + "integrity": "sha1-Lx4vpMNZ8REiqhgwgiGOlX45DHM=" + }, + "bops": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/bops/-/bops-0.0.7.tgz", + "integrity": "sha1-tKClqDmkBkVK8P4FqLkaenZqVOI=", + "requires": { + "base64-js": "0.0.2", + "to-utf8": "0.0.1" + } + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -132,6 +156,11 @@ "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==" }, + "clean-git-ref": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/clean-git-ref/-/clean-git-ref-1.0.3.tgz", + "integrity": "sha1-UyXcg56rAcl0rg6X9XNHgnUPiOw=" + }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -161,6 +190,15 @@ "parse-json": "^4.0.0" } }, + "crc-32": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz", + "integrity": "sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA==", + "requires": { + "exit-on-epipe": "~1.0.1", + "printj": "~1.1.0" + } + }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -173,6 +211,27 @@ "which": "^1.2.9" } }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "diff": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/diff/-/diff-2.2.3.tgz", + "integrity": "sha1-YOr9DSjukG5Oj/ClLBIpUhAzv5k=" + }, + "diff-lines": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/diff-lines/-/diff-lines-1.1.0.tgz", + "integrity": "sha1-S72SVxPgJ0d7zUIIG2hEkUexlkg=", + "requires": { + "diff": "^2.2.3" + } + }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -213,6 +272,11 @@ "strip-eof": "^1.0.0" } }, + "exit-on-epipe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz", + "integrity": "sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw==" + }, "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", @@ -239,6 +303,15 @@ "pump": "^3.0.0" } }, + "git-apply-delta": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/git-apply-delta/-/git-apply-delta-0.0.7.tgz", + "integrity": "sha1-+3auFEVA15RAtSsx3gPmPJk8chk=", + "requires": { + "bops": "~0.0.6", + "varint": "0.0.3" + } + }, "glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", @@ -252,6 +325,16 @@ "path-is-absolute": "^1.0.0" } }, + "globalyzer": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.4.tgz", + "integrity": "sha512-LeguVWaxgHN0MNbWC6YljNMzHkrCny9fzjmEUdnF1kQ7wATFD1RHFRqA1qxaX2tgxGENlcxjOflopBwj3YZiXA==" + }, + "globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==" + }, "graceful-fs": { "version": "4.1.15", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", @@ -364,6 +447,41 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, + "isomorphic-git": { + "version": "0.51.7", + "resolved": "https://registry.npmjs.org/isomorphic-git/-/isomorphic-git-0.51.7.tgz", + "integrity": "sha512-RhNDgaYvVsxTdy3SX4QI3l5LIhNMDSUEtcPUtgkb/5f0+1tlcLsQyuB/MGW44rL3eTbyu+dZdDmPz6DO82J7+A==", + "requires": { + "async-lock": "^1.1.0", + "clean-git-ref": "1.0.3", + "crc-32": "^1.2.0", + "diff-lines": "^1.1.0", + "git-apply-delta": "0.0.7", + "globalyzer": "^0.1.0", + "globrex": "^0.1.2", + "ignore": "^5.0.4", + "marky": "^1.2.1", + "minimisted": "^2.0.0", + "nick": "^0.1.3", + "pako": "^1.0.7", + "pify": "^4.0.1", + "readable-stream": "^3.1.1", + "sha.js": "^2.4.9", + "simple-get": "^3.0.2" + }, + "dependencies": { + "ignore": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.0.5.tgz", + "integrity": "sha512-kOC8IUb8HSDMVcYrDVezCxpJkzSQWTAzf3olpKM6o9rM5zpojx23O0Fl8Wr4+qJ6ZbPEHqf1fdwev/DS7v7pmA==" + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + } + } + }, "js-yaml": { "version": "3.12.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz", @@ -405,6 +523,16 @@ "yallist": "^2.1.2" } }, + "marky": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/marky/-/marky-1.2.1.tgz", + "integrity": "sha512-md9k+Gxa3qLH6sUKpeC2CNkJK/Ld+bEz5X96nYwloqphQE0CKCVEKco/6jxEZixinqNdz5RFi/KaCyfbMDMAXQ==" + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -413,6 +541,19 @@ "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "minimisted": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/minimisted/-/minimisted-2.0.0.tgz", + "integrity": "sha512-oP88Dw3LK/pdrKyMdlbmg3W50969UNr4ctISzJfPl+YPYHTAOrS+dihXnsgRNKSRIzDsrnV3eE2CCVlZbpOKdQ==", + "requires": { + "minimist": "^1.2.0" + } + }, "mri": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.4.tgz", @@ -439,6 +580,14 @@ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" }, + "nick": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/nick/-/nick-0.1.3.tgz", + "integrity": "sha1-2KMLfaeJ1BfguqVDfzPEh76bYCA=", + "requires": { + "benchmark": "^1.0.0" + } + }, "node-fetch": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz", @@ -527,6 +676,11 @@ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==" }, + "pako": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.8.tgz", + "integrity": "sha512-6i0HVbUfcKaTv+EG8ZTr75az7GFXcLYk9UyLEg7Notv/Ma+z/UG3TCoz6GiNeOrn1E/e63I0X/Hpw18jHOTUnA==" + }, "parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", @@ -659,6 +813,11 @@ } } }, + "printj": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz", + "integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ==" + }, "promzard": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/promzard/-/promzard-0.3.0.tgz", @@ -718,6 +877,16 @@ "pify": "^3.0.0" } }, + "readable-stream": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.1.1.tgz", + "integrity": "sha512-DkN66hPyqDhnIQ6Jcsvx9bFjhw214O4poMBcIMgPVpQvNy9a0e0Uhg5SqySyDKAmUlwt8LonTBz1ezOnM8pUdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, "resolve-from": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", @@ -728,6 +897,11 @@ "resolved": "https://registry.npmjs.org/run-node/-/run-node-1.0.0.tgz", "integrity": "sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A==" }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, "semver": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", @@ -738,6 +912,15 @@ "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=" }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -756,6 +939,21 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.0.3.tgz", + "integrity": "sha512-Wvre/Jq5vgoz31Z9stYWPLn0PqRqmBDpFSdypAnHu5AvRVCYPRYGnvryNLiXu8GOBNDH82J2FRHUGMjjHUpXFw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, "slash": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", @@ -794,6 +992,14 @@ "resolved": "http://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, + "string_decoder": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz", + "integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, "strip-eof": { "version": "1.0.0", "resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", @@ -807,6 +1013,11 @@ "has-flag": "^3.0.0" } }, + "to-utf8": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/to-utf8/-/to-utf8-0.0.1.tgz", + "integrity": "sha1-0Xrqcv8vujm55DYBvns/9y4ImFI=" + }, "typescript": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.1.tgz", @@ -817,6 +1028,11 @@ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, "validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -834,6 +1050,11 @@ "builtins": "^1.0.3" } }, + "varint": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/varint/-/varint-0.0.3.tgz", + "integrity": "sha1-uCHemwSzizzSL3LBjZSp+3KrNRg=" + }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", diff --git a/package.json b/package.json index 75cd279..5cda6ac 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "execa": "^1.0.0", "husky": "^1.3.1", "init-package-json": "^1.10.3", + "isomorphic-git": "^0.51.7", "jsonfile": "^5.0.0", "node-fetch": "^2.3.0", "prettier": "^1.16.3", diff --git a/src/hello-world.ts b/src/hello-world.ts new file mode 100644 index 0000000..040d34e --- /dev/null +++ b/src/hello-world.ts @@ -0,0 +1,2 @@ +// happy coding 👻 +console.log("hello world"); diff --git a/src/index.ts b/src/index.ts index cb5314a..020c1d5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,6 +4,7 @@ import init from "init-package-json"; import path from "path"; import fs from "fs"; import fetch from "node-fetch"; +import git from "isomorphic-git"; const HOME = process.env.HOME || "."; // a path to a promzard module. In the event that this file is @@ -36,7 +37,9 @@ init(dir, initFile, configData, function(_er, data) { }; const scripts = { ...data.scripts, - build: "tsc" + prepare: "tsc", + build: "tsc", + start: "node build/hello-world.ts" }; fs.writeFileSync( packageFile, @@ -45,7 +48,7 @@ init(dir, initFile, configData, function(_er, data) { (async () => { await execa("npm", ["install", "typescript", "@types/node", "--save-dev"]); - await execa("tsc", ["--init"]); + await execa("tsc", ["--init", "--outDir", "build"]); await execa("npm", [ "install", "prettier", @@ -57,5 +60,18 @@ init(dir, initFile, configData, function(_er, data) { const dest = fs.createWriteStream(".gitignore"); const res = await fetch("https://gitignore.io/api/node"); res.body.pipe(dest); + + fs.mkdirSync(dir + "/src"); + fs.copyFileSync( + dir + "/node_modules/create-typescript-project/src/hello-world.ts", + dir + "/src/hello-world.ts" + ); + + git.plugins.set("fs", fs); + await git.init({ dir }); + await git.add({ dir, filepath: ".gitignore" }); + await git.add({ dir, filepath: "package.json" }); + await git.add({ dir, filepath: "package-lock.json" }); + await git.add({ dir, filepath: "tsconfig.json" }); })(); });