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

Consolidate configuration setup across repository #685

Merged
merged 32 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
28bcead
Update use of configuration to consistently use .env file. Deprecate …
calebmshafer Jan 30, 2021
c21eda6
Update oidc-signin-tool handling. Clean up forms test setup
calebmshafer Jan 30, 2021
f2c069b
Update the description of rush command
calebmshafer Jan 30, 2021
508286d
Merge branch 'master' into update-test-config
calebmshafer Jan 30, 2021
5d551cb
Merge branch 'master' into update-test-config
mergify[bot] Jan 30, 2021
7a1a93a
fix lint errors and extract-api
calebmshafer Jan 30, 2021
d7b4449
Merge branch 'update-test-config' of github.com:imodeljs/imodeljs int…
calebmshafer Jan 30, 2021
a2ec4c0
merge with master
calebmshafer Feb 1, 2021
f1b9e5e
Merge branch 'master' into update-test-config
mergify[bot] Feb 1, 2021
7f2bb00
Merge branch 'master' into update-test-config
mergify[bot] Feb 1, 2021
22ce409
Merge branch 'master' into update-test-config
mergify[bot] Feb 1, 2021
0baa790
Merge branch 'master' into update-test-config
mergify[bot] Feb 1, 2021
c530fd6
Merge branch 'master' into update-test-config
calebmshafer Feb 4, 2021
3822104
Fix docs and loading error
calebmshafer Feb 4, 2021
6f37f7b
fix lint error
calebmshafer Feb 4, 2021
5eb17b1
Merge branch 'master' into update-test-config
mergify[bot] Feb 4, 2021
fa0566c
Merge branch 'master' into update-test-config
mergify[bot] Feb 4, 2021
bdafb30
Merge branch 'master' into update-test-config
mergify[bot] Feb 4, 2021
c5151f9
Merge branch 'master' into update-test-config
mergify[bot] Feb 4, 2021
13745a4
merge with master
calebmshafer Feb 5, 2021
ee10dfa
Merge branch 'master' into update-test-config
mergify[bot] Feb 5, 2021
204bc42
Merge branch 'master' into update-test-config
calebmshafer Feb 8, 2021
5193326
Merge branch 'master' into update-test-config
mergify[bot] Feb 8, 2021
2fa694d
Merge branch 'master' into update-test-config
calebmshafer Feb 9, 2021
f71fc52
Merge branch 'master' into update-test-config
mergify[bot] Feb 9, 2021
e095d26
Merge branch 'master' into update-test-config
mergify[bot] Feb 9, 2021
abe570e
Merge branch 'master' into update-test-config
mergify[bot] Feb 9, 2021
3c52442
Merge branch 'master' into update-test-config
calebmshafer Feb 10, 2021
82bc092
Merge branch 'master' into update-test-config
mergify[bot] Feb 10, 2021
8c34061
Merge branch 'master' into update-test-config
mergify[bot] Feb 10, 2021
9afe496
Merge branch 'master' into update-test-config
mergify[bot] Feb 10, 2021
5f81758
Merge branch 'master' into update-test-config
mergify[bot] Feb 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion clients/context-registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"test:integration": "npm run webpackTests && npm run test:integration:chrome",
"test:integration:chrome": "certa -r chrome --grep \"#integration\"",
"test:integration:electron": "certa -r electron --grep \"#integration\"",
"copy:config": "internal-tools copy-config",
"cover": ""
},
"keywords": [
Expand Down Expand Up @@ -54,6 +55,7 @@
"@types/node": "10.14.1",
"chai": "^4.1.2",
"eslint": "^6.8.0",
"internal-tools": "0.0.0",
"mocha": "^5.2.0",
"nyc": "^14.0.0",
"rimraf": "^3.0.2",
Expand All @@ -70,4 +72,4 @@
],
"extends": "plugin:@bentley/imodeljs-recommended"
}
}
}
10 changes: 4 additions & 6 deletions clients/context-registry/src/test/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
const path = require("path");
const glob = require("glob");
const webpack = require("webpack");
const raw = require("@bentley/config-loader/lib/IModelJsConfig").IModelJsConfig.init(true /*suppress error*/, true);
require("@bentley/config-loader").loadEnv(path.join(__dirname, "..", "..", "..", ".env"));

const clientsLib = path.resolve(__dirname, "../../../lib");

Expand Down Expand Up @@ -51,16 +51,14 @@ function createConfig(shouldInstrument) {
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === "development") { ... }. See `./env.js`.
new webpack.DefinePlugin({
"process.env": Object.keys(raw)
"process.env": Object.keys(process.env)
.filter((key) => {
return key.match(/^imjs_/i);
})
.reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
env[key] = JSON.stringify(process.env[key]);
return env;
}, {
IMODELJS_CORE_DIRNAME: JSON.stringify(path.join(__dirname, "../..")),
}),
}, {}),
})
]
};
Expand Down
4 changes: 3 additions & 1 deletion clients/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"test:integration:chrome": "certa -r chrome",
"test:integration:electron": "certa -r electron",
"test:integration:node": "certa -r node",
"copy:config": "internal-tools copy-config",
"webpackTests": "webpack --config ./src/test/utils/webpack.config.js 1>&2"
},
"keywords": [
Expand Down Expand Up @@ -51,6 +52,7 @@
"@types/node": "10.14.1",
"chai": "^4.1.2",
"eslint": "^6.8.0",
"internal-tools": "0.0.0",
"mocha": "^5.2.0",
"nyc": "^14.0.0",
"rimraf": "^3.0.2",
Expand All @@ -67,4 +69,4 @@
],
"extends": "plugin:@bentley/imodeljs-recommended"
}
}
}
10 changes: 4 additions & 6 deletions clients/extension/src/test/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
const path = require("path");
const glob = require("glob");
const webpack = require("webpack");
const raw = require("@bentley/config-loader/lib/IModelJsConfig").IModelJsConfig.init(true /*suppress error*/, true);
require("@bentley/config-loader").loadEnv(path.join(__dirname, "..", "..", "..", ".env"));
paulius-valiunas marked this conversation as resolved.
Show resolved Hide resolved

const clientsLib = path.resolve(__dirname, "../../../lib");

Expand Down Expand Up @@ -51,16 +51,14 @@ function createConfig(shouldInstrument) {
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === "development") { ... }. See `./env.js`.
new webpack.DefinePlugin({
"process.env": Object.keys(raw)
"process.env": Object.keys(process.env)
.filter((key) => {
return key.match(/^imjs_/i);
})
.reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
env[key] = JSON.stringify(process.env[key]);
return env;
}, {
IMODELJS_CORE_DIRNAME: JSON.stringify(path.join(__dirname, "../..")),
}),
}, {}),
})
]
};
Expand Down
4 changes: 3 additions & 1 deletion clients/forms-data-management/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"test:integration": "npm run webpackTests && npm run test:integration:chrome",
"test:integration:chrome": "certa -r chrome --grep \"#integration\"",
"test:integration:electron": "certa -r electron --grep \"#integration\"",
"copy:config": "internal-tools copy-config",
"cover": ""
},
"keywords": [
Expand Down Expand Up @@ -53,6 +54,7 @@
"@types/node": "10.14.1",
"chai": "^4.1.2",
"eslint": "^6.8.0",
"internal-tools": "0.0.0",
"mocha": "^5.2.0",
"nyc": "^14.0.0",
"rimraf": "^3.0.2",
Expand All @@ -69,4 +71,4 @@
],
"extends": "plugin:@bentley/imodeljs-recommended"
}
}
}
35 changes: 0 additions & 35 deletions clients/forms-data-management/src/test/TestConfig.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,30 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as chai from "chai";
import { assert } from "chai";
import { ContextRegistryClient, Project } from "@bentley/context-registry-client";
import { AuthorizedClientRequestContext } from "@bentley/itwin-client";
import { AccessToken, AuthorizedClientRequestContext } from "@bentley/itwin-client";
import { getAccessTokenFromBackend, TestUsers } from "@bentley/oidc-signin-tool/lib/frontend";
import { FormDataManagementClient, FormDefinition } from "../../FormDataManagementClient";
import { TestConfig } from "../TestConfig";

