-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: add create-spacetime CLI tool #3251
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
Closed
Closed
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
461e353
feat: create-spacetime command and package
clockwork-tien 6477062
feat(create-spacetime): general improvements and refactor
clockwork-tien 17b926e
feat(create-spacetime): deployment config improvements, code refactor
clockwork-tien b41dbb1
Merge branch 'master' of https://github.com/clockworklabs/SpacetimeDB…
clockwork-tien c562563
feat(create-spacetime): custom template option, move to cli folder, u…
clockwork-tien e9bb472
Merge branch 'master' of https://github.com/clockworklabs/SpacetimeDB…
clockwork-tien 8f7aa3a
feat(create-spacetime): update to use root eslint.config.js
clockwork-tien 7949bea
Update cli/create-spacetime/src/constants.ts
clockwork-tien 818f964
feat(create-spacetime): move to npm-packages folder, updates to use s…
clockwork-tien 8c8bc38
chore(create-spacetime): update SPACETIME_VERSIONS var namings
clockwork-tien File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "env": { | ||
| "node": true, | ||
| "es2022": true | ||
| }, | ||
| "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], | ||
| "parser": "@typescript-eslint/parser", | ||
| "parserOptions": { | ||
| "ecmaVersion": "latest", | ||
| "sourceType": "module" | ||
| }, | ||
| "plugins": ["@typescript-eslint"], | ||
| "rules": { | ||
| "@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }], | ||
| "@typescript-eslint/no-explicit-any": "off", | ||
| "no-console": "off" | ||
| }, | ||
| "ignorePatterns": ["dist/", "node_modules/", "spacetime-*/"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| node_modules/ | ||
| dist/ | ||
| *.log | ||
|
|
||
| .env* | ||
|
|
||
| .DS_Store | ||
| *.tgz | ||
| *.tsbuildinfo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| src/ | ||
| *.ts | ||
| !*.d.ts | ||
|
|
||
| # config files | ||
| .eslintrc* | ||
| .prettierrc* | ||
| tsconfig*.json | ||
| .gitignore | ||
|
|
||
| *.log | ||
| *.tsbuildinfo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "semi": true, | ||
| "singleQuote": false, | ||
| "printWidth": 100, | ||
| "tabWidth": 2 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # create-spacetime | ||
|
|
||
| ## Overview | ||
|
|
||
| This package contains the official CLI tool for creating SpacetimeDB projects. The CLI allows you to quickly scaffold new SpacetimeDB applications with a template of your choice (React frontends with Rust or C# backends). | ||
|
|
||
| ## Installation | ||
|
|
||
| To create a new SpacetimeDB project: | ||
|
|
||
| ```bash | ||
| npm create spacetime@latest | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| To create a project you can run the interactive setup or specify options directly. | ||
|
|
||
| ```bash | ||
| npm create spacetime@latest my-spacetime-app -- -t rust | ||
| ``` | ||
|
|
||
| Skip interactive prompts with `-y` (defaults server language to Rust): | ||
|
|
||
| ```bash | ||
| npm create spacetime@latest my-spacetime-app -- -y | ||
| ``` | ||
|
|
||
| The `-t` flag selects your server language template. | ||
|
|
||
| Available templates: | ||
|
|
||
| - `rust` - Rust server with React client | ||
| - `csharp` - C# server with React client | ||
|
|
||
| Create in your current directory using `.` as the project name: | ||
|
|
||
| ```sh | ||
| npm create spacetime@latest . | ||
| ``` | ||
|
|
||
| Use a local SpacetimeDB server instead of Maincloud: | ||
|
|
||
| ```bash | ||
| npm create spacetime@latest my-spacetime-app -- --local | ||
| ``` | ||
|
|
||
| ## What You Get | ||
|
|
||
| Creates a full-stack SpacetimeDB app with server module and React frontend, including build scripts and example chat app. | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Node.js 18+ and npm 8+ | ||
| - SpacetimeDB CLI (optional for creation, required for Maincloud deployment) - [spacetimedb.com/install](https://spacetimedb.com/install) | ||
|
|
||
| ## Running The Project | ||
|
|
||
| After project creation: | ||
|
|
||
| ```bash | ||
| cd my-spacetime-app | ||
| npm run dev | ||
| ``` | ||
|
|
||
| Your React app will be available at `http://localhost:5173`. | ||
|
|
||
| To deploy your SpacetimeDB module: | ||
|
|
||
| ```bash | ||
| npm run local # Local deployment | ||
| npm run deploy # Deploy to Maincloud | ||
| ``` | ||
|
|
||
| ## Learn More | ||
|
|
||
| - [SpacetimeDB Documentation](https://spacetimedb.com/docs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| { | ||
| "name": "create-spacetime", | ||
| "version": "0.0.4", | ||
| "type": "module", | ||
| "author": { | ||
| "name": "Clockwork Labs", | ||
| "email": "no-reply@clockworklabs.io" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/clockworklabs/SpacetimeDB.git", | ||
| "directory": "templates/create-spacetime" | ||
| }, | ||
| "engines": { | ||
| "node": ">=18.0.0", | ||
| "npm": ">=8.0.0" | ||
| }, | ||
| "bin": { | ||
| "create-spacetime": "./dist/index.js" | ||
| }, | ||
| "files": [ | ||
| "dist/**/*" | ||
| ], | ||
| "scripts": { | ||
| "build": "tsc", | ||
| "dev": "tsc --watch", | ||
| "clean": "rm -rf dist", | ||
| "lint": "eslint src --ext .ts", | ||
| "lint:fix": "eslint src --ext .ts --fix", | ||
| "format": "prettier --write src/**/*.ts src/*.ts", | ||
| "format:check": "prettier --check src/**/*.ts", | ||
| "prepare": "npm run build", | ||
| "prepublishOnly": "npm run clean && npm run lint && npm run format:check && npm run build", | ||
| "size-check": "npm pack --dry-run", | ||
| "test": "npm run build && node dist/index.js test-app --dry-run" | ||
| }, | ||
| "dependencies": { | ||
| "chalk": "^5.3.2", | ||
| "commander": "^12.0.0", | ||
| "cross-spawn": "^7.0.3", | ||
| "degit": "^2.8.4", | ||
| "fs-extra": "^11.2.0", | ||
| "inquirer": "^9.2.15", | ||
| "ora": "^8.0.1", | ||
| "validate-npm-package-name": "^5.0.0", | ||
| "which": "^4.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/cross-spawn": "^6.0.6", | ||
| "@types/degit": "^2.8.6", | ||
| "@types/fs-extra": "^11.0.4", | ||
| "@types/inquirer": "^9.0.7", | ||
| "@types/node": "^20.11.24", | ||
| "@types/validate-npm-package-name": "^4.0.2", | ||
| "@types/which": "^3.0.3", | ||
| "@typescript-eslint/eslint-plugin": "^7.18.0", | ||
| "@typescript-eslint/parser": "^7.18.0", | ||
| "eslint": "^8.57.0", | ||
| "prettier": "^3.2.5", | ||
| "typescript": "^5.5.4" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.