Skip to content

Commit

Permalink
chore: sync package versions
Browse files Browse the repository at this point in the history
  • Loading branch information
bounoable committed Sep 15, 2022
1 parent f8bfffa commit 17abfb6
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 13 deletions.
21 changes: 16 additions & 5 deletions packages/media-entity/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "@modernice/media-entity",
"version": "0.0.4",
"version": "v0.0.4",
"description": "media-entity types",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
Expand All @@ -19,20 +20,30 @@
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "unbuild"
"build": "unbuild",
"update-version": "jiti ./scripts/update-version.ts"
},
"keywords": [],
"author": "Saman Hosseini <[email protected]>",
"license": "MIT",
"dependencies": {
"@modernice/typed-response": "v0.4.6"
"@modernice/typed-response": "0.4.8"
},
"devDependencies": {
"@types/node": "^18.7.18",
"@types/semver": "^7.3.12",
"jiti": "^1.15.0",
"semver": "^7.3.7",
"typescript": "^4.8.3",
"unbuild": "^0.8.11"
},
"publishConfig": {
"access": "public"
},
"files": ["dist", "LICENSE", "README.md", "*.d.ts"]
}
"files": [
"dist",
"LICENSE",
"README.md",
"*.d.ts"
]
}
39 changes: 35 additions & 4 deletions packages/media-entity/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions packages/media-entity/scripts/update-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import fs from 'node:fs/promises'
import { URL } from 'node:url'
import pkg from '../package.json'
// @ts-ignore
import greaterThan from 'semver/functions/gt'

async function run(version: string) {
const url = new URL('../package.json', import.meta.url)

if (!greaterThan(version, pkg.version)) {
console.error(`Version ${version} is not greater than ${pkg.version}.`)
process.exit(1)
}

pkg.version = version

await fs.writeFile(url, JSON.stringify(pkg, null, 2))

console.info(`Updated ${pkg.name} to ${version}.`)
}

run(process.argv[process.argv.length - 1])
12 changes: 10 additions & 2 deletions packages/media-entity/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"isolatedModules": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"declaration": true,
"strict": true,
"resolveJsonModule": true
}
"resolveJsonModule": true,
"types": ["node"]
},
"include": ["src/**/*.ts", "scripts/**/*.ts"],
"exclude": ["node_modules"]
}
6 changes: 4 additions & 2 deletions scripts/release
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ usage() {
echo -e "\tgithub.com/modernice/media-entity/goes – goes/v1.2.3"
echo -e "\tgithub.com/modernice/media-entity/api/proto – api/proto/v1.2.3"
echo
echo "The '-npm' option will also create a git tag for the"
echo "@modernice/media-entity npm package: npm/v1.2.3"
echo "The '-npm' option will update the version in the 'package.json' of the"
echo "@modernice/media-entity package, and also create a git tag: npm/v1.2.3"
echo
echo "Usage: $0 v1.2.3"
echo
Expand Down Expand Up @@ -47,6 +47,8 @@ tag "goes/"
tag "api/proto/"

if [[ $@ =~ --?npm ]]; then
cd ./packages/media-entity
pnpm update-version $VERSION
tag "npm/"
fi

Expand Down

0 comments on commit 17abfb6

Please sign in to comment.