{"id":22758847,"url":"https://github.com/robertcorponoi/pixi-library-template","last_synced_at":"2025-03-30T08:26:03.001Z","repository":{"id":265572092,"uuid":"621406901","full_name":"robertcorponoi/pixi-library-template","owner":"robertcorponoi","description":"A template for creating a library to be used in a Pixi application.","archived":false,"fork":false,"pushed_at":"2023-07-04T06:46:56.000Z","size":378,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T11:06:03.911Z","etag":null,"topics":["jest","library","pixijs","rollup","template","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robertcorponoi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-30T15:44:01.000Z","updated_at":"2023-09-13T12:57:33.000Z","dependencies_parsed_at":"2024-11-30T00:29:45.289Z","dependency_job_id":"fd3f79bf-b91d-41a8-bc3f-9415cd66300b","html_url":"https://github.com/robertcorponoi/pixi-library-template","commit_stats":null,"previous_names":["robertcorponoi/pixi-library-template"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertcorponoi%2Fpixi-library-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertcorponoi%2Fpixi-library-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertcorponoi%2Fpixi-library-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertcorponoi%2Fpixi-library-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertcorponoi","download_url":"https://codeload.github.com/robertcorponoi/pixi-library-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246293145,"owners_count":20754190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jest","library","pixijs","rollup","template","typescript"],"created_at":"2024-12-11T08:16:15.089Z","updated_at":"2025-03-30T08:26:02.973Z","avatar_url":"https://github.com/robertcorponoi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# **Pixi Library Template**\n\nA template for creating a library to be used in a Pixi application.\n\n\u003c/div\u003e\n\n## **Tools**\n\nThe following tools are used to build the library and improve the development experience.\n\n-   [Rollup](https://github.com/rollup/rollup) used to bundle the library.\n-   [Typescript](https://github.com/microsoft/TypeScript) for type safety and a better development experience.\n-   [ESLint](https://github.com/eslint/eslint) to find common issues in the code.\n-   [Prettier](https://github.com/prettier/prettier) to enforce a consistent code style.\n-   [Jest](https://github.com/facebook/jest) running tests and using fake timers to simulate game time passing.\n-   [Testing Library](https://github.com/testing-library) to test user input.\n\n## **Visual Studio Code Extensions**\n\nThe following extensions for code formatting and linting should be recommended to you if you open the project in Visual Studio Code:\n\n-   [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)\n-   [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)\n\n## **Concepts**\n\nThe following are concepts used throughout the library. This documentation is a work in progress so check back regularly for updates or post an issue for a concept that you think is missing documentation.\n\n### **Bundling**\n\n[Rollup](https://github.com/rollup/rollup) is used to create the bundle that is imported by Pixi applications using the library.\n\nThe [rollup.config.js](./rollup.config.js) determines how the bundle is created. In the config we tell Rollup that we want to create an `esm` bundle, with Typescript source, that outputs to a `dist` directory at the top level.\n\nTo create the bundle you can use either `npm run build` or `npm run build:watch`. The watch version is helpful in development as it watches for changes to the source and runs the build again when changes are detected.\n\n**Note:** The `dist` directory is ignored in the `.gitignore`. This is because we don't need to commit this since it'll be created automatically when a user installs your package due to the `prepare` script in the [package.json](./package.json) file.\n\n### **Testing**\n\nTests are located in the [test](./test/) directory. Tests can be run from the command line without a browser since we use [jest-environment-jsdom](https://github.com/facebook/jest/tree/main/packages/jest-environment-jsdom).\n\nThere are several parts to how testing works:\n\n-   The [testing-library](https://github.com/testing-library) package is used to simulate key and mouse events. If you don't need this feel free to uninstall it.\n\n-   We use [Jest](https://github.com/facebook/jest) to run the tests but also for fake timers. You'll notice in the `beforeEach` and `afterEach` sections, that we set up the Jest fake timers and then restore the real timers in between every test. There's also a note about an [issue](https://github.com/testing-library/react-hooks-testing-library/issues/631#issuecomment-1196616173) with the fake timers and testing-library but I'll follow the issue and update the tests as needed.\n\n-   The jest environment we use is [jest-environment-jsdom](https://github.com/facebook/jest/tree/main/packages/jest-environment-jsdom) which lets us simulate a browser-like environment without having to run the tests in a browser.\n\n-   The [jest-canvas-mock package](https://github.com/hustcc/jest-canvas-mock) is used so that the Pixi can be used in the tests.\n\n-   We use the [pixi.js-legacy](https://www.npmjs.com/package/pixi.js-legacy) package instead of [pixi.js](https://github.com/pixijs/pixijs) because the test environment doesn't support everything needed by `pixi.js`. This shouldn't be an issue since it has the same functionality as `pixi.js`.\n\nThe tests can be run with `npm run test`.\n\n## **Scripts**\n\nThe following scripts are available and can be used in the form of `npm run [script_name]`:\n\n-   `build` - Creates the Rollup bundle for the library.\n-   `build:watch` - Creates the Rollup bundle for the library and watches for changes to source, re-running the build whenever changes are made.\n-   `test` - Runs the tests.\n\n## **GitHub Actions**\n\nThe workflow at [.github/workflows/build-and-test.yml](./.github/workflows/build-and-test.yml) will run whenever a pull request is made.\n\nThis action will install the dependencies, create the build, and then run the tests.\n\n## **Dependabot**\n\nThis template uses [Dependabot](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates) to create pull requests for dependencies that are out of date. The configuration file can be found at [.github/dependabot.yml](./.github/dependabot.yml).\n\n## **Keeping Up To Date With Template Changes**\n\nThis template will be updated when dependencies need updating, new packages are added, and new or better concepts are found. To keep up with changes you might want from the template:\n\n1. Add the template repository as a remote:\n\n```sh\ngit remote add template git@github.com:robertcorponoi/react-template.git\n```\n\n2. Fetch the changes:\n\n```sh\ngit fetch --all\n```\n\n3. Merge the changes from the main branch of the template repository:\n\n```sh\ngit merge template/main\n```\n\n## **License**\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertcorponoi%2Fpixi-library-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertcorponoi%2Fpixi-library-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertcorponoi%2Fpixi-library-template/lists"}