
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
pkg-typescript
Advanced tools
[](https://badge.fury.io/js/pkg-typescript) [](https://opensource.org/licenses/ISC) [
yarn add -D pkg-typescript
# Using npm
npm install --save-dev pkg-typescript
package.ts file in your project root:import { PackageConfig } from 'pkg-typescript'
const config: PackageConfig = {
name: 'my-awesome-package',
version: '1.0.0',
scripts: {
dev: 'vite dev',
build: 'vite build',
pre: {
build: 'echo "Starting build..."',
},
post: {
build: 'echo "Build complete!"',
},
},
dependencies: {
react: [18, 0, 0],
lodash: ['github', 'lodash/lodash'],
},
devDependencies: {
typescript: [5, 0, 0],
vite: [4, 0, 0],
},
}
export default config
package.json:npx pkg-ts build
pkg-ts buildGenerate package.json from your TypeScript configuration:
# Build single package
pkg-ts build
# Build specific package file
pkg-ts build --config my-package.ts
# Build all packages in directory
pkg-ts build --all
pkg-ts syncSync version between package.json and your TypeScript config:
# Sync version from package.json to package.ts
pkg-ts sync
# Sync specific config file
pkg-ts sync --config my-package.ts
pkg-ts add-pluginAdd a plugin to your package configuration:
pkg-ts add-plugin my-plugin
pkg-ts updateUpdate package configurations:
pkg-ts update
The PackageConfig interface provides full type safety for your package configuration:
export type PackageConfig<T = any> = {
name: string
version: string
license?: string
type?: 'plugin'
plugins?: string[]
private?: boolean
scripts: {
dev?: string
build?: string
start?: string
pre?: PreScripts
post?: PostScripts
[key: string]: string | undefined | PreScripts | PostScripts
}
dependencies?: Record<string, Dependency>
devDependencies?: Record<string, Dependency>
config?: T
}
Define dependencies using semantic versioning arrays or GitHub sources:
// Semantic version [major, minor, patch]
dependencies: {
'react': [18, 2, 0],
'lodash': [4, 17, 21]
}
// GitHub source
dependencies: {
'my-package': ['github', 'username/repo']
}
// Latest version
dependencies: {
'some-package': 1
}
Define scripts that run before or after main scripts:
scripts: {
build: 'webpack build',
pre: {
build: 'rm -rf dist',
version: 'npm run test'
},
post: {
build: 'npm run deploy',
version: 'git push --tags'
}
}
Create reusable plugins to extend functionality:
// my-plugin.ts
import { PluginFunction } from 'pkg-typescript'
interface MyPluginConfig {
feature: boolean
}
const myPlugin: PluginFunction<MyPluginConfig> = (config) => {
return {
scripts: {
'my-command': 'echo "Plugin command"',
},
dependencies: {
'plugin-dep': [1, 0, 0],
},
}
}
export default myPlugin
Use plugins in your package configuration:
import myPlugin from './my-plugin'
const config: PackageConfig = {
name: 'my-package',
version: '1.0.0',
plugins: ['my-plugin'],
// ... rest of config
}
Extend pkg-ts functionality with these official plugins:
Pre-configured setup for Next.js applications with optimized scripts and dependencies.
Automatic code formatting configuration with Prettier integration.
Database toolkit integration with Prisma ORM setup and scripts.
Mantine UI library integration with Mantine UI setup and scripts.
Scripts integration with scripts setup and scripts.
Install and use plugins in your package configuration:
npx pkg-ts add-plugin prisma
npx pkg-ts add-plugin prettier
import { PackageConfig } from 'pkg-typescript'
import nextjsPlugin from 'pkg-ts-plugin-nextjs'
const config: PackageConfig = {
name: 'my-nextjs-app',
version: '1.0.0',
plugins: ['pkg-ts-plugin-nextjs'],
// Plugin configuration will be automatically applied
}
export default config
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m '✨ add amazing feature')git push origin feature/amazing-feature)This project is licensed under the ISC License - see the LICENSE file for details.
Made with ❤️ and TypeScript
FAQs
[](https://badge.fury.io/js/pkg-typescript) [](https://opensource.org/licenses/ISC) [
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.