-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
83 additions
and
3 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
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,7 +1,7 @@ | ||
{ | ||
"name": "@joelbot/eslint-config", | ||
"version": "0.0.0", | ||
"private": true, | ||
"private": false, | ||
"main": "index.js", | ||
"description": "A personal opinionated eslint configuration.", | ||
"author": "Joel Cox <[email protected]>", | ||
|
@@ -31,5 +31,13 @@ | |
}, | ||
"peerDependencies": { | ||
"typescript": "^5.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"release": { | ||
"branches": [ | ||
"main" | ||
] | ||
} | ||
} |
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,47 @@ | ||
#!/usr/bin/env node | ||
|
||
import * as fs from 'fs'; | ||
import * as cp from 'child_process'; | ||
import root from 'app-root-path'; | ||
import Debug from 'debug'; | ||
|
||
const debug = Debug(`@joelbot/release`); | ||
|
||
debug('running in directory', process.cwd()); | ||
debug('project root directory is', root.path); | ||
|
||
if (!fs.existsSync('package.json')) { | ||
debug('package.json does not exist, doing nothing'); | ||
process.exit(0); | ||
} | ||
|
||
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')); | ||
|
||
if (packageJson.workspaces) { | ||
debug('running in a workspace, looping through workspaces and re-running release'); | ||
const result = cp.spawnSync('yarn', ['workspaces', 'run', 'release'], { | ||
stdio: 'inherit', | ||
}); | ||
process.exit(result.status); | ||
} | ||
|
||
if (packageJson.publishConfig?.access !== 'public') { | ||
debug('publishConfig.access is not public, doing nothing'); | ||
process.exit(0); | ||
} | ||
|
||
debug('publishConfig.access is public, running semantic-release'); | ||
|
||
if (process.cwd() !== root.path) { | ||
debug('running in a workspace folder, using semantic-release-monorepo'); | ||
const result = cp.spawnSync('yarn', ['semantic-release', '-e', 'semantic-release-monorepo'], { | ||
stdio: 'inherit', | ||
}); | ||
process.exit(result.status); | ||
} else { | ||
debug('running semantic-release in project root'); | ||
const result = cp.spawnSync('yarn', ['semantic-release'], { | ||
stdio: 'inherit', | ||
}); | ||
process.exit(result.status); | ||
} |
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,17 @@ | ||
{ | ||
"name": "@joelbot/release", | ||
"version": "0.0.0", | ||
"private": true, | ||
"main": "index.js", | ||
"description": "An opinionated semantic-release wrapper / helper tool for my personal projects.", | ||
"author": "Joel Cox <[email protected]>", | ||
"license": "0BSD", | ||
"type": "module", | ||
"dependencies": { | ||
"app-root-path": "^3.1.0", | ||
"debug": "^4.3.4" | ||
}, | ||
"bin": { | ||
"release": "index.js" | ||
} | ||
} |