@impactor/nodejs 3.0.2 → 5.0.0

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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export * from './src/cache-fs';
2
- export * from './src/fs';
3
- export * from './src/fs-sync';
4
- export * from './src/https';
5
- export * from './src/process';
6
- export { default as cacheFs } from './src/cache-fs';
7
- export { default as https } from './src/https';
1
+ export * from './src/cache-fs.js';
2
+ export * from './src/fs.js';
3
+ export * from './src/fs-sync.js';
4
+ export * from './src/https.js';
5
+ export * from './src/process.js';
6
+ export { default as cacheFs } from './src/cache-fs.js';
7
+ export { default as https } from './src/https.js';
package/index.js CHANGED
@@ -1,10 +1,10 @@
1
- export * from "./src/cache-fs";
2
- export * from "./src/fs";
3
- export * from "./src/fs-sync";
4
- export * from "./src/https";
5
- export * from "./src/process";
6
- import { default as default2 } from "./src/cache-fs";
7
- import { default as default3 } from "./src/https";
1
+ export * from "./src/cache-fs.js";
2
+ export * from "./src/fs.js";
3
+ export * from "./src/fs-sync.js";
4
+ export * from "./src/https.js";
5
+ export * from "./src/process.js";
6
+ import { default as default2 } from "./src/cache-fs.js";
7
+ import { default as default3 } from "./src/https.js";
8
8
  export {
9
9
  default2 as cacheFs,
10
10
  default3 as https
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@impactor/nodejs",
3
- "version": "3.0.2",
3
+ "version": "5.0.0",
4
4
  "type": "module",
5
5
  "description": "nodejs utils",
6
6
  "private": false,
7
7
  "publishConfig": {
8
- "access": "public"
8
+ "access": "public",
9
+ "linkDirectory": false
9
10
  },
10
11
  "keywords": [
11
12
  "nodejs",
@@ -15,32 +16,33 @@
15
16
  "nx": {
16
17
  "projectType": "library",
17
18
  "targets": {
18
- "build": {},
19
- "semantic-release": {}
19
+ "build": {}
20
20
  }
21
21
  },
22
22
  "imports": {
23
- "#*": "./src/*.js"
23
+ "#*": "./*"
24
24
  },
25
25
  "exports": {
26
26
  ".": {
27
27
  "types": "./index.d.js",
28
28
  "default": "./index.js"
29
29
  },
30
+ "./*": {
31
+ "types": "./src/*",
32
+ "default": "./src/*"
33
+ },
30
34
  "./package.json": {
31
35
  "default": "./package.json"
32
- },
33
- "./*": "./src/*"
36
+ }
34
37
  },
38
+ "types": "./index.d.ts",
39
+ "main": "./index.js",
35
40
  "dependencies": {
36
- "content-type": "^1.0.5",
37
- "@impactor/cache": "3.0.2",
38
- "@impactor/javascript": "3.0.2"
41
+ "@impactor/cache": "5.0.0",
42
+ "@impactor/javascript": "5.0.0",
43
+ "content-type": "^1.0.5"
39
44
  },
40
45
  "devDependencies": {
41
- "@types/content-type": "^1.1.9",
42
- "semantic-release": "^25.0.2",
43
- "semantic-release-monorepo": "^8.0.2",
44
46
  "tsx": "^4.21.0"
45
47
  },
46
48
  "engines": {
@@ -68,5 +70,7 @@
68
70
  "url": "https://www.patreon.com/GoogleDev"
69
71
  }
70
72
  ],
71
- "scripts": {}
73
+ "scripts": {
74
+ "start": "NODE_ENV=production pnpm tsx --env-file-if-exists=.env --env-file-if-exists=.env.local --env-file-if-exists=.env.production --env-file-if-exists=.env.production.local main.js"
75
+ }
72
76
  }
package/src/cache-fs.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type CacheOptions } from '@impactor/cache';
2
2
  import { type PathLike } from 'node:fs';
3
- import { type ReadOptions } from './fs-sync';
3
+ import { type ReadOptions } from './fs-sync.js';
4
4
  export interface CacheOpts extends Omit<CacheOptions, 'read' | 'write'> {
5
5
  }
