-
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
9 changed files
with
66 additions
and
20 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
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 |
---|---|---|
|
@@ -21,5 +21,8 @@ | |
"files": [ | ||
"dist/", | ||
"css/" | ||
] | ||
} | ||
], | ||
"config": { | ||
"publish": true | ||
} | ||
} |
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 |
---|---|---|
|
@@ -27,5 +27,8 @@ | |
"devDependencies": { | ||
"estree-walker": "^3.0.3", | ||
"svelte": "^4.2.7" | ||
}, | ||
"config": { | ||
"publish": true | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -20,5 +20,8 @@ | |
"files": [ | ||
"dist/", | ||
"css/" | ||
] | ||
} | ||
], | ||
"config": { | ||
"publish": true | ||
} | ||
} |
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 |
---|---|---|
|
@@ -20,5 +20,8 @@ | |
"files": [ | ||
"dist/", | ||
"css/" | ||
] | ||
} | ||
], | ||
"config": { | ||
"publish": true | ||
} | ||
} |
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,40 @@ | ||
import type { Project } from '@pnpm/find-workspace-packages'; | ||
import { findWorkspacePackages } from '@pnpm/find-workspace-packages'; | ||
import chalk from 'chalk'; | ||
import consola from 'consola'; | ||
import process from 'node:process'; | ||
import { rootPath } from './paths'; | ||
import {exec, execSync} from 'node:child_process'; | ||
|
||
const getWorkspacePackages = () => findWorkspacePackages(rootPath); | ||
|
||
function errorAndExit(err: Error): void { | ||
consola.error(err); | ||
process.exit(1); | ||
} | ||
|
||
async function main() { | ||
consola.debug(chalk.yellow('publish-script started')); | ||
|
||
const pkgs = Object.fromEntries((await getWorkspacePackages()).map(pkg => [pkg.manifest.name!, pkg])); | ||
|
||
const publishPackage = async (project: Project) => { | ||
const config:any = project.manifest.config | ||
if(config && config.publish && config.publish === true) { | ||
execSync('pnpm publish --access public --no-git-checks', {cwd: project.dir, stdio: 'inherit'}) | ||
return; | ||
} | ||
}; | ||
|
||
try { | ||
for (const [name, project] of Object.entries(pkgs)) { | ||
await publishPackage(project); | ||
} | ||
} catch (error) { | ||
errorAndExit(error as Error); | ||
} | ||
|
||
consola.success(chalk.green(`packages published successfully`)); | ||
} | ||
|
||
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