Skip to content

Commit

Permalink
feat: playground
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Nov 7, 2022
1 parent ffa2067 commit e36ac70
Show file tree
Hide file tree
Showing 27 changed files with 3,309 additions and 247 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"extends": "@minko-fe/eslint-config"
"extends": "@minko-fe/eslint-config",
"overrides": [
{
"files": ["**/*.md/*.*"],
"rules": {
"no-restricted-syntax": "off"
}
}
]
}
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Npm Publish

on:
push:
branches:
- master

jobs:
publish-npm:
if: "contains(github.event.head_commit.message, 'release')"
runs-on: ${{matrix.os}}

strategy:
matrix:
os: [ubuntu-latest]
node-version: [16.x]
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install pnpm
uses: pnpm/action-setup@v2.0.1
with:
version: 6.31.0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
cache: 'pnpm'

- name: Install Dependencies
run: pnpm install

- name: Publish to NPM
run: pnpm -r publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Create Release

on:
push:
tags:
- v*

jobs:
build:
name: Create Release
runs-on: ${{matrix.os}}

strategy:
matrix:
os: [ubuntu-latest]
fail-fast: false

steps:
- name: Checkout code
uses: actions/checkout@master

- name: Create Release for Tag
id: release_tag
uses: yyx990803/release-tag@master
env:
GITHUB_TOKEN: ${{ secrets.OPER_TOKEN }}
with:
tag_name: ${{ github.ref }}
body: |
Please refer to [CHANGELOG.md](https://github.com/hemengke1997/vite-plugin-public-typescript/blob/master/CHANGELOG.md) for details.
9 changes: 8 additions & 1 deletion .github/workflows/main.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: ✅ test

on: [push, pull_request]
on:
push:
branches:
- master

pull_request:
branched:
-main

jobs:
test:
Expand Down
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
# vite-plugin-public-typescript

a template for typescript project or plugin
## Feature

- transform public typescript to public javascript
- output js with hash

## Install

```bash
pnpm add vite-plugin-public-typescript -D
```

or

```bash
npm i vite-plugin-public-typescript -D
```

## Usage

```ts
import { defineConfig } from 'vite'
import { publicTypescript } from 'vite-plugin-public-typescript'

export default defineConfig({
plugins: [
publicTypescript({
inputDir: 'publicTypescript',
outputDir: 'lib',
manifestName: 'manifest',
hash: true,
}),
],
})
```
24 changes: 24 additions & 0 deletions playground/vite-project/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
14 changes: 14 additions & 0 deletions playground/vite-project/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + TS</title>
<!--app-head-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/entry-client.ts"></script>
</body>
</html>
26 changes: 26 additions & 0 deletions playground/vite-project/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "vite-project",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "node server",
"build": "npm run build:client && npm run build:server",
"build:client": "vite build --ssrManifest --outDir dist/client",
"build:server": "vite build --ssr src/entry-server.ts --outDir dist/server",
"preview": "cross-env NODE_ENV=production node server"
},
"dependencies": {
"compression": "^1.7.4",
"express": "^4.18.1",
"sirv": "^2.0.2"
},
"devDependencies": {
"@types/express": "^4.17.14",
"@types/node": "^18.7.21",
"cross-env": "^7.0.3",
"typescript": "^4.8.3",
"vite": "^3.1.3",
"vite-plugin-public-typescript": "link: ./../../../"
}
}
Loading

0 comments on commit e36ac70

Please sign in to comment.