6
6
  export interface CacheFSOptions extends CacheOptions, ReadOptions {
package/src/cache-fs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { cache } from "@impactor/cache";
2
- import { readSync, resolve } from "./fs-sync";
3
- import { write } from "./fs";
2
+ import { readSync, resolve } from "./fs-sync.js";
3
+ import { write } from "./fs.js";
4
4
  function getCache(entries, options) {
5
5
  for (let filePath of entries) {
6
6
  try {
@@ -1,7 +1,7 @@
1
1
  import { afterAll, beforeEach, expect, test } from "@jest/globals";
2
- import cache from "./cache-fs";
3
- import { remove, write } from "./fs";
4
- import { resolve } from "./fs-sync";
2
+ import cache from "./cache-fs.js";
3
+ import { remove, write } from "./fs.js";
4
+ import { resolve } from "./fs-sync.js";
5
5
  let dir = resolve(import.meta.dirname, "./test!!/cache");
6
6
  beforeEach(() => remove(`${dir}/file.txt`));
7
7
  afterAll(() => remove(dir));
@@ -13,7 +13,7 @@ import {
13
13
  removeSync,
14
14
  resolve,
15
15
  writeSync
16
- } from "./fs-sync";
16
+ } from "./fs-sync.js";
17
17
  import { objectType } from "@impactor/javascript";
18
18
  import { existsSync, readFileSync, utimesSync } from "node:fs";
19
19
  import { platform } from "node:process";
package/src/fs.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type PathLike, type WriteFileOptions } from 'node:fs';
2
2
  import { type Abortable } from 'node:events';
3
- import { type Filter, type MoveOptions, type ReadOptions } from './fs-sync';
3
+ import { type Filter, type MoveOptions, type ReadOptions } from './fs-sync.js';
4
4
  import { type Obj } from '@impactor/javascript';
5
5
  export declare function getSize(path: PathLike | PathLike[], unit?: 'b' | 'kb' | 'mb' | 'gb', filter?: Filter): Promise<number>;
6
6
  export declare function isDir(path: PathLike): Promise<boolean>;
package/src/fs.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  } from "node:fs/promises";
18
18
  import {
19
19
  resolve
20
- } from "./fs-sync";
20
+ } from "./fs-sync.js";
21
21
  import { dirname, join } from "node:path";
22
22
  import { objectType } from "@impactor/javascript";
23
23
  import { cleanJson } from "@impactor/javascript";
package/src/fs.spec.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { afterEach, beforeEach, describe, expect, test } from "@jest/globals";
2
- import { resolve } from "./fs-sync";
2
+ import { resolve } from "./fs-sync.js";
3
3
  import {
4
4
  copy,
5
5
  getEntries,
@@ -11,7 +11,7 @@ import {
11
11
  read,
12
12
  remove,
13
13
  write
14
- } from "./fs";
14
+ } from "./fs.js";
15
15
  import { existsSync } from "node:fs";
16
16
  import { objectType } from "@impactor/javascript";
17
17
  import { utimes } from "node:fs/promises";
