New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@pie-api/mru

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pie-api/mru

mono repo utils - has strong opinions!

  • 1.3.3
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
3
Weekly downloads
 
Created
Source

mru

mono repo utils - has strong opinions!

You have a cloud funtion here: functions/my-fn, then mru my-fn will:

  1. bundles functions/my-fn/lib/index.ts
  2. creates zip file
  3. pushes zip to gcloud storage
  4. gcloud deploys w/ env vars + flags

mru my-container will:

  1. bundle containers/my-container/lib/index.ts
  2. docker builds w/ tag
  3. docker push tag
  4. gcloud deploys w/ env vars

mru.config.js

mru will read mru.config.js from the cwd. It can overrides the following properties. mru will also read in command line flags, these will take highest priority.

From the above we build a Config that has the following form:

export type Config = {

  envDir: string; // required 
  projectId: string; // required 
  region: string; // required 
  bucketPath: (projectId: string, region: string) => string;  // required
  dockerRegistry: string; // 'grc.io'
  containers: string; //'containers'
  functions: string; //'functions'
  dryRun: boolean; // false
  /**
   * All true by default set --no-bundle to disable bundle. 
   * same for the others
   */
  steps: {
    bundle: boolean;
    docker: boolean;
    deploy: boolean;
  };
  /** 
   * This is generated by mru - don't need to set it
   */
  git?: {
    hash: string;
  };
}

cloud config

mru will generate the deployment arguments for a container/function using 2 sources:

  1. the loaded env file loaded from $envDir/$projectId.yaml.
  2. the cloud map in the package's package.json

Example

{
  "name": "my-fn",
  "cloud": {
    "deployFlags": {
      "foo":  "$ENV_VAR"
    },
    "environment":{
      "ENV_VAR": "$ENV_VAR"
    }
  }
}

env:

ENV_VAR: bar

in the above:

  1. deployFlags.foo will be converted to --foo bar and passed to the appropriate gcloud command.
  2. the env vars will be set to --set-env-vars ENV_VAR=bar

By doing this, we can put all our env vars in 1 place, and each pkg will only pull what it needs.

FAQs

Package last updated on 13 Oct 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc