-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests and automated publishing the package to NPM (#96)
* Add Jest tests * Address comments by Joel Denning * Add more tests * Fix setDocumentAndLoadScript * Add tests for external maps * Add automated release workflow * Adapt changeset config * Fix access for changeset config * Address comments * Revert addition of an empty line * Revert fix on build error --------- Co-authored-by: Roberto Mosca <[email protected]>
- Loading branch information
Showing
19 changed files
with
8,322 additions
and
1,655 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,8 @@ | ||
# Changesets | ||
|
||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
||
We have a quick list of common questions to get you started engaging with this project in | ||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
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,14 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": [ | ||
"@changesets/changelog-github", | ||
{ "repo": "single-spa/import-map-overrides" } | ||
], | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "public", | ||
"baseBranch": "origin/main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
} |
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 @@ | ||
--- | ||
"import-map-overrides": patch | ||
--- | ||
|
||
Add tests on API and automate release flow |
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,83 @@ | ||
name: Build, Test, Release | ||
|
||
on: | ||
push: | ||
branches: main | ||
pull_request: | ||
branches: "*" | ||
|
||
jobs: | ||
build_lint_test: | ||
name: Build, Lint, and Test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
with: | ||
# check out full history | ||
fetch-depth: 0 | ||
|
||
- name: Install Pnpm | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 8.8.0 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: pnpm | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Validate | ||
run: | | ||
pnpm run lint | ||
pnpm run check-format | ||
pnpm exec changeset status --since=origin/main | ||
- name: Test | ||
run: pnpm run test | ||
|
||
- name: Build | ||
run: pnpm run build | ||
|
||
release: | ||
name: Release | ||
needs: build_lint_test | ||
permissions: | ||
contents: write # To push release tags | ||
pull-requests: write # To create release pull requests | ||
runs-on: ubuntu-latest | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Pnpm | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 8.8.0 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: pnpm | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Build | ||
run: pnpm run build | ||
|
||
- name: Create Release Pull Request or Publish to NPM | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
publish: pnpm run release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,8 @@ | ||
/** @type {import('jest').Config} */ | ||
module.exports = { | ||
collectCoverageFrom: ["src/**/*.js", "!src/api/local-storage-mock.js"], | ||
resetMocks: true, | ||
restoreMocks: true, | ||
setupFiles: ["./jest.setup.js"], | ||
testEnvironment: "jsdom", | ||
}; |
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,3 @@ | ||
import jestFetchMock from "jest-fetch-mock"; | ||
|
||
jestFetchMock.enableMocks(); |
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
Oops, something went wrong.