-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from d-koppenhagen/master
refactor: switch to typescript implementation
- Loading branch information
Showing
563 changed files
with
13,588 additions
and
195,229 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,13 @@ | ||
# Editor configuration, see https://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
max_line_length = off | ||
trim_trailing_whitespace = false |
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,27 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint", "prettier"], | ||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"], | ||
"rules": { | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"bracketSpacing": true, | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"semi": true | ||
} | ||
] | ||
}, | ||
"env": { | ||
"node": true, | ||
"jest": true, | ||
"es6": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
} | ||
} |
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,21 @@ | ||
name: CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: yarn install | ||
- run: yarn run lint | ||
- run: yarn run test |
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,16 @@ | ||
# Dependency directories | ||
node_modules/ | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache |
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,5 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm build | ||
git add . |
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 @@ | ||
16 |
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,6 @@ | ||
|
||
*.js.map | ||
*.d.ts | ||
*.md | ||
*.min.* | ||
dist/**/* |
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,5 @@ | ||
{ | ||
"printWidth": 120, | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} |
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,4 @@ | ||
{ | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true | ||
} |
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
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
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,95 @@ | ||
import * as github from '@actions/github'; | ||
import * as core from '@actions/core'; | ||
import * as exec from '@actions/exec'; | ||
import * as io from '@actions/io'; | ||
import * as path from 'path'; | ||
import run from '../index'; | ||
|
||
const originalContext = { ...github.context }; | ||
const originalGitHubWorkspace = process.env['GITHUB_WORKSPACE']; | ||
const gitHubWorkspace = path.resolve('/checkout-tests/workspace'); | ||
|
||
type InputsMock = { | ||
[name: string]: string; | ||
}; | ||
|
||
let inputs: InputsMock = {}; | ||
let execSpy: jest.SpyInstance; | ||
|
||
beforeAll(() => { | ||
execSpy = jest.spyOn(exec, 'exec').mockImplementation(jest.fn()); | ||
jest.spyOn(io, 'cp').mockImplementation(jest.fn()); | ||
|
||
jest.spyOn(core, 'getInput').mockImplementation((name: string) => { | ||
return inputs[name]; | ||
}); | ||
|
||
jest.spyOn(github.context, 'repo', 'get').mockImplementation(() => { | ||
return { | ||
owner: 'foo', | ||
repo: 'foo.github.io', | ||
}; | ||
}); | ||
|
||
github.context.ref = 'refs/heads/some-ref'; | ||
github.context.sha = '1234567890123456789012345678901234567890'; | ||
|
||
process.env['GITHUB_WORKSPACE'] = gitHubWorkspace; | ||
}); | ||
|
||
afterAll(() => { | ||
delete process.env['GITHUB_WORKSPACE']; | ||
if (originalGitHubWorkspace) { | ||
process.env['GITHUB_WORKSPACE'] = originalGitHubWorkspace; | ||
} | ||
|
||
github.context.ref = originalContext.ref; | ||
github.context.sha = originalContext.sha; | ||
|
||
jest.restoreAllMocks(); | ||
}); | ||
|
||
beforeEach(() => { | ||
jest.resetModules(); | ||
inputs = { | ||
'access-token': 'SECRET', | ||
}; | ||
}); | ||
|
||
describe('scully Publish action', () => { | ||
it('returns an error when no access token is given', async () => { | ||
inputs['access-token'] = ''; | ||
const setFailedSpy = jest.spyOn(core, 'setFailed'); | ||
|
||
await run(); | ||
|
||
expect(setFailedSpy).toBeCalledWith( | ||
'No personal access token found. Please provide one by setting the `access-token` input for this action.', | ||
); | ||
}); | ||
|
||
it('skips if deploy branch is the same as the current git head', async () => { | ||
inputs['deploy-branch'] = 'some-ref'; | ||
github.context.ref = 'refs/heads/some-ref'; | ||
|
||
await expect(run()).resolves.not.toThrowError(); | ||
}); | ||
|
||
it('calls angular build without args', async () => { | ||
inputs['build-args'] = ''; | ||
inputs['scully-args'] = ''; | ||
|
||
await run(); | ||
|
||
expect(execSpy).toHaveBeenLastCalledWith('yarn run build ', []); | ||
}); | ||
|
||
it('calls angular build with args', async () => { | ||
inputs['build-args'] = '--prefix-paths --no-uglify'; | ||
inputs['scully-args'] = ''; | ||
|
||
await run(); | ||
|
||
expect(execSpy).toHaveBeenLastCalledWith('yarn run build -- --prefix-paths --no-uglify', []); | ||
}); | ||
}); |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.