diff --git a/lib/cli/tooling/dotenv.ts b/lib/cli/tooling/dotenv.ts new file mode 100644 index 00000000000..d00c07f9515 --- /dev/null +++ b/lib/cli/tooling/dotenv.ts @@ -0,0 +1,24 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export function dotenv() { + return require('dotenv-expand')(require('dotenv')); +} + +export function dotenvConfig(params?: any) { + return require('dotenv-expand')(require('dotenv').config(params)); +} diff --git a/lib/cli/tooling/index.ts b/lib/cli/tooling/index.ts new file mode 100644 index 00000000000..36fed5c9c66 --- /dev/null +++ b/lib/cli/tooling/index.ts @@ -0,0 +1,18 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './dotenv'; diff --git a/lib/cli/tooling/package.json b/lib/cli/tooling/package.json new file mode 100644 index 00000000000..3841875a5b2 --- /dev/null +++ b/lib/cli/tooling/package.json @@ -0,0 +1,11 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "./index.ts", + "flatModuleFile": "adf-cli-tooling" + } + }, + "peerDependencies": { + "dotenv-expand": "^5.1.0" + } +} diff --git a/package-lock.json b/package-lock.json index 880ef79d859..364d23f0dab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41345,6 +41345,11 @@ "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==", "dev": true }, + "dotenv-expand": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", + "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==" + }, "duplexify": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", diff --git a/package.json b/package.json index 14ee99ff689..aa66873d5f1 100644 --- a/package.json +++ b/package.json @@ -97,6 +97,7 @@ "classlist.js": "1.1.20150312", "cropperjs": "1.5.12", "custom-event-polyfill": "^1.0.7", + "dotenv-expand": "^5.1.0", "minimatch": "^3.0.4", "minimatch-browser": "1.0.0", "moment-es6": "^1.0.0",