Skip to content

Commit

Permalink
Replace deepmerge with lodash
Browse files Browse the repository at this point in the history
  • Loading branch information
ApexCaptain committed Mar 10, 2022
1 parent 1e8d055 commit ac37f9b
Show file tree
Hide file tree
Showing 18 changed files with 72 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,14 @@ const project = new typescript.TypeScriptProject({
'dependency',
],
npmAccess: javascript.NpmAccess.PUBLIC,
deps: ['term-size@2.2.1', 'deepmerge'],
deps: ['term-size@2.2.1', 'lodash'],
devDeps: [
'eslint-plugin-spellcheck',
'typedoc',
'typedoc-plugin-missing-exports',
'husky',
'@octokit/rest',
'@types/lodash',
'@cdktf/provider-aws', // tmp
],
peerDeps: ['cdktf', 'constructs'],
Expand All @@ -109,7 +110,7 @@ const project = new typescript.TypeScriptProject({
defaultReleaseBranch: 'main',
release: true,
releaseToNpm: true,
gitignore: ['auth/'],
gitignore: ['auth/', 'cdktf.out/'],
majorVersion: 1,
repository: 'https://github.com/ApexCaptain/cdktf-injector',
});
Expand Down Expand Up @@ -148,7 +149,7 @@ if (project.eslint) {
'repo',
'repos',
'gitignore',
'deepmerge',
'fqn',
].sort();

const srcWords = ['terraform', 'Getters', 'dep'].sort();
Expand Down
8 changes: 4 additions & 4 deletions docs/classes/TerraformInjectorStack.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/classes/TerraformInjectorStackAsync.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/interfaces/Reference.TerraformInjectorCommon.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/interfaces/TerraformInjector.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/interfaces/TerraformInjectorAsync.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/interfaces/TerraformInjectorElementContainer.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/interfaces/TerraformInjectorElementContainerAsync.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/modules.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>cdktf-injector</title><meta name="description" content="Documentation for cdktf-injector"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">cdktf-injector</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><h1>cdktf-injector</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Namespaces</h3><ul class="tsd-index-list"><li class="tsd-kind-namespace"><a href="modules/Reference.html" class="tsd-kind-icon">Reference</a></li></ul></section><section class="tsd-index-section "><h3>Classes</h3><ul class="tsd-index-list"><li class="tsd-kind-class"><a href="classes/TerraformInjectorStack.html" class="tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Stack</a></li><li class="tsd-kind-class"><a href="classes/TerraformInjectorStackAsync.html" class="tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Stack<wbr/>Async</a></li></ul></section><section class="tsd-index-section "><h3>Interfaces</h3><ul class="tsd-index-list"><li class="tsd-kind-interface"><a href="interfaces/TerraformInjector.html" class="tsd-kind-icon">Terraform<wbr/>Injector</a></li><li class="tsd-kind-interface"><a href="interfaces/TerraformInjectorAsync.html" class="tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Async</a></li><li class="tsd-kind-interface tsd-has-type-parameter"><a href="interfaces/TerraformInjectorElementContainer.html" class="tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Element<wbr/>Container</a></li><li class="tsd-kind-interface tsd-has-type-parameter"><a href="interfaces/TerraformInjectorElementContainerAsync.html" class="tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Element<wbr/>Container<wbr/>Async</a></li></ul></section><section class="tsd-index-section "><h3>Variables</h3><ul class="tsd-index-list"><li class="tsd-kind-variable"><a href="modules.html#TerraformInjectorFactory" class="tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Factory</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Variables</h2><section class="tsd-panel tsd-member tsd-kind-variable"><a id="TerraformInjectorFactory" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagConst">Const</span> Terraform<wbr/>Injector<wbr/>Factory<a href="#TerraformInjectorFactory" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Factory<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>scopesOn<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>scope<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Construct</span>, description<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><a href="interfaces/TerraformInjector.html" class="tsd-signature-type" data-tsd-kind="Interface">TerraformInjector</a><span class="tsd-signature-symbol">; </span>scopesOnAsync<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>scope<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Construct</span>, description<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><a href="interfaces/TerraformInjectorAsync.html" class="tsd-signature-type" data-tsd-kind="Interface">TerraformInjectorAsync</a><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ApexCaptain/cdktf-injector/blob/11fb1c7/src/components/core/constants/terraform-injector.factory.constant.ts#L41">components/core/constants/terraform-injector.factory.constant.ts:41</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>cdktf-injector</title><meta name="description" content="Documentation for cdktf-injector"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">cdktf-injector</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><h1>cdktf-injector</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Namespaces</h3><ul class="tsd-index-list"><li class="tsd-kind-namespace"><a href="modules/Reference.html" class="tsd-kind-icon">Reference</a></li></ul></section><section class="tsd-index-section "><h3>Classes</h3><ul class="tsd-index-list"><li class="tsd-kind-class"><a href="classes/TerraformInjectorStack.html" class="tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Stack</a></li><li class="tsd-kind-class"><a href="classes/TerraformInjectorStackAsync.html" class="tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Stack<wbr/>Async</a></li></ul></section><section class="tsd-index-section "><h3>Interfaces</h3><ul class="tsd-index-list"><li class="tsd-kind-interface"><a href="interfaces/TerraformInjector.html" class="tsd-kind-icon">Terraform<wbr/>Injector</a></li><li class="tsd-kind-interface"><a href="interfaces/TerraformInjectorAsync.html" class="tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Async</a></li><li class="tsd-kind-interface tsd-has-type-parameter"><a href="interfaces/TerraformInjectorElementContainer.html" class="tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Element<wbr/>Container</a></li><li class="tsd-kind-interface tsd-has-type-parameter"><a href="interfaces/TerraformInjectorElementContainerAsync.html" class="tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Element<wbr/>Container<wbr/>Async</a></li></ul></section><section class="tsd-index-section "><h3>Variables</h3><ul class="tsd-index-list"><li class="tsd-kind-variable"><a href="modules.html#TerraformInjectorFactory" class="tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Factory</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Variables</h2><section class="tsd-panel tsd-member tsd-kind-variable"><a id="TerraformInjectorFactory" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagConst">Const</span> Terraform<wbr/>Injector<wbr/>Factory<a href="#TerraformInjectorFactory" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Terraform<wbr/>Injector<wbr/>Factory<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>scopesOn<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>scope<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Construct</span>, description<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><a href="interfaces/TerraformInjector.html" class="tsd-signature-type" data-tsd-kind="Interface">TerraformInjector</a><span class="tsd-signature-symbol">; </span>scopesOnAsync<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>scope<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Construct</span>, description<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><a href="interfaces/TerraformInjectorAsync.html" class="tsd-signature-type" data-tsd-kind="Interface">TerraformInjectorAsync</a><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ApexCaptain/cdktf-injector/blob/1e8d055/src/components/core/constants/terraform-injector.factory.constant.ts#L41">components/core/constants/terraform-injector.factory.constant.ts:41</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Constant object for creating <a href="interfaces/TerraformInjector.html">TerraformInjector</a> or <a href="interfaces/TerraformInjectorAsync.html">TerraformInjectorAsync</a> instance.
You can use only one of <code>scopesOn</code> or <code>scopesOnAsync</code> function for one <a href="https://www.npmjs.com/package/constructs" class="external">Construct</a> instance, not both.</p>
</div><dl class="tsd-comment-tags"><dt>see</dt><dd><p><a href="https://www.terraform.io/cdktf/concepts/constructs">https://www.terraform.io/cdktf/concepts/constructs</a></p>
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Reference.html

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
TerraformOutputConfig,
} from 'cdktf';
import { Construct } from 'constructs';
import deepmerge from 'deepmerge';
import _ from 'lodash';
import {
TerraformInjectorElementClassType,
TerraformInjectorBackendClassType,
Expand Down Expand Up @@ -202,22 +202,14 @@ export class TerraformInjectorElementContainerClass<
this.useDefaultConfig &&
!(this.terraformElementClass.prototype instanceof TerraformOutput)
)
config = deepmerge(
config = _.merge(
this.injector.defaultConfigure(
this.id,
this.terraformElementClass.name,
this.description,
),
config,
) as ConfigType;

/*
TODO
Array.from(this.dependencies.values()).filter(
(eachElementContainer) => 'fqn' in eachElementContainer.element,
);
*/

);
this._element =
this.terraformElementClass.prototype instanceof TerraformBackend
? new (this.terraformElementClass as TerraformInjectorBackendClassType<
Expand Down
19 changes: 19 additions & 0 deletions test/tmp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* eslint-disable spellcheck/spell-checker */
// import { vpc } from '@cdktf/provider-aws';
// import { App } from 'cdktf';
// import { TerraformInjectorStack } from '../src';

// class MyStack extends TerraformInjectorStack {
// myVpc1 = this.provide(vpc.Vpc, 'mv', () => ({
// cidrBlock: '10.1.0.0/16',
// }));
// myVpc2 = this.provide(vpc.Vpc, 'mv2', () => ({
// cidrBlock: '10.2.0.0/16',
// dependsOn: [this.myVpc1.element],
// }));
// }

// const app = new App();
// const myStack = new MyStack(app, 'my-stack');
// console.log('start injection');
// myStack.inject();
5 changes: 5 additions & 0 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ac37f9b

Please sign in to comment.