Skip to content

Dev #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Help me get rid of bugs
title: ''
labels: 'bug'
assignees: ''

---

**Specifications:**

- code version:
- platform:
- npm version:
- node version:

**Expected Behavior**

<!-- how it should work -->

**Actual Behavior**

<!-- how it's working -->

**Steps to Reproduce the Problem:**

1.
1.
1.

**Screenshots**

<!-- if applicable -->
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Feature request
about: Suggest an improvement
title: ''
labels: 'enhancement'
assignees: ''

---

**Describe what need the feature would fulfill**

<!-- how you came across the idea for this feature -->

**Describe how the need could be fulfilled**

<!-- suggestions you might have to fulfill this need -->

**Describe any alternatives considered**

<!-- other solutions or features you might have considered -->

**List any references that might showcase a similar feature:**

-
-
-
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Fixes #

**Proposed Changes:**

-
-
-
75 changes: 30 additions & 45 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ jobs:
contents: write
steps:

- run: curl -o 'GitVersion.yml' 'https://gist.githubusercontent.com/KamaranL/9e5c6d02123d4ef984a676e57602a4ef/raw/ContinuousDeployment.yml'
working-directory: ${{ runner.temp }}

- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand All @@ -41,23 +38,13 @@ jobs:

- run: npm run test

- run: npm run build:docs

- run: |
SSH="${{ runner.temp }}/ssh"
mkdir -p $SSH
echo -e "${{ secrets.SSH_ID }}" >"$SSH/id"
echo -e "${{ secrets.SSH_ID_PUB }}" >"$SSH/id.pub"
echo -e "${{ secrets.SSH_ALLOWED_SIGNERS }}" >"$SSH/allowed_signers"
chmod 0600 "$SSH/id"

git config --global user.name "GitHub Actions"
git config --global user.email "lossy.typist.0i@icloud.com"
git config --global user.signingkey "$SSH/id.pub"
git config --global gpg.format "ssh"
git config --global gpg.ssh.allowedsignersfile "$SSH/allowed_signers"
git config --global commit.gpgsign true
git config --global tag.gpgsign true
git config --global push.followtags true
name: Set up Git
source <(curl -s -H "Authorization: token $GH_TOKEN" 'https://gist.githubusercontent.com/KamaranL/a3e6bc50b52459b103f6b36ec3428f5d/raw/.action_profile')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Set up environment

- uses: gittools/actions/gitversion/setup@v0
with:
Expand All @@ -66,43 +53,35 @@ jobs:
- uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true
configFilePath: '${{ runner.temp }}/GitVersion.yml'

- run: |
[ "${{ github.event_name }}" == workflow_dispatch -a "${{ github.ref_name }}" != main ] && echo "CI_CREATE_TAG=true" >>"$GITHUB_ENV"

echo "CI_VERSION=${{ env.GITVERSION_FULLSEMVER }}" >>"$GITHUB_ENV"
echo "CI_BRANCH=${{ github.ref_name }}" >>"$GITHUB_ENV"

if [ "${{ github.event_name }}" == pull_request -a "${{ github.base_ref }}" == main -a "${{ github.head_ref }}" == dev ]; then
echo "CI_VERSION=${{ env.GITVERSION_MAJORMINORPATCH }}" >>"$GITHUB_ENV"
echo "CI_BRANCH=${{ github.head_ref }}" >>"$GITHUB_ENV"
echo "CI_CREATE_TAG=true" >>"$GITHUB_ENV"
configFilePath: '${{ env.GV_CONFIG }}'

gh release view v1.0.0 >/dev/null 2>&1 || echo "CI_VERSION=1.0.0" >>"$GITHUB_ENV"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Set CI_ vars
- run: bash $CI_SCRIPT
name: Set CI vars

- run: |
echo ${{ env.CI_VERSION }} >VERSION.txt
npm version --quiet --allow-same-version --no-commit-hooks --no-git-tag-version ${{ env.CI_VERSION }}
echo "$CI_VERSION" >VERSION.txt
npm version --quiet --allow-same-version --no-commit-hooks --no-git-tag-version "$CI_VERSION"
name: Update manifests

- run: |
source $GH_RC

git commit -a --amend --no-edit --date=now --trailer "skip-checks: true"

[ ${{ env.CI_CREATE_TAG }} ] && git tag -a v${{ env.CI_VERSION }} -m v${{ env.CI_VERSION }} $(git rev-parse HEAD) && echo "CI_CREATE_RELEASE=true" >>"$GITHUB_ENV"
[ $CI_CREATE_TAG ] && git tag -a v$CI_VERSION -m v$CI_VERSION $(git rev-parse HEAD) && core.set-env CI_CREATE_RELEASE "true"

