Skip to content

Commit

Permalink
changesets
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Del Core committed Feb 6, 2024
1 parent f24ede5 commit 6e3ab50
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/silent-steaks-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hypermod/validator': patch
---

Fixes usage of fetchConfig to account for undefined. Now errors should be reported correctly
5 changes: 5 additions & 0 deletions .changeset/slimy-mangos-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hypermod/fetcher': patch
---

Correctly types fetchConfig function to correctly show that this function can return `undefined`
5 changes: 5 additions & 0 deletions .changeset/wild-pigs-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hypermod/mod-atlaskit__textfield': patch
---

Removes unused variables
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ function transformDefineInlineTestCalls(
path.node.callee.property.name === 'defineInlineTest'),
)
.forEach(path => {
const [transformerOpts, input, output, description] = path.node.arguments;
const [transformerOpts, _configOpts, input, output, description] =

Check warning on line 105 in community/hypermod/src/defineInlineTest-to-applyTransform/transform.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

'_configOpts' is assigned a value but never used
path.node.arguments;

const transformer = j(transformerOpts).find(j.ObjectProperty, {
key: { name: 'default' },
Expand Down
20 changes: 11 additions & 9 deletions packages/fetcher/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ describe('fetcher', () => {
require: jest.fn().mockReturnValue(mockConfig),
};

const { filePath, config } = await fetchPackage(
const configMeta = await fetchPackage(
'fake-package',
mockPackageManager as unknown as PluginManager,
);

expect(config).toEqual(mockConfig);
expect(filePath).toEqual(mockFilePath);
expect(configMeta!.config).toEqual(mockConfig);
expect(configMeta!.filePath).toEqual(mockFilePath);
});

it('should throw if fetching fails', async () => {
Expand Down Expand Up @@ -148,13 +148,15 @@ describe('fetcher', () => {
}),
};

const { config, filePath } = await fetchRemotePackage(
const configMeta = await fetchRemotePackage(
'fake-package',
mockPackageManager as unknown as PluginManager,
);

expect(config).toEqual(mockConfig);
expect(filePath).toEqual(mockBasePath + '/hypermod.config.js');
expect(configMeta!.config).toEqual(mockConfig);
expect(configMeta!.filePath).toEqual(
mockBasePath + '/hypermod.config.js',
);
});

it('should throw if fetching fails', async () => {
Expand All @@ -181,13 +183,13 @@ describe('fetcher', () => {
}),
};

const { config, filePath } = await fetchRemotePackage(
const configMeta = await fetchRemotePackage(
'fake-package',
mockPackageManager as unknown as PluginManager,
);

expect(config).toEqual(mockConfig);
expect(filePath).toEqual(mockBasePath + '/index.js');
expect(configMeta!.config).toEqual(mockConfig);
expect(configMeta!.filePath).toEqual(mockBasePath + '/index.js');
});

it('throws if entrypoint-based config does not contain a valid config (and there are no config files available elsewhere)', async () => {
Expand Down
6 changes: 3 additions & 3 deletions scripts/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ async function main() {
const directories = communityCodemods.filter(dir => junk.not(dir));

for (const dir of directories) {
const { config } = await fetchConfig(path.join(COMMUNITY_PATH, dir));
const configMeta = await fetchConfig(path.join(COMMUNITY_PATH, dir));

if (!config) {
if (!configMeta || !configMeta.config) {
throw new Error(`Unable to locate config for path: ${dir}`);
}

data.push({ name: dir, config });
data.push({ name: dir, config: configMeta.config });
}

cleanTargetDir(DOCS_PATH);
Expand Down

0 comments on commit 6e3ab50

Please sign in to comment.