Skip to content

Commit

Permalink
chore: change exported.ts to index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxuanzhangsfdx committed Mar 7, 2024
1 parent 5ae6122 commit d6aceb5
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ new Generator({
}).generate();

const sharedConfig = {
entryPoints: ['src/exported.ts'],
entryPoints: ['src/index.ts'],
bundle: true,
// minify: true,
plugins: [
Expand Down
27 changes: 27 additions & 0 deletions scripts/updateForBundling.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const fs = require('fs');
const path = require('path');

// Function to update package.json
function updatePackageJson() {
Expand Down Expand Up @@ -62,6 +63,32 @@ function updateLoggerTs() {
});
}

function updateLoadMessagesParam() {
const dirs = ['./src', './test'];
function replaceTextInFile(filePath) {
const data = fs.readFileSync(filePath, 'utf8');
const result = data.replace(
/Messages\.loadMessages\('@salesforce\/core'/g,
"Messages.loadMessages('@salesforce/core-bundle'"
);
fs.writeFileSync(filePath, result, 'utf8');
}
function traverseDirectory(directory) {
fs.readdirSync(directory).forEach((file) => {
const fullPath = path.join(directory, file);
if (fs.lstatSync(fullPath).isDirectory()) {
traverseDirectory(fullPath);
} else if (path.extname(fullPath) === '.ts') {
replaceTextInFile(fullPath);
}
});
}
dirs.forEach((dir) => {
traverseDirectory(dir);
});
}

// Run the update functions
updatePackageJson();
updateLoggerTs();
updateLoadMessagesParam();
File renamed without changes.
2 changes: 1 addition & 1 deletion test/perf/logger/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { Suite } from 'benchmark';
import { Logger } from '../../../src/exported';
import { Logger } from '../../../src';
import { cleanup } from '../../../src/logger/cleanup';

const suite = new Suite();
Expand Down
2 changes: 1 addition & 1 deletion test/unit/config/configAggregatorTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { assert, expect, config as chaiConfig } from 'chai';
import { Config, ConfigProperties, SFDX_ALLOWED_PROPERTIES, SfdxPropertyKeys } from '../../../src/config/config';
import { ConfigAggregator, ConfigInfo } from '../../../src/config/configAggregator';
import { ConfigFile } from '../../../src/config/configFile';
import { Messages, OrgConfigProperties, Lifecycle, ORG_CONFIG_ALLOWED_PROPERTIES } from '../../../src/exported';
import { Messages, OrgConfigProperties, Lifecycle, ORG_CONFIG_ALLOWED_PROPERTIES } from '../../../src';
import { TestContext } from '../../../src/testSetup';

// if you add to this, make sure you use both the old and new name
Expand Down
2 changes: 1 addition & 1 deletion test/unit/config/configFileConcurrency.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { tmpdir } from 'node:os';
import { rm } from 'node:fs/promises';
import { expect } from 'chai';
import { sleep } from '@salesforce/kit';
import { ConfigFile } from '../../../src/exported';
import { ConfigFile } from '../../../src';

const FILENAME = 'concurrency.json';
const sharedLocation = join('sfdx-core-ut', 'test', 'configFile');
Expand Down
2 changes: 1 addition & 1 deletion test/unit/config/configFileTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { expect } from 'chai';
import { assert } from '@salesforce/ts-types';
import lockfileLib from 'proper-lockfile';
import { ConfigFile } from '../../../src/config/configFile';
import { SfError } from '../../../src/exported';
import { SfError } from '../../../src';
import { shouldThrow, TestContext } from '../../../src/testSetup';

describe('Config', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/config/configTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import * as lockfileLib from 'proper-lockfile';
import { Config, ConfigPropertyMeta } from '../../../src/config/config';
import { ConfigFile } from '../../../src/config/configFile';
import { ConfigContents } from '../../../src/config/configStackTypes';
import { OrgConfigProperties } from '../../../src/exported';
import { OrgConfigProperties } from '../../../src';
import { shouldThrowSync, TestContext } from '../../../src/testSetup';

const configFileContentsString = '{"target-dev-hub": "configTest_devhub","target-org": "configTest_default"}';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/projectTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { join, sep } from 'node:path';
import { expect } from 'chai';

import { env } from '@salesforce/kit';
import { Messages, NamedPackageDir } from '../../src/exported';
import { Messages, NamedPackageDir } from '../../src';
import { SfProject, SfProjectJson } from '../../src/sfProject';
import { shouldThrow, shouldThrowSync, TestContext } from '../../src/testSetup';

Expand Down

0 comments on commit d6aceb5

Please sign in to comment.