package/src/https.spec.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { expect, test } from "@jest/globals";
2
- import request from "./https";
2
+ import request from "./https.js";
3
3
  test("request", (done) => {
4
4
  request(`https://jsonplaceholder.typicode.com/posts/1`).then((result) => {
5
5
  expect(result.userId).toEqual(1);
@@ -1,5 +1,5 @@
1
1
  import { expect, test } from "@jest/globals";
2
- import { parseArgv, toArgv } from "./process";
2
+ import { parseArgv, toArgv } from "./process.js";
3
3
  let input = "cmd1 cmd2 - --a 1 --b=2 --c true --d false --e --no-f -g -h hh -ijk ok -l- --num=1 --arr=1 --arr=2 --obj.a.b=1 -mn-o -p - -q123 --whitespaces=a\nb c --no-exit -- ext1 ext2";
4
4
  let parsed = {
5
5
  cmd: ["cmd1", "cmd2", "-"],
package/nx.json DELETED
@@ -1,190 +0,0 @@
1
- {
2
- "$schema": "./node_modules/nx/schemas/nx-schema.json",
3
- "targetDefaults": {
4
- "build": {
5
- "executor": "@impactor/nx-manager:universal-builder",
6
- "dependsOn": ["typecheck", "prebuild", "^build"],
7
- "cache": true,
8
- "inputs": ["default", "^default"],
9
- "outputs": ["{projectRoot}/dist"],
10
- "options": {
11
- "forceRnDefaultPostBuild": true
12
- }
13
- },
14
- "serve": {
15
- "executor": "nx:run-commands",
16
- "dependsOn": ["build", "preserve"],
17
- "continuous": true,
18
- "options": {
19
- "cwd": "{projectRoot}",
20
- "command": "NODE_ENV=development pnpm tsx --env-file-if-exists=.env --env-file-if-exists=.env.local dist/main.js"
21
- },
22
- "configurations": {
23
- "production": {
24
- "command": "NODE_ENV=production pnpm tsx --env-file-if-exists=.env --env-file-if-exists=.env.local --env-file-if-exists=.env.production --env-file-if-exists=.env.production.local dist/main.js"
25
- }
26
- }
27
- },
28
- "nx-release-publish": {
29
- "options": {
30
- "packageRoot": "{projectRoot}/dist"
31
- }
32
- },
33
- "semantic-release": {
34
- "executor": "nx:run-commands",
35
- "dependsOn": ["build", "prerelease"],
36
- "options": {
37
- "cwd": "{projectRoot}",
38
- "command": "pnpm tsx node_modules/semantic-release/bin/semantic-release.js"
39
- },
40
- "configurations": {
41
- "local": {
42
- "command": "DOTENV_CONFIG_PATH=../../.env pnpm run release --no-ci"
43
- },
44
- "dry": {
45
- "command": "DOTENV_CONFIG_PATH=../../.env pnpm run release --no-ci --dry-run"
46
- }
47
- }
48
- },
49
- "test": {
50
- "inputs": ["test"],
51
- "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
52
- "dependsOn": ["^build", "pretest"],
53
- "configurations": {
54
- "unit": {
55
- "args": [
56
- "--testPathIgnorePatterns '.*\\.e2e\\.spec\\.ts$'",
57
- "--testPathIgnorePatterns '/.*-e2e/'",
58
- "--testPathIgnorePatterns '/.*-e2e/'"
59
- ]
60
- },
61
- "e2e": {
62
- "args": [
63
- "--testMatch '**/*-e2e/**/*.{spec,test}.[mc]?[jt]s?(x)'",
64
- "--testMatch '**/e2e/**/*.{spec,test}.[mc]?[jt]s?(x)'",
65
- "--testMatch '**/*.e2e.(spec|test).?([mc])[jt]s?(x)'"
66
- ]
67
- }
68
- }
69
- },
70
- "@angular/build:application": {
71
- "cache": true,
72
- "dependsOn": ["prebuild", "^build"],
73
- "inputs": ["default", "^default"]
74
- },
75
- "@nx/angular:package": {
76
- "cache": true,
77
- "dependsOn": ["^build"],
78
- "inputs": ["default", "^default"],
79
- "outputs": ["{projectRoot}/dist"],
80
- "options": {
81
- "project": "{projectRoot}/ng-package.json",
82
- "tsConfig": "{projectRoot}/tsconfig.lib.json"
83
- }
84
- },
85
- "@nx/js:tsc": {
86
- "cache": true,
87
- "dependsOn": ["^build"],
88
- "inputs": ["default", "^default"]
89
- }
90
- },
91
- "namedInputs": {
92
- "default": [
93
- "{projectRoot}/src/**/*",
94
- "!{projectRoot}/**/*.(spec|test)(.e2e)?.[tj]sx?",
95
- "!{projectRoot}/**/e2e/**/*",
96
- "{projectRoot}/.env(.*)?",
97
- "{workspaceRoot}/tasks/(post-)?build.ts",
98
- "{projectRoot}/(project|package|tsconfig)(.+)?.json",
99
- "{workspaceRoot}/tsconfig.base.json",
100
- {
101
- "runtime": "node --version"
102
- },
103
- {
104
- "env": "NODE_ENV"
105
- }
106
- ],
107
- "test": [
108
- "default",
109
- "{projectRoot}/tsconfig.spec.json",
110
- "{projectRoot}/jest.config.[jt]s",
111
- "{workspaceRoot}/jest.config.[jt]s",
112
- "{projectRoot}/**/*.(spec|test)(.e2e)?.[jt]sx?",
113
- "{projectRoot}/**/e2e/**/*.[jt]sx?",
114
- {
115
- "externalDependencies": ["jest"]
116
- }
117
- ]
118
- },
119
- "plugins": [
120
- {
121
- "plugin": "@nx/js/typescript",
122
- "options": {
123
- "typecheck": {
124
- "targetName": "typecheck"
125
- },
126
- "build": false
127
- }
128
- },
129
- {
130
- "plugin": "@nx/jest/plugin",
131
- "options": {
132
- "targetName": "test",
133
- "ciTargetName": "test-ci"
134
- }
135
- }
136
- ],
137
- "tasksRunnerOptions": {
138
- "default": {
139
- "options": {
140
- "useDaemonProcess": false
141
- }
142
- }
143
- },
144
- "generators": {
145
- "@nx/angular:library": {
146
- "linter": "eslint",
147
- "unitTestRunner": "jest"
148
- },
149
- "@nx/angular:component": {
150
- "style": "scss"
151
- }
152
- },
153
- "release": {
154
- "groups": {
155
- "libs": {
156
- "projects": ["libs/*"]
157
- },
158
- "apps": {
159
- "projects": ["apps/*"],
160
- "changelog": {
161
- "projectChangelogs": {
162
- "createRelease": "github"
163
- }
164
- }
165
- }
166
- },
167
- "projectsRelationship": "independent",
168
- "version": {
169
- "conventionalCommits": true,
170
- "updateDependents": "always",
171
- "preVersionCommand": "pnpm nx run-many -t build",
172
- "manifestRootsToUpdate": [
173
- "{projectRoot}",
174
- {
175
- "path": "{projectRoot}/dist",
176
- "preserveLocalDependencyProtocols": false
177
- }
178
- ]
179
- },
180
- "releaseTag": {
181
- "pattern": "{projectName}@{version}"
182
- },
183
- "changelog": {
184
- "projectChangelogs": true
185
- }
186
- },
187
- "sync": {
188
- "applyChanges": false
189
- }
190
- }