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

Fix removing the last empty line in the package.json #933

Merged
merged 4 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 37 additions & 1 deletion .github/workflows/release-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
PRE_RELEASE: ${{ github.event.release.prerelease}}

jobs:
release-commit-pr:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -28,9 +28,45 @@ jobs:
- name: Run unit tests
run: npm test

integration-tests:
runs-on: ubuntu-latest
needs: unit-tests
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm ci

- name: Run integration tests
run: npm run if-check -- -d manifests/outputs

publish:
runs-on: ubuntu-latest
needs: integration-tests
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm ci

- name: Initialize git user email
run: git config --global user.email "${{ vars.RELEASE_USER_EMAIL }}"

Expand Down
3 changes: 3 additions & 0 deletions src/__mocks__/fs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ export const writeFile = async (pathToFile: string, content: string) => {
}
};

export const appendFile = (file: string, appendContent: string) =>
`${file}${appendContent}`;

export const stat = async (filePath: string) => {
if (filePath === 'true') {
return true;
Expand Down
1 change: 1 addition & 0 deletions src/if-env/util/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const updatePackageJsonDependencies = async (
packageJsonPath,
JSON.stringify(parsedPackageJson, null, 2)
);
await fs.appendFile(packageJsonPath, '\n');
};

/**
Expand Down