Skip to content
This repository was archived by the owner on May 1, 2023. It is now read-only.

Commit 6149c2b

Browse files
authored
Merge pull request #4 from inyono/development
2 parents 875dc94 + 191c09a commit 6149c2b

File tree

15 files changed

+6251
-1968
lines changed

15 files changed

+6251
-1968
lines changed

.github/workflows/deploy.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
update-version:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
tag: ${{ steps.version.outputs.tag }}
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 2
15+
- id: version
16+
uses: salsify/action-detect-and-tag-new-version@v2
17+
npm-package:
18+
runs-on: ubuntu-latest
19+
needs: update-version
20+
if: ${{ needs.update-version.outputs.tag }}
21+
steps:
22+
- uses: actions/checkout@v2
23+
- uses: actions/setup-node@v1
24+
with:
25+
node-version: 14.x
26+
registry-url: 'https://registry.npmjs.org'
27+
- id: yarn-cache-dir-path
28+
run: echo "::set-output name=dir::$(yarn cache dir)"
29+
- uses: actions/cache@v2
30+
with:
31+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
32+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
33+
restore-keys: |
34+
${{ runner.os }}-yarn-
35+
- run: yarn
36+
- run: yarn build
37+
- run: npm publish
38+
env:
39+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/workflow.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: JavaScript
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node-version:
13+
- 12.x
14+
- 14.x
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-node@v1
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- id: yarn-cache-dir-path
21+
run: echo "::set-output name=dir::$(yarn cache dir)"
22+
- uses: actions/cache@v2
23+
with:
24+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
25+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
26+
restore-keys: |
27+
${{ runner.os }}-yarn-
28+
- run: yarn
29+
- run: yarn build
30+
lint:
31+
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
node-version:
35+
- 12.x
36+
- 14.x
37+
steps:
38+
- uses: actions/checkout@v2
39+
- uses: actions/setup-node@v1
40+
with:
41+
node-version: ${{ matrix.node-version }}
42+
- id: yarn-cache-dir-path
43+
run: echo "::set-output name=dir::$(yarn cache dir)"
44+
- uses: actions/cache@v2
45+
with:
46+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
47+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
48+
restore-keys: |
49+
${{ runner.os }}-yarn-
50+
- run: yarn
51+
- run: yarn lint
52+
test:
53+
runs-on: ubuntu-latest
54+
strategy:
55+
matrix:
56+
node-version:
57+
- 12.x
58+
- 14.x
59+
steps:
60+
- uses: actions/checkout@v2
61+
- uses: actions/setup-node@v1
62+
with:
63+
node-version: ${{ matrix.node-version }}
64+
- id: yarn-cache-dir-path
65+
run: echo "::set-output name=dir::$(yarn cache dir)"
66+
- uses: actions/cache@v2
67+
with:
68+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
69+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
70+
restore-keys: |
71+
${{ runner.os }}-yarn-
72+
- run: yarn
73+
- run: yarn test

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Transpiled code
2+
dist/

CHANGELOG.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
# Changelog
22

3-
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
3+
All notable changes to this project will be documented in this file.
44

5-
## [0.0.2] - 2018-11-18
5+
## [0.0.2](https://github.com/inyono/copyright-headers/compare/0.0.1..0.0.2) - November 18, 2018
66

77
### Fixed
88

99
- Handle multiple multiline comments without newline in between correctly
1010

11-
## [0.0.1] - 2018-11-08
11+
## [0.0.1](https://github.com/inyono/copyright-headers/compare/0.0.0..0.0.1) - November 8, 2018
1212

1313
### Added
1414

15-
- Add function `updateCopyrightHeader` with slightly different API as a replacement for `updateLicenseHeader`
16-
- Add tests
15+
- Add function `updateCopyrightHeader` with slightly different API as a replacement for `updateLicenseHeader`.
1716

1817
### Deprecated
1918

20-
- `updateLicenseHeader` will be removed with the next breaking change. Use the new `updateCopyrightHeader` instead
19+
- `updateLicenseHeader` will be removed with the next breaking change. Use the new `updateCopyrightHeader` instead.
2120

2221
### Fixed
2322

2423
- Handle `language.after` (e.g. `?>` for PHTML) correctly when input already starts with `language.begin` (e.g. `<?php`)
2524

