Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
Fixed could not create file error
Browse files Browse the repository at this point in the history
- **OS File Name Error Fixed**: When creating the workspace file the name can not contain slashes, it was replaced with a plus
  • Loading branch information
burgil committed Oct 21, 2024
1 parent b78dd9c commit 400fb73
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Changelog

### Version 1.8.3 - Fixed could not create file error

- **OS File Name Error Fixed**: When creating the workspace file the name can not contain slashes, it was replaced with a plus

### Version 1.8.2 - Deno is officially supported

- **Deno is supported**: Deno support for newly created projects now works smoothly even with nodemon and the hotreload
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Supe Project Creator v1.8.2
# Supe Project Creator v1.8.3

A simple tool for creating simple web projects with batteries included.

Expand Down Expand Up @@ -70,7 +70,7 @@ To start using Supe Project Creator, simply run the following command:
### Create a Clean Project in the Current Working Directory:

```bash
deno jsr:@supeprojects/[email protected].2 -n @example/my-supe-project --runtime deno
deno jsr:@supeprojects/[email protected].3 -n @example/my-supe-project --runtime deno
```

```bash
Expand All @@ -80,7 +80,7 @@ cd my-supe-project
### Create an AI Demo Project in the Current Working Directory:

```bash
deno jsr:@supeprojects/[email protected].2 --demo -n @example/cat-dog-detector -r deno
deno jsr:@supeprojects/[email protected].3 --demo -n @example/cat-dog-detector -r deno
```

```bash
Expand Down Expand Up @@ -134,7 +134,7 @@ This behavior is, of course, configurable in `hotreload/config.ts`, allowing you
To view the available options for Supe Project Creator, run the following command:

```bash
deno jsr:@supeprojects/[email protected].2 --help
deno jsr:@supeprojects/[email protected].3 --help
```

- `-h`, `--help`: Displays help information.
Expand Down Expand Up @@ -180,7 +180,7 @@ Utilizing SPC programmatically allows you to:
#### Programmatic Use Example

```ts
import SPC from 'jsr:@supeprojects/[email protected].2';
import SPC from 'jsr:@supeprojects/[email protected].3';

console.log("Testing SPC programmatically...");

Expand Down Expand Up @@ -212,7 +212,7 @@ With these commands, you can easily set up and utilize the Supe Project Creator
To add the `Supe Project Creator` package in Deno, you can import it directly without any installation if you use the `jsr:` prefix in your import:

```ts
import * as SPC from "jsr:@supeprojects/[email protected].2";
import * as SPC from "jsr:@supeprojects/[email protected].3";

// Example usage
console.log("Testing SPC in Deno...");
Expand All @@ -222,7 +222,7 @@ SPC([]); // Shows the help menu
Alternatively, if you prefer to add it, use the following command:

```bash
deno add jsr:@supeprojects/[email protected].2
deno add jsr:@supeprojects/[email protected].3
```

Then, you can import it like this:
Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@supeprojects/supe-project-creator",
"version": "1.8.2",
"version": "1.8.3",
"license": "MIT",
"exports": "./index.ts",
"tasks": {
Expand Down
19 changes: 12 additions & 7 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function SupeProjectCreator(argv: string[]): void {
// Variables:
let CleanProject = true;
let projectName = '';
const supeVersion = '1.8.2';
const supeVersion = '1.8.3';
const supeVersionDate = '2024-10-16';
let runtime: 'deno' | 'bun' | 'node' | 'none' = 'none';
if (argv.length === 0) argv.push('--help');
Expand Down Expand Up @@ -112,10 +112,15 @@ export default function SupeProjectCreator(argv: string[]): void {
}

const outDir = projectName.replaceAll('/', '+');
if (!fs.existsSync(outDir)) {
fs.mkdirSync(outDir);
} else {
console.error(`Error: Folder already exist ${outDir}`);
try {
if (!fs.existsSync(outDir)) {
fs.mkdirSync(outDir);
} else {
console.error(`Error: Folder already exist ${outDir}`);
process.exit(1);
}
} catch (_e) {
console.error(`Error: Could not create folder: ${outDir}`);
process.exit(1);
}
const hotreloadDir = join(outDir, 'hotreload');
Expand Down Expand Up @@ -244,7 +249,7 @@ You have full control over all the source files of almost everything you see, Th
}
`);

fs.writeFileSync(join(outDir, `${projectName}.code-workspace`), `{
fs.writeFileSync(join(outDir, `${outDir}.code-workspace`), `{
"folders": [
{
"name": "▪${projectName}◾", // Yang and Yin. With great power comes great responsibility. wield your creation for the greater good, and never let it be used to harm or exploit others.
Expand All @@ -254,7 +259,7 @@ You have full control over all the source files of almost everything you see, Th
"settings": {
"files.exclude": {
"${packageJSON}": false,
"${projectName}.code-workspace": false,${runtime !== 'deno' ? '\n\t\t\t"tsconfig.json": false,' : ''}
"${outDir}.code-workspace": false,${runtime !== 'deno' ? '\n\t\t\t"tsconfig.json": false,' : ''}
// --
"README.md": true,
${runtime === 'bun' ? '"bun.lockb": true,' : ''}${runtime === 'deno' ? '"deno.lock": true,' : ''}${runtime === 'node' ? '"package-lock.json": true,' : ''}
Expand Down
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@supeprojects/supe-project-creator",
"version": "1.8.2",
"version": "1.8.3",
"exports": "./index.ts",
"license": "MIT"
}

0 comments on commit 400fb73

Please sign in to comment.