5.5.9 • Published 5 months ago

@intlayer/config v5.5.9

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
5 months ago

@intlayer/config: Retrieve Intlayer configuration

Intlayer is a suite of packages designed specifically for JavaScript developers. It is compatible with frameworks like React, React, and Express.js.

The @intlayer/config package is a NPM package that allows you to retrieve the configuration of Intlayer and define the environment variables related to the current environment.

Installation

Install the necessary package using your preferred package manager:

npm install @intlayer/config
pnpm add @intlayer/config
yarn add @intlayer/config

Usage

Read the configuration of Intlayer using file system

Example:

import { getConfiguration, type IntlayerConfig } from "@intlayer/config";

const config: IntlayerConfig = getConfiguration();

console.log(config);
// Output:
// {
//   internationalization: { ... },
//   middleware: { ... },
//   content: { ... },
//   editor: { ... }
// }

This function use fs packages and will only work on the server side.

Read the configuration of Intlayer using environment variables

Example:

import { getConfiguration, type IntlayerConfig } from "@intlayer/config/client";

const config: IntlayerConfig = getConfiguration({
  env: "production",
});

console.log(config);
// Output:
// {
//   internationalization: { ... },
//   middleware: { ... },
//   content: { ... },
//   editor: { ... }
// }

This function will not return anything if the environment variables are not defined.

Define the environment variables

  1. Create a configuration file.
import { type IntlayerConfig } from "intlayer";

const config: IntlayerConfig = {
  internationalization: {
    /* ... */
  },
  middleware: {
    /* ... */
  },
  content: {
    /* ... */
  },
  editor: {
    /* ... */
  },
};

export default config;

See Intlayer configuration documentation for more details.

  1. Define the environment variables.
import { getConfiguration } from "@intlayer/config";

const intlayerConfig = getConfiguration();

// Format all configuration values as environment variables
const env = formatEnvVariable();

// Set each formatted environment variable in process.env
Object.assign(process.env, env);
  1. Import the configuration file.
import { getConfiguration } from "@intlayer/config/client";

const intlayerConfig = getConfiguration();

Read about Intlayer

5.3.3

7 months ago

5.3.2

7 months ago

5.3.1

7 months ago

5.3.0

8 months ago

3.5.11

9 months ago

3.5.10

9 months ago

4.1.8

9 months ago

4.1.7

9 months ago

4.1.9

9 months ago

3.3.6

11 months ago

3.2.2

11 months ago

3.2.1

11 months ago

3.2.0

11 months ago

4.0.5

9 months ago

4.0.4

9 months ago

4.0.0

9 months ago

4.0.3

9 months ago

4.0.2

9 months ago

5.3.13

6 months ago

5.3.12

6 months ago

5.3.11

7 months ago

5.3.10

7 months ago

5.4.2

6 months ago

5.0.6

9 months ago

5.4.1

6 months ago

5.0.5

9 months ago

5.4.0

6 months ago

5.0.4

9 months ago

5.0.3

9 months ago

5.0.2

9 months ago

5.0.1

9 months ago

5.0.0

9 months ago

3.1.0

11 months ago

3.5.3

11 months ago

3.5.2

11 months ago

3.5.1

11 months ago

3.5.0

11 months ago

5.5.9

5 months ago

5.5.8

5 months ago

5.5.7

5 months ago

5.5.6

5 months ago

5.5.5

5 months ago

5.5.4

5 months ago

5.1.8

8 months ago

5.5.3

5 months ago

5.1.7

8 months ago

5.5.2

5 months ago

5.1.6

8 months ago

5.5.1

5 months ago

5.1.5

8 months ago

5.5.0

5 months ago

5.1.4

8 months ago

5.5.0-canary.0

5 months ago

5.1.3

8 months ago

5.1.2

8 months ago

5.1.1

8 months ago

5.1.0

8 months ago

5.4.0-canary.0

6 months ago

3.5.7

9 months ago

3.5.6

10 months ago

3.5.5

10 months ago

3.5.4

10 months ago

3.5.9

9 months ago

3.5.8

9 months ago

3.0.3

12 months ago

3.0.2

12 months ago

3.0.1

12 months ago

3.0.0

12 months ago

5.2.9

8 months ago

5.2.8

8 months ago

5.2.7

8 months ago

5.2.6

8 months ago

5.2.5

8 months ago

5.2.4

8 months ago

5.2.3

8 months ago

5.2.2

8 months ago

5.2.1

8 months ago

5.2.0

8 months ago

4.1.10

9 months ago

4.1.11

9 months ago

3.4.8

11 months ago

3.4.7

11 months ago

3.4.6

11 months ago

4.1.12

9 months ago

3.4.9

11 months ago

3.3.5

11 months ago

3.3.4

11 months ago

3.3.3

11 months ago

3.3.2

11 months ago

4.1.4

9 months ago

4.1.3

9 months ago

4.1.6

9 months ago

4.1.5

9 months ago

4.1.0

9 months ago

4.1.2

9 months ago

4.1.1

9 months ago

5.3.9

7 months ago

5.3.8

7 months ago

5.3.7

7 months ago

5.3.6

7 months ago

5.3.5

7 months ago

5.3.4

7 months ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.13

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.11

1 year ago

2.0.7

1 year ago

2.0.12

1 year ago

2.0.6

1 year ago

2.0.9

1 year ago

2.0.10

1 year ago

2.0.8

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.2.1

1 year ago

1.2.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago