Compare commits

..

No commits in common. "master" and "1.1.0" have entirely different histories.

32 changed files with 232 additions and 8043 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
# ignore all files by default
*
# include required files with an exception
!entrypoint.sh
!LICENSE
!README.md
!THIRD_PARTY_NOTICE.md

View File

@ -1,4 +0,0 @@
dist/
lib/
node_modules/
jest.config.js

View File

@ -1,61 +0,0 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{ "accessibility": "no-public" }
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{ "allowExpressions": true }
],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}

83
.github/main.workflow vendored Normal file
View File

@ -0,0 +1,83 @@
workflow "Pull Request" {
on = "pull_request"
resolves = ["Docker Lint [PR]", "Shell Lint [PR]", "Test [PR]"]
}
action "Docker Lint [PR]" {
uses = "docker://replicated/dockerfilelint"
args = "Dockerfile"
}
action "Shell Lint [PR]" {
uses = "actions/bin/shellcheck@master"
args = "entrypoint.sh"
}
action "Test [PR]" {
uses = "actions/bin/bats@master"
args = "test/*.bats"
}
workflow "Build and Publish" {
resolves = [
"Docker Lint",
"Test",
"Docker Login",
"Docker Publish",
]
on = "push"
}
action "Master Branch" {
uses = "actions/bin/filter@master"
args = "branch master"
}
action "Docker Lint" {
uses = "docker://replicated/dockerfilelint"
needs = ["Master Branch"]
args = "Dockerfile"
}
action "Shell Lint" {
uses = "actions/bin/shellcheck@master"
needs = ["Master Branch"]
args = "entrypoint.sh"
}
action "Test" {
uses = "actions/bin/bats@master"
needs = ["Master Branch"]
args = "test/*.bats"
}
action "Build" {
uses = "actions/docker/cli@master"
needs = [
"Docker Lint",
"Test",
"Shell Lint",
]
args = "build -t yarn ."
}
action "Docker Tag" {
uses = "actions/docker/tag@master"
args = "yarn borales/yarn --no-latest"
needs = ["Build"]
}
action "Docker Login" {
uses = "actions/docker/login@master"
secrets = ["DOCKER_PASSWORD", "DOCKER_USERNAME"]
needs = ["Build"]
}
action "Docker Publish" {
uses = "actions/docker/cli@master"
needs = [
"Docker Login",
"Docker Tag",
]
args = "push borales/yarn"
}

10
.github/renovate.json vendored
View File

@ -1,10 +0,0 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>Borales/renovate-config"],
"packageRules": [
{
"groupName": "GitHub Actions Toolkit",
"matchSourceUrls": ["https://github.com/actions/toolkit{/,}**"]
}
]
}

View File

@ -1,47 +0,0 @@
# https://github.com/actions/typescript-action/blob/main/.github/workflows/check-dist.yml
name: Check dist/
on:
push:
branches:
- master
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set Node.js 20
uses: actions/setup-node@v4.4.0
with:
node-version: 20
- name: Install dependencies
run: yarn
- name: Rebuild the dist/ directory
run: |
yarn build
yarn package
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/

5
.gitignore vendored
View File

@ -1,5 +0,0 @@
node_modules
lib
.DS_Store
Thumbs.db

1
.npmrc
View File

@ -1 +0,0 @@
fund=false

1
.nvmrc
View File

@ -1 +0,0 @@
20

View File

@ -1,3 +0,0 @@
dist/
lib/
node_modules/

View File

@ -1,10 +0,0 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid"
}

2
Brewfile Normal file
View File

@ -0,0 +1,2 @@
brew "bats"
brew "shellcheck"

View File