/* eslint-disable @typescript-eslint/naming-convention */

chai.should();

describe("FormDataManagementClient", () => {
let requestContext: AuthorizedClientRequestContext;
const formDataManagementClient: FormDataManagementClient = new FormDataManagementClient();
let projectId: string;

before(async function () {
if (TestConfig.enableMocks) return;
this.enableTimeouts(false);

requestContext = await TestConfig.getAuthorizedClientRequestContext();
const accessToken = await getAccessTokenFromBackend(TestUsers.super);
requestContext = new AuthorizedClientRequestContext((accessToken as any) as AccessToken);

const contextRegistry = new ContextRegistryClient();
const projectName = "iModelJsIntegrationTest";
const project: Project | undefined = await contextRegistry.getProject(requestContext, {
$select: "*",
$filter: `Name+eq+'${TestConfig.projectName}'`,
$filter: `Name+eq+'${projectName}'`,
});
chai.assert(project, `Project ${TestConfig.projectName} not found for user.`);
assert(project, `Project ${projectName} not found for user.`);
projectId = project.wsgId;
});

Expand All @@ -37,6 +34,6 @@ describe("FormDataManagementClient", () => {
requestContext,
projectId
);
chai.assert(formDefinitions);
assert(formDefinitions);
});
});
10 changes: 4 additions & 6 deletions clients/forms-data-management/src/test/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
const path = require("path");
const glob = require("glob");
const webpack = require("webpack");
const raw = require("@bentley/config-loader/lib/IModelJsConfig").IModelJsConfig.init(true /*suppress error*/, true);
require("@bentley/config-loader").loadEnv(path.join(__dirname, "..", "..", "..", ".env"));

const clientsLib = path.resolve(__dirname, "../../../lib");

Expand Down Expand Up @@ -48,16 +48,14 @@ function createConfig(shouldInstrument) {
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === "development") { ... }. See `./env.js`.
new webpack.DefinePlugin({
"process.env": Object.keys(raw)
"process.env": Object.keys(process.env)
.filter((key) => {
return key.match(/^imjs_/i);
})
.reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
env[key] = JSON.stringify(process.env[key]);
return env;
}, {
IMODELJS_CORE_DIRNAME: JSON.stringify(path.join(__dirname, "../..")),
}),
}, {}),
})
]
};
Expand Down
4 changes: 3 additions & 1 deletion clients/product-settings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"test:integration": "npm run webpackTests && npm run test:integration:chrome",
"test:integration:chrome": "certa -r chrome --grep \"#integration\"",
"test:integration:electron": "certa -r electron --grep \"#integration\"",
"copy:config": "internal-tools copy-config",
"webpackTests": "webpack --config ./src/test/utils/webpack.config.js 1>&2"
},
"keywords": [
Expand Down Expand Up @@ -52,6 +53,7 @@
"@types/node": "10.14.1",
"chai": "^4.1.2",
"eslint": "^6.8.0",
"internal-tools": "0.0.0",
"mocha": "^5.2.0",
"nyc": "^14.0.0",
"rimraf": "^3.0.2",
Expand All @@ -68,4 +70,4 @@
],
"extends": "plugin:@bentley/imodeljs-recommended"
}
}
}
10 changes: 4 additions & 6 deletions clients/product-settings/src/test/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
const path = require("path");
const glob = require("glob");
const webpack = require("webpack");
const raw = require("@bentley/config-loader/lib/IModelJsConfig").IModelJsConfig.init(true /*suppress error*/, true);
require("@bentley/config-loader").loadEnv(path.join(__dirname, "..", ".."));

const clientsLib = path.resolve(__dirname, "../../../lib");

