Skip to content

Commit

Permalink
feat: add minimalistic engine checker wrapper
Browse files Browse the repository at this point in the history
Signed-off-by: TED Vortex <ted.vortex@gmail.com>
  • Loading branch information
0-vortex committed Aug 27, 2021
1 parent 96e489b commit 76438fe
Show file tree
Hide file tree
Showing 12 changed files with 13,714 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .czrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "./node_modules/cz-conventional-changelog"
}
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
max_line_length = 120
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
max_line_length = 0
trim_trailing_whitespace = false
78 changes: 78 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
*.pbxproj -text
* text eol=lf

## DOCKER
*.dockerignore text
Dockerfile text

## DOCUMENTATION
*.markdown text
*.md text
*.mdwn text
*.mdown text
*.mkd text
*.mkdn text
*.mdtxt text
*.mdtext text
*.txt text
AUTHORS text
CHANGELOG text
CHANGES text
CONTRIBUTING text
COPYING text
copyright text
*COPYRIGHT* text
INSTALL text
license text
LICENSE text
NEWS text
readme text
*README* text
TODO text

## CONFIGS
*.bowerrc text
*.cnf text
*.conf text
*.config text
.browserslistrc text
.editorconfig text
.gitattributes text
.gitconfig text
.htaccess text
*.npmignore text
*.yaml text
*.yml text
browserslist text
Makefile text
makefile text

## GRAPHICS
*.ai binary
*.bmp binary
*.eps binary
*.gif binary
*.ico binary
*.jng binary
*.jp2 binary
*.jpg binary
*.jpeg binary
*.jpx binary
*.jxr binary
*.pdf binary
*.png binary
*.psb binary
*.psd binary
*.svg text
*.svgz binary
*.tif binary
*.tiff binary
*.wbmp binary
*.webp binary

## FONTS
*.ttf binary
*.eot binary
*.otf binary
*.woff binary
*.woff2 binary
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Release"

on:
push:
branches:
- main

jobs:
release:
environment:
name: npm
url: https://www.npmjs.com/package/@open-sauced/check-engines/v/${{ steps.release.outputs.version }}
name: Semantic release
runs-on: ubuntu-latest
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: "🔧 setup node"
uses: actions/setup-node@v2.1.5
with:
node-version: 12

- name: "🔧 setup cache"
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: "🔧 install npm@7"
run: npm i -g npm@7

- name: "📦 install dependencies"
run: npm ci

- name: "🚀 release"
id: release
env:
DISABLE_DOCKER: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_AUTHOR_NAME: ${{ github.event.commits[0].author.username }}
GIT_AUTHOR_EMAIL: ${{ github.event.commits[0].author.email }}
GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
run: |
npx semantic-release
echo "::set-output name=version::$(cat package.json | jq -r '.version')"
18 changes: 18 additions & 0 deletions .github/workflows/triage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "Triage"

on:
issue_comment:
types:
- created
- edited

jobs:
one:
runs-on: ubuntu-latest
steps:
- name: take an issue
uses: bdougie/take-action@main
env:
GITHUB_TOKEN: ${{ github.token }}
with:
message: Thanks for taking this on! If you have not already, join the conversation in our [Discord](https://discord.gg/U2peSNf23P)
105 changes: 105 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

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

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

build
6 changes: 6 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
save-exact=false
audit=false
audit-level="moderate"
loglevel="info"
progress=false
timing=false
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<div style="text-align: center" align="center">
<img alt="Open Sauced" src="https://i.ibb.co/7jPXt0Z/logo1-92f1a87f.png" width="300px" />

# @open-sauced/check-engines

> Never break your dependency tree with [**npm-install-checks**](https://www.npmjs.com/package/npm-install-checks) running on [**npx**](https://www.npmjs.com/package/npx).
[![Commits](https://img.shields.io/github/commit-activity/w/open-sauced/check-engines?style=flat)](https://github.com/open-sauced/check-engines/pulse)
[![Issues](https://img.shields.io/github/issues/open-sauced/check-engines.svg?style=flat)](https://github.com/open-sauced/check-engines/issues)
[![Releases](https://img.shields.io/github/v/release/open-sauced/check-engines.svg?style=flat)](https://github.com/open-sauced/check-engines/releases)
[![Discord](https://img.shields.io/discord/714698561081704529.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/U2peSNf23P)
[![Twitter](https://img.shields.io/twitter/follow/saucedopen?label=Follow&style=social)](https://twitter.com/saucedopen)

</div>

## 📦 Install

This package is binary and doesn't require installation however you can add it to your repository as a `devDependency`:

```shell
npm install --save-dev @open-sauced/check-engines
```

## 🚀 Usage

All you have to do is run the script next to your `package.json`:

```shell
npx @open-sauced/check-engines
```

## 🔧 Configuration

The most common use case for this package is to let it run on `install` and `start` generic React applications:

```json
{
"scripts": {
"engines": "npx @open-sauced/check-engines",
"preinstall": "npm run engines",
"prestart": "npm run engines"
}
}
```

## 🤝 Contributing

We encourage you to contribute to Open Sauced! Please check out the [Contributing guide](https://docs.opensauced.pizza/) for guidelines about how to proceed.

If you decide to fix a bug, make sure to use the conventional commit available at:

```shell
npm run push
```

<img align="right" src="https://i.ibb.co/CJfW18H/ship.gif" width="200"/>

## 🍕 Community

Got Questions? Join the conversation in our [Discord](https://discord.gg/U2peSNf23P).
Find Open Sauced videos and release overviews on our [YouTube Channel](https://www.youtube.com/channel/UCklWxKrTti61ZCROE1e5-MQ).

## ⚖️ LICENSE

MIT © [Open Sauced](LICENSE)
14 changes: 14 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env node

const path = require('path');
const { checkEngine, checkPlatform } = require('npm-install-checks');

const packageJson = require(path.join(process.cwd(), 'package.json'));
const regex = /^(?:(?:(?:pnpm|yarn)\/[0-9\.]+)\s)?(?:npm\/(?<npm>[0-9\.\?]+))\s(?:node\/v(?<node>[0-9\.]+))\s(.*)$/gm;
const versions = regex.exec(process.env.npm_config_user_agent);
const { npm, node } = versions.groups;

packageJson._id = packageJson.name;

checkEngine(packageJson, npm, node);

0 comments on commit 76438fe

Please sign in to comment.