Skip to content

Commit abdf659

Browse files
authored
Ts-codebase (#82)
* install-ts * TS-rewrite * rearrage-table-insertion * ci-testing-filters * yml-in-filters * rename-stat.file-to-stat.path * cleanup-ci-filters * coverage-codeclimate * fix-covrage-script * fix-covrage-script * fix-covrage-node-version * fix-covrage-node-version * fix-covrage-node-version * coverage-reporter-settings * release-script-fixes * release-script-artefacts * release-script-artefacts-fixes * changedir-in-publish-workflow * changedir-in-publish-workflow * changedir-in-publish-workflow * changedir-in-publish-workflow * changedir-in-publish-workflow * remove-gpr-publish * dependency-upgrades * remove-unnecessary-files-from-bundle * ready-for-1.0.0
1 parent 36a699b commit abdf659

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1281
-565
lines changed

.codeclimate.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ ratings:
1515
paths:
1616
- "**.js"
1717
- "**.module"
18-
exclude_paths: []
18+
exclude_paths: [ '**/*.spec.ts' ]

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
**/*{.,-}min.js
2+
dist

.eslintrc.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
2+
"parser": "@typescript-eslint/parser",
23
"parserOptions": {
3-
"ecmaVersion": 2017
4+
"ecmaVersion": 2018,
5+
"sourceType": "module"
46
},
5-
67
"env": {
78
"es6": true
89
},
9-
"plugins": ["prettier"],
10+
"plugins": ["@typescript-eslint", "prettier"],
1011
"rules": {
1112
"prettier/prettier": "error"
1213
},
13-
"extends": ["plugin:prettier/recommended"]
14+
"extends": ["plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"]
1415
}

.github/workflows/publish.yml

+28-13
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,41 @@ on:
88
types: [created]
99

1010
jobs:
11-
publish-npm:
11+
setup:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-node@v1
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
1616
with:
17-
node-version: 12
18-
registry-url: https://registry.npmjs.org/
19-
- run: npm publish
17+
node-version: 14
18+
- name: node_modules cache
19+
id: node-modules-cache
20+
uses: actions/cache@v2
2021
env:
21-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
22+
cache-name: node-modules-yarn
23+
cache-fingerprint: ${{ env.node-version }}-${{ hashFiles('yarn.lock') }}
24+
with:
25+
path: node_modules
26+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-fingerprint }}
27+
restore-keys: ${{ runner.os }}-${{ env.cache-name }}
2228

23-
publish-gpr:
29+
- name: Yarn install
30+
# called at most once for the workflow by the "setup" job
31+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
32+
run: yarn install --prefer-offline --frozen-lockfile
33+
34+
publish-npm:
35+
needs: [ setup ]
2436
runs-on: ubuntu-latest
2537
steps:
26-
- uses: actions/checkout@v2
27-
- uses: actions/setup-node@v1
38+
- uses: actions/checkout@v3
39+
- uses: actions/setup-node@v3
2840
with:
29-
node-version: 12
30-
registry-url: https://npm.pkg.github.com/
41+
node-version: 14
42+
registry-url: https://registry.npmjs.org/
43+
- run: npm i -g yarn
44+
- run: yarn install --prefer-offline --frozen-lockfile
45+
- run: yarn build
3146
- run: npm publish
3247
env:
33-
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
48+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/tests.yml

+24-5
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@ on:
77
branches: [ master ]
88

99
jobs:
10-
build:
11-
10+
test:
11+
name: test
1212
runs-on: ubuntu-latest
13-
1413
strategy:
1514
matrix:
1615
os: [ubuntu-latest, macos-latest, windows-latest]
17-
node-version: [12.x, 14.x, 16.x]
16+
node-version: [14.x, 16.x]
1817
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
19-
2018
steps:
2119
- uses: actions/checkout@v3
2220
- name: Use Node.js ${{ matrix.node-version }}
@@ -27,3 +25,24 @@ jobs:
2725
- run: npm i -g yarn
2826
- run: yarn install
2927
- run: yarn test
28+
29+
coverage:
30+
needs: [ test ]
31+
name: coverage
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v3
35+
- uses: actions/setup-node@v3
36+
with:
37+
node-version: '14'
38+
- run: npm install -g yarn
39+
- run: yarn install
40+
- run: yarn build
41+
- uses: paambaati/[email protected]
42+
env:
43+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
44+
with:
45+
coverageCommand: yarn run test:coverage
46+
coverageLocations: |
47+
${{github.workspace}}/coverage/*.lcov:lcov
48+

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ jspm_packages
3636
# Optional REPL history
3737
.node_repl_history
3838
.DS_Store
39+
dist
40+
stats

.npmignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
!dist
2+
.github
3+
.husky
4+
.vscode
5+
stats
6+
src
7+
.codeclimate.yml
8+
.editorconfig
9+
.eslintignore
10+
.eslintrc.json
11+
.gitignore
12+
.prettier*
13+
rollup.config.js
14+
tsconfig.json
15+
jest.config.js

.vscode/settings.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cSpell.words": [
3+
"gitonly",
4+
"typecheck"
5+
]
6+
}

cli.js

-146
This file was deleted.

index.d.ts

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
declare module 'git-state';
2+
3+
type TableHeaderType = 'long' | 'short';
4+
5+
type TableHeader =
6+
| 'displayPath'
7+
| 'branch'
8+
| 'ahead'
9+
| 'dirty'
10+
| 'untracked'
11+
| 'stashes';
12+
13+
type Stat = {
14+
path: string;
15+
stat: FileSystem.Stats | null;
16+
};
17+
18+
type GitStatus = {
19+
branch: string;
20+
issues: string;
21+
untracked: string;
22+
ahead: string;
23+
stashes: string;
24+
dirty: string;
25+
};
26+
27+
interface ExtendedGitStatus extends GitStatus {
28+
git: boolean;
29+
path: string;
30+
displayPath: string;
31+
}
32+
33+
interface InsertFn {
34+
(path: string, gitStatus: GitStatus): void;
35+
}
36+
37+
interface DebugFn {
38+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
39+
(...args: any[]): void;
40+
}
41+
42+
type Options = {
43+
debug: DebugFn;
44+
insert: InsertFn;
45+
showGitOnly: boolean;
46+
};

jest.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2+
3+
module.exports = {
4+
preset: 'ts-jest',
5+
testEnvironment: 'node',
6+
rootDir: '.',
7+
coverageReporters: [['lcov']],
8+
};

0 commit comments

Comments
 (0)