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

chore: clean up build configurations #2060

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ DATAPLANE_URL=
TEST_FILE_PATH=
CONFIG_SERVER_HOST=
DEST_SDK_BASE_URL=
BUGSNAG_API_KEY=
BUGSNAG_RELEASE_STAGE=
6 changes: 4 additions & 2 deletions .github/workflows/deploy-sanity-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ jobs:
- name: Setup workspace
env:
HUSKY: 0
REMOTE_MODULES_BASE_PATH: 'https://cdn.rudderlabs.com/${{ env.SDK_CDN_VERSION_PATH_PREFIX }}v3/modern/plugins'
BUGSNAG_RELEASE_STAGE: ${{ env.BUGSNAG_RELEASE_STAGE }}
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
LOCK_DEPS_VERSION: ${{ inputs.environment == 'production' && 'true' || 'false' }}
run: |
npm run setup:ci

Expand All @@ -92,8 +96,6 @@ jobs:
WRITE_KEY: ${{ secrets.SANITY_SUITE_WRITE_KEY }}
DATAPLANE_URL: ${{ secrets.SANITY_SUITE_DATAPLANE_URL }}
CONFIG_SERVER_HOST: ${{ secrets.SANITY_SUITE_CONFIG_SERVER_HOST }}
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
BUGSNAG_RELEASE_STAGE: ${{ env.BUGSNAG_RELEASE_STAGE }}
SDK_CDN_VERSION_PATH_PREFIX: ${{ env.SDK_CDN_VERSION_PATH_PREFIX }}
HUSKY: 0
run: |
Expand Down
1 change: 0 additions & 1 deletion jest/jest.setup-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ global.window.innerHeight = 1024;
global.window.__BUNDLE_ALL_PLUGINS__ = false;
global.window.__LOCK_DEPS_VERSION__ = false;
global.window.__IS_LEGACY_BUILD__ = false;
global.window.__IS_DYNAMIC_CUSTOM_BUNDLE__ = false;
// Only define the mock if it's not already defined (e.g., in a real browser)
if (typeof PromiseRejectionEvent === 'undefined') {
// Mock class (very minimal)
Expand Down
4 changes: 0 additions & 4 deletions packages/analytics-js-plugins/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ const pluginsMap = {
'./XhrQueue': './src/xhrQueue/index.ts',
};

const bugsnagSDKUrl = 'https://d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js';

export function getDefaultConfig(distName) {
const version = process.env.VERSION || 'dev-snapshot';
const isLocalServerEnabled = isCDNPackageBuild && process.env.DEV_SERVER;
Expand All @@ -77,9 +75,7 @@ export function getDefaultConfig(distName) {
preventAssignment: true,
__PACKAGE_VERSION__: version,
__MODULE_TYPE__: moduleType,
__RS_BUGSNAG_API_KEY__: process.env.BUGSNAG_API_KEY || '{{__RS_BUGSNAG_API_KEY__}}',
__RS_BUGSNAG_RELEASE_STAGE__: process.env.BUGSNAG_RELEASE_STAGE || 'production',
__RS_BUGSNAG_SDK_URL__: bugsnagSDKUrl,
}),
resolve({
jsnext: true,
Expand Down
8 changes: 0 additions & 8 deletions packages/analytics-js-service-worker/.env.example

This file was deleted.

1 change: 0 additions & 1 deletion packages/analytics-js/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ DATAPLANE_URL=
CONFIG_SERVER_HOST=
DEST_SDK_BASE_URL=
REMOTE_MODULES_BASE_PATH=
BUGSNAG_API_KEY=
BUGSNAG_RELEASE_STAGE=
12 changes: 3 additions & 9 deletions packages/analytics-js/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const additionalWatchPaths = isLegacyBuild ? ['../analytics-js-plugins/src/**',
const variantSubfolder = isLegacyBuild ? '/legacy' : '/modern';
const bundledPluginsList = process.env.BUNDLED_PLUGINS;
const isDynamicCustomBuild = Boolean(bundledPluginsList);
const bundleAllPlugins = isLegacyBuild || bundledPluginsList === 'all';
const isContentScriptBuild = process.env.NO_EXTERNAL_HOST;
const isModuleFederatedBuild = !isDynamicCustomBuild && !isLegacyBuild;
const sourceMapType =
Expand All @@ -39,7 +40,7 @@ remotePluginsBasePath = remotePluginsBasePath?.endsWith('/') ? remotePluginsBase
let destSDKBaseURL = process.env.DEST_SDK_BASE_URL;
destSDKBaseURL = destSDKBaseURL?.endsWith('/') ? destSDKBaseURL : `${destSDKBaseURL}/`;
const outDirNpmRoot = `dist/npm`;
const outDirCDNRoot = isDynamicCustomBuild ? `dist/${cdnPath}` : `dist/${cdnPath}`;
const outDirCDNRoot = `dist/${cdnPath}`;
let outDirNpm = `${outDirNpmRoot}${variantSubfolder}`;
const outDirCDN = `${outDirCDNRoot}${variantSubfolder}`;
const distName = 'rsa';
Expand All @@ -49,13 +50,11 @@ const remotePluginsHostPromise = `Promise.resolve(window.RudderStackGlobals && w
const moduleType = process.env.MODULE_TYPE || 'cdn';
const lockDepsVersion = process.env.LOCK_DEPS_VERSION ?? false;
const isCDNPackageBuild = moduleType === 'cdn';
let bugsnagSDKUrl = 'https://d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js';
let polyfillIoUrl = 'https://polyfill-fastly.io/v3/polyfill.min.js';

// For Chrome extension as content script any references in code to third party URLs
// throw violations at approval phase even if relevant code is not used
if (isContentScriptBuild) {
bugsnagSDKUrl = '';
polyfillIoUrl = '';
}

Expand Down Expand Up @@ -181,18 +180,13 @@ export function getDefaultConfig(distName) {
plugins: [
replace({
preventAssignment: true,
__BUNDLE_ALL_PLUGINS__: isLegacyBuild || isDynamicCustomBuild,
__IS_DYNAMIC_CUSTOM_BUNDLE__: isDynamicCustomBuild,
__BUNDLED_PLUGINS_LIST__: bundledPluginsList ?? '',
__BUNDLE_ALL_PLUGINS__: bundleAllPlugins,
__IS_LEGACY_BUILD__: isLegacyBuild,
__PACKAGE_VERSION__: version,
__MODULE_TYPE__: moduleType,
__LOCK_DEPS_VERSION__: lockDepsVersion,
__SDK_BUNDLE_FILENAME__: distName,
__RS_POLYFILLIO_SDK_URL__: polyfillIoUrl,
__RS_BUGSNAG_API_KEY__: process.env.BUGSNAG_API_KEY || '{{__RS_BUGSNAG_API_KEY__}}',
__RS_BUGSNAG_RELEASE_STAGE__: process.env.BUGSNAG_RELEASE_STAGE || 'production',
__RS_BUGSNAG_SDK_URL__: bugsnagSDKUrl,
}),
resolve({
jsnext: true,
Expand Down
5 changes: 0 additions & 5 deletions packages/loading-scripts/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import serve from 'rollup-plugin-serve';
import * as dotenv from 'dotenv';

dotenv.config();
const remotePluginsBasePath = process.env.REMOTE_MODULES_BASE_PATH || 'http://localhost:3002/cdn/';
const outDirRoot = `dist`;
const distName = 'loading-script';
const modName = 'script';
Expand All @@ -36,12 +35,8 @@ export function getDefaultConfig(distName) {
plugins: [
replace({
preventAssignment: true,
__SDK_BUNDLE_FILENAME__: distName,
__WRITE_KEY__: process.env.WRITE_KEY,
__DATAPLANE_URL__: process.env.DATAPLANE_URL,
__CONFIG_SERVER_HOST__: process.env.CONFIG_SERVER_HOST || '',
__DEST_SDK_BASE_URL__: process.env.DEST_SDK_BASE_URL,
__PLUGINS_BASE_URL__: remotePluginsBasePath,
__PACKAGE_VERSION__: version,
}),
typescript({
Expand Down
4 changes: 0 additions & 4 deletions types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ declare global {

declare const __BUNDLE_ALL_PLUGINS__: boolean;

declare const __IS_DYNAMIC_CUSTOM_BUNDLE__: boolean;

declare const __IS_LEGACY_BUILD__: boolean;

declare const __BUNDLED_PLUGINS_LIST__: string | undefined;

declare const __LOCK_DEPS_VERSION__: boolean;