Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
princjef committed Mar 10, 2019
0 parents commit f6c6a4d
Show file tree
Hide file tree
Showing 15 changed files with 11,378 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Node.js
node_modules/

# Build output
/dist/

# Pack output
*.tgz

# Test output
/coverage/
/junit.xml
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGELOG.md
2 changes: 2 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
singleQuote: true
proseWrap: always
20 changes: 20 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MIT License

Copyright (c) 2019 Jeffrey Principe

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# commitlint-azure-pipelines-cli

Lint relevant commits for a branch or Pull Request in [Azure Pipelines][] using
[commitlint][] with no configuration needed.

## Getting Started

Add this package and commitlint to your dev dependencies:

```
npm install --save-dev @commitlint/cli commitlint-azure-pipelines-cli
```

Then, in your `azure-pipelines.yml` file, add a step to invoke it:

```yml
steps:
# Other steps (e.g. install, setup)
- script: ./node_modules/.bin/commitlint-azure-pipelines
```
Alternatively, you can add a standalone job for running commitlint:
```yml
jobs:
- job: commitlint
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: NodeTool@0
inputs:
versionSpec: 10.x
- script: npm ci
- script: ./node_modules/.bin/commitlint-azure-pipelines
name: Lint commits
```
## Compatibility
This package is only tested against the latest Node.js LTS release. Make sure
you select the latest LTS release for your commitlint step/job. This task is
tested against all of the hosted operating systems (win, mac, linux).
[azure pipelines]: https://azure.microsoft.com/en-us/services/devops/pipelines/
[commitlint]: https://github.com/conventional-changelog/commitlint
78 changes: 78 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
variables:
- group: semantic-release

trigger:
- master

pr:
- master

jobs:
- job: commitlint
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: NodeTool@0
inputs:
versionSpec: 10.x
displayName: Use Node.js 10
- script: npm ci
displayName: Install Dependencies
- script: npm run build
displayName: Build
- script: |
chmod a+x ./bin/run
./bin/run
workingDirectory: $(Build.SourcesDirectory)
displayName: Lint Commits
- job: Test
strategy:
matrix:
linux:
imageName: 'ubuntu-16.04'
mac:
imageName: 'macos-10.13'
windows:
imageName: 'vs2017-win2016'
pool:
vmImage: $(imageName)
steps:
- task: NodeTool@0
inputs:
versionSpec: 10.x
displayName: Use Node.js 10
- script: npm ci
displayName: Install Dependencies
- script: npm test
displayName: Run Tests
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: junit.xml
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: coverage/cobertura-coverage.xml
reportDirectory: coverage

- job: publish
dependsOn:
- commitlint
- test
pool:
vmImage: 'ubuntu-16.04'
condition: and(succeeded(), in(variables['Build.Reason'], 'Manual', 'IndividualCI', 'BatchedCI'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
steps:
- task: NodeTool@0
inputs:
versionSpec: 10.x
displayName: Use Node.js 10
- script: npm ci
displayName: Install Dependencies
- script: npm run release
env:
GH_TOKEN: $(GH_TOKEN)
NPM_TOKEN: $(NPM_TOKEN)
displayName: Publish to NPM
7 changes: 7 additions & 0 deletions bin/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env node

require('../dist').default().catch(err => {
console.log(err);
process.exit(1);
});

3 changes: 3 additions & 0 deletions bin/run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\run" %*
1 change: 1 addition & 0 deletions lib.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module '@commitlint/cli';
Loading

0 comments on commit f6c6a4d

Please sign in to comment.