Skip to content

feat: Development experience improvements #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/node_modules
.git
.tmp
packages
mise.toml
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
.gradle
build/

node_modules/

# Ignore Gradle GUI config
gradle-app.setting

Expand All @@ -13,6 +15,7 @@ gradle-app.setting
*.war
*.ear
*.class
mise.toml

# eclipse specific git ignore
*.pydevproject
Expand Down Expand Up @@ -48,6 +51,7 @@ ent-*
.DS_Store

#testing while in dev
/packages
/core/
/plugin-interface/
/plugin/
Expand Down Expand Up @@ -168,4 +172,6 @@ fabric.properties
.idea/**/markdown-navigator/
.idea/GitScope.xml

# End of https://www.gitignore.io/api/intellij
# End of https://www.gitignore.io/api/intellij

app.json
17 changes: 0 additions & 17 deletions .gitpod.yml

This file was deleted.

1 change: 1 addition & 0 deletions .idea/.name

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

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Run_All_Tests.xml

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

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Run_Core.xml

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

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Start_Testing_Environment.xml

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

10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Ignore artifacts:
build
coverage
node_modules
packages

.tmp
.gradle
.idea
.vscode
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "always"
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"git.repositoryScanMaxDepth": 3
}
124 changes: 124 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Contributing to SuperTokens

This document provides guidelines and instructions for contributing to the project.

## Project Structure

The project follows a modular structure with clear separation of concerns:

```
supertokens-root/
├── lib/ # Code library
│ ├── validateAppConfig.ts # Configuration validation
│ ├── setupSdkService.ts # SDK service setup
│ ├── runService.ts # Service execution
│ ├── createExampleApp.ts # Example app creation
│ └── types.ts # Type definitions
├── scripts/ # Scripts and utilities
│ ├── common/ # Common scripts
│ │ ├── run.ts # Main execution script
│ │ └── loadModules.ts # Module loading
│ └── core/ # Core-specific scripts
| # This was kept separate in order to preserve compatibility with previous folder structure
├── packages/ # Downloaded packages. This is where work will be done on the desired repositories.
| # These are part of .gitignore and should not be commited.
└── .tmp/ # Temporary files and build artifacts
# Contains:
# - Version information
# - Build outputs for example apps
# - Temporary configuration files
# This directory is git-ignored and should not be committed
```

## Setting Up Your Development Environment

1. **Fork and Clone**
```bash
git clone https://github.com/your-username/supertokens-root.git
cd supertokens-root
```

2. **Install Dependencies**
```bash
npm install
```

3. **Configure Modules**
Edit `modules.txt` to include the modules you want to work with:
```
module-name,branch-name,github-username(optional)
```
Example:
```
core,main
node,main
auth-react,main
```

4. **Load Modules**
```bash
npm run load
```

## Development Workflow

### 1. Creating Feature Branches

Each package should checkout using the same feature branch name, as this is not managed by this repository.

```bash
git checkout -b feat/your-feature-name
```

### 2. Making Changes

- Add tests for new functionality
- Update documentation as needed
- Ensure backward compatibility

### 3. Testing Your Changes

- Define app following the steps from the README.md file

- Define the `start` and `test` scripts

- Run the example app:
```bash
npm start
```
- Run tests:
```bash
npm test
```
- Test with different configurations
- Verify backward compatibility

### 4. Committing Changes

- Follow conventional commit messages
- Make sure to commit each of the packages, using the same branch name

## Documentation

- Update README.md for significant changes
- Add inline documentation for complex logic
- Keep CHANGELOG.md updated


## Adding Support for New Modules

Currently, only a predefined set of modules are supported (see README.md for the list). To add support for additional modules, you'll need to implement the following requirements:

1. **Runtime Version Management**
- Implement version management for the module's runtime environment
- Use appropriate version managers (e.g., nvm for Node.js, pyenv for Python, mise for everything, etc)
- Ensure compatibility with different runtime versions

2. **Package Dependencies**
- Set up linking between related packages

3. **Build and Test Infrastructure**
- Implement necessary build and test scripts
- Configure start scripts for local development
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM debian:12-slim

RUN apt-get update \
&& apt-get install build-essential -y \
&& apt-get -y --no-install-recommends install \
# install any other dependencies you might need
git-core gpg wget curl unzip jq curl ca-certificates build-essential \
&& rm -rf /var/lib/apt/lists/*

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV MISE_DATA_DIR="/mise"
ENV MISE_CONFIG_DIR="/mise"
ENV MISE_CACHE_DIR="/mise/cache"
ENV MISE_INSTALL_PATH="/usr/local/bin/mise"
ENV PATH="/mise/shims:$PATH"
# ENV MISE_VERSION="..."

RUN curl https://mise.run | sh
RUN mise --version
RUN mise use -g node@20

WORKDIR /supertokens-root
COPY ./ .

RUN rm -rf node_modules
RUN rm -rf .git
RUN rm -rf .tmp
RUN rm -rf packages
RUN rm -rf mise.toml
RUN npm install
RUN npm run load

CMD ["npm run start"]
Loading