-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
46 additions
and
49 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 +1,11 @@ | ||
import fs from 'fs-extra' | ||
import { run } from './run' | ||
|
||
fs.copyFileSync('README.md', 'packages/slidev/README.md') | ||
|
||
run('npx pnpm -r publish --access public --no-git-checks') | ||
;(async() => { | ||
await fs.copyFile('README.md', 'packages/slidev/README.md') | ||
await run('npx pnpm -r publish --access public --no-git-checks') | ||
})() | ||
.catch((e) => { | ||
console.error(e) | ||
process.exit(1) | ||
}) |
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,31 +1,37 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
import { readFileSync, writeFileSync } from 'fs' | ||
import { join } from 'path' | ||
import fs from 'fs-extra' | ||
import { objectMap } from '@antfu/utils' | ||
import { run, runArgs } from './run' | ||
|
||
run('npx bumpp package.json packages/*/package.json') | ||
;(async() => { | ||
await run('npx bumpp package.json packages/*/package.json') | ||
|
||
const templates = [ | ||
'packages/create-app/template', | ||
'packages/create-theme/template', | ||
] | ||
const templates = [ | ||
'packages/create-app/template', | ||
'packages/create-theme/template', | ||
] | ||
|
||
const { version } = require('../package.json') | ||
const { version } = require('../package.json') | ||
|
||
for (const template of templates) { | ||
const path = join(template, 'package.json') | ||
const pkg = JSON.parse(readFileSync(path, 'utf-8')) | ||
pkg.dependencies = objectMap(pkg.dependencies, (k, v) => { | ||
if (k.startsWith('@slidev/')) | ||
return [k, `^${version}`] | ||
return [k, v] | ||
}) | ||
writeFileSync(path, `${JSON.stringify(pkg, null, 2)}\n`, 'utf-8') | ||
} | ||
for (const template of templates) { | ||
const path = join(template, 'package.json') | ||
const pkg = await fs.readJSON(path) | ||
pkg.dependencies = objectMap(pkg.dependencies, (k, v) => { | ||
if (k.startsWith('@slidev/')) | ||
return [k, `^${version}`] | ||
return [k, v] | ||
}) | ||
await fs.writeJSON(path, pkg, { spaces: 2 }) | ||
} | ||
|
||
run('git add .') | ||
runArgs('git', ['commit', '-m', `chore: release v${version}`]) | ||
run(`git tag v${version}`) | ||
run('git push') | ||
run('git push origin --tags') | ||
await run('git add .') | ||
await runArgs('git', ['commit', '-m', `chore: release v${version}`]) | ||
await run(`git tag v${version}`) | ||
await run('git push') | ||
await run('git push origin --tags') | ||
})() | ||
.catch((e) => { | ||
console.error(e) | ||
process.exit(1) | ||
}) |
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,9 +1,9 @@ | ||
import execa from 'execa' | ||
|
||
export function run(command: string, cwd?: string) { | ||
execa.commandSync(command, { stdio: 'inherit', cwd }) | ||
return execa.command(command, { stdio: 'inherit', cwd }) | ||
} | ||
|
||
export function runArgs(command: string, args: string[], cwd?: string) { | ||
execa.sync(command, args, { stdio: 'inherit', cwd }) | ||
return execa(command, args, { stdio: 'inherit', cwd }) | ||
} |