git push origin $(git rev-parse HEAD):${{ env.CI_BRANCH }} --force-with-lease
git push origin $(git rev-parse HEAD):$CI_BRANCH --force-with-lease
name: Commit back to source

- run: gh release create v${{ env.CI_VERSION }} --generate-notes --verify-tag && echo "CI_CD=true" >>"$GITHUB_OUTPUT" && echo "CI_TAG=v${{ env.CI_VERSION }}" >>"$GITHUB_OUTPUT"
- run: |
source $GH_RC

gh release create v$CI_VERSION --latest --generate-notes --verify-tag && core.set-output CI_CD "true" && core.set-output CI_TAG "v$CI_VERSION"
id: release
if: env.CI_CREATE_RELEASE
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Create release v${{ env.CI_VERSION }}

outputs:
cd: ${{ steps.release.outputs.CI_CD }}
Expand All @@ -112,8 +91,6 @@ jobs:
needs: ci
if: needs.ci.outputs.cd
runs-on: ubuntu-latest
permissions:
packages: write
steps:

- uses: actions/checkout@v4
Expand All @@ -131,6 +108,14 @@ jobs:
node-version: 'latest'
registry-url: 'https://registry.npmjs.org'

- run: npm publish
- run: |
source <(curl -s -H "Authorization: token $GH_TOKEN" 'https://gist.githubusercontent.com/KamaranL/e0c9feb6f3bc2a296cef3258c5fdc184/raw/.actionrc')

NPM_TOKEN=$(get-secret NPM.CICD)
core.add-mask "$NPM_TOKEN"
core.set-env NODE_AUTH_TOKEN "$NPM_TOKEN"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Get token

- run: npm publish
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ build/Release
coverage
dist/
dist/**/*
docs/
ehthumbs.db
ehthumbs_vista.db
jspm_packages/
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

> JavaScript standard library extensions

[![cicd](https://github.com/KamaranL/js-stdlib-extensions/actions/workflows/cicd.yml/badge.svg?branch=dev)](https://github.com/KamaranL/js-stdlib-extensions/actions/workflows/cicd.yml)
[![view cicd status](https://github.com/KamaranL/js-stdlib-extensions/actions/workflows/cicd.yml/badge.svg?branch=dev)](https://github.com/KamaranL/js-stdlib-extensions/actions/workflows/cicd.yml)
[![view on npmjs](https://badgen.net/npm/v/js-stdlib-extensions?icon=)](https://www.npmjs.com/package/js-stdlib-extensions)
![type status](https://badgen.net/npm/types/js-stdlib-extensions?icon=typescript)

## Installation and Usage

Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.22.0
1.0.0
35 changes: 35 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
js-stdlib-extensions / [Exports](/docs/modules.md)

# js-stdlib-extensions

> JavaScript standard library extensions

[![view cicd status](https://github.com/KamaranL/js-stdlib-extensions/actions/workflows/cicd.yml/badge.svg?branch=dev)](https://github.com/KamaranL/js-stdlib-extensions/actions/workflows/cicd.yml)
[![view on npmjs](https://badgen.net/npm/v/js-stdlib-extensions?icon=)](https://www.npmjs.com/package/js-stdlib-extensions)
![type status](https://badgen.net/npm/types/js-stdlib-extensions?icon=typescript)

## Installation and Usage

### Prerequisites

- [Node.js](https://nodejs.org/) `>=20.10.0`

### Install

```bash
npm i js-stdlib-extensions
```

### Usage

#### Import into package

```javascript
// javascript
require('js-stdlib-extensions')

// typescript
import 'js-stdlib-extensions'
```

### [Docs](/docs/modules.md)
42 changes: 42 additions & 0 deletions docs/interfaces/ArrayExtensions.Array.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[js-stdlib-extensions](/docs/README.md) / [Exports](/docs/modules.md) / [ArrayExtensions](/docs/modules/ArrayExtensions.md) / Array

# Interface: Array\<T\>

[ArrayExtensions](/docs/modules/ArrayExtensions.md).Array

Array

## Type parameters

| Name |
| :------ |
| `T` |

## Table of contents

### Methods

- [isEmpty](/docs/interfaces/ArrayExtensions.Array.md#isempty)

## Methods

### isEmpty

▸ **isEmpty**(): `boolean`

Returns true if the length of the array is 0.

#### Returns

`boolean`

**`Example`**

```ts
// returns true
[].isEmpty()
```

#### Defined in

[array.ts:17](https://github.com/KamaranL/js-stdlib-extensions/blob/13d3725/src/ext/array.ts#L17)
Loading