Skip to content

Commit

Permalink
refactor: typescript
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
- Refactor to typescript. Generated output is comparable to previous javascript implementation, no additional functionality changes made.
- Use github actions build pipeline and semantic release
  • Loading branch information
allenevans committed Dec 27, 2019
1 parent 95a5685 commit 91b0d33
Show file tree
Hide file tree
Showing 17 changed files with 9,064 additions and 3,122 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
@@ -0,0 +1,14 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120

[*.md]
trim_trailing_whitespace = false
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,37 @@
name: "build"

on: [pull_request]

jobs:
validation:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [8, 10, 12, 13]

steps:
- uses: actions/checkout@v1

- name: "Config"
run: |
git config --global user.email "git-ci@techinity.com"
git config --global user.name "gitci"
- name: "Install dependencies"
run: npm install

- name: "Build"
run: npm run build

- name: "Test"
run: npm run test

- name: "Lint"
run: npm run lint

- name: "Semantic version"
if: |
contains(github.event.commits[0].message, '[skip ci]') == false
run: |
npm run release -- --dry-run
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,38 @@
name: "release"
on:
push:
branches:
- 'master'

jobs:
validation:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12]

steps:
- uses: actions/checkout@v1

- name: "Config"
run: |
echo "Release triggered by ${{github.actor}}"
echo "Commit ${{github.event.commits[0].message}}"
git config --global user.email "git-ci@techinity.com"
git config --global user.name "gitci"
- name: "Install dependencies"
run: npm install

- name: "Build"
run: npm run build

- name: "Test"
run: npm run test

- name: "Semantic version"
if: |
contains(github.event.commits[0].message, '[skip ci]') == false
run: |
npm run release
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,2 +1,5 @@
.npmrc
coverage/
dist/
node_modules/
*.tgz
10 changes: 10 additions & 0 deletions .prettierrc
@@ -0,0 +1,10 @@
{
"arrowParens": "always",
"jsxBracketSameLine": false,
"parser": "typescript",
"printWidth": 120,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
10 changes: 10 additions & 0 deletions .releaserc
@@ -0,0 +1,10 @@
{
"branch": "master",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
]
}
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

20 changes: 10 additions & 10 deletions README.md
@@ -1,8 +1,6 @@
Url Parameter Append
====================

[![Build Status](https://travis-ci.org/techinity/url-parameter-append.svg?branch=master)](https://travis-ci.org/techinity/url-parameter-append)

A quick and easy utility method for adding, updating or removing querystring parameters.

Installation
Expand All @@ -21,17 +19,19 @@ Tests can be executed using the following:
npm test
```

How to Use
How to use
----------

__Reference the package__
__Reference the package:__
```javascript
const urlParameterAppend = require('url-parameter-append');
```
__or__
```javascript
import urlParameterAppend from 'url-parameter-append';
```

__Add querystring__


__Add querystring:__
```javascript
const url = urlParameterAppend('http://example.com/', 'search', 'test');
console.log(url);
Expand All @@ -51,7 +51,7 @@ console.log(url);
http://example.com/?search=test
```

__Replace parameter__
__Replace parameter:__
```javascript
const url = urlParameterAppend('http://example.com/?search=test', 'search', 'other');
console.log(url);
Expand All @@ -73,7 +73,7 @@ console.log(url);
http://example.com/?search=other
```

__Remove parameter__
__Remove parameter:__
```javascript
const url = urlParameterAppend('http://example.com/?search=test', 'search', null);
console.log(url);
Expand All @@ -93,6 +93,6 @@ console.log(url);
http://example.com/
```

More examples can be found in [url-parameter-append.spec.js](url-parameter-append.spec.js)
More examples can be found in [url-parameter-append.spec.ts](src/url-parameter-append.spec.ts)

Tests use the [jest](https://github.com/facebook/jest) testing framework.
17 changes: 17 additions & 0 deletions jest.config.js
@@ -0,0 +1,17 @@
module.exports = {
collectCoverage: true,
moduleFileExtensions: ['ts', 'js', 'json', 'node'],
resetMocks: true,
testMatch: [
'**/?(*.)spec.ts',
],
testPathIgnorePatterns: [
'dist/',
'node_modules/',
],
testURL: 'http://localhost/',
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
verbose: true,
};
23 changes: 0 additions & 23 deletions jest.config.json

This file was deleted.

0 comments on commit 91b0d33

Please sign in to comment.