@knighted/duel 1.0.3 → 1.0.4
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/dist/init.cjs +9 -5
- package/dist/init.js +9 -5
- package/package.json +3 -3
package/dist/init.cjs
CHANGED
|
@@ -8,8 +8,8 @@ var _nodeProcess = require("node:process");
|
|
|
8
8
|
var _nodeUtil = require("node:util");
|
|
9
9
|
var _nodePath = require("node:path");
|
|
10
10
|
var _promises = require("node:fs/promises");
|
|
11
|
-
var _stripJsonComments = _interopRequireDefault(require("strip-json-comments"));
|
|
12
11
|
var _readPkgUp = require("read-pkg-up");
|
|
12
|
+
var _jsoncParser = _interopRequireDefault(require("jsonc-parser"));
|
|
13
13
|
var _util = require("./util.cjs");
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
const init = async args => {
|
|
@@ -104,10 +104,14 @@ const init = async args => {
|
|
|
104
104
|
}
|
|
105
105
|
if (stats.isFile()) {
|
|
106
106
|
let tsconfig = null;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
const errors = [];
|
|
108
|
+
const jsonText = (await (0, _promises.readFile)(configPath)).toString();
|
|
109
|
+
tsconfig = _jsoncParser.default.parse(jsonText, errors, {
|
|
110
|
+
disallowComments: false,
|
|
111
|
+
allowTrailingComma: true
|
|
112
|
+
});
|
|
113
|
+
if (errors.length) {
|
|
114
|
+
(0, _util.logError)(`The config file found at ${configPath} is not parsable as JSONC.`);
|
|
111
115
|
return false;
|
|
112
116
|
}
|
|
113
117
|
if (!tsconfig.compilerOptions?.outDir) {
|
package/dist/init.js
CHANGED
|
@@ -2,8 +2,8 @@ import { cwd } from 'node:process';
|
|
|
2
2
|
import { parseArgs } from 'node:util';
|
|
3
3
|
import { resolve, join, dirname } from 'node:path';
|
|
4
4
|
import { stat, readFile } from 'node:fs/promises';
|
|
5
|
-
import stripJsonComments from 'strip-json-comments';
|
|
6
5
|
import { readPackageUp } from 'read-pkg-up';
|
|
6
|
+
import JSONC from 'jsonc-parser';
|
|
7
7
|
import { logError, log } from './util.js';
|
|
8
8
|
const init = async args => {
|
|
9
9
|
let parsed = null;
|
|
@@ -97,10 +97,14 @@ const init = async args => {
|
|
|
97
97
|
}
|
|
98
98
|
if (stats.isFile()) {
|
|
99
99
|
let tsconfig = null;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
const errors = [];
|
|
101
|
+
const jsonText = (await readFile(configPath)).toString();
|
|
102
|
+
tsconfig = JSONC.parse(jsonText, errors, {
|
|
103
|
+
disallowComments: false,
|
|
104
|
+
allowTrailingComma: true
|
|
105
|
+
});
|
|
106
|
+
if (errors.length) {
|
|
107
|
+
logError(`The config file found at ${configPath} is not parsable as JSONC.`);
|
|
104
108
|
return false;
|
|
105
109
|
}
|
|
106
110
|
if (!tsconfig.compilerOptions?.outDir) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knighted/duel",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "TypeScript dual packages.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"@knighted/specifier": "^1.0.1",
|
|
67
67
|
"find-up": "^6.3.0",
|
|
68
68
|
"glob": "^10.3.3",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
69
|
+
"jsonc-parser": "^3.2.0",
|
|
70
|
+
"read-pkg-up": "^10.0.0"
|
|
71
71
|
},
|
|
72
72
|
"prettier": {
|
|
73
73
|
"arrowParens": "avoid",
|