Skip to content

Commit 3581018

Browse files
authored
fix(configure): properly resolve package.json on windows (#14)
* fix(configure): use proper path to load package.json on windows * ci: only run tests on main or pr
1 parent 267b9c4 commit 3581018

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

.changeset/blue-hairs-hunt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'adonis-cockpit': patch
3+
---
4+
5+
Fix configuration on Windows

.github/workflows/test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: test
22

33
on:
4-
- push
5-
- pull_request
4+
push:
5+
branches:
6+
- main
7+
pull_request:
68

79
jobs:
810
lint:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
#### [🚀 Get started](https://adonis-cockpit.com/docs/getting-started/installation)[🌐 Website](https://adonis-cockpit.com/docs/getting-started/installation)[✍ Contribute](./CONTRIBUTING.md)
1616

17-
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/kerwanp/adonis-cockpit/test?style=flat-square&label=tests)
18-
![Lines](https://img.shields.io/badge/coverage-20.21%25-red.svg?style=flat-square) [![adonis-cockpit](https://img.shields.io/npm/v/adonis-cockpit?style=flat-square)](https://www.npmjs.com/package/adonis-cockpit)
17+
![GitHub branch check runs](https://img.shields.io/github/check-runs/kerwanp/adonis-cockpit/main?style=flat-square)
18+
![Lines](https://img.shields.io/badge/coverage-19.94%25-red.svg?style=flat-square) [![adonis-cockpit](https://img.shields.io/npm/v/adonis-cockpit?style=flat-square)](https://www.npmjs.com/package/adonis-cockpit)
1919

2020
[![PRs Welcome](https://img.shields.io/badge/PRs-Are%20welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com) [![License](https://img.shields.io/github/license/kerwanp/adonis-cockpit?label=License&style=flat-square)](LICENCE)
2121

configure.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const missingDependenciesSteps: {
4646
{
4747
title: 'Lucid is not configured',
4848
detect: async (command) => {
49-
const packageJson = await PackageJson.load(command.app.appRoot.pathname)
49+
const packageJson = await PackageJson.load(command.app.makePath())
5050
const dependencies = Object.keys(packageJson.content.dependencies ?? [])
5151
return dependencies.includes('@adonisjs/lucid')
5252
},
@@ -58,7 +58,7 @@ const missingDependenciesSteps: {
5858
{
5959
title: 'InertiaJS is not configured',
6060
detect: async (command) => {
61-
const packageJson = await PackageJson.load(command.app.appRoot.pathname)
61+
const packageJson = await PackageJson.load(command.app.makePath())
6262
const dependencies = Object.keys(packageJson.content.dependencies ?? [])
6363
return dependencies.includes('@adonisjs/inertia')
6464
},
@@ -199,7 +199,7 @@ async function installTailwindCSS(command: ConfigureCommand, codemods: Codemods)
199199
}
200200

201201
async function updatePackageJson(command: ConfigureCommand) {
202-
const packageJson = await PackageJson.load(command.app.appRoot.pathname)
202+
const packageJson = await PackageJson.load(command.app.makePath())
203203

204204
packageJson.update({
205205
imports: {

tests/integration/configure.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async function prepareApp(
3030
await writeFile(app.makePath('start/env.ts'), `export default Env.create(new URL('./'), {})`)
3131
await writeFile(app.makePath('adonisrc.ts'), 'export default defineConfig({})')
3232
await writeFile(app.makePath('vite.config.ts'), 'export default defineConfig({ plugins: [] })')
33-
await PackageJson.create(app.appRoot.pathname)
33+
await PackageJson.create(app.makePath())
3434
.then((p) => p.update(packageJson))
3535
.then((p) => p.save())
3636
}

0 commit comments

Comments
 (0)