Commit 418d2930 authored by Pedro Costa's avatar Pedro Costa
Browse files

refs #1 - setup

parent c01ff22d
Pipeline #13222 failed with stages
in 4 minutes and 28 seconds
# Created by https://www.toptal.com/developers/gitignore/api/webstorm+all,vim,node
# Edit at https://www.toptal.com/developers/gitignore?templates=webstorm+all,vim,node
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
.env.production
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
### Vim ###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
### WebStorm+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### WebStorm+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
.idea/
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
*.iml
modules.xml
.idea/misc.xml
*.ipr
# Sonarlint plugin
.idea/sonarlint
# End of https://www.toptal.com/developers/gitignore/api/webstorm+all,vim,node
.node_cache: &cache_node_modules
key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
paths:
- node_modules/
- .npm/
policy: pull
.test-cache: &test-cache
key: test-$CI_JOB_IMAGE
paths:
- workdocs/coverage/
policy: pull-push
.build-cache: &build-cache
key: build-$CI_JOB_IMAGE
paths:
- lib/
- dist/
- loader/
policy: pull-push
variables:
FF_USE_FASTZIP: 1
CACHE_COMPRESSION_LEVEL: "fastest"
ARTIFACT_COMPRESSION_LEVEL: "fast"
CACHE_REQUEST_TIMEOUT: 5
default:
image: node:16
before_script:
- |
if [[ ! -f package.json ]]; then
echo "No package.json found! A package.json file is required to publish a package to GitLab's NPM registry."
echo 'For more information, see https://docs.gitlab.com/ee/user/packages/npm_registry/#creating-a-project'
exit 1
fi
- NPM_PACKAGE_NAME=$(node -p "require('./package.json').name")
- NPM_PACKAGE_VERSION=$(node -p "require('./package.json').version")
- npm ci --cache .npm --prefer-offline
stages:
- dependencies
- test
- build
- deploy
install:
stage: dependencies
cache:
<<: *cache_node_modules
policy: pull-push
script:
- npm install
interruptible: true
only:
changes:
- package-lock.json
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
tests:
stage: test
script:
- npm run coverage
cache:
<<: *cache_node_modules
<<: *test-cache
artifacts:
when: always
reports:
junit:
- workdocs/coverage/junit-report.xml
coverage: '/^Statements.*?:.*?(\d+\.\d+)%/'
interruptible: true
build:
stage: build
needs: ["tests"]
cache:
<<: *cache_node_modules
<<: *build-cache
script:
- npm run build:prod
npm-deploy:
stage: deploy
needs: ["tests", "build"]
cache:
<<: *cache_node_modules
<<: *build-cache
policy: pull
script:
- echo "Attempting to publish package ${NPM_PACKAGE_NAME} version ${NPM_PACKAGE_VERSION} to GitLab's NPM registry."
- echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" > .npmrc
- npm publish
only:
- tags
except:
- branches
dsu-publish:
stage: deploy
needs: ["tests", "build"]
cache:
<<: *cache_node_modules
<<: *build-cache
policy: pull
script:
- echo "This will be replaced by a call to a workspace to handle deploying to DSU"
only:
- tags
except:
- branches
pages:
stage: deploy
needs: ["tests"]
cache:
<<: *cache_node_modules
<<: *test-cache
policy: pull
script:
- npm run docs
- mv docs public
artifacts:
paths:
- public
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
changes:
- workdocs/**/*
- docs/**/*
- if: '$CI_COMMIT_TAG'
interruptible: true
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/dapp-market.iml" filepath="$PROJECT_DIR$/.idea/dapp-market.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
.github
/bin
/src
/docs
/tests
/workdocs
.gitignore
.npmignore
gulpfile.js
jest.config.js
jsdocs.json
mdCompile.json
nodemon.json
tsconfig.json
.gitlab-ci.yml
@glass-project:registry=https://gitlab.ubitech.eu/api/v4/packages/npm/
\ No newline at end of file
MIT License
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.
![Node Version](https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbadges%2Fshields%2Fmaster%2Fpackage.json&label=Node&query=$.engines.node&colorB=blue)
![NPM Version](https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbadges%2Fshields%2Fmaster%2Fpackage.json&label=NPM&query=$.engines.npm&colorB=purple)
tsertset
## Typescript Project Workspace Template
With documentation, release mechanism and github workflows to match
### Installation
In order to use the db decorators package, we need to follow a list of steps presented below.
##### Step 1: Run npm install
To install as a dependency do:
```sh
$ npm install @glass-project/nameofpackage
```
To install as a dev dependency do:
```sh
$ npm install @glass-project/nameofpackage --save-dev
```
instead.
### Repository Structure
```
ts-template
│ .gitignore <-- Defines files ignored to git
│ .gitlab-ci.yml <-- GitLab CI/CD config file
│ .nmpignore <-- Defines files ignored by npm
│ .nmprc <-- Defines the Npm registry for this package
│ gulpfile.js <-- Gulp build scripts. used in the 'build' and 'build:prod' npm scripts
│ jest.config.js <-- Tests Configuration file
│ jsdocs.json <-- Documentation generation configuration file
│ LICENCE.md <-- Licence disclamer
│ nodemon.json <-- Nodemon config file (allows to live test ts files)
│ package.json
│ package-lock.json
│ README.md <-- Readme File dynamically compiled from 'workdocs' via the 'docs' npm script
│ tsconfig.json <-- Typescript config file. Is overriden in 'gulpfile.js'
└───bin
│ │ tag_release.sh <-- Script to help with releases
└───docs
│ │ ... <-- Dinamically generated folder, containing the compiled documentation for this repository. generated via the 'docs' npm script
└───src
│ │ ... <-- Source code for this repository
└───tests
│ │ ... <-- Test sources for this repository
└───workdocs <-- Folder with all pre-compiled documentation
│ ...
│ Readme.md <-- Entry point to the README.md
```
### Social
[![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://pt.linkedin.com/company/pdmfc)
#### Disclaimer:
![Disclamer](https://static.wixstatic.com/media/2844e6_69acaab42d5a47c9a20a187b384741ef~mv2.png/v1/fill/w_531,h_65,al_c,q_85,usm_0.66_1.00_0.01/2021-01-21_11-27-05_edited.webp)
#!/bin/bash
function ask_yes_or_no(){
# Test if there are enough arguments
if [[ $# > 2 ]]; then
exit 1
fi
local message="${1}"
local y="y"
local n="N"
# defaults to no if not otherwise specified
[[ $2 == "yes" ]] && local default="yes" && y="Y" && n="n" || local default="no"
read -p "$message ([$y]es or [$n]o): "
case $(echo $REPLY | tr '[A-Z]' '[a-z]') in
y|yes) local response="yes" ;;
*) local response="no" ;;
esac
if [[ $response == $default ]] || [[ -z $REPLY ]]; then
echo $default
else
echo $response
fi
}
function ask(){
# Test if there are enough arguments
if [[ $# -ne 1 ]]; then
exit 1
fi
local answer
local real_answer=""
while [[ "" == "$real_answer" ]]; do
read -p "Please type in $1: " answer
[[ "yes" == $(ask_yes_or_no "Is $answer you final answer?") ]] \
&& real_answer="$answer"
done
echo "$real_answer"
}
echo "Setting node to 14"
nvm use 14
echo "Listing existing tags..."
git tag
TAG=""
while [[ "$TAG" == "" || ! "${TAG}" =~ ^v[0-9]+\.[0-9]+.[0-9]+(\-[0-9a-zA-Z\-]+)?$ ]]; do
TAG=$(ask "What should be the new tag? (accepts v*.*.*[-...])")
done
MESSAGE=$(ask "Tag Message")
echo "Preparing Release... "
npm run prepare-release
if [[ $(git status --porcelain) ]]; then
git add .
git commit -m "after release preparation"
fi
npm version "$TAG"
git push && git push --tags
This diff is collapsed.
This diff is collapsed.
assets folder.
will be copied onto /docs
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TypeScript workspace template hello.ts</title>
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script src="./build/entry.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
<link type="text/css" rel="stylesheet" href="">
<script async defer src="https://buttons.github.io/buttons.js"></script>
</head>