Create .NET and other projects from NetCoreTemplates GitHub repositories.
npx create-net <repo|ls> [ProjectName]List available templates:
npx create-net ls [org]Create a project:
npx create-net <repo> [ProjectName]If ProjectName is not specified, the script will use the current directory name and extract the template into the current directory (which must be empty).
List all available templates:
npx create-net lsShows all templates from NetCoreTemplates and NetFrameworkTemplates organizations.
List templates from a specific organization:
npx create-net ls NetFrameworkTemplatesCreate a project in a new directory:
npx create-net nextjs MyProjectThis downloads from: https://github.com/NetCoreTemplates/nextjs and creates a MyProject folder.
Create a project in the current directory:
mkdir my-project
cd my-project
npx create-net nextjsThis uses the current directory name (my-project) and extracts the template into the current directory.
Create a project from a different organization:
npx create-net NetFrameworkTemplates/web-netfx MyProjectThis downloads from: https://github.com/NetFrameworkTemplates/web-netfx
- Downloads the GitHub repository archive from the specified repository
- Extracts the archive into a folder named
<ProjectName>(or current directory if no ProjectName specified) - Replaces all variations of
MyAppwith variations of your<ProjectName>(or current directory name):My_App→Your_ProjectMy App→Your Projectmy-app→your-projectmy_app→your_projectmyapp→yourprojectmy.app→your.projectMyApp→YourProject
- Renames files and folders containing
MyAppvariations - Runs
npm installin all directories containingpackage.json
- Node.js >= 14.0.0
Two test scripts are provided to verify the functionality:
Run automated tests that verify all scenarios and clean up afterwards:
./test.shThis tests:
- Creating a project with repo name and ProjectName
- Creating a project with organization/repo and ProjectName
- Creating a project without ProjectName (current directory)
- Error handling for existing directories
- Error handling for non-empty directories
Run manual tests that leave the results for inspection:
./test-manual.shThis creates test projects in test-manual/ for manual verification. Clean up with rm -rf test-manual/ when done.
The package is automatically published to npm with provenance when a new GitHub release is created:
-
Update the version:
npm version patch # for bug fixes (1.0.0 → 1.0.1) npm version minor # for new features (1.0.0 → 1.1.0) npm version major # for breaking changes (1.0.0 → 2.0.0)
-
Push changes and tags:
git push && git push --tags -
Create a GitHub release at https://github.com/ServiceStack/create-net/releases/new
- The GitHub Action will automatically run tests and publish to npm with provenance
Security Features:
- Uses OIDC authentication for secure publishing
- Generates provenance attestations for supply chain security
- Published with
--access publicflag
To publish manually:
npm login
npm publish --access publicNote: You need to configure the NPM_TOKEN secret in GitHub repository settings for automated publishing. See .github/workflows/README.md for details.
MIT