Skip to content

Commit

Permalink
convert to @webxdc/create-vite-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed Dec 23, 2024
1 parent 417f2d6 commit 8844669
Show file tree
Hide file tree
Showing 25 changed files with 694 additions and 87 deletions.
35 changes: 16 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
name: CI

on:
pull_request:
branches:
- master
- main
push:
branches:
- master
- main
- master
tags:
- "v*.*.*"
pull_request:
branches:
- main
- master

jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: "https://registry.npmjs.org"
- run: npm install -g pnpm
- run: pnpm i
- run: pnpm install
- run: pnpm check
- run: pnpm build

- name: Release
uses: softprops/action-gh-release@v2
- name: Publish package to NPM
if: startsWith(github.ref, 'refs/tags/v')
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
Auto-generated release
prerelease: ${{ contains(github.event.ref, '-beta') }}
fail_on_unmatched_files: true
files: ./dist-xdc/*.xdc
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ pnpm-debug.log*
.pnpm-debug.log

node_modules
dist
dist-xdc

# Editor directories and files
.vscode/*
Expand Down
2 changes: 0 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
dist
dist-xdc
pnpm-lock.yaml
79 changes: 28 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,49 @@
# WebXDC Vite Template [![CI](https://github.com/webxdc/webxdc-vite/actions/workflows/ci.yml/badge.svg)](https://github.com/webxdc/webxdc-vite/actions/workflows/ci.yml) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
# Webxdc Vite Template

A minimalist Vite project template for [WebXDC](https://webxdc.org) development.
[![npm package](https://img.shields.io/npm/v/@webxdc/create-vite-plugins.svg)](https://npmjs.com/package/@webxdc/create-vite-plugins)
[![CI](https://github.com/webxdc/create-vite-plugins/actions/workflows/ci.yml/badge.svg)](https://github.com/webxdc/create-vite-plugins/actions/workflows/ci.yml)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

## Features
Vite project template scaffolding for [Webxdc](https://webxdc.org) development.

- ⚡️ Fast development with [Vite](https://github.com/vitejs/vite) and [pnpm](https://pnpm.js.org/)
## Scaffolding Your First Vite Project

- 📱 Integrated [WebXDC emulator](https://github.com/webxdc/webxdc-dev) to test your WebXDC right on the browser while developing,
and [Eruda](https://github.com/liriliri/eruda) to debug inside Delta Chat.
With NPM:

- 📝 Code formatting with [Prettier](https://github.com/prettier/prettier)

- 📦 Automatically minify, build and release your `.xdc` file

- 🦕 Automatically support legacy/old browsers

## Usage

### Installing Dependencies

After cloning this repo, install dependecies:

```
pnpm i
```bash
$ npm create @webxdc/vite-plugins@latest
```

### Checking code format
With PNPM:

```bash
$ pnpm create @webxdc/vite-plugins
```
pnpm check
```

### Testing the app in the browser

To test your work in your browser (with hot reloading!) while developing:
With Yarn:

```
pnpm start
# Alternatively to test in a more advanced WebXDC emulator:
pnpm emulator
```bash
$ yarn create @webxdc/vite-plugins
```

### Building
Then follow the prompts!

To package the WebXDC file:
You can also directly specify the project name and the template you want to use via additional command line options. For example, to scaffold a Webxdc + TypeScript project, run:

```
pnpm build
```
```bash
# npm 7+, extra double-dash is needed:
npm create @webxdc/vite-plugins@latest my-app -- --template vanilla-ts

To package the WebXDC with developer tools inside to debug in Delta Chat, set the `NODE_ENV`
environment variable to "debug":
# pnpm
pnpm create @webxdc/vite-plugins my-app --template vanilla-ts

# yarn
yarn create @webxdc/vite-plugins my-app --template vanilla-ts
```
NODE_ENV=debug pnpm build
```

The resulting optimized `.xdc` file is saved in `dist-xdc/` folder.

### Releasing

To automatically build and create a new GitHub release with the `.xdc` file:

```
git tag -a v1.0.1
git push origin v1.0.1
```
Currently supported template presets include:

## Try it now!
- `vanilla`
- `vanilla-ts`

[**Create a repo from this template on GitHub**](https://github.com/webxdc/webxdc-vite/generate).
You can use `.` for the project name to scaffold in the current directory.
Loading

0 comments on commit 8844669

Please sign in to comment.