Skip to content

Commit

Permalink
Add project files
Browse files Browse the repository at this point in the history
Refactor


Progress


Progress


Fixes


fix


Fix


Fix
  • Loading branch information
fradinni committed Dec 14, 2021
1 parent 7a77c02 commit aad869c
Show file tree
Hide file tree
Showing 82 changed files with 20,437 additions and 33 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# IDE
.idea

# Logs
logs
*.log
Expand Down Expand Up @@ -36,6 +39,8 @@ bower_components

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
dist
dist-ng

# Dependency directories
node_modules/
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v12.16.0
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 NW.js Utilities

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.
64 changes: 31 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,47 @@
# FIST - FerUI Icon SVG Tool
# Ferui Icon Tool

# Running Locally for development

1. `npm install`
1. `npm start`
1. Webpack will spin up (takes a moment) then a window will pop up
# Install

You can also run this repo in a regular browser with `npm run start:web`, but will need to add conditionals into your code to skip desktop-specific code (`if (window.nw) {}`).
## macOS x64
1. Download the `*-mac-x64.tar.xz` archive.
2. Extract the archive.
3. Move `*.app` directory to `Applications` folder.

## Linux x64

## Building for distribution
### Run portable archive
1. Download the `*-linux-x64.tar.xz` archive.
1. Extract the `tar.xz` archive
2. Run `./FeruiIconTool` executable

1. `npm run build:clean` will delete your `./dist` and `/dist-ng` folders
1. `npm run build:ng` will build just your Angular app for distribution (`./dist-ng`)
1. `npm run build:nw` will build just your NW.js app (`./dist`)
1. `npm run build` is your all-in-one command. It will clean out the old dist folders and build your Angular and NW.js app
### Install on system
1. Download the `installer-*-linux-x64.run` file.
2. Run it as sudo: `sudo ./installer-*-linux-x64.run`.
3. FeruiIconTool is now available from application menu.

### Uninstall
1. Run as sudo: `sudo /opt/FeruiIconTool/FeruiIconTool-*-linux-x64/uninstall.sh`
2. Remove `/opt/FeruiIconTool` directory.

# **IMPORTANT NOTE ABOUT BUILDS!!!**

They take a long time. If you do `npm run build` expect it to take 10-15 minutes. This can be adjusted by changing the build params in the `package.json`. The more platforms and build types, the longer it takes. You can also remove the `--concurrent` from the `build:nw` script to see a status of what has been completed. This will allow individual pieces to finish faster, but the entire build will take longer.

# Running Locally for development

## Automated quality enforcment
## Requirements

