Skip to content

Commit

Permalink
feat: profile card is up
Browse files Browse the repository at this point in the history
  • Loading branch information
Feelgood3 committed Aug 26, 2022
1 parent b178d98 commit b306183
Show file tree
Hide file tree
Showing 6 changed files with 17,608 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"env": {
"node": true,
"commonjs": true,
"es2021": true
},
"extends": [
"standard"
],
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
}
}
Empty file added .npmignore
Empty file.
110 changes: 108 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,108 @@
# npm-profile-card
NPM card repository workshop
# My npm card

Run
Via npx

```
$ npx npm-profile-card
```

Steps

1. You can fork in [this repo](https://github.com/Feelgood3/npm-profile-card) or just go creating your files.

```bash
# Create new folder
$ mkdir npm-profile-card && cd $_

# Init the npm package
$ npm init
```

2. Install the dependencies
```bash
# dependencies
$ npm install
```

3. Create the personal card

```bash
# Create bin folder
$ mkdir bin && cd $_

# Create the card.js file
$ touch bin/card.js
```

4. Add personal information to your card
```js
#!/usr/bin/env node
// 👆 Used to tell Node.js that this is a CLI tool

// Pull in our modules
const chalk = require('chalk')
const boxen = require('boxen')

// Define options for Boxen
const options = {
padding: 1,
margin: 1,
borderStyle: 'round'
}

// Text + chalk definitions
const data = {
name: chalk.white('YOUR NAME / '),
handle: chalk.cyan('HANDLENAME'),
work: chalk.white('WHERE DO YOU WORK'),
twitter: chalk.cyan('TWITTER ACCOUNT'),
github: chalk.cyan('GITHUB ACCOUNT'),
linkedin: chalk.cyan('LINKEDIN ACCOUNT'),
web: chalk.cyan('YOUR WEBSITE'),
npx: chalk.white('npx YOUR_ALIAS'),
labelWork: chalk.white.bold(' Work:'),
labelTwitter: chalk.white.bold(' Twitter:'),
labelGitHub: chalk.white.bold(' GitHub:'),
labelLinkedIn: chalk.white.bold(' LinkedIn:'),
labelWeb: chalk.white.bold(' Web:'),
labelCard: chalk.white.bold(' Card:')
}

// Actual strings we're going to output
const newline = '\n'
const heading = `${data.name} ${data.handle}`
const working = `${data.labelWork} ${data.work}`
const twittering = `${data.labelTwitter} ${data.twitter}`
const githubing = `${data.labelGitHub} ${data.github}`
const linkedining = `${data.labelLinkedIn} ${data.linkedin}`
const webing = `${data.labelWeb} ${data.web}`
const carding = `${data.labelCard} ${data.npx}`

// Put all our output together into a single variable so we can use boxen effectively
const output = heading + newline + newline + working + newline + twittering + newline + githubing + newline + linkedining + newline + webing + newline + newline + carding

console.log(chalk.green(boxen(output, options)))
```

5. Create an account in [npm.org](https://www.npmjs.com/), if you already have it, skip this step

6. Know the version of your package dependency
```bash
$ npm version major
```

7. Add your npm user - login

```bash
$ npm adduser
```

8. Publish your package
```bash
$ npm publish
```
9. Run your npm-package card
```bash
$ npx npm-profile-card
```
51 changes: 51 additions & 0 deletions bin/card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env node
// 👆 Used to tell Node.js that this is a CLI tool

'use strict'

// Pull in our modules
import chalk from 'chalk'
import boxen from 'boxen'

// Define options for Boxen
const options = {
padding: 1,
margin: 1,
borderStyle: 'round'
}

// Text + chalk definitions
const data = {
name: chalk.white(' Sergio Moncada Ojara'),
handle: chalk.white('@FeelgoodV3'),
work: chalk.white('Full Stack Developer'),
twitter: chalk.gray('https://twitter.com/') + chalk.cyan('FeelgoodV3'),
github: chalk.gray('https://github.com/') + chalk.green('Feelgood3'),
linkedin: chalk.gray('https://www.linkedin.com/in/') + chalk.blue('sergiomoncadao'),
npx: chalk.red('npx') + ' ' + chalk.white('feelgoodv3'),
labelWork: chalk.white.bold(' Work:'),
labelTwitter: chalk.white.bold(' Twitter:'),
labelGitHub: chalk.white.bold(' GitHub:'),
labelLinkedIn: chalk.white.bold('LinkedIn:'),
labelCard: chalk.white.bold(' Card:')
}

// Actual strings we're going to output
const newline = '\n'
const heading = `${data.name} / ${data.handle}`
const working = `${data.labelWork} ${data.work}`
const twittering = `${data.labelTwitter} ${data.twitter}`
const githubing = `${data.labelGitHub} ${data.github}`
const linkedining = `${data.labelLinkedIn} ${data.linkedin}`
const carding = `${data.labelCard} ${data.npx}`

const output = heading + // data.name + data.handle
newline + newline + // Add one whole blank line
working + newline + // data.labelWork + data.work
twittering + newline + // data.labelTwitter + data.twitter
githubing + newline + // data.labelGitHub + data.github
linkedining + newline + newline + // data.labelLinkedIn + data.linkedin
// data.labelWeb + data.web
carding // data.labelCard + data.npx

console.log(chalk.green(boxen(output, options)))

0 comments on commit b306183

Please sign in to comment.