From 999524b60ec8bdf66c168b1bec1327f5b0a0b7df Mon Sep 17 00:00:00 2001 From: "(Holloway) Chew, Kean Ho" Date: Thu, 6 Jun 2024 16:15:36 +0800 Subject: [PATCH] root: added automataci ci automation infrasturcture Since we want to develop this library to be a working one, we should integrate a facility for it. Hence, let's add AutomataCI. This patch adds AutomataCI CI automation infrastructure into root repository. Co-authored-by: Shuralyov, Jean Co-authored-by: Galyna, Cory Co-authored-by: (Holloway) Chew, Kean Ho Signed-off-by: (Holloway) Chew, Kean Ho --- CITATION.cff | 62 ++++ CONFIG.toml | 105 +++++- automataCI/SECRETS-template.toml | 107 +++--- automataCI/_package-npm_unix-any.sh | 80 +++++ automataCI/_package-npm_windows-any.ps1 | 73 ++++ automataCI/_release-npm_unix-any.sh | 67 ++++ automataCI/_release-npm_windows-any.ps1 | 68 ++++ automataCI/archive_windows-any.ps1 | 1 + automataCI/common_unix-any.sh | 6 + automataCI/common_windows-any.ps1 | 5 + automataCI/package_unix-any.sh | 11 +- automataCI/package_windows-any.ps1 | 11 +- automataCI/release_unix-any.sh | 22 +- automataCI/release_windows-any.ps1 | 22 +- automataCI/services/archive/tar.ps1 | 93 ++++- automataCI/services/archive/tar.sh | 87 ++++- automataCI/services/archive/zip.ps1 | 12 +- automataCI/services/archive/zip.sh | 15 +- automataCI/services/compilers/node.ps1 | 423 +++++++++++++++++++++- automataCI/services/compilers/node.sh | 426 ++++++++++++++++++++++- automataCI/services/io/fs.ps1 | 61 +++- automataCI/services/io/fs.sh | 51 ++- automataCI/services/io/net/http.ps1 | 25 +- automataCI/services/io/net/http.sh | 18 + automataCI/services/io/os.ps1 | 23 ++ automataCI/services/io/os.sh | 25 ++ src/.ci/_package-archive_unix-any.sh | 2 + src/.ci/_package-archive_windows-any.ps1 | 2 + src/.ci/_package-deb_unix-any.sh | 2 + src/.ci/_package-deb_windows-any.ps1 | 2 + src/.ci/_package-docker_unix-any.sh | 2 + src/.ci/_package-docker_windows-any.ps1 | 2 + src/.ci/_package-flatpak_unix-any.sh | 2 + src/.ci/_package-flatpak_windows-any.ps1 | 2 + src/.ci/_package-ipk_unix-any.sh | 2 + src/.ci/_package-ipk_windows-any.ps1 | 2 + src/.ci/_package-npm_unix-any.sh | 54 +++ src/.ci/_package-npm_windows-any.ps1 | 55 +++ src/.ci/_package-rpm_unix-any.sh | 2 + src/.ci/_package-rpm_windows-any.ps1 | 2 + src/.ci/package_unix-any.sh | 1 + src/.ci/package_windows-any.ps1 | 1 + src/changelog/data/latest | 4 + src/changelog/deb/latest | 8 + srcNODE/.ci/build_unix-any.sh | 238 +++++++++++++ srcNODE/.ci/build_windows-any.ps1 | 228 ++++++++++++ srcNODE/.ci/prepare_unix-any.sh | 52 +++ srcNODE/.ci/prepare_windows-any.ps1 | 52 +++ srcNODE/.ci/start_unix-any.sh | 47 +++ srcNODE/.ci/start_windows-any.ps1 | 43 +++ srcNODE/.ci/stop_unix-any.sh | 35 ++ srcNODE/.ci/stop_windows-any.ps1 | 34 ++ srcNODE/.ci/test_unix-any.sh | 76 ++++ srcNODE/.ci/test_windows-any.ps1 | 77 ++++ srcNODE/package.json | 21 +- 55 files changed, 2803 insertions(+), 146 deletions(-) create mode 100644 CITATION.cff create mode 100644 automataCI/_package-npm_unix-any.sh create mode 100644 automataCI/_package-npm_windows-any.ps1 create mode 100644 automataCI/_release-npm_unix-any.sh create mode 100644 automataCI/_release-npm_windows-any.ps1 create mode 100644 src/.ci/_package-npm_unix-any.sh create mode 100644 src/.ci/_package-npm_windows-any.ps1 create mode 100644 src/changelog/data/latest create mode 100644 src/changelog/deb/latest create mode 100644 srcNODE/.ci/build_unix-any.sh create mode 100644 srcNODE/.ci/build_windows-any.ps1 create mode 100644 srcNODE/.ci/prepare_unix-any.sh create mode 100644 srcNODE/.ci/prepare_windows-any.ps1 create mode 100644 srcNODE/.ci/start_unix-any.sh create mode 100644 srcNODE/.ci/start_windows-any.ps1 create mode 100644 srcNODE/.ci/stop_unix-any.sh create mode 100644 srcNODE/.ci/stop_windows-any.ps1 create mode 100644 srcNODE/.ci/test_unix-any.sh create mode 100644 srcNODE/.ci/test_windows-any.ps1 diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..073ebcf --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,62 @@ +# WARNING: auto-generated by AutomataCI + +cff-version: "1.2.0" +type: "software" +date-released: "2024-06-06" +title: "Chew Kean Ho's hestiaERROR" +version: "0.0.1" +license: "Apache-2.0" +repository: "https://github.com/ChewKeanHo/hestiaERROR" +repository-code: "https://github.com/ChewKeanHo/hestiaERROR" +repository-artifact: "https://github.com/ChewKeanHo/hestiaERROR/wiki/" +url: "https://www.hollowaykeanho.com" +contact: + - affiliation: "(Holloway) Chew, Kean Ho" + email: "hello@hollowaykeanho.com" + website: "https://www.hollowaykeanho.com" +abstract: |- + Need an efficient error reporting in a memory constrained system? + Wants to keep your error messages internationalized? Having + inconsistencies for error reporting across multiple programming + languages? hestiaERROR, a component from Hestia super libraries is + here to resolve these problems. + + Being as a single peaceful frontend+backend software library suite, + hestiaERROR utilizes 1-byte (8-bits) unsigned integer numbering to + represents 256 different sets of error conditions. By using + numbering system, hestiaERROR keeps the project a lot simplier and + making the error reporting isolated from language (as in English) + translations headache (compared to string type error reporting). + + With its simple data type and value designations, you can + confidently operate with the highest consistencies even in the + smallest memory constraint environment (e.g. 8-bit microcontroller). + + hestiaERROR - One Peaceful Frontend+Backend Software Library Suite. +message: |- + Please cite and reference this repository accordingly. +authors: + - given-names: "Kean Ho" + family-names: "Chew" + email: "hello@hollowaykeanho.com" + affiliation: "Independent" + orcid: "https://orcid.org/0000-0003-4202-4863" + - given-names: "Cory" + family-names: "Galyna" + email: "124406765+corygalyna@users.noreply.github.com" + affiliation: "Independent" +identifiers: + - type: doi + value: "10.5281/zenodo.00000000" + description: "General & Latest" +keywords: + - "hestiaERROR" + - "error numbering" + - "error numbers" + - "super libraries" + - "programming languages" + - "library" + - "continuous integration" + - "native and locally available" + - "solid foundation" + - "self-improvable" diff --git a/CONFIG.toml b/CONFIG.toml index ac32cf3..a00cb34 100644 --- a/CONFIG.toml +++ b/CONFIG.toml @@ -103,10 +103,16 @@ PROJECT_CADENCE = "1" PROJECT_LICENSE = "Apache-2.0" +# PROJECT_SCOPE +# The scope of the project being housed in (e.g. +# GitHub Username|Organization Name, NPMJS scope, etc). This is required for +# certain packages' ecosystems such as but not limited to NPM. +PROJECT_SCOPE = "chewkeanho" + + # PROJECT_CONTACT_BRAND -# Entity's short brand name. -# It should be in lowercase and should not be using dash ('-'), -# underscore ('_'), and space (' ') for maximum compatibility. +# Contact Entity's short brand name. It should be in lowercase and should not be +# using dash ('-'), underscore ('_'), and space (' ') for maximum compatibility. PROJECT_CONTACT_BRAND = "chewkeanho" @@ -129,7 +135,7 @@ PROJECT_CONTACT_EMAIL = "hello@hollowaykeanho.com" # PROJECT_CONTACT_WEBSITE # Entity's website channel for sourcing information. -PROJECT_CONTACT_WEBSITE = "https://www.hollowaykeanho.com" +PROJECT_CONTACT_WEBSITE = "https://github.com/ChewKeanHo/hestiaERROR" # PROJECT_SOURCE_URL @@ -166,8 +172,8 @@ AUTOMATACI_LANG = "" # This is a control variable used for enabling Angular technology and also # defining its source codes directory relative to PROJECT_PATH_ROOT. Depending # on the offered service (e.g. GitHub Actions), setting this variable with value -# shall notify the CI provider to setup Go development environment -# automatically. +# shall notify the CI provider to setup a localized virtual environment for +# development automatically. # # To enable it: simply supply the path (e.g. default is 'srcANGULAR'). # To disable it: simply supply an empty path (e.g. default is ''). @@ -183,7 +189,8 @@ PROJECT_ANGULAR = '' # This is a control variable used for enabling C technology and also defining # its source codes directory relative to PROJECT_PATH_ROOT. Depending on the # offered service (e.g. GitHub Actions), setting this variable with value shall -# notify the CI provider to setup Go development environment automatically. +# notify the CI provider to setup a localized virtual environment for +# development automatically. # # To enable it: simply supply the path (e.g. default is 'srcC'). # To disable it: simply supply an empty path (e.g. default is ''). @@ -393,7 +400,8 @@ GOOGLEAI_BLOCK_HARASSMENT = 'BLOCK_NONE' # This is a control variable used for enabling LibreOffice technology and also # defining its source directory relative to PROJECT_PATH_ROOT. Depending on the # offered service (e.g. GitHub Actions), setting this variable with value shall -# notify the CI provider to setup Go development environment automatically. +# notify the CI provider to setup a localized virtual environment for +# development automatically. # # To enable it: simply supply the path (e.g. default is 'srcLIBREOFFICE'). # To disable it: simply supply an empty path (e.g. default is ''). @@ -430,7 +438,8 @@ PROJECT_LIBREOFFICE_VERSION = "24.2.1" # This is a control variable used for enabling Go technology and also defining # its source codes directory relative to PROJECT_PATH_ROOT. Depending on the # offered service (e.g. GitHub Actions), setting this variable with value shall -# notify the CI provider to setup Go development environment automatically. +# notify the CI provider to setup a localized virtual environment for +# development automatically. # # To enable it: simply supply the path (e.g. default is 'srcGO'). # To disable it: simply supply an empty path (e.g. default is ''). @@ -452,7 +461,8 @@ PROJECT_PATH_GO_ENGINE = "go-engine" # This is a control variable used for enabling Nim technology and also defining # its source codes directory relative to PROJECT_PATH_ROOT. Depending on the # offered service (e.g. GitHub Actions), setting this variable with value shall -# notify the CI provider to setup Go development environment automatically. +# notify the CI provider to setup a localized virtual environment for +# development automatically. # # To enable it: simply supply the path (e.g. default is 'srcNIM'). # To disable it: simply supply an empty path (e.g. default is ''). @@ -467,6 +477,67 @@ PROJECT_PATH_NIM_ENGINE = "nim-engine" +###################### +# NODE TECHNOLOGY # +###################### +# PROJECT_NODE +# This is a control variable used for enabling NodeJS technology and also +# defining its source codes directory relative to PROJECT_PATH_ROOT. Depending +# on the offered service (e.g. GitHub Actions), setting this variable with value +# shall notify the CI provider to setup a localized virtual environment for +# development automatically. +# +# To enable it: simply supply the path (e.g. default is 'srcNODE'). +# To disable it: simply supply an empty path (e.g. default is ''). +PROJECT_NODE = 'srcNODE' + + +# PROJECT_PATH_NODE_ENGINE +# This is a relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_TOOLS for +# setting up localized virtual environment. +PROJECT_PATH_NODE_ENGINE = "node-engine" + + +# PROJECT_NODE_VERSION +# This is to specify which version of node to be downloaded for the project +# as the localized virtual environment engine. Please refer to: +# https://nodejs.org/en/download/prebuilt-binaries/current +# for values. +# +# Leaving it empty shall set AutomataCI to use the system-level NodeJS +# (e.g: your pre-configured NodeJS). +# +# To enable: specify a version (e.g. 'v22.2.0') +# To disable: keep it empty (''). +PROJECT_NODE_VERSION = 'v22.2.0' + + +# PROJECT_NODE_LOCALIZED +# This is a flag environment variable when a localized virtual environment for +# NodeJS is active. This is useful for detecting which nodeJS engine you're +# currently using for the project in a given terminal. +# +# When active, The variable's value is the pathing to the engine itself. +# +# This variable is reserved by the activator script created autonomously by +# AutomataCI. +#PROJECT_NODE_LOCALIZED - Reserved + + +# PROJECT_NODE_NPM_REGISTRY +# The registry URL for publishing the NPM packages. +# +# The following are identified: +# +# GitHub Packages: 'https://npm.pkg.github.com' +# NPMJS : 'https://registry.npmjs.com' +# +# Default is: 'https://npm.pkg.github.com' +PROJECT_NODE_NPM_REGISTRY = 'https://npm.pkg.github.com' + + + + ###################### # PYTHON TECHNOLOGY # ###################### @@ -474,8 +545,8 @@ PROJECT_PATH_NIM_ENGINE = "nim-engine" # This is a control variable used for enabling Python technology and also # defining its source codes directory relative to PROJECT_PATH_ROOT. # Depending on the offered service (e.g. GitHub Actions), setting this -# variable with value shall notify the CI provider to setup Python development -# environment automatically. +# variable with value shall notify the CI provider to setup a localized virtual +# environment for development automatically. # # To enable it: simply supply the path (e.g. default is 'srcPYTHON'). # To disable it: simply supply an empty path (e.g. default is ''). @@ -725,14 +796,14 @@ PROJECT_STATIC_REPO_DIRECTORY = "static" # security access or the ecosystem is not using Release Job at all (e.g. GitHub # Actions). # -# PROJECT_SIMULATE_RELEASE_REPO = "" # Reserved - provided by external. +# PROJECT_SIMULATE_RELEASE_REPO = "" # Reserved - provided externally. # PROJECT_ROBOT_RUN # A flag to indicate the run is operating inside a CI service by its # autonomous robot. # -# PROJECT_ROBOT_RUN = "" # Reserved - provided by external. +# PROJECT_ROBOT_RUN = "" # Reserved - provided externally. # PROJECT_STATIC_URL @@ -759,7 +830,7 @@ DOCKER_CLI_EXPERIMENTAL = "enabled" # PROJECT_HOMEBREW_REPO # The Homebrew formula publication git repository for updating and publishing # Homebrew's formula. This is used in release job. -PROJECT_HOMEBREW_REPO = "git@github.com:ChewKeanHo/Testbed.git" +PROJECT_HOMEBREW_REPO = "git@github.com:ChewKeanHo/Collections.git" # PROJECT_HOMEBREW_REPO_KEY @@ -784,7 +855,7 @@ PROJECT_HOMEBREW_DIRECTORY = "homebrew" # use for constructing the 'url' value. # # NOTE: Please avoid ending with the URL slash. -PROJECT_HOMEBREW_SOURCE_URL = "https://github.com/ChewKeanHo/hestiaERROR/releases/download" +PROJECT_HOMEBREW_SOURCE_URL = "https://github.com/ChewKeanHo/Collections/releases/download/store" # PROJECT_CHOCOLATEY_REPO @@ -815,7 +886,7 @@ PROJECT_CHOCOLATEY_DIRECTORY = "chocolatey" # Chocolatey use for constructing the 'url' value. # # NOTE: Please avoid ending with the URL slash. -PROJECT_CHOCOLATEY_SOURCE_URL = "https://github.com/ChewKeanHo/hestiaERROR/releases/download" +PROJECT_CHOCOLATEY_SOURCE_URL = "https://github.com/ChewKeanHo/Collections/releases/download/store" # PROJECT_DOCS_REPO diff --git a/automataCI/SECRETS-template.toml b/automataCI/SECRETS-template.toml index c37a4ce..f45f490 100644 --- a/automataCI/SECRETS-template.toml +++ b/automataCI/SECRETS-template.toml @@ -1,27 +1,30 @@ -###################### -# PYTHON TECHNOLOGY # -###################### -# TWINE_USERNAME -# Use for logging in a PyPi server. This is the account username. Only used -# when PROJECT_PYTHON is enabled. -TWINE_USERNAME = "" +########################## +# APPLE # +########################## +# APPLE_DEVELOPER_ID +# The developer ID used for notarization process. +APPLE_DEVELOPER_ID = "" +# APPLE_KEYCHAIN_PROFILE +# The keychain access used for accessing notarization credentials. +APPLE_KEYCHAIN_PROFILE = "" -# TWINE_PASSWORD -# Use for logging in a PyPi server. This is the account password. Only used -# when PROJECT_PYTHON is enabled. -TWINE_PASSWORD = "" +########################## +# CONTAINER # +########################## +# CONTAINER_USERNAME +# Use to login your container image's registry's service provider (e.g. Docker, +# GitHub Packages) etc. This is the account username. +CONTAINER_USERNAME = "" -###################### -# RUST TECHNOLOGY # -###################### -# CARGO_PASSWORD -# Use for logging in a Cargo registry server. This is the account -# password/secret token. Only used when PROJECT_RUST is enabled. -CARGO_PASSWORD = "" + +# CONTAINER_PASSWORD +# Use to login your container image's registry's service provider (e.g. Docker, +# GitHub Packages) etc. This is the account password or token value. +CONTAINER_PASSWORD = "" @@ -35,16 +38,18 @@ CARGO_PASSWORD = "" PROJECT_GPG_ID ="" -# CONTAINER_USERNAME -# Use to login your container image's registry's service provider (e.g. Docker, -# GitHub Packages) etc. This is the account username. -CONTAINER_USERNAME = "" -# CONTAINER_PASSWORD -# Use to login your container image's registry's service provider (e.g. Docker, -# GitHub Packages) etc. This is the account password or token value. -CONTAINER_PASSWORD = "" +###################### +# GOOGLE AI # +###################### +# GOOGLEAI_API_TOKEN +# This is the authentication API token provided by Google AI using Google AI +# Studio. A token can be procured from: +# (1) https://aistudio.google.com/ (look for 'Get API Key' button) +# +# Without this token, GOOGLEAI library will not function at all. +GOOGLEAI_API_TOKEN = '' @@ -103,27 +108,43 @@ MICROSOFT_CERT_PASSWORD = "" -########################## -# APPLE # -########################## -# APPLE_DEVELOPER_ID -# The developer ID used for notarization process. -APPLE_DEVELOPER_ID = "" +###################### +# NPM TECHNOLOGY # +###################### +# NPM_USERNAME +# The username for login. +NPM_USERNAME = "" -# APPLE_KEYCHAIN_PROFILE -# The keychain access used for accessing notarization credentials. -APPLE_KEYCHAIN_PROFILE = "" + +# NPM_TOKEN +# The Authentication token (e.g. _authToken) for logging into the corresponding +# NPM registry defined in the CONFIG.toml. +NPM_TOKEN = "" ###################### -# GOOGLE AI # +# PYTHON TECHNOLOGY # ###################### -# GOOGLEAI_API_TOKEN -# This is the authentication API token provided by Google AI using Google AI -# Studio. A token can be procured from: -# (1) https://aistudio.google.com/ (look for 'Get API Key' button) -# -# Without this token, GOOGLEAI library will not function at all. -GOOGLEAI_API_TOKEN = '' +# TWINE_USERNAME +# Use for logging in a PyPi server. This is the account username. Only used +# when PROJECT_PYTHON is enabled. +TWINE_USERNAME = "" + + +# TWINE_PASSWORD +# Use for logging in a PyPi server. This is the account password. Only used +# when PROJECT_PYTHON is enabled. +TWINE_PASSWORD = "" + + + + +###################### +# RUST TECHNOLOGY # +###################### +# CARGO_PASSWORD +# Use for logging in a Cargo registry server. This is the account +# password/secret token. Only used when PROJECT_RUST is enabled. +CARGO_PASSWORD = "" diff --git a/automataCI/_package-npm_unix-any.sh b/automataCI/_package-npm_unix-any.sh new file mode 100644 index 0000000..ef5c70e --- /dev/null +++ b/automataCI/_package-npm_unix-any.sh @@ -0,0 +1,80 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +. "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + + + + +PACKAGE_Run_NPM() { + #__line="$1" + + + # parse input + __line="$1" + + _dest="${__line%%|*}" + __line="${__line#*|}" + + _target="${__line%%|*}" + __line="${__line#*|}" + + _target_filename="${__line%%|*}" + __line="${__line#*|}" + + _target_os="${__line%%|*}" + __line="${__line#*|}" + + _target_arch="${__line%%|*}" + __line="${__line#*|}" + + + # copy all complimentary files to the workspace + cmd="PACKAGE_Assemble_NPM_Content" + I18N_Check_Function "$cmd" + OS_Is_Command_Available "$cmd" + if [ $? -ne 0 ]; then + I18N_Check_Failed + return 1 + fi + + I18N_Assemble_Package + "$cmd" "$_target" "$_dest" "$_target_filename" "$_target_os" "$_target_arch" + case $? in + 10) + I18N_Assemble_Skipped + return 0 + ;; + 0) + # accepted + ;; + *) + I18N_Assemble_Failed + return 1 + ;; + esac + + + # report status + return 0 +} diff --git a/automataCI/_package-npm_windows-any.ps1 b/automataCI/_package-npm_windows-any.ps1 new file mode 100644 index 0000000..8a84999 --- /dev/null +++ b/automataCI/_package-npm_windows-any.ps1 @@ -0,0 +1,73 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return +} + + + + +function PACKAGE-Run-NPM { + param ( + [string]$__line + ) + + + # parse input + $__list = $__line -split "\|" + $_dest = $__list[0] + $_target = $__list[1] + $_target_filename = $__list[2] + $_target_os = $__list[3] + $_target_arch = $__list[4] + + + # copy all complimentary files to the workspace + $cmd = "PACKAGE-Assemble-NPM-Content" + $null = I18N-Check-Function "$cmd" + $___process = OS-Is-Command-Available "$cmd" + if ($___process -ne 0) { + $null = I18N-Check-Failed + return 1 + } + + $null = I18N-Assemble-Package + $___process = PACKAGE-Assemble-NPM-Content ` + "${_target}" ` + "${_dest}" ` + "${_target_filename}" ` + "${_target_os}" ` + "${_target_arch}" + switch ($___process) { + 10 { + $null = I18N-Assemble-Skipped + return 0 + } 0 { + # accepted + } Default { + $null = I18N-Assemble-Failed + return 1 + }} + + + # report status + return 0 +} diff --git a/automataCI/_release-npm_unix-any.sh b/automataCI/_release-npm_unix-any.sh new file mode 100644 index 0000000..771263b --- /dev/null +++ b/automataCI/_release-npm_unix-any.sh @@ -0,0 +1,67 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +. "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" +. "${LIBS_AUTOMATACI}/services/compilers/node.sh" + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + + + + +RELEASE_Run_NPM() { + #_target="$1" + + + # validate input + NODE_NPM_Is_Valid "$1" + if [ $? -ne 0 ]; then + return 0 + fi + + I18N_Activate_Environment + NODE_Activate_Local_Environment + if [ $? -ne 0 ]; then + I18N_Activate_Failed + return 1 + fi + + + # execute + I18N_Check_Login "NPM" + NODE_NPM_Check_Login + if [ $? -eq 0 ]; then + I18N_Publish "$1" + if [ $(OS_Is_Run_Simulated) -eq 0 ]; then + I18N_Simulate_Publish "$1" + else + NODE_NPM_Publish "$1" + if [ $? -ne 0 ]; then + I18N_Publish_Failed + return 1 + fi + fi + fi + + + # report status + return 0 +} diff --git a/automataCI/_release-npm_windows-any.ps1 b/automataCI/_release-npm_windows-any.ps1 new file mode 100644 index 0000000..be16bf1 --- /dev/null +++ b/automataCI/_release-npm_windows-any.ps1 @@ -0,0 +1,68 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" +. "${env:LIBS_AUTOMATACI}\services\compilers\node.ps1" + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return +} + + + + +function RELEASE-Run-NPM { + param( + [string]$_target + ) + + + # validate input + $___process = NODE-NPM-Is-Valid "${_target}" + if ($___process -ne 0) { + return 0 + } + + $null = I18N-Activate-Environment + $___process = NODE-Activate-Local-Environment + if ($___process -ne 0) { + $null = I18N-Activate-Failed + return 1 + } + + + # execute + $null = I18N-Check-Login "NPM" + $___process = NODE-NPM-Check-Login + if ($___process -eq 0) { + $null = I18N-Publish "${_target}" + if ($(OS-Is-Run-Simulated) -ne 0) { + $null = I18N-Simulate-Publish "${_target}" + } else { + $___process = NODE-NPM-Publish "${_target}" + if ($___process -ne 0) { + $null = I18N-Publish-Failed + return 1 + } + } + } + + + # report status + return 0 +} diff --git a/automataCI/archive_windows-any.ps1 b/automataCI/archive_windows-any.ps1 index c20dc37..04b4c29 100644 --- a/automataCI/archive_windows-any.ps1 +++ b/automataCI/archive_windows-any.ps1 @@ -85,6 +85,7 @@ $null = FS-Remove-Silently "${___artifact_workspace}" $___arguments = ".\${env:PROJECT_PATH_BIN}" ` + " .\${env:PROJECT_PATH_LIB}" ` + " .\${env:PROJECT_PATH_TEMP}" ` + + " .\${env:PROJECT_PATH_TOOLS}" ` + " .\${env:PROJECT_PATH_RELEASE}" $null = OS-Exec "tar" "czvf ${___artifact_workspace} ${___arguments}" diff --git a/automataCI/common_unix-any.sh b/automataCI/common_unix-any.sh index 0a97551..0aeae35 100644 --- a/automataCI/common_unix-any.sh +++ b/automataCI/common_unix-any.sh @@ -104,6 +104,12 @@ if [ $? -ne 0 ]; then fi +Run_Subroutine_Exec "$PROJECT_NODE" "NODE" +if [ $? -ne 0 ]; then + return 1 +fi + + Run_Subroutine_Exec "$PROJECT_PYTHON" "PYTHON" if [ $? -ne 0 ]; then return 1 diff --git a/automataCI/common_windows-any.ps1 b/automataCI/common_windows-any.ps1 index 8c8d9c1..29bd9a2 100644 --- a/automataCI/common_windows-any.ps1 +++ b/automataCI/common_windows-any.ps1 @@ -98,6 +98,11 @@ if ($___process -ne 0) { return 1 } +$___process = RUN-Subroutine-Exec "${env:PROJECT_NODE}" "NODE" +if ($___process -ne 0) { + return 1 +} + $___process = RUN-Subroutine-Exec "${env:PROJECT_PYTHON}" "PYTHON" if ($___process -ne 0) { return 1 diff --git a/automataCI/package_unix-any.sh b/automataCI/package_unix-any.sh index bd90175..2e01889 100644 --- a/automataCI/package_unix-any.sh +++ b/automataCI/package_unix-any.sh @@ -36,6 +36,7 @@ fi . "${LIBS_AUTOMATACI}/_package-homebrew_unix-any.sh" . "${LIBS_AUTOMATACI}/_package-ipk_unix-any.sh" . "${LIBS_AUTOMATACI}/_package-msi_unix-any.sh" +. "${LIBS_AUTOMATACI}/_package-npm_unix-any.sh" . "${LIBS_AUTOMATACI}/_package-pdf_unix-any.sh" . "${LIBS_AUTOMATACI}/_package-pypi_unix-any.sh" . "${LIBS_AUTOMATACI}/_package-rpm_unix-any.sh" @@ -155,7 +156,7 @@ for i in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}"/*; do TARGET_FILENAME="${TARGET_FILENAME%.*}" TARGET_OS="${TARGET_FILENAME##*_}" TARGET_FILENAME="${TARGET_FILENAME%%_*}" - TARGET_ARCH="${TARGET_ARCH##*-}" + TARGET_ARCH="${TARGET_OS##*-}" TARGET_ARCH="${TARGET_ARCH%%.*}" TARGET_OS="${TARGET_OS%%-*}" TARGET_OS="${TARGET_OS%%.*}" @@ -252,6 +253,14 @@ ${__common}|${__log}|PACKAGE_Run_MSI return 1 fi + __log="${__log_directory}/npm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + FS_Append_File "$__serial_control" "\ +${__common}|${__log}|PACKAGE_Run_NPM +" + if [ $? -ne 0 ]; then + return 1 + fi + __log="${__log_directory}/pdf_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" FS_Append_File "$__parallel_control" "\ ${__common}|${__log}|PACKAGE_Run_PDF diff --git a/automataCI/package_windows-any.ps1 b/automataCI/package_windows-any.ps1 index cc2f523..e41163c 100644 --- a/automataCI/package_windows-any.ps1 +++ b/automataCI/package_windows-any.ps1 @@ -112,6 +112,7 @@ function SUBROUTINE-Package { $null = . "${env:LIBS_AUTOMATACI}\_package-homebrew_windows-any.ps1" $null = . "${env:LIBS_AUTOMATACI}\_package-ipk_windows-any.ps1" $null = . "${env:LIBS_AUTOMATACI}\_package-msi_windows-any.ps1" + $null = . "${env:LIBS_AUTOMATACI}\_package-npm_windows-any.ps1" $null = . "${env:LIBS_AUTOMATACI}\_package-pdf_windows-any.ps1" $null = . "${env:LIBS_AUTOMATACI}\_package-pypi_windows-any.ps1" $null = . "${env:LIBS_AUTOMATACI}\_package-rpm_windows-any.ps1" @@ -170,7 +171,7 @@ foreach ($file in (Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_P $TARGET_FILENAME = $TARGET_FILENAME -replace "\..*$" $TARGET_OS = $TARGET_FILENAME -replace ".*_" $TARGET_FILENAME = $TARGET_FILENAME -replace "_.*" - $TARGET_ARCH = $TARGET_ARCH -replace ".*-" + $TARGET_ARCH = $TARGET_OS -replace ".*-" $TARGET_ARCH = $TARGET_ARCH -replace "\..*$" $TARGET_OS = $TARGET_OS -replace "-.*" $TARGET_OS = $TARGET_OS -replace "\..*$" @@ -267,6 +268,14 @@ ${__common}|${__log}|PACKAGE-Run-MSI return 1 } + $__log = "${__log_directory}\npm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $___process = FS-Append-File "${__serial_control}" @" +${__common}|${__log}|PACKAGE-Run-NPM +"@ + if ($___process -ne 0) { + return 1 + } + $__log = "${__log_directory}\PDF_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" $___process = FS-Append-File "${__parallel_control}" @" ${__common}|${__log}|PACKAGE-Run-PDF diff --git a/automataCI/release_unix-any.sh b/automataCI/release_unix-any.sh index 23becfe..ce49319 100644 --- a/automataCI/release_unix-any.sh +++ b/automataCI/release_unix-any.sh @@ -32,6 +32,7 @@ fi . "${LIBS_AUTOMATACI}/_release-deb_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-docker_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-homebrew_unix-any.sh" +. "${LIBS_AUTOMATACI}/_release-npm_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-pypi_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-rpm_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-staticrepo_unix-any.sh" @@ -97,42 +98,47 @@ for TARGET in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}"/*; do fi I18N_Processing "$TARGET" - RELEASE_Run_DEB "$TARGET" "$STATIC_REPO" + RELEASE_Run_CARGO "$TARGET" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_RPM "$TARGET" "$STATIC_REPO" + RELEASE_Run_CHOCOLATEY "$TARGET" "$CHOCOLATEY_REPO" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_DOCKER "$TARGET" + RELEASE_Run_CITATION_CFF "$TARGET" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_PYPI "$TARGET" + RELEASE_Run_DEB "$TARGET" "$STATIC_REPO" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_CARGO "$TARGET" + RELEASE_Run_DOCKER "$TARGET" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_CITATION_CFF "$TARGET" + RELEASE_Run_HOMEBREW "$TARGET" "$HOMEBREW_REPO" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_HOMEBREW "$TARGET" "$HOMEBREW_REPO" + RELEASE_Run_NPM "$TARGET" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_CHOCOLATEY "$TARGET" "$CHOCOLATEY_REPO" + RELEASE_Run_PYPI "$TARGET" + if [ $? -ne 0 ]; then + return 1 + fi + + RELEASE_Run_RPM "$TARGET" "$STATIC_REPO" if [ $? -ne 0 ]; then return 1 fi diff --git a/automataCI/release_windows-any.ps1 b/automataCI/release_windows-any.ps1 index 862d26b..19bfa64 100644 --- a/automataCI/release_windows-any.ps1 +++ b/automataCI/release_windows-any.ps1 @@ -31,6 +31,7 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { . "${env:LIBS_AUTOMATACI}\_release-deb_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-docker_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-homebrew_windows-any.ps1" +. "${env:LIBS_AUTOMATACI}\_release-npm_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-pypi_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-rpm_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-staticrepo_windows-any.ps1" @@ -100,42 +101,47 @@ if (Test-Path -PathType Container -Path "${PACKAGE_DIRECTORY}") { $null = I18N-Processing "${TARGET}" - $___process = RELEASE-Run-DEB "$TARGET" "$STATIC_REPO" + $___process = RELEASE-Run-CARGO "$TARGET" if ($___process -ne 0) { return 1 } - $___process = RELEASE-Run-RPM "$TARGET" "$STATIC_REPO" ` + $___process = RELEASE-Run-CITATION-CFF "$TARGET" if ($___process -ne 0) { return 1 } - $___process = RELEASE-Run-DOCKER "$TARGET" + $___process = RELEASE-Run-CHOCOLATEY "$TARGET" "$CHOCOLATEY_REPO" if ($___process -ne 0) { return 1 } - $___process = RELEASE-Run-PYPI "$TARGET" + $___process = RELEASE-Run-DEB "$TARGET" "$STATIC_REPO" if ($___process -ne 0) { return 1 } - $___process = RELEASE-Run-CARGO "$TARGET" + $___process = RELEASE-Run-DOCKER "$TARGET" if ($___process -ne 0) { return 1 } - $___process = RELEASE-Run-CITATION-CFF "$TARGET" + $___process = RELEASE-Run-HOMEBREW "$TARGET" "$HOMEBREW_REPO" if ($___process -ne 0) { return 1 } - $___process = RELEASE-Run-HOMEBREW "$TARGET" "$HOMEBREW_REPO" + $___process = RELEASE-Run-NPM "$TARGET" if ($___process -ne 0) { return 1 } - $___process = RELEASE-Run-CHOCOLATEY "$TARGET" "$CHOCOLATEY_REPO" + $___process = RELEASE-Run-PYPI "$TARGET" + if ($___process -ne 0) { + return 1 + } + + $___process = RELEASE-Run-RPM "$TARGET" "$STATIC_REPO" ` if ($___process -ne 0) { return 1 } diff --git a/automataCI/services/archive/tar.ps1 b/automataCI/services/archive/tar.ps1 index bb0e0a8..a73ab55 100644 --- a/automataCI/services/archive/tar.ps1 +++ b/automataCI/services/archive/tar.ps1 @@ -1,4 +1,4 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy @@ -116,6 +116,11 @@ function TAR-Create-GZ { return 1 } + $___process = GZ-Is-Available + if ($___process -ne 0) { + return 1 + } + # create tar archive $___dest = $___destination -replace '\.gz.*$' @@ -184,3 +189,89 @@ function TAR-Create-XZ { # report status return 0 } + + + + +function TAR-Extract-GZ { + param ( + [string]$___destination, + [string]$___source + ) + + + # validate input + if (($(STRINGS-Is-Empty "${___destination}") -eq 0) -or + ($(STRINGS-Is-Empty "${___source}") -eq 0)) { + return 1 + } + + $___process = FS-Is-File "${___destination}" + if ($___process -eq 0) { + return 1 + } + + $___process = FS-Is-File "${___source}" + if ($___process -ne 0) { + return 1 + } + + $___process = GZ-Is-Available + if ($___process -ne 0) { + return 1 + } + + + # unpack tar.gz + $___process = OS-Exec "tar" "-xzf `"${___destination}`" -C `"${___source}`"" + if ($___process -ne 0) { + return 1 + } + + + # report status + return 0 +} + + + + +function TAR-Extract-XZ { + param ( + [string]$___destination, + [string]$___source + ) + + + # validate input + if (($(STRINGS-Is-Empty "${___destination}") -eq 0) -or + ($(STRINGS-Is-Empty "${___source}") -eq 0)) { + return 1 + } + + $___process = FS-Is-File "${___destination}" + if ($___process -eq 0) { + return 1 + } + + $___process = FS-Is-File "${___source}" + if ($___process -ne 0) { + return 1 + } + + $___process = XZ-Is-Available + if ($___process -ne 0) { + return 1 + } + + + # unpack tar.xz + $___process = OS-Exec "tar" "-xf `"${___destination}`" -C `"${___source}`"" + if ($___process -ne 0) { + return 1 + } + + + # report status + return 0 +} diff --git a/automataCI/services/archive/tar.sh b/automataCI/services/archive/tar.sh index 5a8ab13..56a4689 100644 --- a/automataCI/services/archive/tar.sh +++ b/automataCI/services/archive/tar.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -105,6 +105,11 @@ TAR_Create_GZ() { return 1 fi + GZ_Is_Available + if [ $? -ne 0 ]; then + return 1 + fi + # create tar archive TAR_Create "${1%.gz*}" "$2" "$3" "$4" @@ -172,3 +177,83 @@ TAR_Create_XZ() { # report status return 0 } + + + + +TAR_Extract_GZ() { + #___destination="$1" + #___source="$2" + + + # validate input + if [ $(STRINGS_Is_Empty "$1") -eq 0 ] || [ $(STRINGS_Is_Empty "$2") -eq 0 ]; then + return 1 + fi + + FS_Is_File "$1" + if [ $? -eq 0 ]; then + return 1 + fi + + FS_Is_File "$2" + if [ $? -ne 0 ]; then + return 1 + fi + + GZ_Is_Available + if [ $? -ne 0 ]; then + return 1 + fi + + + # unpack tar.gz + tar -xzf "$2" -C "$1" + if [ $? -ne 0 ]; then + return 1 + fi + + + # report status + return 0 +} + + + + +TAR_Extract_XZ() { + #___destination="$1" + #___source="$2" + + + # validate input + if [ $(STRINGS_Is_Empty "$1") -eq 0 ] || [ $(STRINGS_Is_Empty "$2") -eq 0 ]; then + return 1 + fi + + FS_Is_File "$1" + if [ $? -eq 0 ]; then + return 1 + fi + + FS_Is_File "$2" + if [ $? -ne 0 ]; then + return 1 + fi + + XZ_Is_Available + if [ $? -ne 0 ]; then + return 1 + fi + + + # unpack tar.xz + tar -xf "$2" -C "$1" + if [ $? -ne 0 ]; then + return 1 + fi + + + # report status + return 0 +} diff --git a/automataCI/services/archive/zip.ps1 b/automataCI/services/archive/zip.ps1 index 2dde8d6..cbe7d3c 100644 --- a/automataCI/services/archive/zip.ps1 +++ b/automataCI/services/archive/zip.ps1 @@ -1,4 +1,4 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" @@ -50,26 +51,25 @@ function ZIP-Extract { # validate input - $___process = FS-Is-File "${___source}" + $___process = FS-Is-Directory "${___destination}" if ($___process -ne 0) { return 1 } - $___process = FS-Is-File "${___destination}" - if ($___process -eq 0) { + $___process = FS-Is-File "${___source}" + if ($___process -ne 0) { return 1 } # execute + $null = FS-Make-Directory "${___destination}" try { - $null = FS-Make-Directory "${___destination}" $null = Expand-Archive -Path $___source -DestinationPath $___destination } catch { return 1 } - # report status return 0 } diff --git a/automataCI/services/archive/zip.sh b/automataCI/services/archive/zip.sh index 905a312..7aa6354 100644 --- a/automataCI/services/archive/zip.sh +++ b/automataCI/services/archive/zip.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -10,8 +10,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. -. "${LIBS_AUTOMATACI}/services/io/os.sh" . "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/io/os.sh" @@ -53,13 +53,13 @@ ZIP_Extract() { return 1 fi - FS_Is_File "$___source" + FS_Is_Directory "$___destination" if [ $? -ne 0 ]; then return 1 fi - FS_Is_File "$___destination" - if [ $? -eq 0 ]; then + FS_Is_File "$___source" + if [ $? -ne 0 ]; then return 1 fi @@ -86,6 +86,11 @@ ZIP_Is_Available() { return 0 fi + OS_Is_Command_Available "unzip" + if [ $? -eq 0 ]; then + return 0 + fi + # report status return 1 diff --git a/automataCI/services/compilers/node.ps1 b/automataCI/services/compilers/node.ps1 index 8de6601..05253a4 100644 --- a/automataCI/services/compilers/node.ps1 +++ b/automataCI/services/compilers/node.ps1 @@ -9,7 +9,316 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" . "${env:LIBS_AUTOMATACI}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\net\http.ps1" +. "${env:LIBS_AUTOMATACI}\services\archive\tar.ps1" +. "${env:LIBS_AUTOMATACI}\services\archive\zip.ps1" + + + + +function NODE-Activate-Local-Environment { + # validate input + $___process = NODE-Is-Localized + if ($___process -eq 0) { + $___process = NODE-Is-Available + if ($___process -ne 0) { + return 1 + } + + return 0 + } + + + # execute + $___location = "$(NODE-Get-Activator-Path)" + $___process = FS-Is-File "${___location}" + if ($___process -ne 0) { + Write-Host "FAILED Act 1" + return 1 + } + + . "${___location}" + $___process = NODE-Is-Localized + if ($___process -ne 0) { + Write-Host "FAILED Act 2" + return 1 + } + + $___process = NODE-Is-Available + if ($___process -ne 0) { + Write-Host "FAILED Act 3" + return 1 + } + + + # report status + return 0 +} + + + + +function NODE-Get-Activator-Path { + return "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TOOLS}\${env:PROJECT_PATH_NODE_ENGINE}\Activate.ps1" +} + + + + +function NODE-Is-Available { + # execute + $null = OS-Sync + + if ($(STRINGS-Is-Empty "${env:PROJECT_NODE_VERSION}") -ne 0) { + ## check existing localized engine + $___target = "$(NODE-Get-Activator-Path)" + $___process = FS-Is-File "${___target}" + if ($___process -ne 0) { + Write-Host "DEBUG: failed 1" + return 1 + } + $___target = "$(FS-Get-Directory "${___target}")" + + ## check localized node command availability + $___process = FS-Is-File "${___target}\node.exe" + if ($___process -ne 0) { + Write-Host "DEBUG: failed 2" + return 1 + } + + ## check localized npm command availability + $___process = FS-Is-File "${___target}\npm" + if ($___process -ne 0) { + Write-Host "DEBUG: failed 3" + return 1 + } + + ## check localized npm command availability + $___process = FS-Is-File "${___target}\npx" + if ($___process -ne 0) { + Write-Host "DEBUG: failed 4" + return 1 + } + + return 0 + } + + $___process = OS-Is-Command-Available "npm" + if ($___process -ne 0) { + return 1 + } + + $___process = OS-Is-Command-Available "npx" + if ($___process -ne 0) { + return 1 + } + + $___process = OS-Is-Command-Available "node" + if ($___process -ne 0) { + return 1 + } + + + # report status + return 1 +} + + + + +function NODE-Is-Localized { + # execute + if ($(STRINGS-Is-Empty "${env:PROJECT_NODE_LOCALIZED}") -ne 0) { + return 0 + } + + + # report status + return 1 +} + + + + +function NODE-NPM-Check-Login { + # execute + if ($(STRINGS-Is-Empty "${env:PROJECT_NODE_NPM_REGISTRY}") -eq 0) { + return 1 + } + + if ($(STRINGS-Is-Empty "${env:NPM_USERNAME}") -eq 0) { + return 1 + } + + if ($(STRINGS-Is-Empty "${env:NPM_TOKEN}") -eq 0) { + return 1 + } + + if ($(STRINGS-Is-Empty "${env:PROJECT_SCOPE}") -eq 0) { + return 1 + } + + + # report status + return 0 +} + + + + +function NODE-NPM-Install-Dependencies-All { + # validate input + $___process = NODE-Is-Available + if ($___process -ne 0) { + return 1 + } + + + # execute + $___process = OS-Exec "npm" "install" + if ($___process -ne 0) { + return 1 + } + + + # report status + return 0 +} + + + + +function NODE-NPM-Is-Valid { + param( + [string]$___target + ) + + + # validate input + if ($(STRINGS-Is-Empty "${___target}") -eq 0) { + return 1 + } + + $___process = FS-Is-File "$1" + if ($___process -ne 0) { + return 1 + } + + + # execute + $___process = FS-Is-Target-A-NPM "$1" + if ($___process -ne 0) { + return 1 + } + + + # report status + return 0 +} + + + + +function NODE-NPM-Publish { + param( + [string]$___target + ) + + + # validate input + if ($(STRINGS-Is-Empty "$1") -eq 0) { + return 1 + } + + $___process = FS-Is-File "${___target}" + if ($___process -ne 0) { + return 1 + } + + $___process = NODE-Is-Available + if ($___process -ne 0) { + return 1 + } + + + # execute + $___workspace = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\release-npm" + $___package = "${env:PROJECT_SKU}.tgz" + $___npmrc = ".npmrc" + + ## setup workspace + $___process = FS-Remake-Directory "${___workspace}" + $___current_path = Get-Location + $null = Set-Location "${___workspace}" + + $___process = FS-Copy-File "${___target}" "${___package}" + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Write-File "${___npmrc}" @" +registry=${env:PROJECT_NODE_NPM_REGISTRY} +scope=@${env:PROJECT_SCOPE} +email=$env:NPM_USERNAME +//${PROJECT_NODE_NPM_REGISTRY#*://}/:_authToken=${env:NPM_TOKEN} +"@ + if ($___process -ne 0) { + $null = FS-Remove-Silently "${___npmrc}" + return 1 + } + + $___process = FS-Is-File "${___npmrc}" + if ($___process -ne 0) { + return 1 + } + + ## publish + $___process = OS-Exec "npm" "publish `"${___package}`"" + $null = FS-Remove-Silently "${___npmrc}" + $null = Set-Location "${___current_path}" + $null = Remove-Variable ___current_path + if ($___process -ne 0) { + return 1 + } + + + # report status + return 0 +} + + + + +function NODE-NPM-Run { + param( + [string]$___name + ) + + + # validate input + $___process = NODE-Is-Available + if ($___process -ne 0) { + return 1 + } + + if ($(STRINGS-Is-Empty "${___name}") -eq 0) { + return 1 + } + + + # execute + $___process = OS-Exec "npm" "run `"${___name}`"" + if ($___process -ne 0) { + return 1 + } + + + # report status + return 0 +} @@ -18,19 +327,125 @@ function NODE-Setup { # validate input $null = OS-Sync - $___process = OS-Is-Command-Available "npm" + $___process = NODE-Is-Available if ($___process -eq 0) { return 0 } - $___process = OS-Is-Command-Available "choco" + + # execute + $___filepath = "" + switch ("${env:PROJECT_ARCH}") { + "amd64" { + $___filepath = "x64" + } "arm" { + $___filepath = "armv7l" + } "arm64" { + $___filepath = "arm64" + } "ppc64le" { + $___filepath = "ppc64le" + } "s390x" { + $___filepath = "s390x" + } default { + return 1 + }} + + switch ("${env:PROJECT_OS}") { + "aix" { + $___filepath = "aix-${___filepath}.tar.xz" + } "darwin" { + $___filepath = "darwin-${___filepath}.tar.xz" + } "windows" { + $___filepath = "win-${___filepath}.zip" + } "linux" { + $___filepath = "linux-${___filepath}.tar.xz" + } default { + return 1 + }} + + ## download engine + $___filepath = "node-${env:PROJECT_NODE_VERSION}-${___filepath}" + $___url = "https://nodejs.org/dist/${env:PROJECT_NODE_VERSION}/${___filepath}" + $___filepath = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TOOLS}\${___filepath}" + + $null = FS-Make-Housing-Directory "${___filepath}" + $null = FS-Remove-Silently "${___filepath}" + $___process = HTTP-Download "GET" "${___url}" "${___filepath}" + if ($___process -ne 0) { + return 1 + } + + ## unpack engine + $___process = FS-Is-File "${___filepath}" if ($___process -ne 0) { return 1 } + ls -Path "$(FS-Get-Directory "${___filepath}")" - # execute - $___process = OS-Exec "choco" "install node -y" + $___location = "$(NODE-Get-Activator-Path)" + $null = FS-Remove-Silently "$(FS-Get-Directory "${___location}")" + + $___target = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TOOLS}\" + switch ("${env:PROJECT_OS}") { + "windows" { + $___process = ZIP-Extract "${___target}" "${___filepath}" + $null = FS-Remove-Silently "${___filepath}" + $___target = FS-Extension-Replace "${___filepath}" ".zip" "" + } default { + $___process = TAR-Extract-XZ "${___target}" "${___filepath}" + $null = FS-Remove-Silently "${___filepath}" + $___target = FS-Extension-Replace "${___filepath}" ".tar.xz" "" + }} + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Move "${___target}" "$(FS-Get-Directory "${___location}")" + if ($___process -ne 0) { + return 1 + } + + + ## create activator script + $___label = "(${env:PROJECT_PATH_NODE_ENGINE})" + $___target = "$(FS-Get-Directory "${___location}")" + $null = FS-Write-File "${___location}" @" +`$___target = `"${___target}`" + + +function deactivate { + `$env:Path = (`$env:Path.Split(';') | Where-Object { `$_ -ne "`${___target}" }) -join ';' + + `${env:PROJECT_NODE_LOCALIZED} = `$null + Copy-Item -Path Function:_OLD_PROMPT -Destination Function:prompt + Remove-Item -Path Function:_OLD_PROMPT +} + + +# check existing +if (-not [string]::IsNullOrEmpty(`${env:PROJECT_NODE_LOCALIZED})) { + return +} + + +# activate +`$env:Path = `$env:Path + ";" + "`${___target}" + +`${env:PROJECT_NODE_LOCALIZED} = "${___location}" +`$null = Copy-Item -Path function:prompt -Destination function:_OLD_PROMPT +function global:prompt { + Write-Host -NoNewline -ForegroundColor Green "(${___label}) " + _OLD_VIRTUAL_PROMPT +} +"@ + $___process = FS-Is-File "${___location}" + if ($___process -ne 0) { + return 1 + } + + ## test activator script + $___process = NODE-Activate-Local-Environment if ($___process -ne 0) { return 1 } diff --git a/automataCI/services/compilers/node.sh b/automataCI/services/compilers/node.sh index 349ed6f..dc21a0b 100644 --- a/automataCI/services/compilers/node.sh +++ b/automataCI/services/compilers/node.sh @@ -10,30 +10,448 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. +. "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/io/strings.sh" +. "${LIBS_AUTOMATACI}/services/io/net/http.sh" +. "${LIBS_AUTOMATACI}/services/archive/tar.sh" +. "${LIBS_AUTOMATACI}/services/archive/zip.sh" -NODE_Setup() { +NODE_Activate_Local_Environment() { # validate input - OS_Is_Command_Available "npm" + NODE_Is_Localized if [ $? -eq 0 ]; then + NODE_Is_Available + if [ $? -ne 0 ]; then + return 1 + fi + return 0 fi - OS_Is_Command_Available "brew" + + # execute + ___location="$(NODE_Get_Activator_Path)" + FS_Is_File "$___location" + if [ $? -ne 0 ]; then + return 1 + fi + + . "$___location" + NODE_Is_Localized + if [ $? -ne 0 ]; then + return 1 + fi + + NODE_Is_Available if [ $? -ne 0 ]; then return 1 fi + # report status + return 0 +} + + + + +NODE_Get_Activator_Path() { + printf -- "${PROJECT_PATH_ROOT}/${PROJECT_PATH_TOOLS}/${PROJECT_PATH_NODE_ENGINE}/activate.sh" +} + + + + +NODE_Is_Available() { # execute - brew install node + if [ $(STRINGS_Is_Empty "$PROJECT_NODE_VERSION") -ne 0 ]; then + ## check existing localized engine + ___target="$(NODE_Get_Activator_Path)" + FS_Is_File "$___target" + if [ $? -ne 0 ]; then + return 1 + fi + ___target="$(FS_Get_Directory "$___target")" + + ## check localized node command availablity + FS_Is_File "${___target}/bin/node" + if [ $? -ne 0 ]; then + return 1 + fi + + ## check localized npm command availablity + FS_Is_File "${___target}/bin/npm" + if [ $? -ne 0 ]; then + return 1 + fi + + ## check localized npm command availablity + FS_Is_File "${___target}/bin/npx" + if [ $? -ne 0 ]; then + return 1 + fi + + return 0 + fi + + OS_Is_Command_Available "npm" + if [ $? -ne 0 ]; then + return 1 + fi + + OS_Is_Command_Available "npx" if [ $? -ne 0 ]; then return 1 fi + OS_Is_Command_Available "node" + if [ $? -ne 0 ]; then + return 1 + fi + + + # report status + return 1 +} + + + + +NODE_Is_Localized() { + # execute + if [ $(STRINGS_Is_Empty "$PROJECT_NODE_LOCALIZED") -ne 0 ] ; then + return 0 + fi + + + # report status + return 1 +} + + + + +NODE_NPM_Check_Login() { + # execute + if [ $(STRINGS_Is_Empty "$PROJECT_NODE_NPM_REGISTRY") -eq 0 ]; then + return 1 + fi + + if [ $(STRINGS_Is_Empty "$NPM_USERNAME") -eq 0 ]; then + return 1 + fi + + if [ $(STRINGS_Is_Empty "$NPM_TOKEN") -eq 0 ]; then + return 1 + fi + + if [ $(STRINGS_Is_Empty "$PROJECT_SCOPE") -eq 0 ]; then + return 1 + fi + + + # report status + return 0 +} + + + + +NODE_NPM_Install_Dependencies_All() { + # validate input + NODE_Is_Available + if [ $? -ne 0 ]; then + return 1 + fi + + + # execute + npm install + if [ $? -ne 0 ]; then + return 1 + fi + + + # report status + return 0 +} + + + + +NODE_NPM_Is_Valid() { + #___target="$1" + + + # validate input + if [ $(STRINGS_Is_Empty "$1") -eq 0 ]; then + return 1 + fi + + FS_Is_File "$1" + if [ $? -ne 0 ]; then + return 1 + fi + + + # execute + FS_Is_Target_A_NPM "$1" + if [ $? -ne 0 ]; then + return 1 + fi + + + # report status + return 0 +} + + + + +NODE_NPM_Publish() { + #___target="$1" + + + # validate input + if [ $(STRINGS_Is_Empty "$1") -eq 0 ]; then + return 1 + fi + + FS_Is_File "$1" + if [ $? -ne 0 ]; then + return 1 + fi + + NODE_Is_Available + if [ $? -ne 0 ]; then + return 1 + fi + + + # execute + ___workspace="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/release-npm" + ___package="${PROJECT_SKU}.tgz" + ___npmrc=".npmrc" + + ## setup workspace + FS_Remake_Directory "$___workspace" + ___current_path="$PWD" && cd "$___workspace" + + FS_Copy_File "$1" "$___package" + if [ $? -ne 0 ]; then + return 1 + fi + + FS_Write_File "$___npmrc" "\ +registry=${PROJECT_NODE_NPM_REGISTRY} +scope=@${PROJECT_SCOPE} +email=${NPM_USERNAME} +//${PROJECT_NODE_NPM_REGISTRY#*://}/:_authToken=${NPM_TOKEN} +" + if [ $? -ne 0 ]; then + FS_Remove_Silently "$___npmrc" + return 1 + fi + + FS_Is_File "$___npmrc" + if [ $? -ne 0 ]; then + return 1 + fi + + ## publish + npm publish "$___package" + ___process=$? + FS_Remove_Silently "$___npmrc" + cd "$___current_path" && ___current_path + if [ $___process -ne 0 ]; then + return 1 + fi + + + # report status + return 0 +} + + + + +NODE_NPM_Run() { + #___name="$1" + + + # validate input + NODE_Is_Available + if [ $? -ne 0 ]; then + return 1 + fi + + if [ $(STRINGS_Is_Empty "$1") -eq 0 ]; then + return 1 + fi + + + # execute + npm run "$1" + if [ $? -ne 0 ]; then + return 1 + fi + + + # report status + return 0 +} + + + + +NODE_Setup() { + # validate input + NODE_Is_Available + if [ $? -eq 0 ]; then + return 0 + fi + + + # execute + ___filepath="" + case "$PROJECT_ARCH" in + amd64) + ___filepath="x64" + ;; + arm) + ___filepath="armv7l" + ;; + arm64) + ___filepath="arm64" + ;; + ppc64le) + ___filepath="ppc64le" + ;; + s390x) + ___filepath="s390x" + ;; + *) + return 1 + ;; + esac + + case "$PROJECT_OS" in + aix) + ___filepath="aix-${___filepath}.tar.xz" + ;; + darwin) + ___filepath="darwin-${___filepath}.tar.xz" + ;; + windows) + ___filepath="win-${___filepath}.zip" + ;; + linux) + ___filepath="linux-${___filepath}.tar.xz" + ;; + *) + return 1 + ;; + esac + + ## download engine + ___filepath="node-${PROJECT_NODE_VERSION}-${___filepath}" + ___url="https://nodejs.org/dist/${PROJECT_NODE_VERSION}/${___filepath}" + ___filepath="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TOOLS}/${___filepath}" + + FS_Make_Housing_Directory "$___filepath" + FS_Remove_Silently "$___filepath" + HTTP_Download "GET" "$___url" "$___filepath" + if [ $? -ne 0 ]; then + return 1 + fi + + ## unpack engine + FS_Is_File "$___filepath" + if [ $? -ne 0 ]; then + return 1 + fi + + ___location="$(NODE_Get_Activator_Path)" + FS_Remove_Silently "$(FS_Get_Directory "$___location")" + + ___target="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TOOLS}/" + case "$PROJECT_OS" in + windows) + ZIP_Extract "$___target" "$___filepath" + ___process=$? + FS_Remove_Silently "$___filepath" + ___target="$(FS_Extension_Replace "$___filepath" ".zip" "")" + ;; + *) + TAR_Extract_XZ "$___target" "$___filepath" + ___process=$? + FS_Remove_Silently "$___filepath" + ___target="$(FS_Extension_Replace "$___filepath" ".tar.xz" "")" + ;; + esac + if [ $___process -ne 0 ]; then + return 1 + fi + + FS_Move "$___target" "$(FS_Get_Directory "$___location")" + if [ $? -ne 0 ]; then + return 1 + fi + + + ## create activator script + ___label="($PROJECT_PATH_NODE_ENGINE)" + ___target="$(FS_Get_Directory "$___location")/bin" + FS_Write_File "$___location" "\ +#!/bin/sh +___target=\"${___target}\" + + +deactivate() { + ___path=:\$PATH: + ___path=\${___path/:\$___target:/:} + ___path=\${___path%:} + ___path=\${___path#:} + PATH=\$___path + + export PS1=\"\${PS1##*${___label} }\" + unset PROJECT_NODE_LOCALIZED + return 0 +} + + + + +# check +if [ ! -z \"\$PROJECT_NODE_LOCALIZED\" ]; then + return 0 +fi + + + + +# activate +export PATH=\"\${___target}:\${PATH}\" + +export PROJECT_NODE_LOCALIZED='${___location}' +export PS1=\"${___label} \${PS1}\" +return 0 +" + FS_Is_File "$___location" + if [ $? -ne 0 ]; then + return 1 + fi + + ## test activator script + NODE_Activate_Local_Environment + if [ $? -ne 0 ] ; then + return 1 + fi + # report status return 0 diff --git a/automataCI/services/io/fs.ps1 b/automataCI/services/io/fs.ps1 index b1dfd0d..45d0437 100644 --- a/automataCI/services/io/fs.ps1 +++ b/automataCI/services/io/fs.ps1 @@ -106,47 +106,55 @@ function FS-Extension-Remove { function FS-Extension-Replace { param ( - [string]$__target, + [string]$___path, [string]$___extension, [string]$___candidate ) # validate input - if ([string]::IsNullOrEmpty($__target)) { + if ([string]::IsNullOrEmpty($___path)) { return "" } # execute + ## prepare working parameters + $___target = Split-Path -Leaf "${___path}" + if ($___extension -eq "*") { - $___target = Split-Path -Leaf "${__target}" + ## trim all extensions to the first period $___target = $___target -replace '(\.\w+)+$' - if (-not [string]::IsNullOrEmpty($(Split-Path -Parent "${__target}"))) { - $___target = $(Split-Path -Parent "${__target}") + "\" + "${___target}" + ## restore directory pathing when available + if (-not [string]::IsNullOrEmpty($(Split-Path -Parent "${___path}"))) { + $___target = $(Split-Path -Parent "${___path}") + "\" + "${___target}" } } elseif (-not [string]::IsNullOrEmpty($___extension)) { + ## trim off existing extension if ($___extension.Substring(0,1) -eq ".") { $___extension = $___extension.Substring(1) } - - $___target = Split-Path -Leaf "${__target}" $___target = $___target -replace "\.${___extension}$" - if (-not [string]::IsNullOrEmpty($___candidate)) { - if ($___candidate.Substring(0,1) -eq ".") { - $___target += "." + $___candidate.Substring(1) - } else { - $___target += "." + $___candidate + ## append new extension when available + if ($___target -ne $___path) { + if (-not [string]::IsNullOrEmpty($___candidate)) { + if ($___candidate.Substring(0,1) -eq ".") { + $___target += "." + $___candidate.Substring(1) + } else { + $___target += "." + $___candidate + } } } - if (-not [string]::IsNullOrEmpty($(Split-Path -Parent "${__target}"))) { - $___target = $(Split-Path -Parent "${__target}") + "\" + "${___target}" + ## restore directory pathing when available + if (-not [string]::IsNullOrEmpty($(Split-Path -Parent "${___path}"))) { + $___target = $(Split-Path -Parent "${___path}") + "\" + "${___target}" } } else { - $___target = $__target + ## do nothing + $___target = $___path } @@ -474,6 +482,25 @@ function FS-Is-Target-A-MSI { +function FS-Is-Target-A-NPM { + param ( + [string]$___target + ) + + + # execute + if ($("${___target}" -replace '^.*_js-js.tgz') -ne "${___target}") { + return 0 + } + + + # report status + return 1 +} + + + + function FS-Is-Target-A-Nupkg { param ( [string]$___target @@ -500,7 +527,7 @@ function FS-Is-Target-A-PDF { # execute - if (($("${___target}" -replace '^.*.pdf') -ne "${___target}")) { + if ($("${___target}" -replace '^.*.pdf') -ne "${___target}") { return 0 } @@ -519,7 +546,7 @@ function FS-Is-Target-A-PYPI { # execute - if (($("${___target}" -replace '^.*-pypi') -ne "${___target}")) { + if ($("${___target}" -replace '^.*-pypi') -ne "${___target}") { return 0 } diff --git a/automataCI/services/io/fs.sh b/automataCI/services/io/fs.sh index aacfa07..0e12c06 100644 --- a/automataCI/services/io/fs.sh +++ b/automataCI/services/io/fs.sh @@ -94,7 +94,7 @@ FS_Extension_Remove() { FS_Extension_Replace() { - #___target="$1" + #___path="$1" #___extension="$2" #___candidate="$3" @@ -107,34 +107,27 @@ FS_Extension_Replace() { # execute + ## prepare working parameters + ___target="${1##*/}" + if [ "$2" = "*" ]; then - ___target="${1##*/}" + ## trim all extensions to the first period ___target="${___target%%.*}" + ## restore directory pathing when available if [ ! -z "${1%/*}" ] && [ ! "${1%/*}" = "$1" ]; then ___target="${1%/*}/${___target}" fi elif [ ! -z "$2" ]; then + ## trim off existing extension if [ "$(printf -- "%.1s" "$2")" = "." ]; then ___extension="${2#*.}" else ___extension="$2" fi + ___target="${___target%.${___extension}*}" - ___target="${1##*/}" - while true; do - if [ "${___target#*.}" = "${___extension}" ]; then - ___target="${___target%.${___extension}*}" - continue - fi - - if [ ! "${___target##*.}" = "${___extension}" ]; then - break - fi - - ___target="${___target%.${___extension}*}" - done - + ## append new extension when available if [ ! "${___target}" = "${1##*/}" ]; then if [ ! -z "$3" ]; then if [ "$(printf -- "%.1s" "$3")" = "." ]; then @@ -145,17 +138,18 @@ FS_Extension_Replace() { fi fi + ## restore directory pathing when available if [ ! -z "${1%/*}" ] && [ ! "${1%/*}" = "$1" ]; then ___target="${1%/*}/${___target}" fi else + ## do nothing ___target="$1" fi - printf -- "%s" "$___target" - # report status + printf -- "%s" "$___target" return 0 } @@ -445,6 +439,25 @@ FS_Is_Target_A_MSI() { +FS_Is_Target_A_NPM() { + #___target="$1" + + + # execute + if [ "${1#*_js-js.tgz}" != "$1" ]; then + printf -- "0" + return 0 + fi + + + # report status + printf -- "1" + return 1 +} + + + + FS_Is_Target_A_Nupkg() { #___target="$1" @@ -821,7 +834,7 @@ FS_Write_File() { # perform file write - printf -- "%b" "$2" >> "$1" + printf -- "%b" "$2" > "$1" if [ $? -eq 0 ]; then return 0 fi diff --git a/automataCI/services/io/net/http.ps1 b/automataCI/services/io/net/http.ps1 index 83cf655..a695ac6 100644 --- a/automataCI/services/io/net/http.ps1 +++ b/automataCI/services/io/net/http.ps1 @@ -41,7 +41,6 @@ function HTTP-Download { $null = FS-Make-Directory (Split-Path -Path $___filepath) -ErrorAction SilentlyContinue $___user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15" - ## download payload if (-not [string]::IsNullOrEmpty($___auth_header)) { if (Get-Command curl -ErrorAction SilentlyContinue) { @@ -52,6 +51,10 @@ function HTTP-Download { --request $___method ` $___url if ($LASTEXITCODE -ne 0) { + $null = Remove-Item $___filepath ` + -Force ` + -Recurse ` + -ErrorAction SilentlyContinue return 1 } } elseif (Get-Command wget -ErrorAction SilentlyContinue) { @@ -62,9 +65,17 @@ function HTTP-Download { --method=$___method ` $___url if ($LASTEXITCODE -ne 0) { + $null = Remove-Item $___filepath ` + -Force ` + -Recurse ` + -ErrorAction SilentlyContinue return 1 } } else { + $null = Remove-Item $___filepath ` + -Force ` + -Recurse ` + -ErrorAction SilentlyContinue return 1 } } else { @@ -75,6 +86,10 @@ function HTTP-Download { --request $___method ` $___url if ($LASTEXITCODE -ne 0) { + $null = Remove-Item $___filepath ` + -Force ` + -Recurse ` + -ErrorAction SilentlyContinue return 1 } } elseif (Get-Command wget -ErrorAction SilentlyContinue) { @@ -84,9 +99,17 @@ function HTTP-Download { --method=$___method ` $___url if ($LASTEXITCODE -ne 0) { + $null = Remove-Item $___filepath ` + -Force ` + -Recurse ` + -ErrorAction SilentlyContinue return 1 } } else { + $null = Remove-Item $___filepath ` + -Force ` + -Recurse ` + -ErrorAction SilentlyContinue return 1 } } diff --git a/automataCI/services/io/net/http.sh b/automataCI/services/io/net/http.sh index 9179c48..8953209 100644 --- a/automataCI/services/io/net/http.sh +++ b/automataCI/services/io/net/http.sh @@ -48,6 +48,10 @@ HTTP_Download() { --output "$___filepath" \ --request "$___method" \ "$___url" + if [ $? -ne 0 ]; then + rm -rf "$___filepath" &> /dev/null + return 1 + fi elif [ ! -z "$(type -t wget)" ]; then wget --max-redirect 16 \ --header "$___user_agent" \ @@ -55,7 +59,12 @@ HTTP_Download() { --output-file"$___filepath" \ --method="$___method" \ "$___url" + if [ $? -ne 0 ]; then + rm -rf "$___filepath" &> /dev/null + return 1 + fi else + rm -rf "$___filepath" &> /dev/null return 1 fi else @@ -65,13 +74,22 @@ HTTP_Download() { --output "$___filepath" \ --request "$___method" \ "$___url" + if [ $? -ne 0 ]; then + rm -rf "$___filepath" &> /dev/null + return 1 + fi elif [ ! -z "$(type -t wget)" ]; then wget --max-redirect 16 \ --header "$___user_agent" \ --output-file"$___filepath" \ --method="$___method" \ "$___url" + if [ $? -ne 0 ]; then + rm -rf "$___filepath" &> /dev/null + return 1 + fi else + rm -rf "$___filepath" &> /dev/null return 1 fi fi diff --git a/automataCI/services/io/os.ps1 b/automataCI/services/io/os.ps1 index e95420a..e9df560 100644 --- a/automataCI/services/io/os.ps1 +++ b/automataCI/services/io/os.ps1 @@ -212,6 +212,29 @@ function OS-Is-Run-Simulated { +function OS-Remove-Path { + param( + [string]$___path + ) + + + # validate input + if ([string]::IsNullOrEmpty("${___path}")) { + return 1 + } + + + # execute + $env:Path = ($env:Path.Split(';') | Where-Object { $_ -ne "${___path}" }) -join ';' + + + # report status + return 0 +} + + + + function OS-Sync { $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") ` + ";" ` diff --git a/automataCI/services/io/os.sh b/automataCI/services/io/os.sh index edcaad1..e5f4ba1 100644 --- a/automataCI/services/io/os.sh +++ b/automataCI/services/io/os.sh @@ -147,6 +147,31 @@ OS_Is_Run_Simulated() { +OS_Remove_Path() { + #___path="$1" + + + # validate input + if [ -z "$1" ]; then + return 1 + fi + + + # execute + ___paths=:$PATH: + ___paths=${___paths/:$1:/:} + ___paths=${___paths%:} + ___paths=${___paths#:} + PATH=$___paths + + + # report status + return 0 +} + + + + OS_Sync() { # execute sync diff --git a/src/.ci/_package-archive_unix-any.sh b/src/.ci/_package-archive_unix-any.sh index c29a708..81c934b 100644 --- a/src/.ci/_package-archive_unix-any.sh +++ b/src/.ci/_package-archive_unix-any.sh @@ -87,6 +87,8 @@ PACKAGE_Assemble_ARCHIVE_Content() { return 10 # not applicable elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then return 10 # not applicable + elif [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then + return 10 # not applicable else I18N_Assemble "$_target" "$_directory" FS_Copy_File "$_target" "$_directory" diff --git a/src/.ci/_package-archive_windows-any.ps1 b/src/.ci/_package-archive_windows-any.ps1 index 88413ee..38b15bb 100644 --- a/src/.ci/_package-archive_windows-any.ps1 +++ b/src/.ci/_package-archive_windows-any.ps1 @@ -88,6 +88,8 @@ function PACKAGE-Assemble-ARCHIVE-Content { return 10 # not applicable } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { return 10 # not applicable + } elseif ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { + return 10 # not applicable } else { $null = I18N-Assemble "${_target}" "${_directory}" $___process = FS-Copy-File "${_target}" "${_directory}" diff --git a/src/.ci/_package-deb_unix-any.sh b/src/.ci/_package-deb_unix-any.sh index 84cb601..677cf8a 100644 --- a/src/.ci/_package-deb_unix-any.sh +++ b/src/.ci/_package-deb_unix-any.sh @@ -94,6 +94,8 @@ PACKAGE_Assemble_DEB_Content() { return 10 # not applicable elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then return 10 # not applicable + elif [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then + return 10 # not applicable else # copy main program # TIP: (1) usually is: usr/local/bin or usr/local/sbin diff --git a/src/.ci/_package-deb_windows-any.ps1 b/src/.ci/_package-deb_windows-any.ps1 index 716a8ab..c1b868e 100644 --- a/src/.ci/_package-deb_windows-any.ps1 +++ b/src/.ci/_package-deb_windows-any.ps1 @@ -97,6 +97,8 @@ function PACKAGE-Assemble-DEB-Content { return 10 # not applicable } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { return 10 # not applicable + } elseif ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { + return 10 # not applicable } else { # copy main program # TIP: (1) usually is: usr/local/bin or usr/local/sbin diff --git a/src/.ci/_package-docker_unix-any.sh b/src/.ci/_package-docker_unix-any.sh index cf3e477..a981810 100644 --- a/src/.ci/_package-docker_unix-any.sh +++ b/src/.ci/_package-docker_unix-any.sh @@ -55,6 +55,8 @@ PACKAGE_Assemble_DOCKER_Content() { return 10 # not applicable elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then return 10 # not applicable + elif [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then + return 10 # not applicable fi case "$_target_os" in diff --git a/src/.ci/_package-docker_windows-any.ps1 b/src/.ci/_package-docker_windows-any.ps1 index fdfedee..b106433 100644 --- a/src/.ci/_package-docker_windows-any.ps1 +++ b/src/.ci/_package-docker_windows-any.ps1 @@ -54,6 +54,8 @@ function PACKAGE-Assemble-DOCKER-Content { return 10 # not applicable } elseif ($(FS-Is-Target-A-MSI "${_target}") -eq 0) { return 10 # not applicable + } elseif ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { + return 10 # not applicable } switch ($_target_os) { diff --git a/src/.ci/_package-flatpak_unix-any.sh b/src/.ci/_package-flatpak_unix-any.sh index 4c7a151..a9e3be3 100644 --- a/src/.ci/_package-flatpak_unix-any.sh +++ b/src/.ci/_package-flatpak_unix-any.sh @@ -63,6 +63,8 @@ PACKAGE_Assemble_FLATPAK_Content() { return 10 # not applicable elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then return 10 # not applicable + elif [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then + return 10 # not applicable elif [ ! "$_target_os" = "linux" ] && [ ! "$_target_os" = "any" ]; then return 10 # not applicable fi diff --git a/src/.ci/_package-flatpak_windows-any.ps1 b/src/.ci/_package-flatpak_windows-any.ps1 index 574197e..e606222 100644 --- a/src/.ci/_package-flatpak_windows-any.ps1 +++ b/src/.ci/_package-flatpak_windows-any.ps1 @@ -63,6 +63,8 @@ function PACKAGE-Assemble-FLATPAK-Content { return 10 # not applicable } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { return 10 # not applicable + } elseif ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { + return 10 # not applicable } elseif (($_target_os -ne "linux") -and ($_target_os -ne "any")) { return 10 # not applicable } diff --git a/src/.ci/_package-ipk_unix-any.sh b/src/.ci/_package-ipk_unix-any.sh index 4e323d5..6c85e03 100644 --- a/src/.ci/_package-ipk_unix-any.sh +++ b/src/.ci/_package-ipk_unix-any.sh @@ -80,6 +80,8 @@ PACKAGE_Assemble_IPK_Content() { return 10 # not applicable elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then return 10 # not applicable + elif [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then + return 10 # not applicable else # copy main program # TIP: (1) usually is: usr/local/bin or usr/local/sbin diff --git a/src/.ci/_package-ipk_windows-any.ps1 b/src/.ci/_package-ipk_windows-any.ps1 index 2ce9eb3..8d23c08 100644 --- a/src/.ci/_package-ipk_windows-any.ps1 +++ b/src/.ci/_package-ipk_windows-any.ps1 @@ -79,6 +79,8 @@ function PACKAGE-Assemble-IPK-Content { return 10 # not applicable } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { return 10 # not applicable + } elseif ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { + return 10 # not applicable } else { # copy main program # TIP: (1) usually is: usr/local/bin or usr/local/sbin diff --git a/src/.ci/_package-npm_unix-any.sh b/src/.ci/_package-npm_unix-any.sh new file mode 100644 index 0000000..1085301 --- /dev/null +++ b/src/.ci/_package-npm_unix-any.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +. "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + + + + +PACKAGE_Assemble_NPM_Content() { + _target="$1" + _directory="$2" + _target_name="$3" + _target_os="$4" + _target_arch="$5" + + + # validate project + if [ $(FS_Is_Target_A_NPM "$_target") -ne 0 ]; then + return 10 # not applicable + fi + + + # execute + __dest="${_directory}/${PROJECT_SKU}_${PROJECT_VERSION}_js-js.tgz" + I18N_Copy "$_target" "$__dest" + FS_Copy_File "$_target" "$__dest" + if [ $? -ne 0 ]; then + I18N_Copy_Failed + return 1 + fi + + + # report status + return 0 +} diff --git a/src/.ci/_package-npm_windows-any.ps1 b/src/.ci/_package-npm_windows-any.ps1 new file mode 100644 index 0000000..3b78307 --- /dev/null +++ b/src/.ci/_package-npm_windows-any.ps1 @@ -0,0 +1,55 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + exit 1 +} + + + + +function PACKAGE-Assemble-NPM-Content { + param ( + [string]$_target, + [string]$_directory, + [string]$_target_name, + [string]$_target_os, + [string]$_target_arch + ) + + + # validate project + if ($(FS-Is-Target-A-NPM "${_target}") -ne 0) { + return 10 # not applicable + } + + + # execute + $__dest = "${_directory}\${env:PROJECT_SKU}_${env:PROJECT_VERSION}_js-js.tgz" + $null = I18N-Copy "${_target}" "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Copy-Failed + return 1 + } + + + # report status + return 0 +} diff --git a/src/.ci/_package-rpm_unix-any.sh b/src/.ci/_package-rpm_unix-any.sh index bdcf014..6328f01 100644 --- a/src/.ci/_package-rpm_unix-any.sh +++ b/src/.ci/_package-rpm_unix-any.sh @@ -111,6 +111,8 @@ install -m 0644 copyright %{buildroot}/usr/local/share/doc/lib${PROJECT_SKU}/ return 10 # not applicable elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then return 10 # not applicable + elif [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then + return 10 # not applicable else # copy main program # TIP: (1) copy all files into "${__directory}/BUILD" directory. diff --git a/src/.ci/_package-rpm_windows-any.ps1 b/src/.ci/_package-rpm_windows-any.ps1 index 50f833b..861c293 100644 --- a/src/.ci/_package-rpm_windows-any.ps1 +++ b/src/.ci/_package-rpm_windows-any.ps1 @@ -112,6 +112,8 @@ install -m 0644 copyright %{buildroot}/usr/local/share/doc/lib${env:PROJECT_SKU} return 10 # not applicable } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { return 10 # not applicable + } elseif ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { + return 10 # not applicable } else { # copy main program # TIP: (1) usually is: usr/local/bin or usr/local/sbin diff --git a/src/.ci/package_unix-any.sh b/src/.ci/package_unix-any.sh index a3231e0..83a6d86 100644 --- a/src/.ci/package_unix-any.sh +++ b/src/.ci/package_unix-any.sh @@ -29,6 +29,7 @@ fi . "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-homebrew_unix-any.sh" . "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-ipk_unix-any.sh" . "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-msi_unix-any.sh" +. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-npm_unix-any.sh" . "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-pdf_unix-any.sh" . "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-pypi_unix-any.sh" . "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-rpm_unix-any.sh" diff --git a/src/.ci/package_windows-any.ps1 b/src/.ci/package_windows-any.ps1 index fb5b4fd..dfb0de3 100644 --- a/src/.ci/package_windows-any.ps1 +++ b/src/.ci/package_windows-any.ps1 @@ -28,6 +28,7 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { . "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-homebrew_windows-any.ps1" . "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-ipk_windows-any.ps1" . "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-msi_windows-any.ps1" +. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-npm_windows-any.ps1" . "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-pdf_windows-any.ps1" . "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-pypi_windows-any.ps1" . "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-rpm_windows-any.ps1" diff --git a/src/changelog/data/latest b/src/changelog/data/latest new file mode 100644 index 0000000..0be5ff4 --- /dev/null +++ b/src/changelog/data/latest @@ -0,0 +1,4 @@ +srcNODE: added source codes +root: renamed .src/ to src/ +root: added srcNODE/ into repository +.gitignore: added syncthing artifacts \ No newline at end of file diff --git a/src/changelog/deb/latest b/src/changelog/deb/latest new file mode 100644 index 0000000..944029b --- /dev/null +++ b/src/changelog/deb/latest @@ -0,0 +1,8 @@ +hestiaerror (0.0.1) stable; urgency=low + + * srcNODE: added source codes + * root: renamed .src/ to src/ + * root: added srcNODE/ into repository + * .gitignore: added syncthing artifacts + +-- (Holloway) Chew, Kean Ho Thu, 06 Jun 2024 15:05:14 +0800 diff --git a/srcNODE/.ci/build_unix-any.sh b/srcNODE/.ci/build_unix-any.sh new file mode 100644 index 0000000..a8702d9 --- /dev/null +++ b/srcNODE/.ci/build_unix-any.sh @@ -0,0 +1,238 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + +. "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/io/strings.sh" +. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" +. "${LIBS_AUTOMATACI}/services/archive/tar.sh" +. "${LIBS_AUTOMATACI}/services/compilers/node.sh" + + + + +# define build variables +__workspace_path="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/build-${PROJECT_SKU}_js-js" +__placeholders="\ +" + + + + +# execute +I18N_Activate_Environment +NODE_Activate_Local_Environment +if [ $? -ne 0 ]; then + I18N_Activate_Failed + return 1 +fi + + +## build the artifacts and shift it to the workspace +I18N_Build "$PROJECT_NODE" +FS_Remove_Silently "$__workspace_path" +FS_Make_Housing_Directory "$__workspace_path" + +__current_path="$PWD" && cd "${PROJECT_PATH_ROOT}/${PROJECT_NODE}" +NODE_NPM_Run "build" +___process=$? +cd "$__current_path" && unset __current_path +if [ $___process -ne 0 ]; then + I18N_Build_Failed + return 1 +fi + +___source="${PROJECT_PATH_ROOT}/${PROJECT_NODE}/dist/build" +FS_Move "$___source" "$__workspace_path" +if [ $? -ne 0 ]; then + I18N_Build_Failed + return 1 +fi + +___dest="${__workspace_path}/package.json" +___old_IFS="$IFS" +while IFS="" read -r ___line || [ -n "$___line" ]; do + ## overrides name + ___key=' "name": ' + if [ $(STRINGS_Is_Empty "${___line%%${___key}*}") -eq 0 ]; then + ___value="$(STRINGS_To_Lowercase "@${PROJECT_SCOPE}/${PROJECT_SKU}")" + FS_Append_File "$___dest" "${___key}\"${___value}\",\n" + if [ $? -ne 0 ]; then + IFS="$___old_IFS" && unset ___old_IFS + I18N_Build_Failed + return 1 + fi + + continue + fi + + ## overrides version + ___key=' "version": ' + if [ $(STRINGS_Is_Empty "${___line%%${___key}*}") -eq 0 ]; then + FS_Append_File "$___dest" "${___key}\"${PROJECT_VERSION}\",\n" + if [ $? -ne 0 ]; then + IFS="$___old_IFS" && unset ___old_IFS + I18N_Build_Failed + return 1 + fi + + continue + fi + + ## overrides description + ___key=' "description": ' + if [ $(STRINGS_Is_Empty "${___line%%${___key}*}") -eq 0 ]; then + FS_Append_File "$___dest" "${___key}\"${PROJECT_PITCH}\",\n" + if [ $? -ne 0 ]; then + IFS="$___old_IFS" && unset ___old_IFS + I18N_Build_Failed + return 1 + fi + + continue + fi + + ## overrides author + ___key=' "author": ' + if [ $(STRINGS_Is_Empty "${___line%%${___key}*}") -eq 0 ]; then + FS_Append_File "$___dest" "${___key}\"${PROJECT_CONTACT_NAME}\",\n" + if [ $? -ne 0 ]; then + IFS="$___old_IFS" && unset ___old_IFS + I18N_Build_Failed + return 1 + fi + + continue + fi + + ## overrides license + ___key=' "license": ' + if [ $(STRINGS_Is_Empty "${___line%%${___key}*}") -eq 0 ]; then + FS_Append_File "$___dest" "${___key}\"${PROJECT_LICENSE}\",\n" + if [ $? -ne 0 ]; then + IFS="$___old_IFS" && unset ___old_IFS + I18N_Build_Failed + return 1 + fi + + continue + fi + + ## overrides homepage + ___key=' "homepage": ' + if [ $(STRINGS_Is_Empty "${___line%%${___key}*}") -eq 0 ]; then + FS_Append_File "$___dest" "${___key}\"${PROJECT_CONTACT_WEBSITE}\",\n" + if [ $? -ne 0 ]; then + IFS="$___old_IFS" && unset ___old_IFS + I18N_Build_Failed + return 1 + fi + + continue + fi + + ## retain + FS_Append_File "$___dest" "${___line}\n" + if [ $? -ne 0 ]; then + IFS="$___old_IFS" && unset ___old_IFS + I18N_Build_Failed + return 1 + fi +done < "${PROJECT_PATH_ROOT}/${PROJECT_NODE}/package.json" +IFS="$___old_IFS" && unset ___old_IFS + + +## assemble assets and npm metadata files +I18N_Assemble_Package +FS_Copy_File "${PROJECT_PATH_ROOT}/README.md" "${__workspace_path}/README.md" +if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 +fi + +FS_Copy_File "${PROJECT_PATH_ROOT}/LICENSE.txt" "${__workspace_path}/LICENSE.txt" +if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 +fi + + +## export npm tarball +___dest="${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}/${PROJECT_SKU}_js-js.tar.gz" +I18N_Export "$___dest" +FS_Make_Housing_Directory "$___dest" +FS_Remove_Silently "$___dest" + +__current_path="$PWD" && cd "$__workspace_path" +TAR_Create_GZ "$___dest" "." +___process=$? +cd "$__current_path" && unset __current_path +if [ $___process -ne 0 ]; then + I18N_Export_Failed + return 1 +fi + +### IMPORTANT: npm only recognizes .tgz file extension so rename it accordingly. +___source="$___dest" +___dest="${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}/${PROJECT_SKU}_js-js.tgz" +FS_Remove_Silently "$___dest" +FS_Move "$___source" "$___dest" +if [ $___process -ne 0 ]; then + I18N_Export_Failed + return 1 +fi + + + + +# placeholding flag files +__old_IFS="$IFS" +while IFS="" read -r __line || [ -n "$__line" ]; do + if [ $(STRINGS_Is_Empty "$__line") -eq 0 ]; then + continue + fi + + + # build the file + __file="${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}/${__line}" + I18N_Build "$__line" + FS_Remove_Silently "$__file" + FS_Touch_File "$__file" + if [ $? -ne 0 ]; then + I18N_Build_Failed + IFS="$__old_IFS" && unset __old_IFS + return 1 + fi +done < +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return 1 +} + +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" +. "${env:LIBS_AUTOMATACI}\services\archive\tar.ps1" +. "${env:LIBS_AUTOMATACI}\services\compilers\node.ps1" + + + + +# define build variables +$__workspace_path = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\build-${env:PROJECT_SKU}_js-js" +$__placeholders = @( +) + + + + +# execute +$null = I18N-Activate-Environment +$___process = NODE-Activate-Local-Environment +if ($___process -ne 0) { + $null = I18N-Activate-Failed + return 1 +} + + +## build the artifacts and shift it to the workspace +$null = I18N-Build "${env:PROJECT_NODE}" +$null = FS-Remove-Silently "${__workspace_path}" +$null = FS-Make-Housing-Directory "${__workspace_path}" + +$__current_path = Get-Location +$null = Set-Location "${env:PROJECT_PATH_ROOT}\${env:PROJECT_NODE}" +$___process = NODE-NPM-Run "build" +$null = Set-Location "${__current_path}" +$null = Remove-Variable __current_path +if ($___process -ne 0) { + $null = I18N-Build-Failed + return 1 +} + +$___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_NODE}\dist\build" +$___process = FS-Move "${___source}" "${__workspace_path}" +if ($___process -ne 0) { + $null = I18N-Build-Failed + return 1 +} + +$___dest = "${___workspace_path}\package.json" +foreach ($___line in (Get-Content "${env:PROJECT_PATH_ROOT}\${env:PROJECT_NODE}\package.json")) { + ## overrides name + $___key = ' "name": ' + if ($(STRINGS-Is-Empty "$($___line -replace "^${___key}.*$")") -eq 0) { + $___value = "$(STRINGS-To-Lowercase "@${env:PROJECT_SCOPE}/${env:PROJECT_SKU}")" + $___process = FS-Append-File "${___dest}" "${___key}`"${___value}`",`n" + if ($___process -ne 0) { + $null = I18N-Build-Failed + return 1 + } + + continue + } + + ## overrides version + $___key = ' "version": ' + if ($(STRINGS-Is-Empty "$($___line -replace "^${___key}.*$")") -eq 0) { + $___process = FS-Append-File "${___dest}" "${___key}`"${env:PROJECT_VERSION}`",`n" + if ($___process -ne 0) { + $null = I18N-Build-Failed + return 1 + } + + continue + } + + ## overrides description + $___key = ' "description": ' + if ($(STRINGS-Is-Empty "$($___line -replace "^${___key}.*$")") -eq 0) { + $___process = FS-Append-File "${___dest}" "${___key}`"${env:PROJECT_PITCH}`",`n" + if ($___process -ne 0) { + $null = I18N-Build-Failed + return 1 + } + + continue + } + + ## overrides author + $___key = ' "author": ' + if ($(STRINGS-Is-Empty "$($___line -replace "^${___key}.*$")") -eq 0) { + $___process = FS-Append-File "${___dest}" "${___key}`"${env:PROJECT_CONTACT_NAME}`",`n" + if ($___process -ne 0) { + $null = I18N-Build-Failed + return 1 + } + + continue + } + + ## overrides license + $___key = ' "license": ' + if ($(STRINGS-Is-Empty "$($___line -replace "^${___key}.*$")") -eq 0) { + $___process = FS-Append-File "${___dest}" "${___key}`"${env:PROJECT_LICENSE}`",`n" + if ($___process -ne 0) { + $null = I18N-Build-Failed + return 1 + } + + continue + } + + ## overrides homepage + $___key = ' "homepage": ' + if ($(STRINGS-Is-Empty "$($___line -replace "^${___key}.*$")") -eq 0) { + $___process = FS-Append-File "${___dest}" "${___key}`"${env:PROJECT_CONTACT_WEBSITE}`",`n" + if ($___process -ne 0) { + $null = I18N-Build-Failed + return 1 + } + + continue + } + + ## retain + $___process = FS-Append-File "${___dest}" "${___line}`n" + if ($___process -ne 0) { + $null = I18N-Build-Failed + return 1 + } +} + + +## assemble assets and npm metadata files +$null = I18N-Assemble-Package +$___process = FS-Copy-File ` + "${env:PROJECT_PATH_ROOT}\README.md" ` + "${__workspace_path}\README.md" +if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 +} + +$___process = FS-Copy-File ` + "${env:PROJECT_PATH_ROOT}\LICENSE.txt" ` + "${__workspace_path}\LICENSE.txt" +if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 +} + + +## export npm tarball +$___dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BUILD}\${env:PROJECT_SKU}_js-js.tar.gz" +$null = I18N-Export "${___dest}" +$null = FS-Make-Housing-Directory "${___dest}" +$null = FS-Remove_Silently "${___dest}" + +$__current_path = Get-Location +$null = Set-Location "${__workspace_path}" +$___process = TAR-Create-GZ "${___dest}" "." +$null = Set-Location "${__current_path}" +$null = Remove-Variable __current_path +if ($___process -ne 0) { + $null = I18N-Export-Failed + return 1 +} + +### IMPORTANT: npm only recognizes .tgz file extension so rename it accordingly. +$___source = "${___dest}" +$___dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BUILD}\${env:PROJECT_SKU}_js-js.tgz" +$null = FS-Remove-Silently "${___dest}" +$___process = FS-Move "${___source}" "${___dest}" +if ($___process -ne 0) { + $null = I18N-Export-Failed + return 1 +} + + + + +# placeholding flag files +foreach ($__line in $__placeholders) { + if ($(STRINGS-Is-Empty "${__line}") -eq 0) { + continue + } + + + # build the file + $__file = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BUILD}\${__line}" + $null = I18N-Build "${__line}" + $null = FS-Remove-Silently "${__file}" + $___process = FS-Touch-File "${__file}" + if ($___process -ne 0) { + $null = I18N-Build-Failed + return 1 + } +} + + + + +# compose documentations + + + + +# report status +return 0 diff --git a/srcNODE/.ci/prepare_unix-any.sh b/srcNODE/.ci/prepare_unix-any.sh new file mode 100644 index 0000000..eb3e632 --- /dev/null +++ b/srcNODE/.ci/prepare_unix-any.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + +. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" +. "${LIBS_AUTOMATACI}/services/compilers/node.sh" + + + + +# execute +I18N_Activate_Environment +NODE_Activate_Local_Environment +if [ $? -ne 0 ]; then + I18N_Activate_Failed + return 1 +fi + + +I18N_Import_Dependencies +__current_path="$PWD" && cd "${PROJECT_PATH_ROOT}/${PROJECT_NODE}" +NODE_NPM_Install_Dependencies_All +___process=$? +cd "$__current_path" && unset __current_path +if [ $___process -ne 0 ]; then + I18N_Import_Failed + return 1 +fi + + + + +# report status +return 0 diff --git a/srcNODE/.ci/prepare_windows-any.ps1 b/srcNODE/.ci/prepare_windows-any.ps1 new file mode 100644 index 0000000..8246ddf --- /dev/null +++ b/srcNODE/.ci/prepare_windows-any.ps1 @@ -0,0 +1,52 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return 1 +} + +. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" +. "${env:LIBS_AUTOMATACI}\services\compilers\node.ps1" + + + + +# execute +$null = I18N-Activate-Environment +$___process = NODE-Activate-Local-Environment +if ($___process -ne 0) { + $null = I18N-Activate-Failed + return 1 +} + + +$null = I18N-Import-Dependencies +$__current_path = Get-Location +$null = Set-Location "${env:PROJECT_PATH_ROOT}\${env:PROJECT_NODE}" +$___process = NODE-NPM-Install-Dependencies-All +$null = Set-Location "${__current_path}" +$null = Remove-Variable -Name __current_path +if ($___process -ne 0) { + $null = I18N-Import-Failed + return 1 +} + + + + +# return status +return 0 diff --git a/srcNODE/.ci/start_unix-any.sh b/srcNODE/.ci/start_unix-any.sh new file mode 100644 index 0000000..32d65b4 --- /dev/null +++ b/srcNODE/.ci/start_unix-any.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + +. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" +. "${LIBS_AUTOMATACI}/services/compilers/node.sh" + + + + +# execute +I18N_Activate_Environment +NODE_Activate_Local_Environment +if [ $? -ne 0 ]; then + I18N_Activate_Failed + return 1 +fi + + + + +# execute +I18N_Guide_Start_Source "$PROJECT_NODE_LOCALIZED" + + + + +# report status +return 0 diff --git a/srcNODE/.ci/start_windows-any.ps1 b/srcNODE/.ci/start_windows-any.ps1 new file mode 100644 index 0000000..8c375c5 --- /dev/null +++ b/srcNODE/.ci/start_windows-any.ps1 @@ -0,0 +1,43 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return 1 +} + +. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" +. "${env:LIBS_AUTOMATACI}\services\compilers\node.ps1" + + + + +# execute +$null = I18N-Activate-Environment +$___process = NODE-Activate-Local-Environment +if ($___process -ne 0) { + $null = I18N-Activate-Failed + return 1 +} + + +$null = I18N-Guide-Start-Source "${env:PROJECT_NODE_LOCALIZED}" + + + + +# report status +return 0 diff --git a/srcNODE/.ci/stop_unix-any.sh b/srcNODE/.ci/stop_unix-any.sh new file mode 100644 index 0000000..aaffa99 --- /dev/null +++ b/srcNODE/.ci/stop_unix-any.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + +. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" + + + + +# execute +I18N_Guide_Stop_Deactivate + + + + +# report status +return 0 diff --git a/srcNODE/.ci/stop_windows-any.ps1 b/srcNODE/.ci/stop_windows-any.ps1 new file mode 100644 index 0000000..59f6888 --- /dev/null +++ b/srcNODE/.ci/stop_windows-any.ps1 @@ -0,0 +1,34 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + exit 1 +} + +. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" + + + + +# execute +$null = I18N-Guide-Stop-Deactivate + + + + +# report status +return 0 diff --git a/srcNODE/.ci/test_unix-any.sh b/srcNODE/.ci/test_unix-any.sh new file mode 100644 index 0000000..15e6d8d --- /dev/null +++ b/srcNODE/.ci/test_unix-any.sh @@ -0,0 +1,76 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + +. "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" +. "${LIBS_AUTOMATACI}/services/compilers/node.sh" + + + + +# execute +I18N_Activate_Environment +NODE_Activate_Local_Environment +if [ $? -ne 0 ]; then + I18N_Activate_Failed + return 1 +fi + + +I18N_Run_Test_Coverage +__current_path="$PWD" && cd "${PROJECT_PATH_ROOT}/${PROJECT_NODE}" +if [ $(OS_Is_Run_Simulated) -eq 0 ]; then + I18N_Simulate_Testing + return 0 +else + NODE_NPM_Run "test" + if [ $? -ne 0 ]; then + I18N_Run_Failed + return 1 + fi +fi +cd "$__current_path" && unset __current_path + + +I18N_Processing_Test_Coverage +___source="${PROJECT_PATH_ROOT}/${PROJECT_NODE}/dist/coverage" +___dest="${PROJECT_PATH_ROOT}/${PROJECT_PATH_LOG}/node-test-report" +FS_Is_Directory "$___source" +if [ $? -ne 0 ]; then + I18N_Processing_Failed + return 1 +fi + +FS_Remove_Silently "$___dest" +FS_Make_Housing_Directory "$___dest" +FS_Move "$___source" "$___dest" +if [ $? -ne 0 ]; then + I18N_Processing_Failed + return 1 +fi + + + + +# return status +return 0 diff --git a/srcNODE/.ci/test_windows-any.ps1 b/srcNODE/.ci/test_windows-any.ps1 new file mode 100644 index 0000000..5c15282 --- /dev/null +++ b/srcNODE/.ci/test_windows-any.ps1 @@ -0,0 +1,77 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return 1 +} + +. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" +. "${env:LIBS_AUTOMATACI}\services\compilers\node.ps1" + + + + +# execute +$null = I18N-Activate-Environment +$___process = NODE-Activate-Local-Environment +if ($___process -ne 0) { + $null = I18N-Activate-Failed + return 1 +} + + +$null = I18N-Run-Test-Coverage +$__current_path = Get-Location +$null = Set-Location "${env:PROJECT_PATH_ROOT}\${env:PROJECT_NODE}" +if ($(OS-Is-Run-Simulated) -eq 0) { + $null = I18N-Simulate-Testing + return 0 +} else { + $___process = NODE-NPM-Run "test" + if ($___process -ne 0) { + $null = I18N-Run-Failed + return 1 + } +} +$null = Set-Location "${__current_path}" +$null = Remove-Variable __current_path + + +$null = I18N-Processing-Test-Coverage +$___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_ANGULAR}\dist\coverage" +$___dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_LOG}\node-test-report" +$___process = FS-Is-Directory "${___source}" +if ($___process -ne 0) { + $null = I18N-Processing-Failed + return 1 +} + +$null = FS-Remove-Silently "${___dest}" +$null = FS-Make-Housing-Directory "${___dest}" +$___process = FS-Move "${___source}" "${___dest}" +if ($___process -ne 0) { + $null = I18N-Processing-Failed + return 1 +} + + + + +# report status +return 0 diff --git a/srcNODE/package.json b/srcNODE/package.json index 77bdf22..ff2cf19 100644 --- a/srcNODE/package.json +++ b/srcNODE/package.json @@ -3,14 +3,8 @@ "version": "0.0.1", "type": "module", "description": "One Peaceful Frontend+Backend Software Libraries Suite.", - "scripts": { - "build": "tsc -p tsconfig-build.json", - "test": "tsc -p tsconfig-test.json && c8 --config c8rc.json jasmine --config=tsconfig-test.json" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/ChewKeanHo/hestiaERROR.git" - }, + "author": " (Holloway)", + "license": "Apache-2.0", "keywords": [ "hestiaERROR", "error numbering", @@ -25,12 +19,19 @@ "i18n", "typescript" ], - "author": " (Holloway)", - "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/ChewKeanHo/hestiaERROR.git" + }, "bugs": { "url": "https://github.com/ChewKeanHo/hestiaERROR/issues" }, "homepage": "https://github.com/ChewKeanHo/hestiaERROR", + "main": "Vanilla.js", + "scripts": { + "build": "tsc -p tsconfig-build.json", + "test": "tsc -p tsconfig-test.json && c8 --config c8rc.json jasmine --config=tsconfig-test.json" + }, "devDependencies": { "@types/jasmine": "^5.1.4", "@types/node": "^20.12.7",