Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: new-objects/nobj
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: mi-skam/issue3
Choose a base ref
...
head repository: new-objects/nobj
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 17 commits
  • 15 files changed
  • 3 contributors

Commits on Oct 26, 2023

  1. Merge pull request #7 from new-objects/mi-skam/issue3

    Mi-skam/issue3
    mi-skam authored Oct 26, 2023
    Configuration menu
    Copy the full SHA
    5241360 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2023

  1. fixes some names

    mi-skam committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    7416514 View commit details
    Browse the repository at this point in the history
  2. aider: Add test cases for the doesDirectoryExist function in `src/d…

    …ownloadRepo.js` using the Vitest framework.
    
    # Aider chat conversation:
    
    USER: run the test
    
    ASSISTANT: As an AI, I don't have the ability to execute commands on your local machine. However, you can run the test yourself by opening your terminal, navigating to your project directory, and running the following command:
    
    ```bash
    npm test
    ```
    
    This command will run Jest, which will automatically find and run files ending in `.test.js` or `.spec.js`, or files within a `__tests__` directory.
    
    USER:     Details:
    
        /Users/plumps/Development/nobj/cli/src/projectType.test.js:9
        import { projectType } from './projectType';
        ^^^^^^
    
        SyntaxError: Cannot use import statement outside a module
    
          at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)
    
    ASSISTANT: The error message indicates that the import statement is not recognized. This is because Node.js does not support ES6 modules out of the box. However, Jest can be configured to support ES6 modules using Babel.
    
    To fix this issue, you need to install Babel and its Jest plugin, and then configure Babel to compile your code for Jest.
    
    Here are the steps:
    
    1. Install Babel and its Jest plugin:
    
    ```bash
    npm install --save-dev @babel/core @babel/preset-env babel-jest
    ```
    
    2. Create a Babel configuration file named `babel.config.js` in your project root:
    
    ```javascript
    babel.config.js
    <<<<<<< SEARCH
    
    =======
    module.exports = {
      presets: [
        [
          '@babel/preset-env',
          {
            targets: {
              node: 'current',
            },
          },
        ],
      ],
    };
    >>>>>>> REPLACE
    ```
    
    This configuration tells Babel to compile your code for the current version of Node.js.
    
    3. Update your Jest configuration to use Babel. If you don't have a Jest configuration file, create one named `jest.config.js` in your project root:
    
    ```javascript
    jest.config.js
    <<<<<<< SEARCH
    
    =======
    module.exports = {
      transform: {
        '^.+\\.js$': 'babel-jest',
      },
    };
    >>>>>>> REPLACE
    ```
    
    This configuration tells Jest to use Babel to transform your JavaScript files before running the tests.
    
    After making these changes, you should be able to run your tests with `npm test`.
    
    USER: are you aware of vitest
    
    ASSISTANT: Yes, I'm aware of Vite's testing framework, Vitest. Vitest is a fast and lightweight test runner built for Vite. It supports native ES modules, which means you can use `import` and `export` statements without needing to transpile your code with Babel.
    
    If you're using Vite for your project and want to use Vitest for your tests, you can install it as a dev dependency with the following command:
    
    ```bash
    npm install --save-dev vitest
    ```
    
    Then, you can add a test script to your `package.json` file to run Vitest:
    
    ```json
    "scripts": {
      "test": "vitest"
    }
    ```
    
    With this setup, you can run your tests with `npm test`. Vitest will automatically find and run files ending in `.test.js`, `.test.ts`, `.spec.js`, or `.spec.ts`.
    
    USER: let's try the vitest framework with function doesDirectoryExist(directoryPath)
    
    ASSISTANT: Sure, let's create a test file for the `doesDirectoryExist` function in `src/downloadRepo.js`. We'll create a new file named `src/downloadRepo.test.js` and write a test case for the `doesDirectoryExist` function.
    
    ```javascript
    src/downloadRepo.test.js
    <<<<<<< SEARCH
    
    =======
    import { doesDirectoryExist } from './downloadRepo';
    import { promises as fs } from 'fs';
    import path from 'path';
    
    describe('doesDirectoryExist', () => {
      it('should return true if the directory exists', async () => {
        const directoryPath = path.resolve(__dirname);
        const result = await doesDirectoryExist(directoryPath);
        expect(result).toBe(true);
      });
    
      it('should return false if the directory does not exist', async () => {
        const directoryPath = path.resolve(__dirname, 'nonexistent');
        const result = await doesDirectoryExist(directoryPath);
        expect(result).toBe(false);
      });
    });
    >>>>>>> REPLACE
    ```
    
    This test file includes two test cases for the `doesDirectoryExist` function. The first test case checks if the function correctly returns true when the directory exists. The second test case checks if the function correctly returns false when the directory does not exist.
    
    You can run these tests by typing `npm test` in the terminal. Vitest will automatically run files ending in `.test.js` or `.spec.js`.
    mi-skam committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    80cf583 View commit details
    Browse the repository at this point in the history
  3. aider: Import necessary functions from Vitest in downloadRepo.test.js.

    # Aider chat conversation:
    
    USER: you forgot the import ```import { assert, describe, expect, it } from 'vitest'```
    
    ASSISTANT: You're right, I apologize for the oversight. We need to import the necessary functions from Vitest in our test file. Here's the corrected test file:
    
    ```javascript
    src/downloadRepo.test.js
    <<<<<<< SEARCH
    import { doesDirectoryExist } from './downloadRepo';
    import { promises as fs } from 'fs';
    import path from 'path';
    
    describe('doesDirectoryExist', () => {
      it('should return true if the directory exists', async () => {
        const directoryPath = path.resolve(__dirname);
        const result = await doesDirectoryExist(directoryPath);
        expect(result).toBe(true);
      });
    
      it('should return false if the directory does not exist', async () => {
        const directoryPath = path.resolve(__dirname, 'nonexistent');
        const result = await doesDirectoryExist(directoryPath);
        expect(result).toBe(false);
      });
    });
    =======
    import { doesDirectoryExist } from './downloadRepo';
    import { promises as fs } from 'fs';
    import path from 'path';
    import { assert, describe, expect, it } from 'vitest';
    
    describe('doesDirectoryExist', () => {
      it('should return true if the directory exists', async () => {
        const directoryPath = path.resolve(__dirname);
        const result = await doesDirectoryExist(directoryPath);
        expect(result).toBe(true);
      });
    
      it('should return false if the directory does not exist', async () => {
        const directoryPath = path.resolve(__dirname, 'nonexistent');
        const result = await doesDirectoryExist(directoryPath);
        expect(result).toBe(false);
      });
    });
    >>>>>>> REPLACE
    ```
    
    This updated test file now correctly imports the necessary functions from Vitest.
    mi-skam committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    3356f6a View commit details
    Browse the repository at this point in the history
  4. aider: Fix issue with doesDirectoryExist function not being recogni…

    …zed in test file.
    
    # Aider chat conversation:
    
    USER:  DEV  v0.34.6 /Users/plumps/Development/nobj/cli
    
     ❯ src/downloadRepo.test.js (2)
       ❯ doesDirectoryExist (2)
         × should return true if the directory exists
         × should return false if the directory does not exist
    
    ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 2 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
    
     FAIL  src/downloadRepo.test.js > doesDirectoryExist > should return true if the directory exists
    TypeError: doesDirectoryExist is not a function
     ❯ src/downloadRepo.test.js:9:26
          7|   it('should return true if the directory exists', async () => {
          8|     const directoryPath = path.resolve(__dirname);
          9|     const result = await doesDirectoryExist(directoryPath);
           |                          ^
         10|     expect(result).toBe(true);
         11|   });
    
    ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/2]⎯
    
     FAIL  src/downloadRepo.test.js > doesDirectoryExist > should return false if the directory does not exist
    TypeError: doesDirectoryExist is not a function
     ❯ src/downloadRepo.test.js:15:26
         13|   it('should return false if the directory does not exist', async () => {
         14|     const directoryPath = path.resolve(__dirname, 'nonexistent');
         15|     const result = await doesDirectoryExist(directoryPath);
           |                          ^
         16|     expect(result).toBe(false);
         17|   });
    
    ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/2]⎯
    
     Test Files  1 failed (1)
          Tests  2 failed (2)
       Start at  12:09:52
       Duration  197ms (transform 24ms, setup 0ms, collect 32ms, tests 4ms, environment 0ms, prepare 60ms)
    
     FAIL  Tests failed. Watching for file changes...
           press h to show help, press q to quit
    
    ASSISTANT: The error message indicates that the function `doesDirectoryExist` is not being recognized as a function in the test file `src/downloadRepo.test.js`. This is likely because the function is not being exported from the `src/downloadRepo.js` file where it is defined.
    
    To fix this, we need to export the `doesDirectoryExist` function from `src/downloadRepo.js` and then import it in `src/downloadRepo.test.js`.
    
    Here are the changes needed:
    
    ```javascript
    src/downloadRepo.js
    <<<<<<< SEARCH
    async function doesDirectoryExist(directoryPath) {
    =======
    export async function doesDirectoryExist(directoryPath) {
    >>>>>>> REPLACE
      try {
        const stats = await stat(directoryPath);
        return stats.isDirectory();
      } catch (error) {
        if (error.code === 'ENOENT') {
          // The directory does not exist.
          return false;
        }
        throw error; // For other errors, rethrow the error.
      }
    }
    ```
    
    ```javascript
    src/downloadRepo.test.js
    <<<<<<< SEARCH
    import { doesDirectoryExist } from './downloadRepo';
    =======
    import { doesDirectoryExist } from '../src/downloadRepo';
    >>>>>>> REPLACE
    import { promises as fs } from 'fs';
    import path from 'path';
    import { assert, describe, expect, it } from 'vitest';
    
    describe('doesDirectoryExist', () => {
      it('should return true if the directory exists', async () => {
        const directoryPath = path.resolve(__dirname);
        const result = await doesDirectoryExist(directoryPath);
        expect(result).toBe(true);
      });
    
      it('should return false if the directory does not exist', async () => {
        const directoryPath = path.resolve(__dirname, 'nonexistent');
        const result = await doesDirectoryExist(directoryPath);
        expect(result).toBe(false);
      });
    });
    ```
    
    These changes should resolve the issue and allow the tests to run successfully.
    mi-skam committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    9b36be9 View commit details
    Browse the repository at this point in the history

