Skip to content

Commit

Permalink
🎉 initial npm module files
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnath committed Sep 8, 2023
1 parent b1c6f6d commit 8979fae
Show file tree
Hide file tree
Showing 8 changed files with 33,890 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,11 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# local dev
*.bak
bak
.DS_Store

# storybook
storybook-static
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20
9 changes: 9 additions & 0 deletions .releaserc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
extends: 'storydocker-utilities/releases',
branches: [
{ name: 'main', channel: 'latest', prerelease: false },
{ name: 'setup-module', channel: 'next', prerelease: true },
],
debug: true,
tagFormat: 'profile-components@${version}',
};
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
# profile-components

Web components which display profile information from various websites

## @todo

- [ ] get releases to npm working
- [ ] how to unpkg?
- [ ] deploy to chromatic
- [ ] chromatic VRT
- [ ] get esbuild making separate bundles for each component
- [ ] stackblitz? webcomponents.dev?
- [ ] put docs in storybook

## Expanding @todo

- [ ] graph contrib: https://github.com/enpitsuLin/wc-github-graph/blob/master/src/github-graph.ts
34 changes: 34 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import path from 'path'
import { fileURLToPath } from 'url'

/**
* Helper to replace losing `__dirname` in ES Modules
* @param {string} moduleUrl - the import.meta.url of file which needs the dirname
* @returns
*/
export const getDirName = function (moduleUrl) {
const filename = fileURLToPath(moduleUrl)
return path.dirname(filename)
}

/**
* Helper to get commonly used directory paths
* @returns object of directory paths
*/
export const getModulePaths = function () {
const __dirname = getDirName(import.meta.url);
const root = path.join(__dirname, '..');
return {
root,
dist: path.join(root, 'dist'),
lib: path.join(root, 'lib'),
src: path.join(root, 'src'),
}
}

/**
* Guickie to combine a path to root
* @param {string} relPath - relative path from root
* @returns absolute path from root
*/
export const pathFromRoot = (relPath = '') => path.join(getModulePaths().root, relPath);
Loading

0 comments on commit 8979fae

Please sign in to comment.