-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add create-rstack package #233
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
Merged
Merged
Changes from all commits
Commits
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
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,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2026 Rstack contributors | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
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,33 @@ | ||
| # create-rstack | ||
|
|
||
| Create a new Rstack project. | ||
|
|
||
| ## Usage | ||
|
|
||
| Using `npm create`: | ||
|
|
||
| ```bash | ||
| npm create rstack@latest | ||
| ``` | ||
|
|
||
| Using CLI flags: | ||
|
|
||
| ```bash | ||
| npx create-rstack --dir my-project --template app-ts | ||
|
|
||
| # Using abbreviations | ||
| npx create-rstack -d my-project -t app-ts | ||
| ``` | ||
|
|
||
| ## Templates | ||
|
|
||
| - `app-js` - JavaScript application | ||
| - `app-ts` - TypeScript application | ||
|
|
||
| ## Documentation | ||
|
|
||
| See the [Rstack documentation](https://rstack.rs). | ||
|
|
||
| ## License | ||
|
|
||
| [MIT](https://github.com/rstackjs/rstack-cli/blob/main/LICENSE). |
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,2 @@ | ||
| #!/usr/bin/env node | ||
| import './dist/index.js'; |
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,52 @@ | ||
| { | ||
| "name": "create-rstack", | ||
| "version": "3.0.0", | ||
| "description": "Create a new Rstack project", | ||
| "homepage": "https://rstack.rs", | ||
| "bugs": { | ||
| "url": "https://github.com/rstackjs/rstack-cli/issues" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/rstackjs/rstack-cli.git", | ||
| "directory": "packages/create-rstack" | ||
| }, | ||
| "license": "MIT", | ||
| "type": "module", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "default": "./dist/index.js" | ||
| } | ||
| }, | ||
| "types": "./dist/index.d.ts", | ||
| "bin": { | ||
| "create-rstack": "./bin.js" | ||
| }, | ||
| "files": [ | ||
| "template-*/**", | ||
| "dist", | ||
| "bin.js" | ||
| ], | ||
| "scripts": { | ||
| "build": "rs lib", | ||
| "dev": "rs lib --watch", | ||
| "start": "node ./dist/index.js", | ||
| "test": "rs test" | ||
| }, | ||
| "dependencies": { | ||
| "@rstackjs/create-toolkit": "catalog:" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "catalog:", | ||
| "rstack": "workspace:*", | ||
| "typescript": "catalog:" | ||
| }, | ||
| "engines": { | ||
| "node": ">=22.12.0" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public", | ||
| "registry": "https://registry.npmjs.org/" | ||
| } | ||
| } |
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 @@ | ||
| // Rstack configuration guide: https://rstack.rs/config | ||
| import { define } from 'rstack'; | ||
|
|
||
| define.lib({ | ||
| syntax: 'es2023', | ||
| }); | ||
|
|
||
| define.test({ | ||
| source: { | ||
| tsconfigPath: './tests/tsconfig.json', | ||
| }, | ||
| }); | ||
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,43 @@ | ||
| import { | ||
| type Argv, | ||
| checkCancel, | ||
| create, | ||
| type ESLintTemplateName, | ||
| type RslintTemplateName, | ||
| select, | ||
| } from '@rstackjs/create-toolkit'; | ||
| import path from 'node:path'; | ||
|
|
||
| const getTemplateName = async ({ template }: Argv): Promise<string> => { | ||
| if (typeof template === 'string') { | ||
| const [type, language = 'js'] = template.split('-'); | ||
| return `${type}-${language}`; | ||
| } | ||
|
|
||
| const language = checkCancel<string>( | ||
| await select({ | ||
| message: 'Select language', | ||
| options: [ | ||
| { value: 'ts', label: 'TypeScript' }, | ||
| { value: 'js', label: 'JavaScript' }, | ||
| ], | ||
| }), | ||
| ); | ||
|
|
||
| return `app-${language}`; | ||
| }; | ||
|
|
||
| const mapESLintTemplate = (templateName: string): ESLintTemplateName => | ||
| templateName.endsWith('-ts') ? 'vanilla-ts' : 'vanilla-js'; | ||
|
|
||
| const mapRslintTemplate = (templateName: string): RslintTemplateName => | ||
| templateName.endsWith('-ts') ? 'vanilla-ts' : 'vanilla-js'; | ||
|
|
||
| await create({ | ||
| root: path.join(import.meta.dirname, '..'), | ||
| name: 'rstack', | ||
| templates: ['app-js', 'app-ts'], | ||
| getTemplateName, | ||
| mapESLintTemplate, | ||
| mapRslintTemplate, | ||
| }); |
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,14 @@ | ||
| { | ||
| "name": "rstack-app-js", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "build": "rs build", | ||
| "dev": "rs dev --open", | ||
| "preview": "rs preview" | ||
| }, | ||
| "devDependencies": { | ||
| "rstack": "^0.3.5" | ||
| } | ||
| } |
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,5 @@ | ||
| // @ts-check | ||
| // Rstack configuration guide: https://rstack.rs/config | ||
| import { define } from 'rstack'; | ||
|
|
||
| define.app({}); |
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,26 @@ | ||
| body { | ||
| margin: 0; | ||
| color: #fff; | ||
| font-family: Inter, Avenir, Helvetica, Arial, sans-serif; | ||
| background-image: linear-gradient(to bottom, #020917, #101725); | ||
| } | ||
|
|
||
| .content { | ||
| display: flex; | ||
| min-height: 100vh; | ||
| line-height: 1.1; | ||
| text-align: center; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| } | ||
|
|
||
| .content h1 { | ||
| font-size: 3.6rem; | ||
| font-weight: 700; | ||
| } | ||
|
|
||
| .content p { | ||
| font-size: 1.2rem; | ||
| font-weight: 400; | ||
| opacity: 0.5; | ||
| } |
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 @@ | ||
| import './index.css'; | ||
|
|
||
| const rootElement = document.querySelector('#root'); | ||
|
|
||
| if (rootElement) { | ||
| rootElement.innerHTML = ` | ||
| <main class="content"> | ||
| <h1>Rstack</h1> | ||
| <p>Start building amazing things with Rstack.</p> | ||
| </main> | ||
| `; | ||
| } |
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,16 @@ | ||
| { | ||
| "name": "rstack-app-ts", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "build": "rs build", | ||
| "dev": "rs dev --open", | ||
| "preview": "rs preview" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^24.13.3", | ||
| "rstack": "^0.3.5", | ||
| "typescript": "^7.0.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,4 @@ | ||
| // Rstack configuration guide: https://rstack.rs/config | ||
| import { define } from 'rstack'; | ||
|
|
||
| define.app({}); |
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,26 @@ | ||
| body { | ||
| margin: 0; | ||
| color: #fff; | ||
| font-family: Inter, Avenir, Helvetica, Arial, sans-serif; | ||
| background-image: linear-gradient(to bottom, #020917, #101725); | ||
| } | ||
|
|
||
| .content { | ||
| display: flex; | ||
| min-height: 100vh; | ||
| line-height: 1.1; | ||
| text-align: center; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| } | ||
|
|
||
| .content h1 { | ||
| font-size: 3.6rem; | ||
| font-weight: 700; | ||
| } | ||
|
|
||
| .content p { | ||
| font-size: 1.2rem; | ||
| font-weight: 400; | ||
| opacity: 0.5; | ||
| } |
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 @@ | ||
| import './index.css'; | ||
|
|
||
| const rootElement = document.querySelector('#root'); | ||
|
|
||
| if (rootElement) { | ||
| rootElement.innerHTML = ` | ||
| <main class="content"> | ||
| <h1>Rstack</h1> | ||
| <p>Start building amazing things with Rstack.</p> | ||
| </main> | ||
| `; | ||
| } |
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,22 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "lib": ["DOM", "ES2020"], | ||
| "target": "ES2020", | ||
| "noEmit": true, | ||
| "skipLibCheck": true, | ||
| "types": ["rstack/types", "node"], | ||
| "useDefineForClassFields": true, | ||
|
|
||
| /* modules */ | ||
| "moduleDetection": "force", | ||
| "moduleResolution": "bundler", | ||
| "verbatimModuleSyntax": true, | ||
| "resolveJsonModule": true, | ||
| "allowImportingTsExtensions": true, | ||
|
|
||
| /* type checking */ | ||
| "noUnusedLocals": true, | ||
| "noUnusedParameters": true | ||
| }, | ||
| "include": ["src"] | ||
| } |
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,15 @@ | ||
| # AGENTS.md | ||
|
|
||
| You are an expert in JavaScript, Rstack, and web application development. You write maintainable, performant, and accessible code. | ||
|
|
||
| ## Commands | ||
|
|
||
| - `{{ packageManager }} run dev` - Start the development server | ||
| - `{{ packageManager }} run build` - Build the app for production | ||
| - `{{ packageManager }} run preview` - Preview the production build locally | ||
|
|
||
| ## Docs | ||
|
|
||
| - Rstack: https://rstack.rs/llms.txt | ||
| - Rsbuild: https://rsbuild.rs/llms.txt | ||
| - Rspack: https://rspack.rs/llms.txt |
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,34 @@ | ||
| # Rstack project | ||
|
|
||
| ## Setup | ||
|
|
||
| Install the dependencies: | ||
|
|
||
| ```bash | ||
| {{ packageManager }} install | ||
| ``` | ||
|
|
||
| ## Get started | ||
|
|
||
| Start the development server: | ||
|
|
||
| ```bash | ||
| {{ packageManager }} run dev | ||
| ``` | ||
|
|
||
| Build the app for production: | ||
|
|
||
| ```bash | ||
| {{ packageManager }} run build | ||
| ``` | ||
|
|
||
| Preview the production build locally: | ||
|
|
||
| ```bash | ||
| {{ packageManager }} run preview | ||
| ``` | ||
|
|
||
| ## Learn more | ||
|
|
||
| - [Rstack documentation](https://rstack.rs) | ||
| - [Rstack GitHub repository](https://github.com/rstackjs/rstack-cli) |
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,13 @@ | ||
| # Local | ||
| .DS_Store | ||
| *.local | ||
| *.log* | ||
|
|
||
| # Dist | ||
| node_modules | ||
| dist/ | ||
|
|
||
| # IDE | ||
| .vscode/* | ||
| !.vscode/extensions.json | ||
| .idea |
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.