1. **Linting:** `npm run lint` - tslint.json
1. **Unit tests:** `npm test` - [Karma](https://karma-runner.github.io).
1. **End-to-end:** `npm run e2e` - Accepting PR to fix these tests. - [Protractor](http://www.protractortest.org).
Using NVM is highly recommended for managing multiple versions of Node/NPM.
- NodeJS v12.16.0

## Development

## Code scaffolding
1. `nvm use` ( if you use NVM )
2. `npm install`
3. `npm run start`
4. Webpack will spin up (takes a moment) then a window will pop up

[ng generate Docs](https://angular.io/cli/generate)

1. `npm run generate -- component component-name` to generate a new component.
1. `npm run generate -- directive directive-name` to generate a new directive.
1. `npm run generate -- pipe pipe-name` to generate a new pipe.
1. `npm run generate -- service service-name` to generate a new service.
1. `npm run generate -- class class-name` to generate a new class.
1. `npm run generate -- guard guard-name` to generate a new guard.
1. `npm run generate -- interface interface-name` to generate a new interface.
1. `npm run generate -- enum enum-name` to generate a new enum.
1. `npm run generate -- module module-name` to generate a new module.
## Building for distribution

Run the `./build.sh` script. This will build Linux and macOS binaries.

## Further help
# **IMPORTANT NOTE ABOUT BUILDS!!!**

To get more help on the Angular CLI use `npm run ng -- help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
They take a long time !
121 changes: 121 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"FeruiIconTool": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/FeruiIconTool",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "FeruiIconTool:build"
},
"configurations": {
"production": {
"browserTarget": "FeruiIconTool:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "FeruiIconTool:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "FeruiIconTool:serve"
},
"configurations": {
"production": {
"devServerTarget": "FeruiIconTool:serve:production"
}
}
}
}
}
},
"defaultProject": "FeruiIconTool",
"cli": {
"defaultCollection": "@angular-eslint/schematics"
}
}
Binary file added assets/FerUI/favicon.ico
Binary file not shown.
Binary file added assets/FerUI/icon.icns
Binary file not shown.
Binary file added assets/FerUI/icon.ico
Binary file not shown.
Binary file added assets/FerUI/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Fist/favicon.ico
Binary file not shown.
Binary file added assets/Fist/icon.icns
Binary file not shown.
Binary file added assets/Fist/icon.ico
Binary file not shown.
Binary file added assets/Fist/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon.ico
Binary file not shown.
Binary file added assets/favicon/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions assets/favicon/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
Binary file added assets/icon.icns
Binary file not shown.
Binary file added assets/icon.ico
Binary file not shown.
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions browserslist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# You can see what browsers were selected by your queries by running:
# npx browserslist

chrome 75
79 changes: 79 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash

# Get package versions
PACKAGE_NAME=$(sed -nE 's/^\s*"name": "(.*?)",$/\1/p' package.json)
PACKAGE_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json)

# Directories
DIST_DIR="dist"
LINUX_DIR="${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-x64"
OSX_DIR="${PACKAGE_NAME}-${PACKAGE_VERSION}-mac-x64"
LINUX_ARCHIVE_FILE="${DIST_DIR}/${LINUX_DIR}.tar.xz"
OSX_ARCHIVE_FILE="${DIST_DIR}/${OSX_DIR}.tar.xz"

######################################################################
# Functions
#
make_linux_archive() {
# Create tar.xz file
echo "-> Create Linux_x64 archive..."
tar -C "$DIST_DIR" -cJf "$LINUX_ARCHIVE_FILE" "$LINUX_DIR"
}

make_osx_archive() {
# Create tar.xz file
echo "-> Create Mac_x64 archive..."
tar -C "$DIST_DIR/$OSX_DIR" -cJf "$OSX_ARCHIVE_FILE" "${PACKAGE_NAME}.app"
}

make_linux_installer() {
echo "-> Create Linux_x64 installer..."
INSTALLER_FILE="$DIST_DIR/installer-${LINUX_DIR}.run"
cp ./scripts/linux_installer.sh "$INSTALLER_FILE"
sed -i "s/{{PACKAGE_NAME}}/${PACKAGE_NAME}/g" "$INSTALLER_FILE"
sed -i "s/{{PACKAGE_VERSION}}/${PACKAGE_VERSION}/g" "$INSTALLER_FILE"
sed -i "s/{{APP_DIR}}/${LINUX_DIR}/g" "$INSTALLER_FILE"

# Append archive to installer script
cat "$LINUX_ARCHIVE_FILE" >> "$INSTALLER_FILE"
chmod +x "$INSTALLER_FILE"
}

make_linux_uninstaller() {
echo "-> Create Linux_x64 uninstaller..."
UNINSTALL_FILE="${DIST_DIR}/${LINUX_DIR}/uninstall.sh"
cp ./scripts/linux_uninstaller.sh "$UNINSTALL_FILE"
sed -i "s/{{PACKAGE_NAME}}/${PACKAGE_NAME}/g" "$UNINSTALL_FILE"
sed -i "s/{{PACKAGE_VERSION}}/${PACKAGE_VERSION}/g" "$UNINSTALL_FILE"
chmod +x "$UNINSTALL_FILE"
}

######################################################################
# Entry Point
#

# Run build script
npm run build:x64

# Fix permissions for Linux
chmod +x "${DIST_DIR}/${LINUX_DIR}/chrome_crashpad_handler"

# Make uninstall script for linux
make_linux_uninstaller

# Remove credits files
rm "$DIST_DIR/$LINUX_DIR/credits.html"
rm "$DIST_DIR/$OSX_DIR/credits.html"

# Make archives
make_linux_archive &
make_osx_archive &
wait

# Make Installer script for linux
make_linux_installer
wait

echo ""
echo "Build complete."
echo ""
57 changes: 57 additions & 0 deletions e2e/protractor.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');

let nwBinary = 'nwjs/nw.exe';
let driver = 'nwjs/chromedriver.exe';

if (process.platform === 'linux') {
nwBinary = 'nwjs/nw';
driver = 'nwjs/chromedriver'
}
if (process.platform === 'darwin') {
nwBinary = 'nwjs.app/contents/MacOS/nwjs';
driver = 'chromedriver';
}

nwBinary = './node_modules/nw/' + nwBinary;
driver = '../node_modules/nw/' + driver;

/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
chromeDriver: driver,
capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: nwBinary
}
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function () {}
},
onPrepare: function () {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});

jasmine.getEnv()
.addReporter(new SpecReporter({
spec: {
displayStacktrace: true
}
}));
}
};
Loading

0 comments on commit aad869c

Please sign in to comment.