Skip to content

Commit

Permalink
Merge pull request #136 from secundant/124-neodxvfs-redesign-api-and-…
Browse files Browse the repository at this point in the history
…add-documentation

Rework `@neodx/vfs` from scratch
  • Loading branch information
secundant authored Feb 21, 2024
2 parents 9c27d82 + d0dd044 commit 40ab6cc
Show file tree
Hide file tree
Showing 221 changed files with 18,437 additions and 8,393 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-islands-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neodx/glob': minor
---

Add `walkGlob`, low-level API for building glob-based search
5 changes: 5 additions & 0 deletions .changeset/clean-gifts-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neodx/vfs': minor
---

Stabilize `prettier` and `eslint` plugins
8 changes: 1 addition & 7 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"@neodx/scripts",
"@neodx/vite-plugin-library",
"@neodx/codegen",
"example-*",
"@neodx/docs"
],
"ignore": ["@neodx/scripts", "@neodx/codegen", "example-*", "@neodx/docs"],
"privatePackages": false,
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"updateInternalDependents": "always"
Expand Down
5 changes: 5 additions & 0 deletions .changeset/eleven-poems-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neodx/vfs': minor
---

Introduce renewed `@neodx/vfs` with new core, plugins, documentation and integrations
5 changes: 5 additions & 0 deletions .changeset/green-radios-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neodx/log': minor
---

Preserve backend internals, fix readonly mode
12 changes: 12 additions & 0 deletions .changeset/grumpy-flies-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@neodx/autobuild': patch
'@neodx/pkg-misc': patch
'@neodx/figma': patch
'@neodx/log': patch
'@neodx/std': patch
'@neodx/svg': patch
'@neodx/vfs': patch
'@neodx/fs': patch
---

Upgrade dependencies
5 changes: 5 additions & 0 deletions .changeset/odd-onions-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neodx/svg': minor
---

Make builder params more stable and simple
5 changes: 5 additions & 0 deletions .changeset/pretty-ears-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neodx/vfs': minor
---

Add `scan` plugin
5 changes: 5 additions & 0 deletions .changeset/real-ducks-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neodx/vfs': minor
---

Add `glob` plugin powered by `@neodx/glob` and `scan` plugin
5 changes: 5 additions & 0 deletions .changeset/shiny-zebras-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neodx/std': minor
---

Add `fromRange`, `mapEntries`, `mapToObject`, `tee` and other
5 changes: 5 additions & 0 deletions .changeset/shy-pumpkins-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neodx/log': minor
---

Add "createLoggerAutoFactory" API
5 changes: 5 additions & 0 deletions .changeset/slimy-turkeys-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neodx/vfs': minor
---

Rework and simplify public API
5 changes: 5 additions & 0 deletions .changeset/soft-wolves-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neodx/glob': minor
---

Add `extractGlobPaths` for a splitting single glob pattern to static paths and dynamic globs
7 changes: 7 additions & 0 deletions .changeset/thirty-plants-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@neodx/autobuild': minor
'@neodx/figma': minor
'@neodx/svg': minor
---

Adapt new `@neodx/vfs`
5 changes: 5 additions & 0 deletions .changeset/weak-cooks-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neodx/std': minor
---

Add `fromEntries`, `fromKeys`, and `zipObject` object helpers
5 changes: 5 additions & 0 deletions .changeset/weak-meals-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@neodx/glob': minor
---

Implement glob matching with `createGlobMatcher` and `matchGlob`
3 changes: 1 addition & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v3
Expand All @@ -32,7 +32,6 @@ jobs:
- name: Run NX checks
run: |
yarn nx format:check
yarn nx workspace-lint
yarn nx affected --target lint --parallel 3
yarn nx affected --target test --parallel 3
yarn nx affected --target build --parallel 3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 20.x
cache: yarn

- name: Install dependencies
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ node_modules
.pnp.*

# ========== Yarn ==========

.nx/cache
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
.pnp.js
.yarn/
node_modules/
**/.vitepress

/.nx/cache
363 changes: 0 additions & 363 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

9 changes: 0 additions & 9 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

This file was deleted.

28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

785 changes: 0 additions & 785 deletions .yarn/releases/yarn-3.2.0.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.1.0.cjs

Large diffs are not rendered by default.

25 changes: 2 additions & 23 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
changesetBaseRefs:
- main
- origin/main
- upstream/main