Commits on Nov 1, 2023

  1. Configuration menu
    Copy the full SHA
    a272541 View commit details
    Browse the repository at this point in the history

Commits on Nov 7, 2023

  1. Configuration menu
    Copy the full SHA
    c41f1f5 View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2023

  1. fixing not existing files

    mi-skam committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    54eda60 View commit details
    Browse the repository at this point in the history

Commits on Nov 30, 2023

  1. Showing if a repo is deprecated:

    + better wording
    mi-skam committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    3b76af4 View commit details
    Browse the repository at this point in the history
  2. updating deps

    mi-skam committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    5734f19 View commit details
    Browse the repository at this point in the history

Commits on Jan 20, 2024

  1. Configuration menu
    Copy the full SHA
    aacd391 View commit details
    Browse the repository at this point in the history
  2. Bumping to version 0.0.11

    we added support for new-objects/template-frontend-phaser3-ts
    mi-skam authored Jan 20, 2024
    Configuration menu
    Copy the full SHA
    19570bf View commit details
    Browse the repository at this point in the history
  3. Update templates.js

    mi-skam authored Jan 20, 2024
    Configuration menu
    Copy the full SHA
    faef5d0 View commit details
    Browse the repository at this point in the history
  4. Update package.json

    mi-skam authored Jan 20, 2024
    Configuration menu
    Copy the full SHA
    df3ae70 View commit details
    Browse the repository at this point in the history
  5. Update package.json

    mi-skam authored Jan 20, 2024
    Configuration menu
    Copy the full SHA
    4423b4a View commit details
    Browse the repository at this point in the history

Commits on Mar 28, 2024

  1. Update README.md

    mi-skam authored Mar 28, 2024
    Configuration menu
    Copy the full SHA
    5af8403 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    391c54a View commit details
    Browse the repository at this point in the history
Loading