Skip to content

Commit a0ca93f

Browse files
chore: update possible issue with publish
1 parent d1bdf91 commit a0ca93f

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

packages/enhanced/test/unit/sharing/utils.ts

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,20 @@ export const createMockCompilation = () => {
197197
},
198198
resolverFactory: {
199199
get: jest.fn().mockReturnValue({
200-
resolve: jest.fn().mockResolvedValue({ path: '/resolved/path' }),
200+
resolve: jest
201+
.fn()
202+
.mockImplementation(
203+
(
204+
resolveOptions,
205+
resolveFrom,
206+
resolveTo,
207+
resolveContext,
208+
callback,
209+
) => {
210+
// Mock successful resolution with correct 5-parameter signature
211+
callback(null, '/resolved/' + resolveTo);
212+
},
213+
),
201214
}),
202215
},
203216
codeGenerationResults: {
@@ -363,10 +376,20 @@ export const createSharingTestEnvironment = () => {
363376
mockCompilation.context = compiler.context;
364377
mockCompilation.resolverFactory = {
365378
get: jest.fn().mockReturnValue({
366-
resolve: jest.fn().mockImplementation((context, request, callback) => {
367-
// Mock successful resolution
368-
callback(null, '/resolved/' + request);
369-
}),
379+
resolve: jest
380+
.fn()
381+
.mockImplementation(
382+
(
383+
resolveOptions,
384+
resolveFrom,
385+
resolveTo,
386+
resolveContext,
387+
callback,
388+
) => {
389+
// Mock successful resolution with correct 5-parameter signature
390+
callback(null, '/resolved/' + resolveTo);
391+
},
392+
),
370393
}),
371394
};
372395

tools/scripts/publish.mjs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ async function main() {
6969
json.version = version;
7070
writeFileSync(packageJsonPath, JSON.stringify(json, null, 2));
7171

72-
console.log(chalk.green(`Updated version from ${oldVersion} to ${version}`));
72+
console.log(
73+
chalk.green(`Updated version from ${oldVersion} to ${version}`),
74+
);
7375
} catch (e) {
7476
console.error(
7577
chalk.bold.red(
@@ -82,9 +84,15 @@ async function main() {
8284

8385
// Execute "npm publish" to publish
8486
try {
85-
console.log(chalk.blue(`Publishing with command: npm publish --access public --tag ${tag}`));
87+
console.log(
88+
chalk.blue(
89+
`Publishing with command: npm publish --access public --tag ${tag}`,
90+
),
91+
);
8692
execSync(`npm publish --access public --tag ${tag}`, { stdio: 'inherit' });
87-
console.log(chalk.green(`Successfully published ${name}@${version} with tag: ${tag}`));
93+
console.log(
94+
chalk.green(`Successfully published ${name}@${version} with tag: ${tag}`),
95+
);
8896
} catch (error) {
8997
console.error(chalk.bold.red('Failed to publish package:'), error);
9098
process.exit(1);
@@ -95,4 +103,4 @@ async function main() {
95103
main().catch((error) => {
96104
console.error(chalk.bold.red('Unexpected error:'), error);
97105
process.exit(1);
98-
});
106+
});

0 commit comments

Comments
 (0)