@code-essentials/tsconfig 1.2.0 → 1.2.3

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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # Graph Mind License Agreement
2
+
3
+ Copyright © 2025 Isaac Valdez. All Rights Reserved.
4
+
5
+ 1. Ownership
6
+ The source code and all associated intellectual property for the 'graph-math' project (hereinafter referred to as "the Software") are the exclusive private property of Isaac Valdez.
7
+
8
+ 2. Permitted Use
9
+ The Software may only be examined in source code form with explicit permission from Isaac Valdez. Individuals or entities wishing to review or utilize the source code must obtain this permission in writing.
10
+
11
+ 3. End-User Licensing
12
+ End users are permitted to run the Software on their local computer systems, provided such usage complies with a separate End-User License Agreement (EULA) that will be supplied to the end user.
13
+
14
+ 4. License Modifications
15
+ Isaac Valdez reserves the right to update or modify this license at any time. Changes will be effective upon modification of the license text and will apply to all users from that date onward.
16
+
17
+ 5. No Warranty
18
+ The Software is provided "as is," without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, or non-infringement.
19
+
20
+ 6. Acceptance
21
+ By using the Software, you indicate your acceptance of this license agreement. If you do not agree to abide by the terms of this agreement, you must refrain from using the Software.
package/README.md CHANGED
@@ -2,17 +2,36 @@
2
2
 
3
3
  ## Install
4
4
 
5
+ Automatic
6
+
5
7
  ```bash
6
8
  pnpm i -d @code-essentials/tsconfig
7
- cp node_modules/@code-essentials/tsconfig/tsconfig.json.template tsconfig.json
8
- cp node_modules/@code-essentials/tsconfig/tsconfig.prod.json.template tsconfig.prod.json
9
- cp node_modules/@code-essentials/tsconfig/tsconfig.debug.json.template tsconfig.debug.json
9
+ pnpm dlx setup-tsconfig
10
+ ```
11
+
12
+ Manual install
13
+
14
+ ```bash
15
+ pnpm i -d @code-essentials/tsconfig
16
+ cp -r node_modules/@code-essentials/tsconfig/template/* .
10
17
  ```
11
18
 
12
19
  1. Install `@code-essentials/tsconfig`.
13
20
 
14
21
  2. Copy [tsconfig.json.template](./tsconfig.json.template), [tsconfig.prod.json.template](./tsconfig.prod.json.template), and [tsconfig.debug.json.template](./tsconfig.debug.json.template) into project root, removing `.template`.
15
22
 
23
+ 3. Write the following scripts in your `package.json`
24
+
25
+ ```json
26
+ {
27
+ "clean": "rm -rf dist",
28
+ "prebuild": "pnpm run clean",
29
+ "prebuild:debug": "pnpm run clean",
30
+ "build": "tsc -p tsconfig.prod.json",
31
+ "build:debug": "tsc -p tsconfig.debug.json",
32
+ }
33
+ ```
34
+
16
35
  ## License
17
36
 
18
37
  MIT
