npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@a_team/prisma

v3.2.0-win

Published

- This package contains a shared Prisma schema, organized into [multiple files](https://www.prisma.io/blog/organize-your-prisma-schema-with-multi-file-support), to be used across multiple projects. - By centralizing the schema definitions, we ensure consi

Downloads

3,576

Readme

A.Team prisma library

  • This package contains a shared Prisma schema, organized into multiple files, to be used across multiple projects.
  • By centralizing the schema definitions, we ensure consistency and reduce duplication of effort:
    • Consistency: We are targeting the same MongoDB database. If we use different schema definition files, there's a risk of having inconsistent model definitions, which could lead to conflicts and data overrides.
    • Efficiency: A single schema definition can reduce redundant work. Currently, the schema file has over 300 lines, and this could easily grow to 1000+ lines as we onboard more collections. By working collaboratively on a single schema definition, we can streamline our efforts and improve the overall quality.

Installation

  • To install this package, add the following optional dependencies (where X.Y.Z represents the version):
"optionalDependencies": {
    "@a_team/prisma-win": "npm:@a_team/[email protected]",
    "@a_team/prisma-macos": "npm:@a_team/[email protected]",
    "@a_team/prisma-linux": "npm:@a_team/[email protected]"
}
  • Add the following script as postinstall & change per need in your service:
const fs = require('fs');
const path = require('path');

const getPlatformPackage = () => {
  switch (process.platform) {
    case 'darwin':
      return '@a_team/prisma-macos';
    case 'win32':
      return '@a_team/prisma-win';
    default:
      return '@a_team/prisma-linux';
  }
};

const platformPackage = getPlatformPackage();
const nodeModulesPath = path.join(__dirname, '..', 'node_modules');
const sourcePath = path.join(nodeModulesPath, platformPackage);
const targetPath = path.join(nodeModulesPath, '@a_team/prisma');

if (fs.existsSync(sourcePath)) {
  if (fs.existsSync(targetPath)) {
    fs.rmSync(targetPath, { recursive: true, force: true });
  }

  fs.renameSync(sourcePath, targetPath);
  console.log(`Renamed ${platformPackage} to @a_team/prisma`);
} else {
  console.error(`Platform-specific package ${platformPackage} not found`);
  process.exit(1);
}
  • The script above will link the required OS dependency as the main one.

Usage

  • To use the library:
import { ATeamPrismaClient } from '@a_team/prisma';

export class DbClient extends ATeamPrismaClient {
  constructor(connectionUrl: string) {
    super(connectionUrl);
  }

  async onModuleInit() {
    await this.connect();
  }

  async onModuleDestroy() {
    await this.disconnect();
  }
}

Playground

  • The playground is a dedicated space where you can test and experiment with the prisma client and schema.
  • It contains various scripts that demonstrate how to interact with your database models.
  • Before running any playground scripts, make sure to set up your environment variables. First, copy the .env.sample file to .env:
cp .env.sample .env
  • Then, fill in the required environment variables in the .env file.
  • To run a playground script, use the following command:
npx ts-node playground/missionSpec.ts

Publishing a new version

  • Pull the latest changes on the main branch and push the following tag to the repository:

    git tag v<major>.<minor>.<patch> # matches v0.0.1
    git push origin tag v<major>.<minor>.<patch> # runs the publishing process
  • This tag creates the new package versions needed and pushes them towards the npm repository,

  • A release on the github repository is generated,

  • A slack notification is sent to the required channel with the release changes.