touch-all 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -104,11 +104,10 @@ my-project/
104
104
 
105
105
  Both formats produce identical results.
106
106
 
107
-
108
107
  ### Rules
109
108
 
110
109
  | Syntax | Meaning |
111
- |-------------------| -------------------------------- |
110
+ | ----------------- | -------------------------------- |
112
111
  | `name/` | directory |
113
112
  | `name` | file |
114
113
  | `dir/sub/` | directory at an explicit subpath |
@@ -166,11 +165,7 @@ import { NodeContext, NodeRuntime } from '@effect/platform-node'
166
165
  const projectDirectory = '/absolute/target/path'
167
166
  const items = parserFolderStructure(tree)
168
167
 
169
- fileStructureCreator(items, projectDirectory)
170
- .pipe(
171
- Effect.provide(NodeContext.layer),
172
- NodeRuntime.runMain,
173
- )
168
+ fileStructureCreator(items, projectDirectory).pipe(Effect.provide(NodeContext.layer), NodeRuntime.runMain)
174
169
  ```
175
170
 
176
171
  ### `resolveProjectPathToBase(projectPath: string, basePath: string): Effect<string, PathTraversalError>`
@@ -180,7 +175,6 @@ Resolves `projectPath` relative to `basePath` and rejects any path that would es
180
175
  > [!CAUTION]
181
176
  > `projectPath` cannot traverse outside of `basePath`. If `projectPath` is absolute, it treated as relative to `basePath`. If `projectPath` is relative, it is resolved against `basePath`. In either case, if the resulting path is outside of `basePath`, a `PathTraversalError` is thrown.
182
177
 
183
-
184
178
  ### Error types
185
179
 
186
180
  | Class | `_tag` | When thrown |
package/dist/lib/index.js CHANGED
@@ -42,31 +42,31 @@ var resolveProjectPathToBase = (projectPath, basePath) => {
42
42
  };
43
43
 
44
44
  // src/fsGenerator.ts
45
- var fileStructureCreator = (items, basePath) => Effect2.gen(function* (_) {
46
- yield* _(Effect2.logInfo(`Creating structure in: ${basePath}`));
45
+ var fileStructureCreator = (items, basePath) => Effect2.gen(function* () {
46
+ yield* Effect2.logInfo(`Creating structure in: ${basePath}`);
47
47
  for (const item of items) {
48
- const fullPath = yield* _(resolveProjectPathToBase(item.path, basePath));
48
+ const fullPath = yield* resolveProjectPathToBase(item.path, basePath);
49
49
  if (item.isFile) {
50
50
  const dir = path.dirname(fullPath);
51
- yield* _(Effect2.try({
51
+ yield* Effect2.try({
52
52
  try: () => fs.mkdirSync(dir, { recursive: true }),
53
53
  catch: (error) => new FsError(`Failed to create directory ${dir}: ${String(error)}`)
54
- }));
55
- yield* _(Effect2.try({
54
+ });
55
+ yield* Effect2.try({
56
56
  try: () => fs.writeFileSync(fullPath, ""),
57
57
  catch: (error) => new FsError(`Failed to create file ${fullPath}: ${String(error)}`)
58
- }));
59
- yield* _(Effect2.logInfo(` Created file: ${item.path}`));
58
+ });
59
+ yield* Effect2.logInfo(` Created file: ${item.path}`);
60
60
  } else {
61
- yield* _(Effect2.try({
61
+ yield* Effect2.try({
62
62
  try: () => fs.mkdirSync(fullPath, { recursive: true }),
63
63
  catch: (error) => new FsError(`Failed to create directory ${fullPath}: ${String(error)}`)
64
- }));
65
- yield* _(Effect2.logInfo(` Created directory: ${item.path}`));
64
+ });
65
+ yield* Effect2.logInfo(` Created directory: ${item.path}`);
66
66
  }
67
67
  }
68
- yield* _(Effect2.logInfo(`
69
- ✓ Structure created successfully!`));
68
+ yield* Effect2.logInfo(`
69
+ ✓ Structure created successfully!`);
70
70
  });
71
71
  // src/parser.ts
72
72
  var parserFolderStructure = (treeString) => {
@@ -97,36 +97,36 @@ var resolveProjectPathToBase = (projectPath, basePath) => {
97
97
  };
98
98
 
99
99
  // src/fsGenerator.ts
100
- var fileStructureCreator = (items, basePath) => Effect2.gen(function* (_) {
101
- yield* _(Effect2.logInfo(`Creating structure in: ${basePath}`));
100
+ var fileStructureCreator = (items, basePath) => Effect2.gen(function* () {
101
+ yield* Effect2.logInfo(`Creating structure in: ${basePath}`);
102
102
  for (const item of items) {
103
- const fullPath = yield* _(resolveProjectPathToBase(item.path, basePath));
103
+ const fullPath = yield* resolveProjectPathToBase(item.path, basePath);
104
104
  if (item.isFile) {
105
105
  const dir = path.dirname(fullPath);
106
- yield* _(Effect2.try({
106
+ yield* Effect2.try({
107
107
  try: () => fs.mkdirSync(dir, { recursive: true }),
108
108
  catch: (error) => new FsError(`Failed to create directory ${dir}: ${String(error)}`)
109
- }));
110
- yield* _(Effect2.try({
109
+ });
110
+ yield* Effect2.try({
111
111
  try: () => fs.writeFileSync(fullPath, ""),
112
112
  catch: (error) => new FsError(`Failed to create file ${fullPath}: ${String(error)}`)
113
- }));
114
- yield* _(Effect2.logInfo(` Created file: ${item.path}`));
113
+ });
114
+ yield* Effect2.logInfo(` Created file: ${item.path}`);
115
115
  } else {
116
- yield* _(Effect2.try({
116
+ yield* Effect2.try({
117
117
  try: () => fs.mkdirSync(fullPath, { recursive: true }),
118
118
  catch: (error) => new FsError(`Failed to create directory ${fullPath}: ${String(error)}`)
119
- }));
120
- yield* _(Effect2.logInfo(` Created directory: ${item.path}`));
119
+ });
120
+ yield* Effect2.logInfo(` Created directory: ${item.path}`);
121
121
  }
122
122
  }
123
- yield* _(Effect2.logInfo(`
124
- ✓ Structure created successfully!`));
123
+ yield* Effect2.logInfo(`
124
+ ✓ Structure created successfully!`);
125
125
  });
126
126
  // package.json
127
127
  var package_default = {
128
128
  name: "touch-all",
129
- version: "1.2.0",
129
+ version: "1.2.1",
130
130
  description: "CLI tool to create folder structures from markdown tree representations",
131
131
  keywords: [
132
132
  "cli",
@@ -165,23 +165,24 @@ var package_default = {
165
165
  build: "tsup --config .config/tsup.config.ts",
166
166
  "check:lint": "oxlint . -c .config/.oxlintrc.json",
167
167
  "check:format": "oxfmt . -c .config/.oxfmtrc.json --check",
168
+ "check:ts": "tsc --noEmit",
168
169
  format: "oxfmt . -c .config/.oxfmtrc.json --write",
169
170
  test: "vitest --config .config/vitest.config.ts run"
170
171
  },
171
172
  dependencies: {
172
- "@effect/cli": "^0.73.2",
173
- "@effect/platform-node": "^0.104.1",
174
- effect: "^3.19.16"
173
+ "@effect/cli": "^0.75.0",
174
+ "@effect/platform-node": "^0.106.0",
175
+ effect: "^3.21.0"
175
176
  },
176
177
  devDependencies: {
177
- "@total-typescript/tsconfig": "1.0.4",
178
- "@types/bun": "1.3.9",
179
- "@types/node": "25.3.2",
180
- oxfmt: "0.28.0",
181
- oxlint: "1.43.0",
178
+ "@total-typescript/tsconfig": "1.0.3",
179
+ "@types/bun": "1.3.11",
180
+ "@types/node": "25.5.0",
181
+ oxfmt: "0.41.0",
182
+ oxlint: "1.56.0",
182
183
  tsup: "8.5.1",
183
184
  typescript: "5.9.3",
184
- vitest: "4.0.18"
185
+ vitest: "4.1.0"
185
186
  },
186
187
  engines: {
187
188
  node: ">=18"
@@ -200,11 +201,11 @@ var command = Command.make("touch-all", {
200
201
  dryRun: dryRunOption,
201
202
  verbose: verboseOption
202
203
  }).pipe(Command.withDescription("Create directory structure from a tree representation"), Command.withHandler(({ tree, path: targetPath, dryRun = false, verbose }) => {
203
- const readStdin = Effect3.gen(function* (_) {
204
+ const readStdin = Effect3.gen(function* () {
204
205
  if (process.stdin.isTTY) {
205
- yield* _(Console.log("Paste your tree structure and press Ctrl+D when done:"));
206
+ yield* Console.log("Paste your tree structure and press Ctrl+D when done:");
206
207
  }
207
- return yield* _(Effect3.tryPromise({
208
+ return yield* Effect3.tryPromise({
208
209
  try: () => new Promise((resolve2) => {
209
210
  const rl = createInterface({ input: process.stdin });
210
211
  const lines = [];
@@ -213,25 +214,25 @@ var command = Command.make("touch-all", {
213
214
  `)));
