Skip to content

Commit

Permalink
refactor: script
Browse files Browse the repository at this point in the history
  • Loading branch information
rharkor committed Sep 26, 2023
1 parent 3cd4ea0 commit 98e2d3f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ jobs:
- name: Format check
run: npm run prettier
- name: Unit & Integration tests
run: npm test
run: npm run test
- name: Check dependencies usage
run: npm run depcheck
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ npm run init
4. Install the dependencies:

```bash
npm ci
npm install
```

5. Run the development server:
Expand Down Expand Up @@ -166,7 +166,7 @@ This boilerplate comes with various testing setups to ensure your application's

### Running Tests

- **Unit and integration tests**: Run Jest tests using `npm test`
- **Unit and integration tests**: Run Jest tests using `npm run test`

<img width="1392" alt="image" src="https://user-images.githubusercontent.com/28964599/233666655-93b7d08b-2fd8-406a-b43c-44d4d96cf387.png">

Expand Down
11 changes: 8 additions & 3 deletions scripts/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const processPackageFile = async (currentRuntime: IRuntime, newRuntime: IRuntime
}
//? Save the package.json
await fs.writeFile(file, JSON.stringify(packageJson, null, 2) + "\n", "utf8")
chalk.blue(`Done for ${file}`)
console.log(chalk.blue(`Done for ${file}`))
}
}

Expand All @@ -52,7 +52,7 @@ const processBasicFiles = async (currentRuntime: IRuntime, newRuntime: IRuntime)
const fileContent = await fs.readFile(filePath, "utf8")
const newFileContent = file.replace(currentRuntime, newRuntime, fileContent)
await fs.writeFile(filePath, newFileContent, "utf8")
chalk.blue(`Done for ${filePath}`)
console.log(chalk.blue(`Done for ${filePath}`))
}
}

Expand All @@ -65,7 +65,7 @@ export const runtime = async () => {
{
type: "list",
name: "runtime",
message: "What runtime do you want to use?",
message: `What runtime do you want to use? (current: ${currentRuntime.npm})`,
choices: ["node (npm)", "bun"],
},
])
Expand All @@ -74,4 +74,9 @@ export const runtime = async () => {
const newRuntime = res.runtime === "node (npm)" ? { npm: "npm", npx: "npx" } : { npm: "bun", npx: "bunx" }
await processPackageFile(currentRuntime, newRuntime)
await processBasicFiles(currentRuntime, newRuntime)

//? Save the new runtime
projectInfoJson.runtime = newRuntime
await fs.writeFile(path.join(root, "scripts", ".pinfo.json"), JSON.stringify(projectInfoJson, null, 2) + "\n", "utf8")
console.log(chalk.blue(`Done for .pinfo.json`))
}

0 comments on commit 98e2d3f

Please sign in to comment.