changesetIgnorePatterns:
- '**/*.test.{js,ts,tsx}'
- '**/*.spec.{js,ts,tsx}'
compressionLevel: mixed

defaultSemverRangePrefix: ''

Expand All @@ -17,18 +10,4 @@ nodeLinker: node-modules

npmRegistryServer: 'https://registry.npmjs.org/'

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: '@yarnpkg/plugin-typescript'

supportedArchitectures:
cpu:
- current
os:
- current

yarnPath: .yarn/releases/yarn-3.2.0.cjs
yarnPath: .yarn/releases/yarn-4.1.0.cjs
25 changes: 8 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Packages overview:
- [@neodx/figma](#neodxfigma) | [docs](https://neodx.pages.dev/figma) | [source](./libs/figma)
- [@neodx/svg](#neodxsvg) | [docs](https://neodx.pages.dev/svg) | [source](./libs/svg)
- [@neodx/log](#neodxlog) | [docs](https://neodx.pages.dev/log) | [source](./libs/log)
- [@neodx/vfs](#neodxvfs) | [docs](https://neodx.pages.dev/vfs) | [source](./libs/vfs)

### [@neodx/figma](./libs/figma)

Expand Down Expand Up @@ -172,24 +173,14 @@ Meet `@neodx/vfs`, the missing abstraction layer for file system operations that
```typescript
import { createVfs } from '@neodx/vfs';

// main.ts
const vfs = createVfs(process.cwd(), {
dryRun: process.env.DRY_RUN === 'true'
});
const fs = createVfs();

await doSomethingWithVfs(vfs);
await vfs.formatChangedFiles(); // Format all changed files
await vfs.applyChanges(); // Only now changes will be applied to the real file system (if not in dry-run mode)!

// other-file.ts
async function doSomethingWithVfs(vfs: Vfs) {
await vfs.write('file.txt', 'Hello, world!');
// ...
await vfs.remove('other-file.txt');
await vfs.updateJson('manifest.json', manifest => {
manifest.version = '1.0.0';
return manifest;
});
await fs.writeJson('.cache/meta.json', { timestamp: Date.now(), stats });
await fs.updateJson('package.json', pkg => {
pkg.version = '1.0.0';
});
await fs.write('src/index.ts', 'export const foo = 42;');
await fs.apply();
}
```

Expand Down
43 changes: 42 additions & 1 deletion apps/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export default defineConfig({
items: [
{ text: '@neodx/log', link: '/log/', activeMatch: '^/log/' },
{ text: '@neodx/svg', link: '/svg/', activeMatch: '^/svg/' },
{ text: '@neodx/figma', link: '/figma/', activeMatch: '^/figma/' }
{ text: '@neodx/figma', link: '/figma/', activeMatch: '^/figma/' },
{ text: '@neodx/vfs', link: '/vfs/', activeMatch: '^/vfs/' },
{ text: '@neodx/glob', link: '/glob/', activeMatch: '^/glob/' }
]
}
],
Expand Down Expand Up @@ -201,6 +203,45 @@ export default defineConfig({
]
}
]
},
{
text: '@neodx/vfs',
collapsed: true,
items: [
{ text: 'Getting started', link: '/vfs/' },
{ text: 'Extending', link: '/vfs/extending' },
{
text: 'Plugins',
items: [
{ text: 'scan', link: '/vfs/plugins/scan' },
{ text: 'glob', link: '/vfs/plugins/glob' },
{ text: 'json', link: '/vfs/plugins/json' },
{ text: 'eslint', link: '/vfs/plugins/eslint' },
{ text: 'prettier', link: '/vfs/plugins/prettier' },
{ text: 'package.json', link: '/vfs/plugins/package-json' }
]
},
{ text: 'Limitations', link: '/vfs/limitations' },
{
text: 'API',
collapsed: true,
items: [
{ text: 'createVfs', link: '/vfs/api/create-vfs' },
{ text: 'Plugins', link: '/vfs/api/plugins' },
{ text: 'Context', link: '/vfs/api/context' },
{ text: 'Backend', link: '/vfs/api/backend' }
]
}
]
},
{
text: '@neodx/glob',
collapsed: true,
items: [
{ text: 'Getting started', link: '/glob/' },
{ text: 'Writing your glob', link: '/glob/writing-your-glob' },
{ text: 'API', link: '/glob/api' }
]
}
]
}
Expand Down
Loading

0 comments on commit 40ab6cc

Please sign in to comment.