-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c88fdec
Showing
8 changed files
with
13,518 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
version: 2.1 | ||
|
||
jobs: | ||
install: | ||
docker: | ||
- image: &node_image circleci/node:lts | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- &install_cache_key npm-install-v1-{{ checksum "package-lock.json" }} | ||
- npm-install-v1- | ||
- run: | ||
name: Install Dependencies | ||
command: npm ci --no-audit | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- node_modules | ||
- build | ||
- save_cache: | ||
key: *install_cache_key | ||
paths: | ||
- ~/.npm/_cacache | ||
|
||
audit: | ||
docker: | ||
- image: *node_image | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
name: NPM Audit | ||
command: | | ||
npm -v | ||
npm audit --audit-level=moderate | ||
test: | ||
docker: | ||
- image: *node_image | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
name: Test Packages | ||
command: npm run test -- --ci | ||
|
||
publish: | ||
docker: | ||
- image: *node_image | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
name: npmrc | ||
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | ||
- deploy: | ||
name: Publish | ||
when: on_success | ||
command: | | ||
git config --global user.name Bot Vance | ||
git config --global user.email bot@autovance.com | ||
npx semantic-release | ||
workflows: | ||
version: 2 | ||
|
||
test: | ||
jobs: | ||
- install: | ||
context: org-global | ||
- audit: | ||
context: org-global | ||
requires: | ||
- install | ||
- test: | ||
context: org-global | ||
requires: | ||
- install | ||
- publish: | ||
context: org-global | ||
requires: | ||
- test | ||
- audit | ||
filters: | ||
branches: | ||
only: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/ | ||
node_modules/ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testRegex: 'tests/.*\\.ts$', | ||
// automock: true, | ||
moduleFileExtensions: ['ts', 'js'], | ||
coverageThreshold: { | ||
global: { | ||
branches: 100, | ||
functions: 100, | ||
lines: 100, | ||
statements: 100 | ||
} | ||
}, | ||
transform: { | ||
'^.+\\.tsx?$': ['ts-jest'], | ||
'\\.ts$': ['ts-jest'] | ||
}, | ||
rootDir: '.', | ||
globals: { | ||
'ts-jest': { | ||
tsConfig: 'tsconfig.json' | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* eslint-disable no-restricted-syntax */ | ||
|
||
import { extname, basename, dirname, sep } from 'path'; | ||
|
||
class FilePath { | ||
/** The string representing the file name excluding the extension */ | ||
public filename: string | undefined; | ||
|
||
/** An ordered array of folder names. folders[0] represents the root of the path. | ||
* If absolute, it will be empty '' (required), if relative, it will be the folder reference '.' or '..' | ||
*/ | ||
public folders: string[] = []; | ||
|
||
private _extension: string | undefined; | ||
|
||
/** Set a up path to be manipulated */ | ||
public constructor(path: string) { | ||
this.path = path; | ||
} | ||
|
||
/** Set: up a path to be manipulated */ | ||
public set path(path: string) { | ||
this.extension = extname(path); | ||
this.filename = basename(path, `.${this.extension}`); | ||
this.folders = dirname(path).split(sep); | ||
} | ||
|
||
/** Get: the current path */ | ||
public get path() { | ||
return `${this.folders.join(sep)}${sep}${this.file ? this.file : ''}`; | ||
} | ||
|
||
/** Set: the full file name including the extension */ | ||
public set file(file: string | undefined) { | ||
if (file) { | ||
this.extension = extname(file); | ||
this.filename = basename(file, `.${this.extension}`); | ||
} else { | ||
this.extension = undefined; | ||
this.filename = undefined; | ||
} | ||
} | ||
|
||
/** Get: the full file with the extension included */ | ||
public get file(): string | undefined { | ||
if (this.filename) { | ||
return `${this.filename}${this.extension ? `.${this.extension}` : ''}`; | ||
} else return undefined; | ||
} | ||
|
||
/** Set: the extension */ | ||
public set extension(extension: string | undefined) { | ||
if (extension) this._extension = extension.replace(/^\./g, ''); | ||
else this._extension = undefined; | ||
} | ||
|
||
/** Get: the extension. Does not include the `.` delimiter */ | ||
public get extension(): string | undefined { | ||
return this._extension; | ||
} | ||
} | ||
|
||
export default FilePath; |
Oops, something went wrong.