Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aserto/console-common

Package Overview
Dependencies
Maintainers
0
Versions
166
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aserto/console-common

  • 0.1.64
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
193
decreased by-57.3%
Maintainers
0
Weekly downloads
 
Created
Source

console-common npm package

Console Common Components and Utilities

Local development

The project comes with yarn 3 configured.

Code generation:

REST API
yarn generate:rest
# or
DIRECTORY_SERVICE_URL='https://directory.eng.aserto.com' yarn generate:rest
GraphQL
yarn generate:gql
or
DIRECTORY_SERVICE_URL='https://directory.eng.aserto.com' yarn generate:gql

Building

yarn build - uses rollup to build the library, see rollup.config.js. Everything is bundled in the dist folder.

yarn push - uses yalc to push the library to the local registry. To consume the packages you will need to run yalc link @aserto/console-common in your project. After you do that you will see a .yalc folder in the root of your project, which is the local registry that yalc will push to when running yarn push in the console-common directory.

The library also provides a dev mode where it watches for file changes and updates the package in the local registry. yarn dev You can use this command after you have run yalc link @aserto/console-common in your project

Consuming

yalc local dev

To add a dependency to the local package use yalc link @aserto/console-common in the client application.

import { Directory } from '@aserto/console-common'
Using console-common from gitbub

Update project package.json(make sure you console-common is not linked locally(yarn unlink:console-common))

"@aserto/console-common": "aserto-dev/console-common#git_ref"
yarn install

Troubleshooting

Module not found: Error: Can't resolve '@aserto/console-common -> run rm -rf .yalc && yarn link:console-common && yarn install

Force reinstall -> run rm -rf node_modules/@aserto && yarn cache clean && rm -rf .yarn/cache && yarn install

Jest setup
{
  "moduleNameMapper": {
    "monaco-editor": "<rootDir>/node_modules/monaco-editor/esm/vs/editor/editor.api.js"
  },
  "transformIgnorePatterns": [
    "node_modules/(?!@aserto)/"
  ],
  "transform": {
    "^.+\\.(js|jsx|mjs|cjs|ts|tsx)$": [
      "babel-jest",
      {
        "presets": [
          "@babel/preset-env",
          "@babel/preset-react",
          "@babel/preset-typescript"
        ],
        "plugins": [
          "babel-plugin-transform-import-meta"
        ]
      }
    ]
  }
}

Examples

Passing a configuration:

import { InternalConfigProvider } from '@aserto/console-common'


<InternalConfigProvider config={config}>
  {children}
</InternalConfigProvider>

Feature Flags:

import { FeatureFlagsProvider } from '@aserto/console-common'

<FeatureFlagsProvider
  featureFlags={{
    isGraphQLEnabled: false,
    hasTemplates: false,
    hasAssertions: true,
  }}
>
  {children}
</FeatureFlagsProvider>

const { isGraphQLEnabled } = useFeatureFlags()

Passing an identity:

import { GenericIdentityProvider } from '@aserto/console-common'


<GenericIdentityProvider
  identity={{
    getAccessToken: getAccessToken || (() => Promise.resolve('')),
    logout: logout || (() => {}),
  }}
>
  {children}
</GenericIdentityProvider>

Passing a profile

import { InternalProfileProvider } from '@aserto/console-common'

<InternalProfileProvider profile={{ tenantId: tenant?.id }}>
  {children}
</InternalProfileProvider>

Testing

This lib uses jest for testing, see jest.config.js

yarn test

Release

yarn release_prep - creates a new branch, release_prep/${version}, bumps to the next minor version, commits and pushes changes

yarn release - tags the latest commit with the version from package.json and pushes the changes

Keywords

FAQs

Package last updated on 19 Nov 2024

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