Expand Down Expand Up @@ -51,16 +51,14 @@ function createConfig(shouldInstrument) {
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === "development") { ... }. See `./env.js`.
new webpack.DefinePlugin({
"process.env": Object.keys(raw)
"process.env": Object.keys(process.env)
.filter((key) => {
return key.match(/^imjs_/i);
})
.reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
env[key] = JSON.stringify(process.env[key]);
return env;
}, {
IMODELJS_CORE_DIRNAME: JSON.stringify(path.join(__dirname, "../..")),
}),
}, {}),
})
]
};
Expand Down
4 changes: 3 additions & 1 deletion clients/projectshare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"test:integration": "npm run webpackTests && npm run test:integration:chrome",
"test:integration:chrome": "certa -r chrome --grep \"#integration\"",
"test:integration:electron": "certa -r electron --grep \"#integration\"",
"copy:config": "internal-tools copy-config",
"webpackTests": "webpack --config ./src/test/utils/webpack.config.js 1>&2"
},
"keywords": [
Expand Down Expand Up @@ -52,6 +53,7 @@
"@types/node": "10.14.1",
"chai": "^4.1.2",
"eslint": "^6.8.0",
"internal-tools": "0.0.0",
"mocha": "^5.2.0",
"nyc": "^14.0.0",
"rimraf": "^3.0.2",
Expand All @@ -68,4 +70,4 @@
],
"extends": "plugin:@bentley/imodeljs-recommended"
}
}
}
10 changes: 4 additions & 6 deletions clients/projectshare/src/test/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
const path = require("path");
const glob = require("glob");
const webpack = require("webpack");
const raw = require("@bentley/config-loader/lib/IModelJsConfig").IModelJsConfig.init(true /*suppress error*/, true);
require("@bentley/config-loader").loadEnv(path.join(__dirname, "..", "..", "..", ".env"));

const clientsLib = path.resolve(__dirname, "../../../lib");

Expand Down Expand Up @@ -51,16 +51,14 @@ function createConfig(shouldInstrument) {
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === "development") { ... }. See `./env.js`.
new webpack.DefinePlugin({
"process.env": Object.keys(raw)
"process.env": Object.keys(process.env)
.filter((key) => {
return key.match(/^imjs_/i);
})
.reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
env[key] = JSON.stringify(process.env[key]);
return env;
}, {
IMODELJS_CORE_DIRNAME: JSON.stringify(path.join(__dirname, "../..")),
}),
}, {}),
})
]
};
Expand Down
4 changes: 3 additions & 1 deletion clients/rbac/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"test:integration": "npm run webpackTests && npm run test:integration:chrome",
"test:integration:chrome": "certa -r chrome --grep \"#integration\"",
"test:integration:electron": "certa -r electron --grep \"#integration\"",
"copy:config": "internal-tools copy-config",
"webpackTests": "webpack --config ./src/test/utils/webpack.config.js 1>&2"
},
"keywords": [
Expand Down Expand Up @@ -53,6 +54,7 @@
"@types/node": "10.14.1",
"chai": "^4.1.2",
"eslint": "^6.8.0",
"internal-tools": "0.0.0",
"mocha": "^5.2.0",
"nyc": "^14.0.0",
"rimraf": "^3.0.2",
Expand All @@ -69,4 +71,4 @@
],
"extends": "plugin:@bentley/imodeljs-recommended"
}
}
}
10 changes: 4 additions & 6 deletions clients/rbac/src/test/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
const path = require("path");
const glob = require("glob");
const webpack = require("webpack");
const raw = require("@bentley/config-loader/lib/IModelJsConfig").IModelJsConfig.init(true /*suppress error*/, true);
require("@bentley/config-loader").loadEnv(path.join(__dirname, "..", "..", "..", ".env"));

const clientsLib = path.resolve(__dirname, "../../../lib");

Expand Down Expand Up @@ -51,16 +51,14 @@ function createConfig(shouldInstrument) {
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === "development") { ... }. See `./env.js`.
new webpack.DefinePlugin({
"process.env": Object.keys(raw)
"process.env": Object.keys(process.env)
.filter((key) => {
return key.match(/^imjs_/i);
})
.reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
env[key] = JSON.stringify(process.env[key]);
return env;
}, {
IMODELJS_CORE_DIRNAME: JSON.stringify(path.join(__dirname, "../..")),
}),
}, {}),
})
]
};
Expand Down