-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7797aa
commit 6394865
Showing
21 changed files
with
436 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'glob-modules': patch | ||
--- | ||
|
||
Initial release |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@aacc/babel-preset", | ||
{ | ||
"typescript": true | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* @type {import('eslint').Linter.Config} | ||
*/ | ||
module.exports = { | ||
root: true, | ||
extends: ['@aacc/eslint-config/typescript'], | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: 'tsconfig.eslint.json', | ||
}, | ||
ignorePatterns: ['node_modules', 'dist', 'playground'], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# glob-modules | ||
|
||
Glob modules resolver for file convention based systems. | ||
|
||
## Installation | ||
|
||
```sh | ||
npm install glob-modules | ||
``` | ||
|
||
## Usage | ||
|
||
**Example directory structure:** | ||
|
||
``` | ||
src/ | ||
|-- main.js | ||
|__ commands/ | ||
|-- foo.js | ||
|-- bar.js | ||
|__ baz.txt | ||
``` | ||
|
||
```js | ||
// src/commands/foo.js | ||
export default 'foo' | ||
|
||
// src/commands/bar.js | ||
export default 'bar' | ||
export const baz = 'baz' | ||
|
||
// src/main.js | ||
import { globModules } from 'glob-modules' | ||
|
||
const { commands } = await globModules('./commands/*.js', { | ||
importMeta: import.meta, | ||
}) | ||
/* | ||
commands === { | ||
foo: { | ||
default: 'foo', | ||
}, | ||
bar: { | ||
default: 'bar', | ||
baz: 'baz', | ||
}, | ||
} | ||
*/ | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"name": "glob-modules", | ||
"version": "0.0.0", | ||
"description": "Glob modules resolver for file convention based systems", | ||
"author": "Aaron Casanova <aaronccasanova@gmail.com>", | ||
"license": "MIT", | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/esm/index.mjs", | ||
"types": "dist/types/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./dist/types/index.d.ts", | ||
"import": "./dist/esm/index.mjs", | ||
"require": "./dist/cjs/index.js" | ||
} | ||
}, | ||
"scripts": { | ||
"dev": "npm-run-all --parallel 'build:* -- --watch'", | ||
"build": "npm-run-all --parallel build:*", | ||
"build:js": "rollup -c", | ||
"build:types": "tsc --emitDeclarationOnly", | ||
"type-check": "tsc --noEmit", | ||
"type-check:watch": "npm run type-check -- --watch", | ||
"lint": "TIMING=1 eslint . --ext .js,.ts --cache", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"dependencies": { | ||
"globby": "^11.1.0", | ||
"just-safe-set": "^4.2.0" | ||
}, | ||
"devDependencies": { | ||
"@aacc/babel-preset": "*", | ||
"@aacc/browserslist-config": "*", | ||
"@aacc/eslint-config": "*", | ||
"@aacc/tsconfigs": "*", | ||
"@rollup/plugin-babel": "^5.3.1", | ||
"@rollup/plugin-commonjs": "^21.1.0", | ||
"@rollup/plugin-node-resolve": "^13.2.1", | ||
"rollup": "^2.70.2", | ||
"typescript": "^4.7.3" | ||
}, | ||
"browserslist": [ | ||
"extends @aacc/browserslist-config" | ||
], | ||
"publishConfig": { | ||
"access": "public", | ||
"@aacc:registry": "https://registry.npmjs.org" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/aaronccasanova/aacc.git", | ||
"directory": "packages/glob-modules" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/aaronccasanova/aacc/issues" | ||
}, | ||
"homepage": "https://github.com/aaronccasanova/aacc/blob/main/packages/glob-modules/README.md" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 4 |
1 change: 1 addition & 0 deletions
1
packages/glob-modules/playground/modules/nested-modules/eight.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 8 |
3 changes: 3 additions & 0 deletions
3
packages/glob-modules/playground/modules/nested-modules/five.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default 5 | ||
|
||
export const five = 'five' |
1 change: 1 addition & 0 deletions
1
packages/glob-modules/playground/modules/nested-modules/seven.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 7 |
1 change: 1 addition & 0 deletions
1
packages/glob-modules/playground/modules/nested-modules/six.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default 1 | ||
|
||
export const one = 'one' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import * as path from 'node:path' | ||
import * as url from 'node:url' | ||
import { globModules as globModulesRaw } from '../dist/esm/index.mjs' | ||
|
||
/** @type {import('../dist/types/index.js').globModules} */ | ||
// @ts-ignore | ||
const globModules = globModulesRaw | ||
|
||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url)) | ||
|
||
const modules = await globModules('./modules/*.mjs', { | ||
importMeta: import.meta, | ||
}) | ||
/* { | ||
modules: { | ||
one: { default: 1, one: 'one' }, | ||
two: { default: 2 }, | ||
four: { default: 4 }, | ||
}, | ||
} */ | ||
|
||
const nestedModules = await globModules('./modules/nested-modules/*.mjs', { | ||
importMeta: import.meta, | ||
}) | ||
/* { | ||
modules: { | ||
'nested-modules': { | ||
five: 5, | ||
six: 6, | ||
eight: 8, | ||
}, | ||
}, | ||
} */ | ||
|
||
const allModules = await globModules('./modules/**/*.mjs', { | ||
cwd: __dirname, | ||
}) | ||
/* { | ||
modules: { | ||
one: { default: 1 }, | ||
two: { default: 2 }, | ||
four: { default: 4 }, | ||
'nested-modules': { | ||
five: 5, | ||
six: 6, | ||
eight: 8, | ||
}, | ||
}, | ||
} */ | ||
|
||
const cjsModules = await globModules('./modules/**/*.js', { | ||
cwd: __dirname, | ||
}) | ||
/* { | ||
modules: { | ||
three: { default: 3 }, | ||
'nested-modules': { | ||
seven: 8, | ||
}, | ||
}, | ||
} */ | ||
|
||
console.log('allModules:', JSON.stringify(allModules, null, 2)) |
Oops, something went wrong.
6394865
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
aacc-scales – ./apps/scales
aacc-scales.vercel.app
aacc-scales-git-main-aaronccasanova.vercel.app
aacc-scales-aaronccasanova.vercel.app
6394865
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
aacc-next-ts-styled-comps – ./recipes/next-ts-styled-comps
aacc-next-ts-styled-comps.vercel.app
aacc-next-ts-styled-comps-aaronccasanova.vercel.app
aacc-next-ts-styled-comps-git-main-aaronccasanova.vercel.app
6394865
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
aacc-next-ts – ./recipes/next-ts
aacc-next-ts.vercel.app
aacc-next-ts-git-main-aaronccasanova.vercel.app
aacc-next-ts-aaronccasanova.vercel.app