Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement flow translation addition #322

Merged
merged 30 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6fb03b5
feat: implement a flow translation handler
scolladon Aug 2, 2022
f2f24c9
refactor: implement treat package as a post processing action
scolladon Aug 3, 2022
6507fdf
refactor: simplify fsHelper API
scolladon Aug 3, 2022
59b8623
refactor: split function in package generator
scolladon Aug 3, 2022
5749109
refactor: extract file and package utility from standardHandler
scolladon Aug 3, 2022
1401e5c
refactor: implement translation addition from flow as post processor
scolladon Aug 3, 2022
facb770
refactor: package service class to helper methods
scolladon Aug 4, 2022
bfff84e
refactor: merge package helper and package generator
scolladon Aug 4, 2022
7e6b8e5
refactor: remove duplication in packageGenerator
scolladon Aug 4, 2022
f8a0818
test: add fillPackageWithParameter test suite
scolladon Aug 4, 2022
ca436d7
build: move analysis check to push
scolladon Aug 4, 2022
7e56951
build: remove eslint check from analysis
scolladon Aug 4, 2022
ef609b6
build: use runInBand in CI
scolladon Aug 4, 2022
113741f
test: add fsHelper test suite
scolladon Aug 4, 2022
cfe5759
test: add baseProcessor test suite
scolladon Aug 5, 2022
8fe178a
test: add postProcessorManager test suite
scolladon Aug 5, 2022
b659bf1
test: add packageGenerator test suite
scolladon Aug 5, 2022
52919b4
refactor: remove unecessary argument
scolladon Aug 6, 2022
00b66d5
fix: flowTranslationProcessor when there a translation and no flow
scolladon Aug 6, 2022
9b0a88d
test: add flowTranslationProcessor test suite
scolladon Aug 6, 2022
ec045d4
refactor: simplify flowTranslationProcessor
scolladon Aug 7, 2022
11f7c46
test: improve branch coverage
scolladon Aug 7, 2022
e79e71d
build: upgrade dependencies
scolladon Aug 7, 2022
2629827
fix: pre-push code analysis issue
scolladon Aug 7, 2022
e2594f5
build: migrate stanza to dedicated file
scolladon Aug 7, 2022
915ab0b
refactor: simplify flowTranslationProcessor.test
scolladon Aug 8, 2022
53d6c2a
feat: add translation if not already present
scolladon Aug 15, 2022
276e63e
build: schedule dependency check once a week
scolladon Aug 15, 2022
5e50501
build: upgrade cache and checkout to v3
scolladon Aug 15, 2022
e962179
refactor: use fsHelper readFile
scolladon Aug 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ plugins:
config:
languages:
- javascript
eslint:
enabled: true
channel: eslint-8
config:
config: .eslintrc.js
extensions:
- .js
- .ts
fixme:
enabled: true
exclude_patterns:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: 'Check Dependencies'

on:
schedule:
- cron: '0 0 * * *'
- cron: '0 0 * * 1'

jobs:
check-dependencies:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v1
Expand All @@ -21,7 +21,7 @@ jobs:
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache yarn
uses: actions/cache@v2
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v1
Expand All @@ -21,7 +21,7 @@ jobs:
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache yarn
uses: actions/cache@v2
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand All @@ -36,7 +36,7 @@ jobs:
run: yarn pack

- name: Unit test
run: yarn test:coverage
run: yarn test:coverage --runInBand

- name: Upload coverage
uses: codecov/codecov-action@v1
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v1
Expand All @@ -22,7 +22,7 @@ jobs:
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache yarn
uses: actions/cache@v2
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand All @@ -43,7 +43,7 @@ jobs:
run: yarn pack

- name: Unit test
run: yarn test:coverage
run: yarn test:coverage --runInBand

- name: Upload coverage
uses: codecov/codecov-action@v1
Expand All @@ -59,7 +59,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
Expand All @@ -71,7 +71,7 @@ jobs:
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache yarn
uses: actions/cache@v2
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand All @@ -98,7 +98,7 @@ jobs:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{secrets.ADMIN_TOKEN}}
Expand All @@ -24,7 +24,7 @@ jobs:
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache yarn
uses: actions/cache@v2
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
1 change: 0 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
yarn analysis
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@

yarn pack
yarn test:coverage
yarn analysis force-app
yarn outdated
5 changes: 5 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"scripts": {
"postbump": "yarn pack && git add README.md"
}
}
4 changes: 3 additions & 1 deletion __mocks__/fast-xml-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ fxp.__setMockContent = contents => {
}
}

const mockParse = jest.fn(content => JSON.parse(xml2json.get(content)))
fxp.XMLParser = function () {
return {
parse: jest.fn(content => JSON.parse(xml2json.get(content))),
parse: mockParse,
}
}

Expand All @@ -25,3 +26,4 @@ fxp.XMLBuilder = function () {
}

module.exports = fxp
module.exports.mockParse = mockParse
2 changes: 1 addition & 1 deletion __mocks__/fs-extra.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fse.outputFileError = false
fse.pathShouldExist = true

fse.pathExists.mockImplementation(() => Promise.resolve(fse.pathShouldExist))
fse.copy = jest.fn(() => {
fse.copy.mockImplementation(() => {
if (fse.errorMode) return Promise.reject()
return Promise.resolve()
})
Expand Down
10 changes: 8 additions & 2 deletions __mocks__/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,15 @@ fs.promises.readFile = jest.fn(
)

fs.promises.readdir = jest.fn(
directoryPath =>
(directoryPath, config) =>
new Promise(res => {
const result = mockFiles.get(path.basename(directoryPath)) ?? []
let result = mockFiles.get(path.basename(directoryPath)) ?? []
if (config) {
result = result.map(filePath => ({
name: filePath,
isDirectory: () => false,
}))
}
res(result)
})
)
Expand Down
20 changes: 20 additions & 0 deletions __tests__/unit/lib/post-processor/baseProcessor.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict'
const BaseProcessor = require('../../../../src/post-processor/baseProcessor')

describe('BaseProcessor', () => {
describe('when process is called', () => {
it('throws an error', async () => {
// Arrange
expect.assertions(1)
const sut = new BaseProcessor({})

// Act
try {
await sut.process()
} catch (error) {
// Assert
expect(error.message).toEqual('this class should be derived')
}
})
})
})
Loading