-
Notifications
You must be signed in to change notification settings - Fork 208
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
chore: streamline package publishing #453
Open
wjhsf
wants to merge
14
commits into
master
Choose a base branch
from
wjh/streamline-release
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
147f4ec
chore(scripts): rename "api:" scripts to "docs"
wjhsf 38213a9
chore(scripts): add docs generation to version script
wjhsf 8750aef
chore(scripts): generate docs to /docs for GitHub Pages
wjhsf 6f3dc53
chore(docs): move docs to /docs for GitHub Pages
wjhsf 7b4266b
Revert "chore(docs): move docs to /docs for GitHub Pages"
wjhsf 30d2734
Revert "chore(scripts): generate docs to /docs for GitHub Pages"
wjhsf 51979e7
test(version): avoid hard-coding version in tests
wjhsf 3494d1a
docs(changelog): adjust text
wjhsf ffed4ec
ci: use --check so prettier works
wjhsf 7b71e9c
chore(prettier): just check everything
wjhsf efef954
chore(prettier): prettier fixes
wjhsf 7e11360
ci: create workflow to publish to npm on GitHub release
wjhsf 60846f4
Merge branch 'master' into wjh/streamline-release
wjhsf 29e91b8
Merge branch 'master' into wjh/streamline-release
wjhsf 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 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,30 +1,30 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
- package-ecosystem: 'npm' | ||
directory: '/' | ||
schedule: | ||
interval: "monthly" | ||
interval: 'monthly' | ||
labels: | ||
- "dependencies" | ||
- "npm" | ||
- "skip changelog" | ||
- 'dependencies' | ||
- 'npm' | ||
- 'skip changelog' | ||
groups: | ||
production-dependencies: | ||
dependency-type: "production" | ||
dependency-type: 'production' | ||
update-types: | ||
- "minor" | ||
- "patch" | ||
- 'minor' | ||
- 'patch' | ||
dev-dependencies: | ||
dependency-type: "development" | ||
dependency-type: 'development' | ||
update-types: | ||
- "minor" | ||
- "patch" | ||
- 'minor' | ||
- 'patch' | ||
ignore: | ||
# We want @types/node to match the *lowest* version of node.js that we support | ||
- dependency-name: "@types/node" | ||
- dependency-name: '@types/node' | ||
update-types: | ||
- "version-update:semver-major" | ||
- "version-update:semver-minor" | ||
- 'version-update:semver-major' | ||
- 'version-update:semver-minor' | ||
# As a library, upgrading TypeScript and using new language features would | ||
# be a breaking change for users who have not yet upgraded their TS version | ||
- dependency-name: "typescript" | ||
- dependency-name: 'typescript' |
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,45 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
publish: | ||
name: Publish to NPM | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: npm | ||
- run: npm ci | ||
- run: npm run prettier -- --check | ||
- run: npm run lint | ||
- run: npm run build | ||
- run: npm run docs:ci | ||
- name: Validate up-to-date documentation | ||
run: | | ||
git add --renormalize . | ||
if (( "$(git diff HEAD --ignore-space-at-eol --ignore-cr-at-eol | wc -l)" != 0 )); then | ||
cat << EOF >> $GITHUB_STEP_SUMMARY | ||
### Detected uncommitted changes | ||
|
||
\`\`\`shell | ||
$(git diff HEAD) | ||
\`\`\` | ||
EOF | ||
git diff HEAD | ||
exit 1 | ||
fi | ||
|
||
- run: npm test | ||
- run: npm publish --provenance | ||
env: | ||
NODE_AUTH_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
dist | ||
test | ||
api |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Changelog | ||
|
||
All notable changes to this project can be found at on the [Releases](https://github.com/salesforce/tough-cookie/releases) | ||
All notable changes to this project can be found on the [GitHub Releases](https://github.com/salesforce/tough-cookie/releases) | ||
page. |
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import type { JestConfigWithTsJest } from "ts-jest"; | ||
import type { JestConfigWithTsJest } from 'ts-jest' | ||
|
||
const config: JestConfigWithTsJest = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
rootDir: './lib/', | ||
testPathIgnorePatterns: ['./lib/__tests__/data/'], | ||
fakeTimers: { | ||
enableGlobally: true | ||
} | ||
enableGlobally: true, | ||
}, | ||
} | ||
|
||
export default config |
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 @@ | ||
import { version } from '../version' | ||
|
||
describe('version file', () => { | ||
it('should have a valid semver version', () => { | ||
expect(typeof version).toBe('string') | ||
expect(version).toMatch(/^\d+?\.\d+?\.\d+?(?:-[\w.]+?)?$/) | ||
}) | ||
}) |
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
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.
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.
I'm not sure I agree with this specific renaming. There are actually two distinct processes happening here:
If we're going to rename, we should probably use names that reflect these different processes so we don't conflate them as I originally did.
Also, we shouldn't use pass
--local
in thedocs:ci
script. That flag disables the validation which checks if the public API has changed. The API report thatapi-extractor
produces should be thought of as similar topackage-lock.json
only it's a lockfile for public API changes, not dependencies. Following that comparison, consider the workflow forpackage-lock.json
:npm ci
in an automated environment, if the lockfile doesn't matchpackage.json
then it will errorWe should follow a similar process for the API report. That is how the previous scripts operated with
api:dev
being the deliberate, local change andapi:extract
being the automated one which should fail if there is a difference detected.