Skip to content

Commit

Permalink
feat: bring vite (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyrpex authored Feb 19, 2024
1 parent 7d549c1 commit cb7c8a8
Show file tree
Hide file tree
Showing 19 changed files with 1,921 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
26 changes: 26 additions & 0 deletions .github/workflows/vite-pull.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: vite-pull
on:
pull_request:
paths:
- vite/**
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: vite
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
registry-url: https://registry.npmjs.org
- name: Install winglang
run: npm i -g winglang
- name: Install dependencies
run: npm install
working-directory: vite
- name: Test
run: wing test
working-directory: vite
38 changes: 38 additions & 0 deletions .github/workflows/vite-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: vite-release
on:
push:
branches:
- main
paths:
- vite/**
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: vite
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
registry-url: https://registry.npmjs.org
- name: Install winglang
run: npm i -g winglang
- name: Install dependencies
run: npm install
working-directory: vite
- name: Test
run: wing test
working-directory: vite
- name: Pack
run: wing pack
working-directory: vite
- name: Publish
run:
npm publish --access=public --registry https://registry.npmjs.org --tag
latest *.tgz
working-directory: vite
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions vite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target/
node_modules/
21 changes: 21 additions & 0 deletions vite/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Wing

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.
40 changes: 40 additions & 0 deletions vite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# vite

`@winglibs/vite` allows using a [Vite](https://vitejs.dev/) project with Wing.

## Prerequisites

- [winglang](https://winglang.io).

## Installation

```sh
npm i @winglibs/vite
```

## Usage

```js
bring cloud;
bring vite;

let api = new cloud.Api();

let website = new vite.Vite(
// The path to the website root.
root: "../website",

// Environment variables passed to the Vite project.
// They'll available through the global `wing` object.
publicEnv: {
API_URL: api.url,
},
);

// Get the URL of the website.
let url = website.url;
```

## License

This library is licensed under the [MIT License](./LICENSE).
2 changes: 2 additions & 0 deletions vite/example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.winglibs/
/dist/
11 changes: 11 additions & 0 deletions vite/example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Example</title>
</head>
<body>
<h1>Example</h1>
</body>
</html>
Loading

0 comments on commit cb7c8a8

Please sign in to comment.