214
215
  }),
215
216
  catch: (e) => new Error(`Failed to read stdin: ${String(e)}`)
216
- }));
217
+ });
217
218
  });
218
- const program = Effect3.gen(function* (_) {
219
- const treeString = Option.isSome(tree) ? tree.value : yield* _(readStdin);
219
+ const program = Effect3.gen(function* () {
220
+ const treeString = Option.isSome(tree) ? tree.value : yield* readStdin;
220
221
  if (dryRun) {
221
- yield* _(Effect3.logInfo("Running in dry mode. No one file system node will be created."));
222
+ yield* Effect3.logInfo("Running in dry mode. No one file system node will be created.");
222
223
  }
223
- yield* _(Effect3.logInfo("Parsing tree structure..."));
224
+ yield* Effect3.logInfo("Parsing tree structure...");
224
225
  const items = parserFolderStructure(treeString);
225
226
  if (items.length === 0) {
226
- yield* _(Console.error("No valid items found in the tree structure"));
227
- return yield* _(Effect3.fail(new Error("Invalid tree structure")));
227
+ yield* Console.error("No valid items found in the tree structure");
228
+ return yield* Effect3.fail(new Error("Invalid tree structure"));
228
229
  }
229
- yield* _(Effect3.logInfo(`Found ${items.length} items to create`));
230
- yield* _(Effect3.logInfo(`Found:
230
+ yield* Effect3.logInfo(`Found ${items.length} items to create`);
231
+ yield* Effect3.logInfo(`Found:
231
232
  ${items.map((i) => `${i.path}
232
- `).join("")}`));
233
+ `).join("")}`);
233
234
  if (!dryRun) {
234
- yield* _(fileStructureCreator(items, targetPath));
235
+ yield* fileStructureCreator(items, targetPath);
235
236
  }
236
237
  });
237
238
  return verbose ? program.pipe(Logger.withMinimumLogLevel(LogLevel.Info)) : program;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "touch-all",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "CLI tool to create folder structures from markdown tree representations",
5
5
  "keywords": [
6
6
  "cli",
@@ -39,23 +39,24 @@
39
39
  "build": "tsup --config .config/tsup.config.ts",
40
40
  "check:lint": "oxlint . -c .config/.oxlintrc.json",
41
41
  "check:format": "oxfmt . -c .config/.oxfmtrc.json --check",
42
+ "check:ts": "tsc --noEmit",
42
43
  "format": "oxfmt . -c .config/.oxfmtrc.json --write",
43
44
  "test": "vitest --config .config/vitest.config.ts run"
44
45
  },
45
46
  "dependencies": {
46
- "@effect/cli": "^0.73.2",
47
- "@effect/platform-node": "^0.104.1",
48
- "effect": "^3.19.16"
47
+ "@effect/cli": "^0.75.0",
48
+ "@effect/platform-node": "^0.106.0",
49
+ "effect": "^3.21.0"
49
50
  },
50
51
  "devDependencies": {
51
- "@total-typescript/tsconfig": "1.0.4",
52
- "@types/bun": "1.3.9",
53
- "@types/node": "25.3.2",
54
- "oxfmt": "0.28.0",
55
- "oxlint": "1.43.0",
52
+ "@total-typescript/tsconfig": "1.0.3",
53
+ "@types/bun": "1.3.11",
54
+ "@types/node": "25.5.0",
55
+ "oxfmt": "0.41.0",
56
+ "oxlint": "1.56.0",
56
57
  "tsup": "8.5.1",
57
58
  "typescript": "5.9.3",
58
- "vitest": "4.0.18"
59
+ "vitest": "4.1.0"
59
60
  },
60
61
  "engines": {
61
62
  "node": ">=18"
File without changes
File without changes
File without changes
File without changes