npm package diff
Package: @forge/cli-shared
Versions: 6.8.0-next.12 - 6.8.0-next.13
File: package/out/shared/test.js
Index: package/out/shared/test.js
===================================================================
--- package/out/shared/test.js
+++ package/out/shared/test.js
@@ -18,13 +18,14 @@
snapshotLog: jest.fn()
};
}
exports.mockLogger = mockLogger;
-async function createTestApp({ userCode, packages, withI18nBundle = false }) {
+async function createTestApp({ userCode, userCodeFilename = 'index', packages, withI18nBundle = false }) {
const appDirectory = (0, directories_1.tmpDir)();
- const srcDirectory = path_1.default.join(appDirectory, 'src');
- await (0, fs_extra_1.ensureDir)(srcDirectory);
- const userCodePath = path_1.default.join(srcDirectory, 'index.ts');
+ const userCodeDir = path_1.default.join(appDirectory, 'src', path_1.default.dirname(userCodeFilename));
+ const userCodeBaseName = path_1.default.basename(userCodeFilename);
+ await (0, fs_extra_1.ensureDir)(userCodeDir);
+ const userCodePath = path_1.default.join(userCodeDir, `${userCodeBaseName}.ts`);
await (0, promises_1.writeFile)(userCodePath, userCode);
await (0, promises_1.writeFile)(path_1.default.join(appDirectory, 'tsconfig.json'), JSON.stringify({}));
const allPackages = ['@types/node', ...(packages ?? [])];
await (0, promises_1.writeFile)(path_1.default.join(appDirectory, 'package.json'), JSON.stringify({
@@ -50,8 +51,8 @@
await (0, promises_1.writeFile)(path_1.default.join(appDirectory, localeFolder, 'en-US.json'), JSON.stringify({ title: 'i18n' }));
}
return {
appDirectory,
- entryPoints: [{ name: 'main', path: userCodePath }]
+ entryPoints: [{ name: userCodeFilename, path: path_1.default.join(userCodeDir, userCodeBaseName) }]
};
}
exports.createTestApp = createTestApp;