Skip to content

Commit

Permalink
Ts-codebase (#82)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
pankajpatel authored May 2, 2022
1 parent 36a699b commit abdf659
Show file tree
Hide file tree
Showing 41 changed files with 1,281 additions and 565 deletions.
2 changes: 1 addition & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ ratings:
paths:
- "**.js"
- "**.module"
exclude_paths: []
exclude_paths: [ '**/*.spec.ts' ]
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**/*{.,-}min.js
dist
9 changes: 5 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2017
"ecmaVersion": 2018,
"sourceType": "module"
},

"env": {
"es6": true
},
"plugins": ["prettier"],
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"prettier/prettier": "error"
},
"extends": ["plugin:prettier/recommended"]
"extends": ["plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"]
}
41 changes: 28 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,41 @@ on:
types: [created]

jobs:
publish-npm:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm publish
node-version: 14
- name: node_modules cache
id: node-modules-cache
uses: actions/cache@v2
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
cache-name: node-modules-yarn
cache-fingerprint: ${{ env.node-version }}-${{ hashFiles('yarn.lock') }}
with:
path: node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-fingerprint }}
restore-keys: ${{ runner.os }}-${{ env.cache-name }}

publish-gpr:
- name: Yarn install
# called at most once for the workflow by the "setup" job
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile

publish-npm:
needs: [ setup ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
node-version: 14
registry-url: https://registry.npmjs.org/
- run: npm i -g yarn
- run: yarn install --prefer-offline --frozen-lockfile
- run: yarn build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
29 changes: 24 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ on:
branches: [ master ]

jobs:
build:

test:
name: test
runs-on: ubuntu-latest

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [12.x, 14.x, 16.x]
node-version: [14.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -27,3 +25,24 @@ jobs:
- run: npm i -g yarn
- run: yarn install
- run: yarn test

coverage:
needs: [ test ]
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
- run: npm install -g yarn
- run: yarn install
- run: yarn build
- uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: yarn run test:coverage
coverageLocations: |
${{github.workspace}}/coverage/*.lcov:lcov
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ jspm_packages
# Optional REPL history
.node_repl_history
.DS_Store
dist
stats
15 changes: 15 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
!dist
.github
.husky
.vscode
stats
src
.codeclimate.yml
.editorconfig
.eslintignore
.eslintrc.json
.gitignore
.prettier*
rollup.config.js
tsconfig.json
jest.config.js
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cSpell.words": [
"gitonly",
"typecheck"
]
}
146 changes: 0 additions & 146 deletions cli.js

This file was deleted.

46 changes: 46 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
declare module 'git-state';

type TableHeaderType = 'long' | 'short';

type TableHeader =
| 'displayPath'
| 'branch'
| 'ahead'
| 'dirty'
| 'untracked'
| 'stashes';

type Stat = {
path: string;
stat: FileSystem.Stats | null;
};

type GitStatus = {
branch: string;
issues: string;
untracked: string;
ahead: string;
stashes: string;
dirty: string;
};

interface ExtendedGitStatus extends GitStatus {
git: boolean;
path: string;
displayPath: string;
}

interface InsertFn {
(path: string, gitStatus: GitStatus): void;
}

interface DebugFn {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(...args: any[]): void;
}

type Options = {
debug: DebugFn;
insert: InsertFn;
showGitOnly: boolean;
};
8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */

module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
rootDir: '.',
coverageReporters: [['lcov']],
};
Loading

0 comments on commit abdf659

Please sign in to comment.