package/cli/setup.js ADDED
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { fileURLToPath } from 'url';
4
+ import path from 'path';
5
+ import fs from 'fs/promises';
6
+ import { constants } from 'fs';
7
+
8
+ // --- Configuration ---
9
+ // Assuming this script is located at 'cli/setup.js'
10
+ const SCRIPT_PATH = fileURLToPath(import.meta.url);
11
+ const SCRIPT_DIR = path.dirname(SCRIPT_PATH);
12
+
13
+ // Source directory is two levels up from the script location, then into 'template'
14
+ const SOURCE_DIR = path.resolve(SCRIPT_DIR, '..', 'template');
15
+
16
+ // Destination is the user's current working directory (project root)
17
+ const DEST_DIR = process.cwd();
18
+ // ---------------------
19
+
20
+ /**
21
+ * Recursively copies a directory's contents from source to destination.
22
+ * @param {string} src The source directory path.
23
+ * @param {string} dest The destination directory path.
24
+ */
25
+ async function copyDir(src, dest) {
26
+ try {
27
+ // 1. Create the destination directory if it doesn't exist
28
+ await fs.mkdir(dest, { recursive: true });
29
+
30
+ // 2. Read the contents of the source directory
31
+ const entries = await fs.readdir(src, { withFileTypes: true });
32
+
33
+ // 3. Process each entry
34
+ for (const entry of entries) {
35
+ const srcPath = path.join(src, entry.name);
36
+ const destPath = path.join(dest, entry.name);
37
+
38
+ if (entry.isDirectory()) {
39
+ // If it's a directory, recurse
40
+ await copyDir(srcPath, destPath);
41
+ } else if (entry.isFile()) {
42
+ // If it's a file, copy it.
43
+ // COPYFILE_EXCL ensures we do not overwrite existing files,
44
+ // which is often desired for config templates.
45
+ await fs.copyFile(srcPath, destPath, constants.COPYFILE_EXCL);
46
+ console.log(`- Created ${path.relative(DEST_DIR, destPath)}`);
47
+ }
48
+ // Ignore symbolic links and other types
49
+ }
50
+ } catch (err) {
51
+ // If a file already exists due to COPYFILE_EXCL, skip it and continue.
52
+ // Otherwise, throw the error.
53
+ if (err.code === 'EEXIST') {
54
+ // Inform the user that a file was skipped
55
+ console.log(`- Skipped ${path.relative(DEST_DIR, dest)} (File already exists)`);
56
+ } else {
57
+ throw err;
58
+ }
59
+ }
60
+ }
61
+
62
+ async function main() {
63
+ console.log(`🚀 Starting TSConfig setup in: ${DEST_DIR}`);
64
+ console.log(`Source template: ${SOURCE_DIR}`);
65
+
66
+ try {
67
+ await copyDir(SOURCE_DIR, DEST_DIR);
68
+ console.log('\n✅ **Setup Complete!** TSConfig template files have been copied.');
69
+ console.log(' Note: Existing files were skipped to prevent accidental overwrites.');
70
+ } catch (error) {
71
+ console.error('\n❌ **Setup Failed!**');
72
+ console.error('An unexpected error occurred during file copying:', error.message);
73
+ process.exit(1);
74
+ }
75
+ }
76
+
77
+ main();
package/package.json CHANGED
@@ -1,21 +1,35 @@
1
1
  {
2
2
  "name": "@code-essentials/tsconfig",
3
- "version": "1.2.0",
3
+ "version": "1.2.3",
4
4
  "description": "",
5
5
  "type": "module",
6
- "scripts": {
7
- "build": "",
8
- "test": ""
6
+ "files": [
7
+ "template",
8
+ "cli/setup.js"
9
+ ],
10
+ "bin": {
11
+ "setup-tsconfig": "cli/setup.js"
9
12
  },
10
13
  "peerDependencies": {
11
- "@tsconfig/node24": "^24.0.1",
14
+ "@tsconfig/node24": "^24.10.0",
12
15
  "@tsconfig/strictest": "^2.0.5"
13
16
  },
17
+ "devDependencies": {
18
+ "@types/node": "^24.10.1"
19
+ },
14
20
  "keywords": [],
15
21
  "author": {
16
22
  "name": "Isaac Valdez",
17
23
  "email": "isaac_valdez@msn.com",
18
24
  "url": "https://i12345.github.io"
19
25
  },
20
- "license": "MIT"
21
- }
26
+ "license": "MIT",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/code-essentials/tsconfig.git"
30
+ },
31
+ "scripts": {
32
+ "build": "",
33
+ "test": ""
34
+ }
35
+ }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "sourceMap": true,
5
- "rootDir": ".",
6
- "lib": ["ESNext", "Decorators", "DOM"]
7
- },
8
- "exclude": ["node_modules"]
9
- }
package/tsconfig.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "extends": [
3
- "@tsconfig/node24/tsconfig.json",
4
- "@tsconfig/strictest/tsconfig.json",
5
- ],
6
- "compilerOptions": {
7
- "declaration": true,
8
- "rootDir": ".",
9
- "lib": ["ESNext", "Decorators", "DOM"],
10
- "moduleResolution": "nodenext",
11
- },
12
- "exclude": ["node_modules"]
13
- }
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "sourceMap": false,
5
- "rootDir": "src",
6
- // remove DOM
7
- "lib": ["ESNext", "Decorators"],
8
- },
9
- "exclude": ["node_modules", "test"]
10
- }