Skip to content

Commit 24d7a8f

Browse files
committed
chore: temp wizard fix for dud next version
1 parent 9ed468f commit 24d7a8f

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

packages/cli/src/_test_/apply.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,14 @@ describe('copyTemplate — package.json merge', () => {
231231
expect(written.dependencies['@stencil/core']).toBe('link:../local/packages/core');
232232
});
233233

234-
it('uses the provided stencil version in devDependencies', async () => {
234+
it('pins the provided stencil version in devDependencies (no caret)', async () => {
235235
const existing = { name: 'my-app' };
236236
fsPromises.readFile.mockResolvedValueOnce(JSON.stringify(existing));
237237

238238
await copyTemplate('/project', 'my-app', 'MyApp', '5.0.0-alpha.8');
239239

240240
const written = JSON.parse(vi.mocked(fsPromises.writeFile).mock.calls[0][1] as string);
241-
expect(written.devDependencies['@stencil/core']).toBe('^5.0.0-alpha.8');
241+
expect(written.devDependencies['@stencil/core']).toBe('5.0.0-alpha.8');
242242
});
243243

244244
it('falls back to ^5.0.0 when no stencil version is provided', async () => {

packages/cli/src/wizard/init/apply.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ export async function copyTemplate(
2020
) {
2121
const templateDir = getTemplatePath('component-starter');
2222
const entries = await readdir(templateDir, { recursive: true, withFileTypes: true });
23-
const resolvedStencilVersion = stencilVersion ? `^${stencilVersion}` : '^5.0.0';
23+
// TEMP: pin exact version (no caret range). npm has a bad "5.0.0-next.0" prerelease whose
24+
// precedence is higher than our alpha releases; caret range resolves to it.
25+
// Revert to `^${stencilVersion}` once there is a version with a higher precedence than "5.0.0-next.0".
26+
const resolvedStencilVersion = stencilVersion ?? '^5.0.0';
2427

2528
for (const entry of entries) {
2629
if (!entry.isFile()) continue;

0 commit comments

Comments
 (0)