26-
## [0.0.0] - 2018-11-08
25+
### Internal
26+
27+
- Add tests.
28+
29+
## [0.0.0](https://github.com/inyono/copyright-headers/compare/df12fe2868efc66641034590c3ffd37e0896afbb..0.0.0) - November 8, 2018
2730

2831
### Added
2932

3033
- Add initial `updateLicenseHeader` function supporting JavaScript, TypeScript, PHP, PHTML and Twig.
31-
32-
[unreleased]: https://github.com/splish-me/copyright-headers/compare/0.0.2...HEAD
33-
[0.0.2]: https://github.com/splish-me/copyright-headers/compare/0.0.1...0.0.2
34-
[0.0.1]: https://github.com/splish-me/copyright-headers/compare/0.0.0...0.0.1
35-
[0.0.0]: https://github.com/splish-me/copyright-headers/compare/df12fe2868efc66641034590c3ffd37e0896afbb...HEAD

__tests__/index.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ import {
33
CopyrightHeaderStatus,
44
getUpdatedCopyrightHeader,
55
php,
6-
phtml
6+
phtml,
77
} from '../src'
88

99
describe('php', () => {
1010
const options: CopyrightHeaderOptions = {
1111
lines: [
1212
'This file is part of @splish-me/copyright-headers',
1313
'',
14-
'Copyright (c) 2018 Splish UG (haftungsbeschränkt)'
15-
]
14+
'Copyright (c) 2018 Splish UG (haftungsbeschränkt)',
15+
],
1616
}
1717

1818
test('does not start with <?php', () => {
@@ -76,7 +76,7 @@ echo "foo bar";
7676
`
7777
const [status, output] = getUpdatedCopyrightHeader(input, php, {
7878
...options,
79-
shouldUpdate: () => true
79+
shouldUpdate: () => true,
8080
})
8181

8282
expect(status).toEqual(CopyrightHeaderStatus.Changed)
@@ -99,7 +99,7 @@ echo "foo bar";
9999
`
100100
const [status, output] = getUpdatedCopyrightHeader(input, php, {
101101
...options,
102-
shouldUpdate: () => false
102+
shouldUpdate: () => false,
103103
})
104104

105105
expect(status).toEqual(CopyrightHeaderStatus.External)
@@ -121,7 +121,7 @@ echo "foo bar";
121121
`
122122
const [status, output] = getUpdatedCopyrightHeader(input, php, {
123123
...options,
124-
shouldUpdate: () => true
124+
shouldUpdate: () => true,
125125
})
126126

127127
expect(status).toEqual(CopyrightHeaderStatus.Changed)
@@ -153,7 +153,7 @@ echo "foo bar";
153153
`
154154
const [status, output] = getUpdatedCopyrightHeader(input, php, {
155155
...options,
156-
shouldUpdate: () => true
156+
shouldUpdate: () => true,
157157
})
158158

159159
expect(status).toEqual(CopyrightHeaderStatus.Changed)
@@ -176,8 +176,8 @@ describe('phtml', () => {
176176
lines: [
177177
'This file is part of @splish-me/copyright-headers',
178178
'',
179-
'Copyright (c) 2018 Splish UG (haftungsbeschränkt)'
180-
]
179+
'Copyright (c) 2018 Splish UG (haftungsbeschränkt)',
180+
],
181181
}
182182

183183
test('does not start with <?php', () => {
@@ -224,7 +224,7 @@ echo "foo bar";
224224
`
225225
const [status, output] = getUpdatedCopyrightHeader(input, phtml, {
226226
...options,
227-
shouldUpdate: () => true
227+
shouldUpdate: () => true,
228228
})
229229

230230
expect(status).toEqual(CopyrightHeaderStatus.Changed)
@@ -249,7 +249,7 @@ echo "foo bar";
249249
`
250250
const [status, output] = getUpdatedCopyrightHeader(input, phtml, {
251251
...options,
252-
shouldUpdate: () => false
252+
shouldUpdate: () => false,
253253
})
254254

255255
expect(status).toEqual(CopyrightHeaderStatus.External)
@@ -272,7 +272,7 @@ echo "foo bar";
272272
`
273273
const [status, output] = getUpdatedCopyrightHeader(input, php, {
274274
...options,
275-
shouldUpdate: () => true
275+
shouldUpdate: () => true,
276276
})
277277

278278
expect(status).toEqual(CopyrightHeaderStatus.Changed)
@@ -306,7 +306,7 @@ echo "foo bar";
306306
`
307307
const [status, output] = getUpdatedCopyrightHeader(input, php, {
308308
...options,
309-
shouldUpdate: () => true
309+
shouldUpdate: () => true,
310310
})
311311

312312
expect(status).toEqual(CopyrightHeaderStatus.Changed)

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
preset: 'ts-jest',
3-
testEnvironment: 'node'
3+
testEnvironment: 'node',
44
}

package.json

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,49 @@
11
{
2-
"name": "@splish-me/copyright-headers",
3-
"version": "0.0.2",
4-
"homepage": "https://github.com/splish-me/copyright-headers",
2+
"name": "@inyono/copyright-headers",
3+
"version": "0.1.0",
4+
"homepage": "https://github.com/inyono/changelog",
55
"bugs": {
6-
"url": "https://github.com/splish-me/copyright-headers/issues"
6+
"url": "https://github.com/inyono/changelog/issues"
77
},
8+
"repository": "inyono/copyright-headers",
89
"license": "MIT",
9-
"author": "Splish UG (haftungsbeschränkt)",
10-
"files": [
11-
"dist",
12-
"src"
13-
],
10+
"author": "Jonas Keinholz <[email protected]>",
1411
"main": "dist/index.js",
15-
"repository": "github:splish-me/copyright-headers",
12+
"source": "src/index.ts",
13+
"types": "dist/index.d.ts",
1614
"scripts": {
15+
"_prettier": "prettier .",
1716
"prebuild": "rimraf dist",
18-
"build": "tsc",
19-
"format": "npm-run-all format:*",
20-
"lint": "npm-run-all lint:*",
17+
"build": "tsdx build --target node --format cjs --tsconfig tsconfig.prod.json",
18+
"changelog": "ts-node --compiler-options '{\"module\": \"commonjs\"}' scripts/changelog",
19+
"format": "yarn _prettier --write",
2120
"license": "ts-node scripts/license-headers",
22-
"test": "jest",
23-
"format:prettier": "yarn _prettier --write",
24-
"lint:prettier": "yarn _prettier --list-different",
25-
"_php-cs-fixer": "php php-cs-fixer.phar fix --config=php-cs-fixer.config.php",
26-
"_prettier": "prettier \"{src/**/*,*}.{js,jsx,ts,tsx,css,scss,sass,less,json,md,markdown,yaml,yml}\""
21+
"lint": "npm-run-all --parallel lint:prettier lint:tsc",
22+
"lint:prettier": "yarn _prettier --check",
23+
"lint:tsc": "tsc --noEmit",
24+
"test": "jest"
2725
},
2826
"dependencies": {
29-
"ramda": "^0.26.0",
30-
"signale": "^1.3.0"
27+
"ramda": "^0.27.0",
28+
"signale": "^1.0.0"
3129
},
3230
"devDependencies": {
31+
"@inyono/changelog": "^0.2.0",
3332
"@types/glob": "^7.0.0",
34-
"@types/jest": "^23.3.9",
35-
"@types/node": "^10.0.0",
36-
"@types/ramda": "^0.25.41",
37-
"@types/signale": "^1.2.0",
33+
"@types/jest": "^26.0.0",
34+
"@types/node": "^14.0.0",
35+
"@types/ramda": "^0.27.0",
36+
"@types/signale": "^1.0.0",
3837
"glob": "^7.0.0",
39-
"jest": "^23.6.0",
38+
"jest": "^26.0.0",
4039
"npm-run-all": "^4.0.0",
41-
"prettier": "^1.0.0",
42-
"rimraf": "^2.6.2",
43-
"ts-jest": "^23.10.4",
44-
"ts-node": "^7.0.0",
45-
"typescript": "^3.0.0"
40+
"prettier": "^2.0.0",
41+
"prettier-plugin-packagejson": "^2.0.0",
42+
"rimraf": "^3.0.0",
43+
"ts-jest": "^26.0.0",
44+
"ts-node": "^9.0.0",
45+
"tsdx": "^0.14.0",
46+
"typescript": "^4.0.0"
4647
},
4748
"publishConfig": {
4849
"access": "public"

prettier.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
semi: false,
3+
singleQuote: true,
4+
}

0 commit comments

Comments
 (0)