Skip to content

Commit

Permalink
chore: init
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Nov 5, 2020
0 parents commit 54c680a
Show file tree
Hide file tree
Showing 23 changed files with 4,237 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
typings
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test

on: [push]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x]

steps:
- uses: actions/checkout@v1

- name: Install
run: npm ci

- name: Lint
run: npm run lint

- name: Test
run: npm test
81 changes: 81 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# 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

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://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/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

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

# next.js build output
.next

# nuxt.js build output
.nuxt

# Nuxt generate
dist

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# IDE
.idea
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Anthony Fu <https://github.com/antfu>

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.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ni

~~`npm i` in a yarn project, again? F**k!~~

**ni** - smart packages `install` that sense your current package manager.

`ni` => `npm install` / `yarn add` / `pnpm install`

<pre>
$ npm i -g @antfu/ni

$ <b>ni</b>
</pre>

---


## Usages

### `ni` - Install

### `nr` - Run

## How it works

**ni** assumes that you work with lock files (and you should). Before it runs, it will detect your `yarn.lock` / `pnpm-lock.yaml` / `package-lock.json` to check your package mangar, and runs the corresponding command from them. If not matches, npm will be used as fallback
3 changes: 3 additions & 0 deletions bin/ni.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node
'use strict'
require('../dist/ni')
3 changes: 3 additions & 0 deletions bin/nr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node
'use strict'
require('../dist/nr')
78 changes: 78 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"name": "@antfu/ni",
"version": "0.0.0",
"description": "Smart packages install that sense your current package manager",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"author": "Anthony Fu <[email protected]>",
"license": "MIT",
"bin": {
"ni": "bin/ni.js",
"nr": "bin/nr.js"
},
"bugs": {
"url": "https://github.com/antfu/ni/issues"
},
"homepage": "https://github.com/antfu/ni#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/antfu/ni.git"
},
"scripts": {
"prepublishOnly": "npm run build",
"watch": "npm run build -- --watch",
"ni": "esno src/ni.ts",
"nr": "esno src/nr.ts",
"dev": "esno src/ni.ts",
"build": "tsup src/ni.ts src/nr.ts --format cjs,esm --dts",
"publish:ci": "npm publish --access public",
"release": "npx bumpp --commit --push --tag && npm run publish:ci",
"lint": "eslint \"{src,test}/**/*.ts\"",
"lint:fix": "npm run lint -- --fix",
"test": "c8 ava"
},
"devDependencies": {
"@antfu/eslint-config-ts": "^0.4.3",
"@types/node": "^14.14.6",
"c8": "^7.3.3",
"esbuild-register": "^1.0.2",
"eslint": "^7.11.0",
"esm": "^3.2.25",
"esno": "^0.2.4",
"husky": "^4.3.0",
"lint-staged": "^10.5.1",
"tsup": "^3.7.1",
"typescript": "^4.0.5"
},
"files": [
"dist"
],
"dependencies": {
"ava": "^3.13.0",
"find-up": "^5.0.0"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{ts,js}": [
"eslint --fix",
"git add"
]
},
"eslintConfig": {
"extends": "@antfu/eslint-config-ts"
},
"ava": {
"extensions": [
"ts"
],
"require": [
"esm",
"esbuild-register"
]
}
}
Loading

0 comments on commit 54c680a

Please sign in to comment.