@elliots/typical 0.1.0 → 0.1.2

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
@@ -23,7 +23,7 @@ Why not.
23
23
  - ✅ Configurable include/exclude patterns
24
24
  - ✅ Optionally reuse validation logic for identical types to optimize performance (enabled by default)
25
25
  - ✅ TSC plugin
26
- - ✅ ESM loader for runtime transformation with `node --import typical/esm` (or `node --loader typical/esm-loader` for older Node versions)
26
+ - ✅ ESM loader for runtime transformation with `node --import @elliots/typical/esm` (or `node --loader @elliots/typical/esm-loader` for older Node versions)
27
27
  - ✅ tsx wrapper (ttsx) for easy use like `npx ttsx script.ts`
28
28
 
29
29
  ## Installation
@@ -53,10 +53,17 @@ See ./samples/esm and ./samples/tsc and ./samples/ttsx
53
53
  Quickest way to try it out is to use ttsx:
54
54
 
55
55
  ```bash
56
- npm add github:elliots/typical
56
+ npm add @elliots/typical
57
57
  npx ttsx your-script.ts
58
58
  ```
59
59
 
60
+ or globally:
61
+
62
+ ```bash
63
+ npm add -g @elliots/typical
64
+ ttsx your-script.ts
65
+ ```
66
+
60
67
  ## Example
61
68
 
62
69
  This code will run without errors when compiled normally, but will throw an error when using Typical.
package/bin/ttsx CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/bin/sh
2
2
 
3
- NODE_OPTIONS="--import typical/esm" exec tsx $@
3
+ NODE_OPTIONS="--import @elliots/typical/esm" exec tsx $@
package/bin/typical ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import('../dist/src/cli.js');
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@elliots/typical",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Runtime safe TypeScript transformer using typia",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "bin": {
8
- "typical": "dist/cli.js",
8
+ "typical": "bin/typical",
9
9
  "ttsx": "bin/ttsx",
10
10
  "ttsc": "bin/ttsc"
11
11
  },
@@ -1,4 +1,4 @@
1
- // monkeypatch fs.readFileSync to automatically add typical/tsc-plugin to tsconfig.json (if not present)
1
+ // monkeypatch fs.readFileSync to automatically add @elliots/typical/tsc-plugin to tsconfig.json (if not present)
2
2
 
3
3
  const fs = require("fs");
4
4
  const stripJsonComments = require('strip-json-comments').default;
@@ -24,7 +24,7 @@ fs.readFileSync = function (path, ...args) {
24
24
  }
25
25
 
26
26
  const hasTypical = config.compilerOptions.plugins.some(
27
- (plugin) => plugin.transform === "typical/tsc-plugin"
27
+ (plugin) => plugin.transform === "@elliots/typical/tsc-plugin"
28
28
  );
29
29
 
30
30
  if (!hasTypical) {
@@ -35,7 +35,7 @@ fs.readFileSync = function (path, ...args) {
35
35
  });
36
36
  } else {
37
37
  config.compilerOptions.plugins.push({
38
- transform: "typical/tsc-plugin",
38
+ transform: "@elliots/typical/tsc-plugin",
39
39
  });
40
40
  }
41
41
  }
@@ -44,7 +44,7 @@ fs.readFileSync = function (path, ...args) {
44
44
 
45
45
  return JSON.stringify(config, null, 2);
46
46
  } catch (e) {
47
- console.error("ERROR patching tsconfig.json to add typical/tsc-plugin", e);
47
+ console.error("ERROR patching tsconfig.json to add @elliots/typical/tsc-plugin", e);
48
48
  throw e;
49
49
  }
50
50
  }