Skip to content

Commit

Permalink
Merge pull request #328 from pyxelpioneer/master
Browse files Browse the repository at this point in the history
feat: Github Codespaces Plugin
  • Loading branch information
overbit authored Apr 15, 2024
2 parents 6546d71 + ba8dcfe commit f9cb44b
Show file tree
Hide file tree
Showing 20 changed files with 691 additions and 0 deletions.
153 changes: 153 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions plugins/devcontainer-github-codespaces/.amplicationrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"settings": {
"includeAdminUI": false,
"customLocation": null,
"generateBasedOnServiceName": false
},
"systemSettings": {
"requireAuthenticationEntity": "false"
}
}
4 changes: 4 additions & 0 deletions plugins/devcontainer-github-codespaces/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"]
}
2 changes: 2 additions & 0 deletions plugins/devcontainer-github-codespaces/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.prettierignore
.gitignore
1 change: 1 addition & 0 deletions plugins/devcontainer-github-codespaces/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
53 changes: 53 additions & 0 deletions plugins/devcontainer-github-codespaces/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# @amplication/plugin-devcontainer-github-codespaces

[![NPM Downloads](https://img.shields.io/npm/dt/@amplication/plugin-devcontainer-github-codespaces)](https://www.npmjs.com/package/@amplication/plugin-devcontainer-github-codespaces)

Quickly generates the configuration that you require to setup devcontainer for your Amplication App

## Purpose
This plugin serves the purpose of generating devcontainer based on your configuration for your Amplication app


## Usage

1. To install the plugin:
- Enable the plugin in the Amplication dashboard
- Configure the plugin according to your needs
- Commit changes and build!

2. To use the plugin
- Head over to https://github.com/codespaces/new to create a new codespace

![Create new codespace](./assets/codespaces_before.png)

- In repository, select the repository that you pushed your Amplication code to.
In branch, select the branch that your pushed your Amplication code to.
In Dev container configuration, choose the configuration with the name of your Amplication app.
In region, select the region that is nearest to you.
In machine type, select the specs for the codespace that you want to use

![Configure codespace](./assets/codespaces_after.png)

- Lastly, click on the Create Codespace to create your codespace and start developing!


## Configuration

This plugins allows you to customize the devcontainer config based:

- includeAdminUI (boolean): Start Admin UI alongside the server
- customLocation (string | null): Allows generating config as a specific directory.
- generateBasedOnServiceName (string): Generates the config based on the service name, i.e., at `<root>/.devcontainer/<service-name>/devcontainer.json`

>[!WARNING]
>If `customLocation` is not null and the `generateBasedOnServiceName` is true, then the latter will be ignored and the config will be generated in the custom location provided
## Scripts

### `build`

Running `npm run build` will bundle your plugin with Webpack for production.

### `dev`

Running `npm run dev` will watch your plugin's source code and automatically bundle it with every change.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions plugins/devcontainer-github-codespaces/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "@amplication/plugin-devcontainer-github-codespaces",
"version": "1.0.0",
"description": "Quickly setup your GitHub codespaces configuration for your Amplication app",
"main": "dist/index.js",
"nx": {},
"scripts": {
"prepublishOnly": "npm run build",
"dev": "webpack --watch",
"build": "webpack",
"prebuild": "rimraf dist",
"test": "jest"
},
"author": "pyxelpioneer",
"license": "Apache-2.0",
"dependencies": {
"@amplication/code-gen-types": "^2.0.19",
"@amplication/code-gen-utils": "^0.0.7",
"lodash": "^4.17.21"
},
"devDependencies": {
"@babel/parser": "^7.23.3",
"@babel/types": "^7.23.3",
"@types/jest": "^29.5.8",
"@types/lodash": "^4.14.201",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"copy-webpack-plugin": "^11.0.0",
"eslint": "^8.53.0",
"jest-mock-extended": "^3.0.5",
"prettier": "^3.1.0",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.1",
"ts-loader": "^9.5.1",
"typescript": "^5.2.2",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
},
"jest": {
"passWithNoTests": true,
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src/tests",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"testEnvironment": "node"
}
}
5 changes: 5 additions & 0 deletions plugins/devcontainer-github-codespaces/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"targets": {
"lint": {}
}
}
Loading

0 comments on commit f9cb44b

Please sign in to comment.