-
Notifications
You must be signed in to change notification settings - Fork 0
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: Compile each project individually #969
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ | |
"test": "npm run test --workspaces --if-present", | ||
"test-update": "jest -u", | ||
"synth": "npm run synth --workspace=cdk", | ||
"typecheck": "tsc", | ||
"pretypecheck": "npm -w common run typecheck", | ||
"typecheck": "npm run typecheck --workspaces", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
"build": "npm run build --workspaces --if-present", | ||
"lint": "eslint packages/** --ext .ts --no-error-on-unmatched-pattern" | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ | |
"type": "module", | ||
"scripts": { | ||
"postinstall": "prisma generate", | ||
"test": "jest --detectOpenHandles --config ../../jest.config.js --selectProjects common" | ||
"test": "jest --detectOpenHandles --config ../../jest.config.js --selectProjects common", | ||
"typecheck": "tsc" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When compiling the |
||
}, | ||
"dependencies": { | ||
"@aws-sdk/client-secrets-manager": "^3.568.0", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,18 +23,24 @@ export function generateBranchName(prefix: string) { | |
return `${prefix}-${randomBytes(8).toString('hex')}`; | ||
} | ||
|
||
/** | ||
* Creates or updates a pull request, and return its URL. | ||
* On error, an exception is thrown, or undefined is returned. | ||
*/ | ||
export async function createPullRequest( | ||
octokit: Octokit, | ||
{ | ||
props: CreatePullRequestOptions, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change moves the object destructing out of the function signature, in an attempt to improve readability. This is totally subjective though! |
||
): Promise<string | undefined> { | ||
const { | ||
repoName, | ||
title, | ||
body, | ||
branchName, | ||
baseBranch = 'main', | ||
changes, | ||
}: CreatePullRequestOptions, | ||
) { | ||
return await composeCreatePullRequest(octokit, { | ||
} = props; | ||
|
||
const response = await composeCreatePullRequest(octokit, { | ||
owner: 'guardian', | ||
repo: repoName, | ||
title, | ||
|
@@ -46,6 +52,8 @@ export async function createPullRequest( | |
files, | ||
})), | ||
}); | ||
|
||
return response?.data.html_url; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the main change here, and resolves the compilation error in the PR description. The return type of |
||
} | ||
|
||
type PullRequestParameters = | ||
|
@@ -99,7 +107,7 @@ export async function createPrAndAddToProject( | |
); | ||
|
||
if (!existingPullRequest) { | ||
const response = await createPullRequest(octokit, { | ||
const pullRequestUrl = await createPullRequest(octokit, { | ||
repoName, | ||
title: prTitle, | ||
body: prBody, | ||
|
@@ -113,12 +121,12 @@ export async function createPrAndAddToProject( | |
}, | ||
], | ||
}); | ||
console.log( | ||
'Pull request successfully created:', | ||
response?.data.html_url, | ||
); | ||
await addPrToProject(stage, repoName, boardNumber, author); | ||
console.log('Updated project board'); | ||
|
||
if (pullRequestUrl) { | ||
console.log('Pull request successfully created:', pullRequestUrl); | ||
await addPrToProject(stage, repoName, boardNumber, author); | ||
console.log('Updated project board'); | ||
} | ||
} else { | ||
console.log( | ||
`Existing pull request found. Skipping creating a new one.`, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,8 @@ | |
"version": "0.0.0", | ||
"scripts": { | ||
"start": "./script/start", | ||
"test": "find . | egrep '.yml|.yaml' | xargs yamllint" | ||
"test": "find . | egrep '.yml|.yaml' | xargs yamllint", | ||
"typecheck": "echo 'Nothing to typecheck'" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This package has no TypeScript code, so there's nothing to do. |
||
}, | ||
"devDependencies": { | ||
"yaml-lint": "^1.7.0" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ | |
"description": "Diagrams as code", | ||
"type": "module", | ||
"scripts": { | ||
"generate": "mmdc -i diagram.mmd -o output.svg " | ||
"generate": "mmdc -i diagram.mmd -o output.svg ", | ||
"typecheck": "echo 'Nothing to typecheck'" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This package has no TypeScript code, so there's nothing to do. |
||
}, | ||
"devDependencies": { | ||
"@mermaid-js/mermaid-cli": "10.8.0" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretypecheck
will always run beforetypecheck
see https://docs.npmjs.com/cli/v10/using-npm/scripts#pre--post-scripts. We need to compile the shared package first, as other projects depend on it, and it doesn't look like TypeScript understands this dependency.