Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add GeneratedCacheAdapter for production usage #4167

Merged
merged 1 commit into from Mar 26, 2023

Conversation

B4nan
Copy link
Member

@B4nan B4nan commented Mar 26, 2023

MikroORM now lets you generate production cache bundle into a single JSON file via CLI:

npx mikro-orm cache:generate --combined

This will create ./temp/metadata.json file which can be used together with GeneratedCacheAdapter in your production configuration:

import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});

This way you can keep the @mikro-orm/reflection package as a development dependency only, use the CLI to create the cache bundle, and depend only on that in your production build.

The cache bundle can be statically imported, which is handy in case you are using some bundler.

Closes #4164

@B4nan B4nan force-pushed the sync-init branch 2 times, most recently from 4772b56 to ac9806d Compare March 26, 2023 19:16
Base automatically changed from sync-init to v6 March 26, 2023 19:45
@codecov
Copy link

codecov bot commented Mar 26, 2023

Codecov Report

Patch coverage: 82.92% and project coverage change: -0.05 ⚠️

Comparison is base (261d174) 99.51% compared to head (c716934) 99.47%.

Additional details and impacted files
@@            Coverage Diff             @@
##               v6    #4167      +/-   ##
==========================================
- Coverage   99.51%   99.47%   -0.05%     
==========================================
  Files         217      218       +1     
  Lines       14152    14187      +35     
  Branches     3241     3249       +8     
==========================================
+ Hits        14083    14112      +29     
- Misses         66       72       +6     
  Partials        3        3              
Impacted Files Coverage Δ
packages/core/src/utils/Configuration.ts 99.25% <ø> (ø)
packages/core/src/cache/GeneratedCacheAdapter.ts 57.14% <57.14%> (ø)
packages/core/src/cache/FileCacheAdapter.ts 98.11% <93.75%> (-1.89%) ⬇️
packages/cli/src/commands/GenerateCacheCommand.ts 100.00% <100.00%> (ø)
packages/core/src/cache/index.ts 100.00% <100.00%> (ø)
packages/core/src/metadata/MetadataDiscovery.ts 99.29% <100.00%> (+<0.01%) ⬆️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@B4nan B4nan force-pushed the generated-cache-adapter branch 3 times, most recently from a215d0c to 1f181a4 Compare March 26, 2023 22:41
@B4nan B4nan marked this pull request as ready for review March 26, 2023 22:44
@B4nan B4nan merged commit 23af765 into v6 Mar 26, 2023
6 of 8 checks passed
@B4nan B4nan deleted the generated-cache-adapter branch March 26, 2023 23:13
B4nan added a commit that referenced this pull request Apr 6, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Apr 10, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Apr 12, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Apr 26, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request May 14, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request May 14, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request May 24, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request May 26, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Jun 11, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Sep 10, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Sep 20, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Sep 24, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Sep 30, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Oct 2, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Oct 17, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Oct 21, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Oct 25, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Nov 2, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
B4nan added a commit that referenced this pull request Nov 5, 2023
MikroORM now lets you generate production cache bundle into a single
JSON file via CLI:

```bash
npx mikro-orm cache:generate --combined
```

This will create `./temp/metadata.json` file which can be used together
with `GeneratedCacheAdapter` in your production configuration:

```ts
import { GeneratedCacheAdapter, MikroORM } from '@mikro-orm/core';

await MikroORM.init({
  metadataCache: {
    enabled: true,
    adapter: GeneratedCacheAdapter, 
    options: { data: require('./temp/metadata.json') },
  },
  // ...
});
```

This way you can keep the `@mikro-orm/reflection` package as a
development dependency only, use the CLI to create the cache bundle, and
depend only on that in your production build.

> The cache bundle can be statically imported, which is handy in case
you are using some bundler.

Closes #4164
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant