-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a6cee3
commit 261ddcc
Showing
14 changed files
with
902 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
node_modules | ||
release.json |
This file contains 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,123 @@ | ||
# EasyWind [![CI](https://github.com/avencera/easywind/workflows/Mean%20Bean%20CI/badge.svg)](https://github.com/avencera/easywind/actions?query=workflow%3A%22Mean+Bean+CI%22) | ||
|
||
## Install | ||
|
||
Install using homebrew (mac and linux): | ||
|
||
`brew install avencera/taps/easywind` | ||
|
||
or | ||
|
||
Install from a github release: | ||
|
||
`curl -LSfs https://avencera.github.io/easywind/install.sh | sh -s -- --git avencera/easywind` | ||
|
||
or | ||
|
||
Install from crates.io (if you already have Rust installed) | ||
|
||
`cargo install easywind_cli` | ||
|
||
or | ||
|
||
Download a release directly from github: github.com/avencera/easywind/releases | ||
|
||
## Usage | ||
|
||
You only need to commands to get started (no dependencies not even node): | ||
|
||
`easywind init mywebsite` will create a project in a new directory, with a `tailwind.config.js` file and an `index.html` file. | ||
***NOTE:** This command will also download the [standalone tailwindcss cli](https://github.com/tailwindlabs/tailwindcss/releases) if you don't have node on your system.* | ||
|
||
`easywind start mywebsite --open` will start the tailwind watcher and a live reloading server | ||
|
||
|
||
https://github.com/avencera/easywind/assets/1775346/e2b55eec-8875-412e-9324-7e65e6d7086e | ||
|
||
|
||
|
||
### easywind init | ||
|
||
```bash | ||
Initialize a new project | ||
|
||
Usage: easywind init <PROJECT_NAME> | ||
|
||
Arguments: | ||
<PROJECT_NAME> | ||
Name of the project to initialize | ||
|
||
This will be used to create a directory with the same name (usage: easywind init portfolio) | ||
|
||
Options: | ||
-h, --help | ||
Print help (see a summary with '-h') | ||
``` | ||
|
||
### easywind start | ||
```shell | ||
Start the server and tailwind watcher | ||
|
||
Usage: easywind start [OPTIONS] [ROOT_DIR] | ||
|
||
Arguments: | ||
[ROOT_DIR] [default: .] | ||
|
||
Options: | ||
-p, --port <PORT> Port the server shoud use, defaults to 3500 [default: 3500] | ||
-O, --open Open in your browser | ||
-i, --input <INPUT> Input css file to process | ||
-o, --output <OUTPUT> Where you want the final CSS file to be written | ||
-h, --help Print help | ||
``` | ||
|
||
### easywind serve | ||
|
||
```shell | ||
Run a live reloading server to serve content | ||
|
||
Usage: easywind serve [OPTIONS] [ROOT_DIR] | ||
|
||
Arguments: | ||
[ROOT_DIR] [default: .] | ||
|
||
Options: | ||
-p, --port <PORT> Port the server shoud use, defaults to 3500 [default: 3500] | ||
-o, --open Open in your browser | ||
-h, --help Print help | ||
``` | ||
|
||
<img width="1537" alt="easywind_serve" src="https://github.com/avencera/easywind/assets/1775346/bb816533-9df6-42a2-953b-eea96ebab090"> | ||
|
||
### easywind tailwind | ||
```shell | ||
Run the tailwind watcher that generates the CSS | ||
|
||
Usage: easywind tailwind [OPTIONS] [ROOT_DIR] | ||
|
||
Arguments: | ||
[ROOT_DIR] | ||
Path to the root directory of the project. This is where the `tailwind.config.js` file is located. | ||
|
||
Defaults to the current directory | ||
|
||
[default: .] | ||
|
||
Options: | ||
-i, --input <INPUT> | ||
Input css file to process | ||
|
||
[default: src/app.css] | ||
|
||
-o, --output <OUTPUT> | ||
Where you want the final CSS file to be written | ||
|
||
[default: dist/app.css] | ||
|
||
-w, --watch | ||
Watch for changes in input CSS and recompile the output CSS | ||
|
||
-h, --help | ||
Print help (see a summary with '-h') | ||
|
||
``` |
This file contains 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 @@ | ||
empty file, will be replaced with the binary during install |
This file contains 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,7 @@ | ||
// @ts-check | ||
"use strict"; | ||
|
||
module.exports = { | ||
REPO: "avencera/easywind", | ||
VERSION: "v0.1.2", | ||
}; |
This file contains 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,54 @@ | ||
// @ts-check | ||
"use strict"; | ||
|
||
const { REPO } = require("./constants"); | ||
const get = require("./get"); | ||
|
||
/** | ||
* @param {string} repo | ||
* @param {string} tag | ||
*/ | ||
function getApiUrl(repo, tag) { | ||
return `https://github.com/gitapi/repos/${repo}/releases/tags/${tag}`; | ||
} | ||
|
||
/** | ||
* @param {{ token?: string; version: string; }} opts | ||
*/ | ||
async function getReleaseFromGitHubApi(opts) { | ||
const downloadOpts = { | ||
headers: { | ||
"user-agent": "easywind", | ||
}, | ||
}; | ||
|
||
if (opts.token) { | ||
downloadOpts.headers.authorization = `token ${opts.token}`; | ||
} | ||
|
||
console.log(`Finding easywind ${opts.version} release`); | ||
const release = await get(getApiUrl(REPO, opts.version), downloadOpts); | ||
let jsonRelease; | ||
try { | ||
jsonRelease = JSON.parse(release); | ||
} catch (e) { | ||
throw new Error("Malformed API response: " + e.stack); | ||
} | ||
|
||
if (!jsonRelease.assets) { | ||
throw new Error("Bad API response: " + JSON.stringify(release)); | ||
} | ||
|
||
return jsonRelease; | ||
} | ||
|
||
/** | ||
* @param {{ token?: string; version: string; }} opts | ||
*/ | ||
module.exports = async (opts) => { | ||
if (!opts.version) { | ||
return Promise.reject(new Error("Missing version")); | ||
} | ||
|
||
return getReleaseFromGitHubApi(opts); | ||
}; |
Oops, something went wrong.