Skip to content

Commit

Permalink
add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
201flaviosilva committed Oct 7, 2022
1 parent 3a399cc commit 20a0022
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 2 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/DeployDoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Github Pages Deploy

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

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

- name: Install and Build
run: npm install && npm run jsDoc

- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.1
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs # The folder the action should deploy.
26 changes: 26 additions & 0 deletions .github/workflows/DeployWiki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# https://github.com/marketplace/actions/github-wiki-action
name: Deploy Wiki

on:
push:
paths:
# Trigger only when wiki directory changes
- "wiki/**"
branches:
# And only on master branch
- main

jobs:
deploy-wiki:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Push Wiki Changes
uses: Andrew-Chen-Wang/github-wiki-action@v3
env:
WIKI_DIR: wiki/ # WIKI_DIR's default is wiki/ - Make sure you have that / at the end. We use rsync
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_MAIL: ${{ secrets.EMAIL }} # github.event.pusher.email
GH_NAME: ${{ github.repository_owner }}
EXCLUDED_FILES: "_ignore/"
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@ This file was based on [this template](https://gist.github.com/juampynr/4c18214a
----
## [1.2.0 - More Functions](https://gitlab.com/201flaviosilva/utilsjs/-/milestones/2)

## [1.2.9] - 29-07-2022
## [1.2.10] - 00-09-2022

### Added

### Changed

### Fixed

#### Breaking Changes


## [1.2.9] - 02-09-2022

### Added
- [Random Walk](https://gitlab.com/201flaviosilva/utilsjs/-/commit/56eebcaac033c05401140c4418b54e9579fb8d38) #46;
Expand Down
2 changes: 1 addition & 1 deletion build/utils.min.js

Large diffs are not rendered by default.

99 changes: 99 additions & 0 deletions wiki/Custom-Build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Custom Build

## Description

This project is using [webpack](https://webpack.js.org/) to create a build.

So it's kinda simple to create a custom build.

Just follow the steps below.

## Step 0 - Clone the repository

(If you want you can clone the repository on [Gitpod](https://www.gitpod.io/) which will do these steps for you automatically)

To create a custom build, you need to have the repository in your machine.

### Clone
One way to do that it’s cloning the repository, opening a new terminal, and pasting this code:

(You need to have git installed on your machine)
```sh
git clone https://gitlab.com/201flaviosilva/utilsjs.git
```

### Install the decencies

#### Move to the project folder
After clone the repository, you need to move to the project folder to start working :)
```sh
cd utilsjs
```

#### Install
Then install the dependencies
```sh
npm install
```

## Step 1 - webpack.config.js

In the file tree you'll find a `webpack.config.js` file, open and you will find a configuration more or less similar to the one below.

```javascript
const path = require("path");

module.exports = {
mode: "production",
entry: "./src/index.js",
optimization: { minimize: true, }, // false/true
experiments: { outputModule: true, },
output: {
path: path.resolve("build"),
filename: "utils.min.js", // "utils.js"/"utils.min.js"
libraryTarget: "window", // module/commonjs2/window // https://webpack.js.org/configuration/output/#outputlibrarytarget
},
module: {
rules: [
{
test: /\.js?$/,
exclude: /(node_modules)/,
use: "babel-loader",
},
],
},
resolve: { extensions: [".js"], },
};

```
## Step 2 - change the configuration

You probably just will want to change 3 properties:

### Optimization and Minimization
In the property `optimization` you'll find a property called `minimize` that will be used to decide if the build will be development mode or not (minimize or not).

- If you want to development build, just set it to `false`.
- If you want to production build, just set it to `true`.

### Filename
In the property `filename` you'll find the name of the file that will be created (the output file). Just change the file name to whatever name you need.
Example:

- `utils.min.js`;
- `build.js`;
- etc...

### Library Target
In the property `libraryTarget` you'll find the target of the library.

- If you want to create a module build, just set it to `module`.
- If you want to create a node build, just set it to `commonjs2`.
- If you want to create a window build, just set it to `window`.
- Etc... you can find more information in the [webpack documentation](https://webpack.js.org/configuration/output/#outputlibrarytarget).

## Step 3 - Build

Finally, you'll need to run the command `npm run compile` in the terminal.

Check your folder tree, and in the folder build you'll find the file build file with the name of the file you've changed in the configuration.
2 changes: 2 additions & 0 deletions wiki/References.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [javatpoint - Data Structure](https://www.javatpoint.com/data-structure-tutorial)
- [Code Wars](https://www.codewars.com/dashboard)
7 changes: 7 additions & 0 deletions wiki/home.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 201flaviosilva-UtilsJS Wiki

## Description
Just some simple JavaScript Utils and algorithms solutions. Some functions was created to solve a challenge in [Code Wars](https://www.codewars.com/dashboard).

To see the library documentation: https://201flaviosilva.gitlab.io/utilsjs/

0 comments on commit 20a0022

Please sign in to comment.