Skip to content

Commit

Permalink
feat(load-esm-config): add new package (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
ifiokjr committed May 27, 2022
1 parent b9e294b commit b807c2f
Show file tree
Hide file tree
Showing 179 changed files with 3,554 additions and 860 deletions.
3 changes: 1 addition & 2 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.6.1/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "monots/monots" }],
"$schema": "https://unpkg.com/@changesets/config@2.0.0/schema.json",
"updateInternalDependencies": "patch",
"commit": false,
"linked": [],
Expand Down
12 changes: 12 additions & 0 deletions .changeset/khaki-zoos-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'eslint-config-monots': patch
'@monots/cli': patch
'@monots/core': patch
'@monots/next-plugin': patch
'@monots/types': patch
'@monots/utils': patch
'prettier-config-monots': patch
'superstruct-extra': patch
---

Update packages and refactor some internal code.
5 changes: 5 additions & 0 deletions .changeset/thin-coins-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-monots': minor
---

Add a new `rust` template and update dependencies.
16 changes: 16 additions & 0 deletions .changeset/wet-beds-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'load-esm-config': minor
---

Add new package `load-esm-config` for loading a configuration written in **TypeScript** / **JavaScript** with support for both **CommonJS** and **ESModule** packages.

```ts
import { loadEsmConfig } from 'load-esm-config';

// Load the configuration file and the absolute path to the config file.
const { config, path } = loadEsmConfig({ name: 'something' });
```

By default it supports these extensions: `['.ts', '.mts', '.cts', '.js', '.mjs', '.cjs']`. It is also possible to limit support for extensions by passing the `extensions` property.

Another feature allows you to load from custom configuration folders. By default `./` (current) and `.config/` folders will be searched for matching configuration files. In the example above both `something.config.ts` and `.config/something.config.mjs` are valid configuration locations. This optionality should help remove configuration file overload in top level Further configuration folders can be added via the `dirs` property.
9 changes: 9 additions & 0 deletions .changeset/witty-seals-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@monots/utils': minor
---

Breaking change to `deepMerge` which now takes an array of object to merge followed by the options available via the `deepmerge` library.

- Add new `createDebugger` function to `@monots/utils` which creates a `debug` function with the given namespace.