@ -1,38 +1,5 @@
# CHANGELOG # CHANGELOG
## 5.0.0 (3 Feb 2024)
- Switching to `node20`
## 4.2.0 (5 Dec 2022)
- Added proper support for multiple arguments
## 4.1.0 (26 Nov 2022)
- Added `dir` option
## 4.0.0 (26 Nov 2022)
- Migrated to Actions toolkit
## 3.0.0 (8 Jun 2022)
- Migrating to Python3
## 2.1.0 (8 Nov 2019)
- Switching to `node:lts` docker image
## 2.0.2 (6 Nov 2019)
- Added Git to the Docker image
## 2.0.0 (14 Oct 2019)
- Migrated to the latest Github Action syntax
- Using `node:10.16-alpine` as base image
## 1.1.0 (22 Apr 2019) ## 1.1.0 (22 Apr 2019)
- Docker now uses the full image `node:10` and `entrypoint.sh` accepts extra NPM settings (thanks to [@Embraser01](https://github.com/Embraser01)) - Docker now uses the full image `node:10` and `entrypoint.sh` accepts extra NPM settings (thanks to [@Embraser01](https://github.com/Embraser01))

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM node:10
LABEL version="1.1.0"
LABEL repository="https://github.com/Borales/actions-yarn"
LABEL homepage="https://github.com/Borales/actions-yarn"
LABEL maintainer="Oleksandr Bordun <bordun.alexandr@gmail.com>"
LABEL com.github.actions.name="GitHub Action for Yarn"
LABEL com.github.actions.description="Wraps the yarn CLI to enable common yarn commands."
LABEL com.github.actions.icon="package"
LABEL com.github.actions.color="blue"
# COPY LICENSE README.md THIRD_PARTY_NOTICE.md /
COPY "entrypoint.sh" "/entrypoint.sh"
ENTRYPOINT ["/entrypoint.sh"]
CMD ["help"]

21
LICENSE
View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2023 Oleksandr Bordun
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,57 +1,58 @@
# GitHub Actions for Yarn # GitHub Actions for Yarn
This GitHub Action is currently compatible with Yarn 1.x only. > Look https://github.com/actions/npm for more details.
> Look [github.com/actions/setup-node](https://github.com/actions/setup-node) for more details.
This Action for [yarn](https://yarnpkg.com) enables arbitrary actions with the `yarn` command-line client, including testing packages and publishing to a registry. This Action for [yarn](https://yarnpkg.com) enables arbitrary actions with the `yarn` command-line client, including testing packages and publishing to a registry.
## Usage ## Usage
> It is required to run `actions/setup-node@v3` before `borales/actions-yarn` in order to setup the desired node version. An example workflow to build, test, and publish an npm package to the default public registry follows:
An example workflow how to install packages via Yarn (using repository syntax): ```hcl
workflow "Build, Test, and Publish" {
on = "push"
resolves = ["Publish"]
}
```yml action "Build" {
name: CI uses = "Borales/actions-yarn@master"
on: [push] args = "install"
}
jobs: action "Test" {
build: needs = "Build"
name: Test uses = "Borales/actions-yarn@master"
runs-on: ubuntu-latest args = "test"
steps: }
- uses: actions/checkout@v3
- name: Set Node.js 16.x action "Publish" {
uses: actions/setup-node@v3 needs = "Test"
with: uses = "Borales/actions-yarn@master"
node-version: 16.x args = "publish --access public"
secrets = ["NPM_AUTH_TOKEN"]
- name: Run install }
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # if needed
- name: Build production bundle
uses: borales/actions-yarn@v4
with:
cmd: build:prod # will run `yarn build:prod` command
- name: Test the app
uses: borales/actions-yarn@v4
with:
cmd: test # will run `yarn test` command
- name: Run test in sub-folder
uses: borales/actions-yarn@v4
with:
cmd: test
dir: 'frontend' # will run `yarn test` in `frontend` sub folder
``` ```
> `cmd` value will be used as a command for Yarn ### Secrets
>
> `dir` value will be used for Yarn `cwd`
More information about [private registry setup](https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#use-private-packages). * `NPM_AUTH_TOKEN` - **Optional**. The token to use for authentication with the npm registry. Required for `yarn publish` ([more info](https://docs.npmjs.com/getting-started/working_with_tokens))
### Environment variables
* `NPM_REGISTRY_URL` - **Optional**. To specify a registry to authenticate with. Defaults to `registry.npmjs.org`
* `NPM_CONFIG_USERCONFIG` - **Optional**. To specify a non-default per-user configuration file. Defaults to `$HOME/.npmrc` ([more info](https://docs.npmjs.com/misc/config#npmrc-files))
#### Example
To authenticate with, and publish to, a registry other than `registry.npmjs.org`:
```hcl
action "Publish" {
uses = "Borales/actions-yarn@master"
args = "publish --access public"
env = {
NPM_REGISTRY_URL = "someOtherRegistry.someDomain.net"
}
secrets = ["NPM_AUTH_TOKEN"]
}
```

View File

@ -1,17 +0,0 @@
name: 'GitHub Action for Yarn'
description: 'Wraps the yarn CLI to enable common yarn commands'
author: 'Alex Bordun'
branding:
icon: 'package'
color: 'blue'
inputs:
cmd:
description: 'Yarn command'
required: true
dir:
description: 'Yarn sub-folder (if needed)'
required: false
default: ''
runs:
using: 'node20'
main: 'dist/index.js'

3658
dist/index.js vendored

File diff suppressed because it is too large Load Diff

1
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

84
dist/licenses.txt vendored
View File

@ -1,84 +0,0 @@
@actions/core
MIT
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@actions/exec
MIT
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@actions/http-client
MIT
Actions Http Client for Node.js
Copyright (c) GitHub, Inc.
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@actions/io
MIT
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
tunnel
MIT
The MIT License (MIT)
Copyright (c) 2012 Koichi Kobayashi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

File diff suppressed because one or more lines are too long

22
entrypoint.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
set -e
if [ -n "$NPM_AUTH_TOKEN" ]; then
# Respect NPM_CONFIG_USERCONFIG if it is provided, default to $HOME/.npmrc
NPM_CONFIG_USERCONFIG="${NPM_CONFIG_USERCONFIG-"$HOME/.npmrc"}"
NPM_REGISTRY_URL="${NPM_REGISTRY_URL-registry.npmjs.org}"
NPM_STRICT_SSL="${NPM_STRICT_SSL-true}"
NPM_REGISTRY_SCHEME="https"
if ! $NPM_STRICT_SSL
then
NPM_REGISTRY_SCHEME="http"
fi
# Allow registry.npmjs.org to be overridden with an environment variable
printf "//%s/:_authToken=%s\\nregistry=%s\\nstrict-ssl=%s" "$NPM_REGISTRY_URL" "$NPM_AUTH_TOKEN" "${NPM_REGISTRY_SCHEME}://$NPM_REGISTRY_URL" "${NPM_STRICT_SSL}" > "$NPM_CONFIG_USERCONFIG"
chmod 0600 "$NPM_CONFIG_USERCONFIG"
fi
sh -c "yarn $*"

View File

@ -1,30 +0,0 @@
{
"name": "@borales/actions-yarn",
"version": "4.2.0",
"main": "lib/index.js",
"scripts": {
"build": "tsc",
"format": "prettier --write '**/*.ts'",
"format-check": "prettier --check '**/*.ts'",
"lint": "eslint src/**/*.ts",
"package": "ncc build --source-map --license licenses.txt",
"test": "jest",
"all": "yarn build && yarn format && yarn lint && yarn package && yarn test"
},
"dependencies": {
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3"
},
"devDependencies": {
"@types/node": "^20.19.39",
"@typescript-eslint/parser": "^6.21.0",
"@vercel/ncc": "^0.38.4",
"eslint-plugin-github": "^4.10.2",
"eslint-plugin-jest": "^27.9.0",
"eslint": "^8.57.1",
"jest": "^29.7.0",
"prettier": "^3.8.1",
"typescript": "^5.9.3"
}
}

15
script/bootstrap Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# script/bootstrap: Resolve dependencies that the application requires to run.
# Exit if any subcommand fails
set -e
# Ensure we're always running from the project root
cd "$(dirname "$0")/.."
if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
}
fi

10
script/test Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Exit if any subcommand fails
set -e
# Ensure we're always running from the project root
cd "$(dirname "$0")/.."
bats test/*.bats
shellcheck *.sh

View File

@ -1,22 +0,0 @@
import {debug, getInput, setFailed, getState} from '@actions/core'
import {ensureYarnIsInstalled} from './yarn'
import {run} from './run'
import {resolve} from 'path'
const main = async (): Promise<void> => {
await ensureYarnIsInstalled()
const cmd: string = getInput('cmd', {required: true})
const dir: string = getInput('dir')
const cwd: string = resolve(getState('repositoryPath'), dir || '')
try {
debug(`Running "${cmd}" command`)
await run(cmd, {cwd})
} catch (error) {
if (error instanceof Error) setFailed(error.message)
}
}
main()

View File

@ -1,5 +0,0 @@
import {exec} from '@actions/exec'
export const run = async (cmd: string, {cwd}: {cwd: string}): Promise<void> => {
await exec('yarn', cmd.split(' '), {cwd})
}

View File

@ -1,20 +0,0 @@
import {debug, setOutput} from '@actions/core'
import {exec, getExecOutput} from '@actions/exec'
import {which} from '@actions/io'
export const ensureYarnIsInstalled = async (): Promise<void> => {
try {
await which('yarn', true)
} catch (e) {
await exec('npm install --global yarn')
}
const [{stdout: yarnVersion}, {stdout: nodeVersion}] = await Promise.all([
getExecOutput('yarn', ['--version'], {silent: true}),
getExecOutput('node', ['--version'], {silent: true})
])
debug(`Node ${nodeVersion.trim()} detected`)
debug(`Yarn v${yarnVersion.trim()} detected`)
setOutput('yarn-version', yarnVersion.trim())
}

2
test/bin/yarn Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
echo "Fake yarn"

31
test/entrypoint.bats Normal file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env bats
PATH="$PATH:$BATS_TEST_DIRNAME/bin"
function setup() {
# Ensure GITHUB_WORKSPACE is set
export GITHUB_WORKSPACE="${GITHUB_WORKSPACE-"${BATS_TEST_DIRNAME}/.."}"
}
@test "entrypoint runs successfully" {
run $GITHUB_WORKSPACE/entrypoint.sh help
echo "$output"
[ "$status" -eq 0 ]
}
@test "npmrc location can be overridden" {
export NPM_CONFIG_USERCONFIG=$( mktemp )
export NPM_AUTH_TOKEN=NPM_AUTH_TOKEN
run $GITHUB_WORKSPACE/entrypoint.sh help
[ "$status" -eq 0 ]
[ "$(cat $NPM_CONFIG_USERCONFIG)" = $'//registry.npmjs.org/:_authToken=NPM_AUTH_TOKEN\nregistry=registry.npmjs.org' ]
}
@test "registry can be overridden" {
export NPM_CONFIG_USERCONFIG=$( mktemp )
export NPM_REGISTRY_URL=someOtherRegistry.someDomain.net
export NPM_AUTH_TOKEN=NPM_AUTH_TOKEN
run $GITHUB_WORKSPACE/entrypoint.sh help
[ "$status" -eq 0 ]
[ "$(cat $NPM_CONFIG_USERCONFIG)" = $'//someOtherRegistry.someDomain.net/:_authToken=NPM_AUTH_TOKEN\nregistry=someOtherRegistry.someDomain.net' ]
}

View File

@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"outDir": "./lib" /* Redirect output structure to the directory. */,
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
"strict": true /* Enable all strict type-checking options. */,
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
},
"exclude": ["node_modules", "**/*.test.ts"]
}

3954
yarn.lock

File diff suppressed because it is too large Load Diff