This commit is contained in:
Ken 2019-06-04 15:02:29 -07:00
Родитель 72b4c586d1
Коммит a1be6f19ac
10 изменённых файлов: 118 добавлений и 1 удалений

2
.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,2 @@
node_modules/
lib/

4
.npmignore Normal file
Просмотреть файл

@ -0,0 +1,4 @@
src/
node_modules/
tsconfig.json
yarn.lock

Просмотреть файл

@ -2,5 +2,17 @@
"name": "beachball",
"version": "1.0.0",
"main": "index.js",
"license": "MIT"
"license": "MIT",
"scripts": {
"build": "tsc",
"start": "tsc -w --preserveWatchOutput"
},
"dependencies": {
"prompts": "~2.1.0"
},
"devDependencies": {
"@types/node": "^12.0.4",
"@types/prompts": "~2.0.0",
"typescript": "^3.5.1"
}
}

0
src/changefile.ts Normal file
Просмотреть файл

0
src/cli.ts Normal file
Просмотреть файл

5
src/git.ts Normal file
Просмотреть файл

@ -0,0 +1,5 @@
import { spawnSync } from 'child_process';
export function git(args: string[]) {
return spawnSync('git', args);
}

0
src/index.ts Normal file
Просмотреть файл

45
src/paths.ts Normal file
Просмотреть файл

@ -0,0 +1,45 @@
import path from 'path';
import fs from 'fs';
function searchUp(pathName: string, cwd?: string) {
if (!cwd) {
cwd = process.cwd();
}
const root = path.parse(cwd).root;
let found = false;
while (!found && cwd !== root) {
if (fs.existsSync(path.join(cwd, pathName))) {
found = true;
break;
}
cwd = path.dirname(cwd);
}
if (found) {
return cwd;
}
return null;
}
export function findGitRoot(cwd?: string) {
return searchUp('.git', cwd);
}
export function findPackageRoot(cwd?: string) {
return searchUp('package.json', cwd);
}
export function getChangeFilePath(cwd?: string) {
const gitRoot = findGitRoot(cwd);
if (gitRoot) {
return path.join(gitRoot, 'beachbump');
}
return null;
}

13
tsconfig.json Normal file
Просмотреть файл

@ -0,0 +1,13 @@
{
"compilerOptions": {
"outDir": "./lib",
"target": "es2016",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"declarationMap": true,
"strict": true,
"esModuleInterop": true
},
"include": ["src/**/*"]
}

36
yarn.lock Normal file
Просмотреть файл

@ -0,0 +1,36 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@types/node@^12.0.4":
version "12.0.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.4.tgz#46832183115c904410c275e34cf9403992999c32"
integrity sha512-j8YL2C0fXq7IONwl/Ud5Kt0PeXw22zGERt+HSSnwbKOJVsAGkEz3sFCYwaF9IOuoG1HOtE0vKCj6sXF7Q0+Vaw==
"@types/prompts@~2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@types/prompts/-/prompts-2.0.0.tgz#28551307ae9e10f5e5b703edcd7261c84b8a5f2f"
integrity sha512-Rl7itDnYA+Eunkd8WUcB7SF8B0cuzykwDWeQ2rfZry8fqdXJ3piw5B+SgzHWBYQuHCwF7E5iyozQf3BziCuXhA==
kleur@^3.0.2:
version "3.0.3"
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==
prompts@~2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.1.0.tgz#bf90bc71f6065d255ea2bdc0fe6520485c1b45db"
integrity sha512-+x5TozgqYdOwWsQFZizE/Tra3fKvAoy037kOyU6cgz84n8f6zxngLOV4O32kTwt9FcLCxAqw0P/c8rOr9y+Gfg==
dependencies:
kleur "^3.0.2"
sisteransi "^1.0.0"
sisteransi@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.0.tgz#77d9622ff909080f1c19e5f4a1df0c1b0a27b88c"
integrity sha512-N+z4pHB4AmUv0SjveWRd6q1Nj5w62m5jodv+GD8lvmbY/83T/rpbJGZOnK5T149OldDj4Db07BSv9xY4K6NTPQ==
typescript@^3.5.1:
version "3.5.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.1.tgz#ba72a6a600b2158139c5dd8850f700e231464202"
integrity sha512-64HkdiRv1yYZsSe4xC1WVgamNigVYjlssIoaH2HcZF0+ijsk5YK2g0G34w9wJkze8+5ow4STd22AynfO6ZYYLw==