This repository was archived by the owner on Apr 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Revamp build system & types #3
Merged
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
715c38d
build: switch build system to microbundle & improve tooling
olance 3dc60ec
chore: prettier all the files
olance 1311e3b
refactor(types): rewrote types to be more solid and compile without e…
olance adba4c7
chore: update dependencies
olance a7647b9
test(jest): improve/fix configuration of jest
olance 4d02cc0
refactor(exports): remove internal default exports, as modules alread…
olance 1941276
test: add first dummy but "meaningful" tests
olance de68bbc
refactor: shuffle a few things around
olance a4d4cfa
chore(tests): additional improvement/fixes to testing setup
olance 1b834cb
test(config): test the makeConfig function
olance dcbcf63
refactor: alias `ResolvePreserve` to `SettingsLiteral` for improved s…
olance f9606b8
chore: adjust TS config to be able to test on older Node versions
olance 439416e
refactor: pass settings type explicitly to `makeConfig` to solve type…
olance de8a80a
test(coverage): collect coverage but don't set a minimum threshold
olance File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,58 @@ | ||
| name: CI/CD | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| tests: | ||
| if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" | ||
| name: Test | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| node: [10, 12, 13, 14] | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v1 | ||
| - name: Setup Node.js ${{ matrix.node }} | ||
| uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: ${{ matrix.node }} | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Run tests | ||
| run: npm run test | ||
| - name: Upload coverage data | ||
| uses: codecov/codecov-action@v1 | ||
|
|
||
| release: | ||
| name: Release | ||
| needs: tests | ||
| if: "github.event_name == 'push' && !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| # Do not persist the GH token, so that the release step uses its own credentials. | ||
| persist-credentials: false | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: 14 | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Build | ||
| run: npm run build | ||
| - name: Release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} | ||
| GIT_AUTHOR_NAME: github-actions | ||
| GIT_AUTHOR_EMAIL: 44210433+github-actions@users.noreply.github.com | ||
| GIT_COMMITTER_NAME: github-actions | ||
| GIT_COMMITTER_EMAIL: 44210433+github-actions@users.noreply.github.com | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| run: npx semantic-release |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 @@ | ||
| module.exports = 'test-file-stub' |
This file contains hidden or 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 @@ | ||
| module.exports = {} |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
| @@ -1,46 +1,49 @@ | ||
| <!DOCTYPE html> | ||
olance marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>Alma Widgets basic example</title> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <title>Alma Widgets basic example</title> | ||
|
|
||
| <link rel="stylesheet" href="../dist/alma-widgets.umd.css"> | ||
| <style> | ||
| body { | ||
| font-family: "Helvetica Neue", Helvetica, Arial, "Segoe UI", sans-serif; | ||
| font-size: 15px; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <h1>Échéancier</h1> | ||
| <link rel="stylesheet" href="../dist/alma-widgets.css" /> | ||
| <style> | ||
| body { | ||
| font-family: 'Helvetica Neue', Helvetica, Arial, 'Segoe UI', sans-serif; | ||
| font-size: 15px; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <h1>Échéancier</h1> | ||
|
|
||
| <ul> | ||
| <li>Paiement de 150€</li> | ||
| <li>Paiement en 3 ou 4 fois</li> | ||
| </ul> | ||
| <ul> | ||
| <li>Paiement de 150€</li> | ||
| <li>Paiement en 3 ou 4 fois</li> | ||
| </ul> | ||
|
|
||
| <div id="payment-plan"></div> | ||
| <br><br><br><br><br><br><br><br> | ||
| <div id="how-it-works"></div> | ||
| <div id="payment-plan"></div> | ||
| <br /><br /><br /><br /><br /><br /><br /><br /> | ||
| <div id="how-it-works"></div> | ||
|
|
||
| <script src="../dist/alma-widgets.umd.js"></script> | ||
| <script> | ||
| (function () { | ||
| var widgets = Alma.Widgets.initialize("11gKoO333vEXacMNMUMUSc4c4g68g2Les4", Alma.ApiMode.TEST); | ||
| <script src="../dist/alma-widgets.umd.js"></script> | ||
| <script> | ||
| ;(function () { | ||
| var widgets = Alma.Widgets.initialize( | ||
| '11gKoO333vEXacMNMUMUSc4c4g68g2Les4', | ||
| Alma.ApiMode.TEST | ||
| ) | ||
|
|
||
| widgets.create(Alma.Widgets.PaymentPlan, { | ||
| container: '#payment-plan', | ||
| purchaseAmount: 15000, | ||
| installmentsCount: [3, 4, 12] | ||
| }); | ||
| widgets.create(Alma.Widgets.PaymentPlan, { | ||
| container: '#payment-plan', | ||
| purchaseAmount: 15000, | ||
| installmentsCount: [3, 4, 12], | ||
| }) | ||
|
|
||
| widgets.create(Alma.Widgets.HowItWorks, { | ||
| container: '#how-it-works', | ||
| }); | ||
| widgets.create(Alma.Widgets.HowItWorks, { | ||
| container: '#how-it-works', | ||
| }) | ||
|
|
||
| widgets.render(); | ||
| })(); | ||
| </script> | ||
| </body> | ||
| widgets.render() | ||
| })() | ||
| </script> | ||
| </body> | ||
| </html> | ||
This file contains hidden or 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,42 @@ | ||
| const image = require('@rollup/plugin-image') | ||
|
|
||
| module.exports = { | ||
| plugins: { | ||
| typescript: function (config) { | ||
| // Since imported *.svg will be transformed to ES modules by the image plugin, tell | ||
| // TypeScript to process them | ||
| return { ...config, include: ['*.ts+(|x)', '**/*.ts+(|x)', '*.s?css', '*.svg', '**/*.svg'] } | ||
| }, | ||
| }, | ||
|
|
||
| config: function (config, context) { | ||
| const { | ||
| format, | ||
| options: { pkg }, | ||
| } = context | ||
|
|
||
| // Add image plugin right after json plugin | ||
| const jsonIdx = config.inputOptions.plugins.findIndex((p) => p.name === 'json') | ||
| config.inputOptions.plugins.splice(jsonIdx + 1, 0, image()) | ||
|
|
||
| // When building browser "standalone" bundles, make sure we inline dependencies | ||
| if (format === 'umd') { | ||
| const _external = config.inputOptions.external | ||
|
|
||
| config.inputOptions.external = (id, ...args) => { | ||
| if (id in (pkg.dependencies || {}) || id in (pkg.peerDependencies || {})) { | ||
| return false | ||
| } | ||
| return _external(id, ...args) | ||
| } | ||
|
|
||
| // Make sure @alma/client is exported on the `Alma` global object, and deactivate cache to | ||
| // ensure the lib is indeed inlined into the bundle | ||
| // (see https://github.com/rollup/rollup/issues/3874) | ||
| config.outputOptions.globals['@alma/client'] = 'Alma' | ||
| config.inputOptions.cache = false | ||
| } | ||
|
|
||
| return config | ||
| }, | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.