- Add `normalizePath` function for creating a linux friendly path.
7 changes: 7 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base", ":preserveSemverRanges", "group:allNonMajor"],
"pin": false,
"ignoreDeps": [],
"ignorePaths": []
}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
changeset:
timeout-minutes: 8
runs-on: ubuntu-latest
if: ${{ false == contains(github.ref, 'changeset') && github.repository == 'kickjump/kickjump' }}
if: ${{ false == contains(github.ref, 'changeset') && github.repository == 'monots/monots' }}
steps:
- name: cancel previous runs
uses: styfle/cancel-workflow-action@0.9.1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ yarn.lock
/.huskyrc
/.lintstagedrc
/vite.config.ts
/vitest.config.ts
/tsconfig.json
/tsconfig.references.json
/.markdownlint.json
Expand Down
2 changes: 1 addition & 1 deletion .monots/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpx lint-staged
pnpm lint-staged
9 changes: 4 additions & 5 deletions .monots/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
"type": "module",
"scripts": {
"check:pnpm": "node ./check-pnpm.js",
"delete:changeset:property": "pnpm ts ./delete-changeset-changelog-property.ts",
"fix:audit": "pnpm ts ./fix-audit.ts",
"delete:changeset:property": "tsx ./delete-changeset-changelog-property.ts",
"fix:audit": "tsx ./fix-audit.ts",
"symlink:root": "node ./symlink-root.js",
"ts": "node --experimental-specifier-resolution=node --loader ts-node/esm",
"update:changelog:dates": "pnpm ts ./changelog-dates.ts",
"update:templates": "pnpm ts ./update-package.json-templates.ts"
"update:changelog:dates": "tsx ./changelog-dates.ts",
"update:templates": "tsx ./update-package.json-templates.ts"
},
"dependencies": {
"@manypkg/get-packages": "^1.1.3",
Expand Down
2 changes: 1 addition & 1 deletion .monots/symlink/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ pnpm-lock.yaml
/pnpm-lock.yaml
.pnpm-store/

**/__fixtures__/**
**/fixtures/**
2 changes: 1 addition & 1 deletion .monots/symlink/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
rules: { 'no-console': 'off', 'unicorn/no-process-exit': 'off' },
},
{
files: ['**/vite.config.{js,ts}'],
files: ['**/{vite,vitest}.config.{js,ts}'],
rules: { 'import/no-default-export': 'off' },
},
],
Expand Down
1 change: 1 addition & 0 deletions .monots/symlink/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"**/*.js": [
"eslint --fix",
"prettier --write --ignore-path .eslintignore"
],
"*.{json,yml,yaml}": [
Expand Down
22 changes: 21 additions & 1 deletion .monots/symlink/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,25 @@

"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
},
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#fae967",
"activityBar.activeBorder": "#059a89",
"activityBar.background": "#fae967",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#059a89",
"activityBarBadge.foreground": "#e7e7e7",
"sash.hoverBorder": "#fae967",
"statusBar.background": "#f8e236",
"statusBar.foreground": "#15202b",
"statusBarItem.hoverBackground": "#f3d808",
"statusBarItem.remoteBackground": "#f8e236",
"statusBarItem.remoteForeground": "#15202b",
"titleBar.activeBackground": "#f8e236",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#f8e23699",
"titleBar.inactiveForeground": "#15202b99"
},
"peacock.color": "#f8e236"
}
12 changes: 4 additions & 8 deletions .monots/symlink/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
"extends": "./.monots/tsconfig.base.json",
"include": [],
"files": [],
"ts-node": {
"transpileOnly": true,
"compilerOptions": {
"esModuleInterop": true,
"target": "ESNext"
}
},
"references": [
{
"path": ".monots/scripts"
Expand All @@ -20,7 +13,7 @@
"path": "packages/eslint-config-monots/src"
},
{
"path": "packages/monots__cli/__tests__"
"path": "packages/load-esm-config/src"
},
{
"path": "packages/monots__cli/src"
Expand All @@ -31,6 +24,9 @@
{
"path": "packages/monots__next-plugin/src"
},
{
"path": "packages/monots__test/src"
},
{
"path": "packages/monots__types/src"
},
Expand Down
18 changes: 18 additions & 0 deletions .monots/symlink/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// <reference types="vitest" />
import path from 'node:path';
import { defineConfig } from 'vite';

const config = defineConfig({
test: {
// rename `__snapshots__` to `snapshots`
resolveSnapshotPath(testPath, snapExtension) {
return path.join(
path.dirname(testPath),
'snapshots',
`${path.basename(testPath)}${snapExtension}`,
);
},
},
});

export default config;
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.14.2
v16.15.0
42 changes: 16 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@
"changeset": "changeset",
"checks": "run-s lint test build test postinstall",
"clean": "git clean -fdX",
"create-monots": "pnpm ts packages/create-monots/src/index.ts",
"create-monots": "tsx packages/create-monots/src/index.ts",
"fix": "run-s -c fix:repo fix:build fix:es fix:prettier",
"fix:audit": "pnpm scripts fix:audit",
"fix:build": "pnpm monots fix",
"fix:es": "pnpm lint:es --fix",
"fix:prettier": "pnpm run:prettier --write",
"fix:repo": "manypkg fix",
"preinstall": "pnpm scripts symlink:root && pnpm scripts check:pnpm",
"postinstall": "pnpm ts .monots/scripts/enable-cli.ts pnpm monots prepare",
"postinstall": "tsx .monots/scripts/enable-cli.ts pnpm monots prepare",
"lint": "run-s lint:\\*",
"lint:audit": "pnpm audit",
"lint:build": "pnpm monots check",
"lint:es": "eslint --ext=.tsx,.ts,.js .",
"lint:prettier": "pnpm run:prettier --check",
"lint:repo": "manypkg check",
"monots": "pnpm ts packages/monots__cli/src/index.ts",
"monots": "tsx packages/monots__cli/src/index.ts",
"prepare": "husky install .monots/.husky",
"prerelease": "pnpm build",
"release": "rm pnpm-lock.yaml pnpm-workspace.yaml && changeset publish",
Expand All @@ -45,13 +45,11 @@
"scripts": "pnpm --dir .monots/scripts run",
"test": "vitest run",
"test:watch": "vitest watch",
"ts": "node --experimental-specifier-resolution=node --loader ts-node/esm",
"typecheck": "tsc --build --force",
"update:deps": "pnpm update --latest --recursive -i",
"update:templates": "pnpm scripts update:templates",
"update:workspace": "pnpm up -r --workspace \"packages/*\"",
"version:changeset": "changeset version",
"version:ci": "run-s version:changeset version:date fix:repo update:workspace fix:prettier version:lockfile",
"version:ci": "run-s version:changeset version:date fix:repo fix:prettier version:lockfile",
"version:date": "pnpm scripts update:changelog:dates",
"version:lockfile": "pnpm install --lockfile-only",
"version:pr": "pnpm scripts delete:changeset:property"
Expand All @@ -62,24 +60,25 @@
"@manypkg/cli": "^0.19.1",
"@manypkg/get-packages": "^1.1.3",
"@monots/tsconfig": "^0.1.0",
"@types/node": "^17.0.29",
"@types/node": "^17.0.35",
"@types/ws": "^8.5.3",
"browserslist": "^4.20.3",
"eslint": "^8.14.0",
"eslint": "^8.16.0",
"eslint-config-monots": "^0.11.0",
"fast-glob": "^3.2.11",
"got": "^12.0.4",
"husky": "^7.0.4",
"lint-staged": "^12.4.1",
"find-up": "^6.3.0",
"got": "^12.1.0",
"husky": "^8.0.1",
"lint-staged": "^12.4.2",
"npm-run-all": "^4.1.5",
"prettier": "^2.6.2",
"prettier-config-monots": "^0.2.1",
"ts-node": "^10.7.0",
"typescript": "4.7.0-beta",
"vite": "^2.9.6",
"vitest": "^0.10.0"
"tsx": "^3.4.2",
"typescript": "^4.7.2",
"vite": "^2.9.9",
"vitest": "^0.12.9"
},
"packageManager": "pnpm@7.0.0-rc.9",
"packageManager": "pnpm@7.1.6",
"engines": {
"node": ">=16.9",
"pnpm": ">=6"
Expand All @@ -92,16 +91,7 @@
".monots/scripts",
"!packages/monots__tsconfig",
"docs"
],
"tsconfig": {
"ts-node": {
"transpileOnly": true,
"compilerOptions": {
"esModuleInterop": true,
"target": "ESNext"
}
}
}
]
},
"pnpm": {
"overrides": {
Expand Down
4 changes: 2 additions & 2 deletions packages/create-monots/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@monots/utils": "^0.3.6",
"@types/async-retry": "^1.4.4",
"@types/cross-spawn": "^6.0.2",
"@types/node": "^17.0.29",
"@types/node": "^17.0.35",
"@types/prompts": "^2.0.14",
"@types/rimraf": "^3.0.2",
"@types/tar": "^6.1.0",
Expand All @@ -40,7 +40,7 @@
"chalk": "^5.0.1",
"chalk-template": "^0.4.0",
"execa": "^6.1.0",
"got": "^12.0.4",
"got": "^12.1.0",
"meow": "^10.1.1",
"prompts": "^2.4.2",
"rimraf": "^3.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
"type": "module",
"scripts": {
"check:pnpm": "node ./check-pnpm.js",
"delete:changeset:property": "pnpm ts ./delete-changeset-changelog-property.ts",
"fix:audit": "pnpm ts ./fix-audit.ts",
"delete:changeset:property": "tsx ./delete-changeset-changelog-property.ts",
"fix:audit": "tsx ./fix-audit.ts",
"symlink:root": "node ./symlink-root.js",
"ts": "node --experimental-specifier-resolution=node --loader ts-node/esm",
"update:changelog:dates": "pnpm ts ./changelog-dates.ts",
"update:templates": "pnpm ts ./update-package.json-templates.ts"
"update:changelog:dates": "tsx ./changelog-dates.ts",
"update:templates": "tsx ./update-package.json-templates.ts"
},
"dependencies": {
"@manypkg/get-packages": "^1.1.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ pnpm-lock.yaml
/pnpm-lock.yaml
.pnpm-store/

**/__fixtures__/**
**/fixtures/**
2 changes: 1 addition & 1 deletion packages/create-monots/templates/default/node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.14.2
v16.15.0

0 comments on commit b807c2f

Please sign in to comment.