Skip to content

Commit

Permalink
feat!: bump all (dev)Deps, require node 18+ (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Nov 17, 2023
1 parent 955c958 commit 0fcdf63
Show file tree
Hide file tree
Showing 11 changed files with 5,966 additions and 5,532 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"commit": false,
"linked": [],
"access": "restricted",
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
Expand Down
5 changes: 5 additions & 0 deletions .changeset/funny-planes-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"changesets-gitlab": minor
---

feat!: bump all (dev)Deps, require node 18+
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
Expand All @@ -24,7 +24,7 @@ jobs:
cache: yarn

- name: Install Dependencies
run: yarn --frozen-lockfile --ignore-engines
run: yarn --frozen-lockfile

- name: Build, Lint and Test
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
Expand Down
2 changes: 1 addition & 1 deletion .remarkrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"plugins": [
"@1stg/remark-config"
"@1stg/remark-preset"
]
}
88 changes: 27 additions & 61 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,10 @@
"type": "module",
"repository": "git+https://github.com/rx-ts/changesets-gitlab.git",
"author": "JounQin (https://www.1stG.me) <[email protected]>",
"donate": {
"recipients": [
{
"name": "unts",
"platform": "opencollective",
"address": "https://opencollective.com/unts",
"weight": 60
},
{
"name": "rxts",
"platform": "opencollective",
"address": "https://opencollective.com/rxts",
"weight": 20
},
{
"name": "1stG",
"email": "[email protected]",
"weight": 20,
"platforms": [
{
"platform": "opencollective",
"address": "https://opencollective.com/1stG"
},
{
"platform": "patreon",
"address": "https://www.patreon.com/1stG"
}
]
}
]
},
"funding": "https://opencollective.com/unts",
"license": "MIT",
"engines": {
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
"node": ">=18.0.0"
},
"bin": {
"changesets-gitlab": "lib/cli.js"
Expand Down Expand Up @@ -69,7 +38,7 @@
"typecov": "type-coverage"
},
"dependencies": {
"@actions/core": "^1.9.0",
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@changesets/assemble-release-plan": "^5.2.4",
"@changesets/config": "^2.3.1",
Expand All @@ -79,52 +48,49 @@
"@changesets/read": "^0.5.9",
"@gitbeaker/rest": "^39.23.0",
"@manypkg/get-packages": "^1.1.3",
"@sentry/node": "^7.6.0",
"commander": "^9.3.0",
"dotenv": "^16.0.3",
"fs-extra": "^10.1.0",
"@sentry/node": "^7.80.1",
"commander": "^11.1.0",
"dotenv": "^16.3.1",
"fs-extra": "^11.1.1",
"global-agent": "^3.0.0",
"human-id": "^4.0.0",
"human-id": "^4.1.0",
"js-yaml": "^4.1.0",
"markdown-table": "^3.0.3",
"mdast-util-to-string": "^3.1.0",
"mdast-util-to-string": "^4.0.0",
"micromatch": "^4.0.5",
"remark-parse": "^10.0.2",
"remark-stringify": "^10.0.3",
"remark-parse": "^11.0.0",
"remark-stringify": "^11.0.0",
"resolve-from": "^5.0.0",
"semver": "^7.5.4",
"unified": "^10.1.2"
"unified": "^11.0.4"
},
"devDependencies": {
"@1stg/lib-config": "^8.1.2",
"@1stg/lib-config": "^12.0.0",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"@types/global-agent": "^2.1.2",
"@types/jest": "^28.1.8",
"@types/js-yaml": "^4.0.8",
"@types/micromatch": "^4.0.4",
"jest": "^28.1.3",
"ts-jest": "^28.0.8",
"@types/global-agent": "^2.1.3",
"@types/jest": "^29.5.8",
"@types/js-yaml": "^4.0.9",
"@types/micromatch": "^4.0.5",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"type-coverage": "^2.27.0",
"typescript": "^4.7.4",
"yarn-deduplicate": "^5.0.2"
},
"resolutions": {
"prettier": "^2.8.8"
},
"publishConfig": {
"access": "public"
"typescript": "^5.2.2",
"yarn-deduplicate": "^6.0.2"
},
"jest": {
"preset": "ts-jest",
"extensionsToTreatAsEsm": [
".ts"
],
"globals": {
"ts-jest": {
"useESM": true
}
"transform": {
"^.+\\.tsx?$": [
"ts-jest",
{
"useESM": true
}
]
}
},
"typeCoverage": {
Expand Down
25 changes: 8 additions & 17 deletions src/get-changed-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,7 @@ export const getChangedPackages = async ({
)
}
}
let tool:
| {
tool: Tool
globs: string[]
}
| undefined
let tool: { tool: Tool; globs: string[] } | undefined

if (isPnpm) {
tool = {
Expand All @@ -134,16 +129,12 @@ export const getChangedPackages = async ({
const rootPackageJsonContent = await rootPackageJsonContentsPromise

if (rootPackageJsonContent.workspaces) {
// eslint-disable-next-line no-negated-condition
tool = !Array.isArray(rootPackageJsonContent.workspaces)
? {
tool: 'yarn',
globs: rootPackageJsonContent.workspaces.packages,
}
: {
tool: 'yarn',
globs: rootPackageJsonContent.workspaces,
}
tool = {
tool: 'yarn',
globs: Array.isArray(rootPackageJsonContent.workspaces)
? rootPackageJsonContent.workspaces
: rootPackageJsonContent.workspaces.packages,
}
} else if (rootPackageJsonContent.bolt?.workspaces) {
tool = {
tool: 'bolt',
Expand All @@ -170,8 +161,8 @@ export const getChangedPackages = async ({
) {
throw new Error('globs are not valid: ' + JSON.stringify(tool.globs))
}
const matches = micromatch(potentialWorkspaceDirectories, tool.globs)

const matches = micromatch(potentialWorkspaceDirectories, tool.globs)
packages.packages = await Promise.all(matches.map(dir => getPackage(dir)))
} else {
packages.packages.push(packages.root)
Expand Down
9 changes: 6 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,23 @@ export const createApi = (gitlabToken?: string) => {
// we cannot use { [tokenType]: token } now
// because it will break the type of the Gitlab constructor
switch (process.env.GITLAB_TOKEN_TYPE) {
case 'job':
case 'job': {
return new Gitlab({
host,
jobToken: token,
})
case 'oauth':
}
case 'oauth': {
return new Gitlab({
host,
oauthToken: token,
})
default:
}
default: {
return new Gitlab({
host,
token,
})
}
}
}
51 changes: 25 additions & 26 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,31 @@ export async function runPublish({
const { packages, tool } = await getPackages(cwd)
const releasedPackages: Package[] = []

// eslint-disable-next-line no-negated-condition -- do not change original source code logic
if (tool !== 'root') {
if (tool === 'root') {
if (packages.length === 0) {
throw new Error(
`No package found.` +
'This is probably a bug in the action, please open an issue',
)
}
const pkg = packages[0]
const newTagRegex = /New tag:/

for (const line of changesetPublishOutput.stdout.split('\n')) {
const match = newTagRegex.exec(line)

if (match) {
releasedPackages.push(pkg)
if (createGitlabReleases) {
await createRelease(api, {
pkg,
tagName: `v${pkg.packageJson.version}`,
})
}
break
}
}
} else {
// eslint-disable-next-line regexp/no-super-linear-backtracking
const newTagRegex = /New tag:\s+(@[^/]+\/[^@]+|[^/]+)@(\S+)/
const packagesByName = new Map(packages.map(x => [x.packageJson.name, x]))
Expand Down Expand Up @@ -128,30 +151,6 @@ export async function runPublish({
),
)
}
} else {
if (packages.length === 0) {
throw new Error(
`No package found.` +
'This is probably a bug in the action, please open an issue',
)
}
const pkg = packages[0]
const newTagRegex = /New tag:/

for (const line of changesetPublishOutput.stdout.split('\n')) {
const match = newTagRegex.exec(line)

if (match) {
releasedPackages.push(pkg)
if (createGitlabReleases) {
await createRelease(api, {
pkg,
tagName: `v${pkg.packageJson.version}`,
})
}
break
}
}
}

if (releasedPackages.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/utils.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`utils getAllFiles 1`] = `
Array [
[
".gitkeep",
"dir/.gitkeep",
"dir/subdir/.gitkeep",
Expand Down
Loading

0 comments on commit 0fcdf63

Please sign in to comment.