mwts 1.3.0 → 2.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/README.md +49 -7
- package/dist/eslint.config.js +88 -0
- package/dist/eslint.ignores.js +3 -0
- package/dist/src/clean.d.ts +0 -1
- package/dist/src/clean.js +1 -2
- package/dist/src/clean.js.map +1 -1
- package/dist/src/cli.d.ts +3 -2
- package/dist/src/cli.js +61 -17
- package/dist/src/cli.js.map +1 -1
- package/dist/src/index.d.ts +7 -2
- package/dist/src/index.js +84 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/init.d.ts +2 -6
- package/dist/src/init.js +172 -24
- package/dist/src/init.js.map +1 -1
- package/dist/src/util.d.ts +3 -5
- package/dist/src/util.js +16 -12
- package/dist/src/util.js.map +1 -1
- package/eslint.config.js +89 -0
- package/eslint.ignores.js +1 -0
- package/package.json +35 -33
- package/tsconfig-midway.json +5 -7
- package/tsconfig.json +8 -5
- package/.eslintrc.json +0 -58
- package/dist/.eslintrc.json +0 -58
- package/dist/src/clean.d.ts.map +0 -1
- package/dist/src/cli.d.ts.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/init.d.ts.map +0 -1
- package/dist/src/util.d.ts.map +0 -1
package/dist/src/init.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ESLINT_IGNORE = void 0;
|
|
4
|
+
exports.addScripts = addScripts;
|
|
5
|
+
exports.addDependencies = addDependencies;
|
|
6
|
+
exports.installDefaultTemplate = installDefaultTemplate;
|
|
7
|
+
exports.init = init;
|
|
4
8
|
const cp = require("child_process");
|
|
5
9
|
const fs = require("fs");
|
|
6
10
|
const inquirer = require("inquirer");
|
|
@@ -9,7 +13,6 @@ const ncp_1 = require("ncp");
|
|
|
9
13
|
const util = require("util");
|
|
10
14
|
const util_1 = require("./util");
|
|
11
15
|
const chalk = require("chalk");
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
13
16
|
const pkg = require('../../package.json');
|
|
14
17
|
const ncpp = util.promisify(ncp_1.ncp);
|
|
15
18
|
const DEFAULT_PACKAGE_JSON = {
|
|
@@ -23,6 +26,102 @@ const DEFAULT_PACKAGE_JSON = {
|
|
|
23
26
|
keywords: [],
|
|
24
27
|
scripts: { test: 'echo "Error: no test specified" && exit 1' },
|
|
25
28
|
};
|
|
29
|
+
const ESLINT_CONFIG = `let customConfig = [];
|
|
30
|
+
let hasIgnoresFile = false;
|
|
31
|
+
try {
|
|
32
|
+
require.resolve('./eslint.ignores.js');
|
|
33
|
+
hasIgnoresFile = true;
|
|
34
|
+
} catch {
|
|
35
|
+
// eslint.ignores.js doesn't exist
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (hasIgnoresFile) {
|
|
39
|
+
const ignores = require('./eslint.ignores.js');
|
|
40
|
+
customConfig = [{ ignores }];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
module.exports = [...customConfig, ...require('mwts')];
|
|
44
|
+
`;
|
|
45
|
+
const ESLINT_STYLISTIC_CONFIG = `const stylistic = require('@stylistic/eslint-plugin');
|
|
46
|
+
|
|
47
|
+
let customConfig = [];
|
|
48
|
+
let hasIgnoresFile = false;
|
|
49
|
+
try {
|
|
50
|
+
require.resolve('./eslint.ignores.js');
|
|
51
|
+
hasIgnoresFile = true;
|
|
52
|
+
} catch {
|
|
53
|
+
// eslint.ignores.js doesn't exist
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (hasIgnoresFile) {
|
|
57
|
+
const ignores = require('./eslint.ignores.js');
|
|
58
|
+
customConfig = [{ ignores }];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = [
|
|
62
|
+
...customConfig,
|
|
63
|
+
...require('mwts'),
|
|
64
|
+
{
|
|
65
|
+
plugins: {
|
|
66
|
+
'@stylistic': stylistic,
|
|
67
|
+
},
|
|
68
|
+
rules: {
|
|
69
|
+
'prettier/prettier': 'off',
|
|
70
|
+
'@stylistic/semi': ['error', 'always'],
|
|
71
|
+
'@stylistic/quotes': ['warn', 'single', { avoidEscape: true }],
|
|
72
|
+
'@stylistic/comma-dangle': ['error', 'always-multiline'],
|
|
73
|
+
'@stylistic/arrow-parens': ['error', 'as-needed'],
|
|
74
|
+
'@stylistic/object-curly-spacing': ['error', 'always'],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
`;
|
|
79
|
+
const ESLINT_BIOME_CONFIG = `let customConfig = [];
|
|
80
|
+
let hasIgnoresFile = false;
|
|
81
|
+
try {
|
|
82
|
+
require.resolve('./eslint.ignores.js');
|
|
83
|
+
hasIgnoresFile = true;
|
|
84
|
+
} catch {
|
|
85
|
+
// eslint.ignores.js doesn't exist
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (hasIgnoresFile) {
|
|
89
|
+
const ignores = require('./eslint.ignores.js');
|
|
90
|
+
customConfig = [{ ignores }];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
module.exports = [
|
|
94
|
+
...customConfig,
|
|
95
|
+
...require('mwts'),
|
|
96
|
+
{
|
|
97
|
+
rules: {
|
|
98
|
+
'prettier/prettier': 'off',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
`;
|
|
103
|
+
const BIOME_CONFIG = `{
|
|
104
|
+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
|
105
|
+
"formatter": {
|
|
106
|
+
"enabled": true,
|
|
107
|
+
"indentStyle": "space",
|
|
108
|
+
"indentWidth": 2,
|
|
109
|
+
"lineWidth": 80
|
|
110
|
+
},
|
|
111
|
+
"javascript": {
|
|
112
|
+
"formatter": {
|
|
113
|
+
"quoteStyle": "single",
|
|
114
|
+
"trailingCommas": "es5",
|
|
115
|
+
"semicolons": "always",
|
|
116
|
+
"arrowParentheses": "asNeeded"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
exports.ESLINT_IGNORE = "module.exports = ['dist/', '**/node_modules/']\n";
|
|
122
|
+
function getFormatterMode(options) {
|
|
123
|
+
return options.formatterMode || 'prettier';
|
|
124
|
+
}
|
|
26
125
|
async function query(message, question, defaultVal, options) {
|
|
27
126
|
if (options.yes) {
|
|
28
127
|
return true;
|
|
@@ -67,7 +166,6 @@ async function addScripts(packageJson, options) {
|
|
|
67
166
|
install = await query(message, 'Replace', false, options);
|
|
68
167
|
}
|
|
69
168
|
if (install) {
|
|
70
|
-
// eslint-disable-next-line require-atomic-updates
|
|
71
169
|
packageJson.scripts[script] = scripts[script];
|
|
72
170
|
edits = true;
|
|
73
171
|
}
|
|
@@ -75,7 +173,6 @@ async function addScripts(packageJson, options) {
|
|
|
75
173
|
}
|
|
76
174
|
return edits;
|
|
77
175
|
}
|
|
78
|
-
exports.addScripts = addScripts;
|
|
79
176
|
async function addDependencies(packageJson, options) {
|
|
80
177
|
let edits = false;
|
|
81
178
|
const deps = {
|
|
@@ -97,15 +194,47 @@ async function addDependencies(packageJson, options) {
|
|
|
97
194
|
install = await query(message, 'Overwrite', false, options);
|
|
98
195
|
}
|
|
99
196
|
if (install) {
|
|
100
|
-
// eslint-disable-next-line require-atomic-updates
|
|
101
197
|
packageJson.devDependencies[dep] = deps[dep];
|
|
102
198
|
edits = true;
|
|
103
199
|
}
|
|
104
200
|
}
|
|
105
201
|
}
|
|
202
|
+
if (getFormatterMode(options) === 'stylistic') {
|
|
203
|
+
const dep = '@stylistic/eslint-plugin';
|
|
204
|
+
const target = '^5.5.0';
|
|
205
|
+
let install = true;
|
|
206
|
+
const existing = packageJson.devDependencies[dep];
|
|
207
|
+
if (existing !== target) {
|
|
208
|
+
if (existing) {
|
|
209
|
+
const message = `Already have devDependency for ${chalk.bold(dep)}:\n` +
|
|
210
|
+
`-${chalk.red(existing)}\n+${chalk.green(target)}`;
|
|
211
|
+
install = await query(message, 'Overwrite', false, options);
|
|
212
|
+
}
|
|
213
|
+
if (install) {
|
|
214
|
+
packageJson.devDependencies[dep] = target;
|
|
215
|
+
edits = true;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (getFormatterMode(options) === 'biome') {
|
|
220
|
+
const dep = '@biomejs/biome';
|
|
221
|
+
const target = '^1.9.4';
|
|
222
|
+
let install = true;
|
|
223
|
+
const existing = packageJson.devDependencies[dep];
|
|
224
|
+
if (existing !== target) {
|
|
225
|
+
if (existing) {
|
|
226
|
+
const message = `Already have devDependency for ${chalk.bold(dep)}:\n` +
|
|
227
|
+
`-${chalk.red(existing)}\n+${chalk.green(target)}`;
|
|
228
|
+
install = await query(message, 'Overwrite', false, options);
|
|
229
|
+
}
|
|
230
|
+
if (install) {
|
|
231
|
+
packageJson.devDependencies[dep] = target;
|
|
232
|
+
edits = true;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
106
236
|
return edits;
|
|
107
237
|
}
|
|
108
|
-
exports.addDependencies = addDependencies;
|
|
109
238
|
function formatJson(object) {
|
|
110
239
|
const json = JSON.stringify(object, null, ' ');
|
|
111
240
|
return `${json}\n`;
|
|
@@ -121,10 +250,6 @@ async function writePackageJson(packageJson, options) {
|
|
|
121
250
|
};
|
|
122
251
|
options.logger.dir(preview);
|
|
123
252
|
}
|
|
124
|
-
exports.ESLINT_CONFIG = {
|
|
125
|
-
extends: './node_modules/mwts/',
|
|
126
|
-
};
|
|
127
|
-
exports.ESLINT_IGNORE = 'dist/\n';
|
|
128
253
|
async function generateConfigFile(options, filename, contents) {
|
|
129
254
|
let existing;
|
|
130
255
|
try {
|
|
@@ -136,7 +261,9 @@ async function generateConfigFile(options, filename, contents) {
|
|
|
136
261
|
/* not found, create it. */
|
|
137
262
|
}
|
|
138
263
|
else {
|
|
139
|
-
throw new Error(`Unknown error reading ${filename}: ${err.message}
|
|
264
|
+
throw new Error(`Unknown error reading ${filename}: ${err.message}`, {
|
|
265
|
+
cause: exc,
|
|
266
|
+
});
|
|
140
267
|
}
|
|
141
268
|
}
|
|
142
269
|
let writeFile = true;
|
|
@@ -156,10 +283,16 @@ async function generateConfigFile(options, filename, contents) {
|
|
|
156
283
|
}
|
|
157
284
|
}
|
|
158
285
|
async function generateESLintConfig(options) {
|
|
159
|
-
|
|
286
|
+
const formatterMode = getFormatterMode(options);
|
|
287
|
+
const config = formatterMode === 'stylistic'
|
|
288
|
+
? ESLINT_STYLISTIC_CONFIG
|
|
289
|
+
: formatterMode === 'biome'
|
|
290
|
+
? ESLINT_BIOME_CONFIG
|
|
291
|
+
: ESLINT_CONFIG;
|
|
292
|
+
return generateConfigFile(options, './eslint.config.js', config);
|
|
160
293
|
}
|
|
161
294
|
async function generateESLintIgnore(options) {
|
|
162
|
-
return generateConfigFile(options, '
|
|
295
|
+
return generateConfigFile(options, './eslint.ignores.js', exports.ESLINT_IGNORE);
|
|
163
296
|
}
|
|
164
297
|
async function generateTsConfig(options) {
|
|
165
298
|
const config = formatJson({
|
|
@@ -170,12 +303,22 @@ async function generateTsConfig(options) {
|
|
|
170
303
|
return generateConfigFile(options, './tsconfig.json', config);
|
|
171
304
|
}
|
|
172
305
|
async function generatePrettierConfig(options) {
|
|
306
|
+
if (getFormatterMode(options) === 'stylistic' ||
|
|
307
|
+
getFormatterMode(options) === 'biome') {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
173
310
|
const style = `module.exports = {
|
|
174
|
-
...require('mwts/.prettierrc.json')
|
|
175
|
-
}
|
|
311
|
+
...require('mwts/.prettierrc.json'),
|
|
312
|
+
};
|
|
176
313
|
`;
|
|
177
314
|
return generateConfigFile(options, './.prettierrc.js', style);
|
|
178
315
|
}
|
|
316
|
+
async function generateBiomeConfig(options) {
|
|
317
|
+
if (getFormatterMode(options) !== 'biome') {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
return generateConfigFile(options, './biome.json', BIOME_CONFIG + '\n');
|
|
321
|
+
}
|
|
179
322
|
async function installDefaultTemplate(options) {
|
|
180
323
|
const cwd = process.cwd();
|
|
181
324
|
const sourceDirName = path.join(__dirname, '../template');
|
|
@@ -202,7 +345,6 @@ async function installDefaultTemplate(options) {
|
|
|
202
345
|
options.logger.log('Default template installed.');
|
|
203
346
|
return true;
|
|
204
347
|
}
|
|
205
|
-
exports.installDefaultTemplate = installDefaultTemplate;
|
|
206
348
|
async function init(options) {
|
|
207
349
|
let generatedPackageJson = false;
|
|
208
350
|
let packageJson;
|
|
@@ -212,7 +354,9 @@ async function init(options) {
|
|
|
212
354
|
catch (exc) {
|
|
213
355
|
const err = (0, util_1.safeError)(exc);
|
|
214
356
|
if (err.code !== 'ENOENT') {
|
|
215
|
-
throw new Error(`Unable to open package.json file: ${err.message}
|
|
357
|
+
throw new Error(`Unable to open package.json file: ${err.message}`, {
|
|
358
|
+
cause: exc,
|
|
359
|
+
});
|
|
216
360
|
}
|
|
217
361
|
const generate = await query(`${chalk.bold('package.json')} does not exist.`, 'Generate', true, options);
|
|
218
362
|
if (!generate) {
|
|
@@ -222,18 +366,23 @@ async function init(options) {
|
|
|
222
366
|
packageJson = DEFAULT_PACKAGE_JSON;
|
|
223
367
|
generatedPackageJson = true;
|
|
224
368
|
}
|
|
225
|
-
const addedDeps = await
|
|
226
|
-
|
|
369
|
+
const [addedDeps, addedScripts] = await Promise.all([
|
|
370
|
+
addDependencies(packageJson, options),
|
|
371
|
+
addScripts(packageJson, options),
|
|
372
|
+
]);
|
|
227
373
|
if (generatedPackageJson || addedDeps || addedScripts) {
|
|
228
374
|
await writePackageJson(packageJson, options);
|
|
229
375
|
}
|
|
230
376
|
else {
|
|
231
377
|
options.logger.log('No edits needed in package.json.');
|
|
232
378
|
}
|
|
233
|
-
await
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
379
|
+
await Promise.all([
|
|
380
|
+
generateTsConfig(options),
|
|
381
|
+
generateESLintConfig(options),
|
|
382
|
+
generateESLintIgnore(options),
|
|
383
|
+
generatePrettierConfig(options),
|
|
384
|
+
generateBiomeConfig(options),
|
|
385
|
+
]);
|
|
237
386
|
await installDefaultTemplate(options);
|
|
238
387
|
// Run `npm install` after initial setup so `npm run lint` works right away.
|
|
239
388
|
if (!options.dryRun) {
|
|
@@ -243,5 +392,4 @@ async function init(options) {
|
|
|
243
392
|
}
|
|
244
393
|
return true;
|
|
245
394
|
}
|
|
246
|
-
exports.init = init;
|
|
247
395
|
//# sourceMappingURL=init.js.map
|
package/dist/src/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":";;;AAoKA,gCAwCC;AAED,0CA0EC;AA4GD,wDA8BC;AAED,oBA2DC;AA/dD,oCAAoC;AACpC,yBAAyB;AACzB,qCAAqC;AACrC,6BAA6B;AAC7B,6BAA0B;AAC1B,6BAA6B;AAE7B,iCAQgB;AAIhB,+BAAgC;AAEhC,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE1C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,SAAG,CAAC,CAAC;AAEjC,MAAM,oBAAoB,GAAgB;IACxC,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,EAAE;IACf,IAAI,EAAE,mBAAmB;IACzB,KAAK,EAAE,qBAAqB;IAC5B,KAAK,EAAE,CAAC,UAAU,CAAC;IACnB,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,EAAE,IAAI,EAAE,2CAA2C,EAAE;CAC/D,CAAC;AAEF,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;CAerB,CAAC;AAEF,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C,SAAS,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAClD,eAAe,CAAC,WAAW,EAAE,OAAO,CAAC;QACrC,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC;KACjC,CAAC,CAAC;IACH,IAAI,oBAAoB,IAAI,SAAS,IAAI,YAAY,EAAE,CAAC;QACtD,MAAM,gBAAgB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,gBAAgB,CAAC,OAAO,CAAC;QACzB,oBAAoB,CAAC,OAAO,CAAC;QAC7B,oBAAoB,CAAC,OAAO,CAAC;QAC7B,sBAAsB,CAAC,OAAO,CAAC;QAC/B,mBAAmB,CAAC,OAAO,CAAC;KAC7B,CAAC,CAAC;IACH,MAAM,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAEtC,4EAA4E;IAC5E,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACpB,yEAAyE;QACzE,oBAAoB;QACpB,EAAE,CAAC,SAAS,CACV,IAAA,2BAAoB,EAAC,OAAO,CAAC,IAAI,CAAC,EAClC,CAAC,SAAS,EAAE,kBAAkB,CAAC,EAC/B,EAAE,KAAK,EAAE,SAAS,EAAE,CACrB,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/src/util.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import * as fs from 'fs';
|
|
3
2
|
import * as ncp from 'ncp';
|
|
4
3
|
export declare const readFilep: ReadFileP;
|
|
5
4
|
export declare const rimrafp: (arg1: string) => Promise<void>;
|
|
6
|
-
export declare const writeFileAtomicp: (
|
|
7
|
-
export declare const ncpp: (source: string, destination: string, options?: ncp.Options
|
|
5
|
+
export declare const writeFileAtomicp: (filename: string, data: string) => Promise<void>;
|
|
6
|
+
export declare const ncpp: (source: string, destination: string, options?: ncp.Options) => Promise<void>;
|
|
8
7
|
export interface Bag<T> {
|
|
9
8
|
[script: string]: T;
|
|
10
9
|
}
|
|
@@ -24,7 +23,7 @@ export declare function safeError(err: unknown): NodeJS.ErrnoException;
|
|
|
24
23
|
*/
|
|
25
24
|
export interface ConfigFile {
|
|
26
25
|
files?: string[];
|
|
27
|
-
compilerOptions?: unknown
|
|
26
|
+
compilerOptions?: Record<string, unknown>;
|
|
28
27
|
include?: string[];
|
|
29
28
|
exclude?: string[];
|
|
30
29
|
extends?: string[] | string;
|
|
@@ -45,4 +44,3 @@ export declare function getPkgManagerCommand(isYarnUsed?: boolean): string;
|
|
|
45
44
|
*/
|
|
46
45
|
export declare function getTSConfig(rootDir: string, customReadFilep?: ReadFileP): Promise<ConfigFile>;
|
|
47
46
|
export declare function readJSON(filepath: string): unknown;
|
|
48
|
-
//# sourceMappingURL=util.d.ts.map
|
package/dist/src/util.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ncpp = exports.writeFileAtomicp = exports.rimrafp = exports.readFilep = void 0;
|
|
4
|
+
exports.readJsonp = readJsonp;
|
|
5
|
+
exports.nop = nop;
|
|
6
|
+
exports.safeError = safeError;
|
|
7
|
+
exports.isYarnUsed = isYarnUsed;
|
|
8
|
+
exports.getPkgManagerCommand = getPkgManagerCommand;
|
|
9
|
+
exports.getTSConfig = getTSConfig;
|
|
10
|
+
exports.readJSON = readJSON;
|
|
4
11
|
const fs = require("fs");
|
|
5
12
|
const path = require("path");
|
|
6
13
|
const rimraf = require("rimraf");
|
|
@@ -10,19 +17,18 @@ const writeFileAtomic = require("write-file-atomic");
|
|
|
10
17
|
const JSON5 = require("json5");
|
|
11
18
|
exports.readFilep = (0, util_1.promisify)(fs.readFile);
|
|
12
19
|
exports.rimrafp = (0, util_1.promisify)(rimraf);
|
|
13
|
-
|
|
20
|
+
const writeFileAtomicp = (filename, data) => writeFileAtomic(filename, data);
|
|
21
|
+
exports.writeFileAtomicp = writeFileAtomicp;
|
|
14
22
|
exports.ncpp = (0, util_1.promisify)(ncp.ncp);
|
|
15
23
|
async function readJsonp(jsonPath) {
|
|
16
24
|
const contents = await (0, exports.readFilep)(jsonPath, 'utf8');
|
|
17
25
|
return JSON5.parse(contents);
|
|
18
26
|
}
|
|
19
|
-
exports.readJsonp = readJsonp;
|
|
20
27
|
function nop() {
|
|
21
28
|
/* empty */
|
|
22
29
|
}
|
|
23
|
-
exports.nop = nop;
|
|
24
30
|
function safeError(err) {
|
|
25
|
-
if (err
|
|
31
|
+
if (err === null || err === undefined) {
|
|
26
32
|
return new Error(`(${err})`);
|
|
27
33
|
}
|
|
28
34
|
if (err instanceof Error) {
|
|
@@ -30,7 +36,6 @@ function safeError(err) {
|
|
|
30
36
|
}
|
|
31
37
|
return new Error(`${err}`);
|
|
32
38
|
}
|
|
33
|
-
exports.safeError = safeError;
|
|
34
39
|
/**
|
|
35
40
|
* Recursively iterate through the dependency chain until we reach the end of
|
|
36
41
|
* the dependency chain or encounter a circular reference
|
|
@@ -85,8 +90,9 @@ async function getBase(filePath, customReadFilep, readFiles, currentDir) {
|
|
|
85
90
|
*/
|
|
86
91
|
function combineTSConfig(base, inherited) {
|
|
87
92
|
const result = { compilerOptions: {} };
|
|
93
|
+
const compilerOptions = Object.assign({}, base.compilerOptions || {}, inherited.compilerOptions || {});
|
|
88
94
|
Object.assign(result, base, inherited);
|
|
89
|
-
|
|
95
|
+
result.compilerOptions = compilerOptions;
|
|
90
96
|
delete result.extends;
|
|
91
97
|
return result;
|
|
92
98
|
}
|
|
@@ -101,11 +107,9 @@ function isYarnUsed(existsSync = fs.existsSync) {
|
|
|
101
107
|
}
|
|
102
108
|
return existsSync('yarn.lock');
|
|
103
109
|
}
|
|
104
|
-
exports.isYarnUsed = isYarnUsed;
|
|
105
110
|
function getPkgManagerCommand(isYarnUsed) {
|
|
106
111
|
return ((isYarnUsed ? 'yarn' : 'npm') + (process.platform === 'win32' ? '.cmd' : ''));
|
|
107
112
|
}
|
|
108
|
-
exports.getPkgManagerCommand = getPkgManagerCommand;
|
|
109
113
|
/**
|
|
110
114
|
* Find the tsconfig.json, read it, and return parsed contents.
|
|
111
115
|
* @param rootDir Directory where the tsconfig.json should be found.
|
|
@@ -117,7 +121,6 @@ async function getTSConfig(rootDir, customReadFilep) {
|
|
|
117
121
|
const readArr = new Set();
|
|
118
122
|
return getBase('tsconfig.json', customReadFilep, readArr, rootDir);
|
|
119
123
|
}
|
|
120
|
-
exports.getTSConfig = getTSConfig;
|
|
121
124
|
function readJSON(filepath) {
|
|
122
125
|
const content = fs.readFileSync(filepath, 'utf8');
|
|
123
126
|
try {
|
|
@@ -125,8 +128,9 @@ function readJSON(filepath) {
|
|
|
125
128
|
}
|
|
126
129
|
catch (exc) {
|
|
127
130
|
const err = safeError(exc);
|
|
128
|
-
throw new Error(`Failed to parse JSON file '${content}' for: ${err.message}
|
|
131
|
+
throw new Error(`Failed to parse JSON file '${content}' for: ${err.message}`, {
|
|
132
|
+
cause: exc,
|
|
133
|
+
});
|
|
129
134
|
}
|
|
130
135
|
}
|
|
131
|
-
exports.readJSON = readJSON;
|
|
132
136
|
//# sourceMappingURL=util.js.map
|
package/dist/src/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":";;;AA0BA,8BAGC;AAMD,kBAEC;AAED,8BAQC;AAqGD,gCAKC;AAED,oDAIC;AASD,kCAMC;AAED,4BAaC;AA7LD,yBAAyB;AACzB,6BAA6B;AAC7B,iCAAiC;AACjC,+BAAiC;AACjC,2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,eAAe,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC;AAED,SAAgB,QAAQ,CAAC,QAAgB;IACvC,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QAC3B,MAAM,IAAI,KAAK,CACb,8BAA8B,OAAO,UAAU,GAAG,CAAC,OAAO,EAAE,EAC5D;YACE,KAAK,EAAE,GAAG;SACX,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const eslint = require('@eslint/js');
|
|
4
|
+
const tseslint = require('typescript-eslint');
|
|
5
|
+
const prettierConfig = require('eslint-config-prettier');
|
|
6
|
+
const pluginN = require('eslint-plugin-n');
|
|
7
|
+
const pluginPrettier = require('eslint-plugin-prettier');
|
|
8
|
+
const globals = require('globals');
|
|
9
|
+
const ignores = require('./eslint.ignores.js');
|
|
10
|
+
const defineConfig = require('eslint/config').defineConfig;
|
|
11
|
+
|
|
12
|
+
module.exports = defineConfig([
|
|
13
|
+
{ ignores },
|
|
14
|
+
eslint.configs.recommended,
|
|
15
|
+
prettierConfig,
|
|
16
|
+
{
|
|
17
|
+
languageOptions: {
|
|
18
|
+
globals: globals.node,
|
|
19
|
+
},
|
|
20
|
+
plugins: {
|
|
21
|
+
n: pluginN,
|
|
22
|
+
prettier: pluginPrettier,
|
|
23
|
+
},
|
|
24
|
+
rules: {
|
|
25
|
+
'prettier/prettier': 'error',
|
|
26
|
+
'block-scoped-var': 'error',
|
|
27
|
+
eqeqeq: 'error',
|
|
28
|
+
'no-var': 'error',
|
|
29
|
+
'prefer-const': 'error',
|
|
30
|
+
'eol-last': 'error',
|
|
31
|
+
'prefer-arrow-callback': 'error',
|
|
32
|
+
'no-trailing-spaces': 'error',
|
|
33
|
+
quotes: ['warn', 'single', { avoidEscape: true }],
|
|
34
|
+
'no-restricted-properties': [
|
|
35
|
+
'error',
|
|
36
|
+
{
|
|
37
|
+
object: 'describe',
|
|
38
|
+
property: 'only',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
object: 'it',
|
|
42
|
+
property: 'only',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
files: ['**/.prettierrc.js', '**/eslint.config.js', '**/eslint.ignores.js'],
|
|
49
|
+
languageOptions: {
|
|
50
|
+
sourceType: 'commonjs',
|
|
51
|
+
globals: globals.node,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
56
|
+
extends: [tseslint.configs.recommended],
|
|
57
|
+
languageOptions: {
|
|
58
|
+
parser: tseslint.parser,
|
|
59
|
+
parserOptions: {
|
|
60
|
+
ecmaVersion: 2018,
|
|
61
|
+
sourceType: 'module',
|
|
62
|
+
project: './tsconfig.json',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
rules: {
|
|
66
|
+
'@typescript-eslint/ban-ts-comment': 'warn',
|
|
67
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
68
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
69
|
+
'@typescript-eslint/no-use-before-define': 'off',
|
|
70
|
+
'@typescript-eslint/no-warning-comments': 'off',
|
|
71
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
72
|
+
'@typescript-eslint/no-unused-vars': 'warn',
|
|
73
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
74
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
75
|
+
'@typescript-eslint/no-empty-object-type': 'off',
|
|
76
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
77
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
78
|
+
'@typescript-eslint/ban-types': 'off',
|
|
79
|
+
'@typescript-eslint/camelcase': 'off',
|
|
80
|
+
'n/no-missing-import': 'off',
|
|
81
|
+
'n/no-empty-function': 'off',
|
|
82
|
+
'n/no-unsupported-features/es-syntax': 'off',
|
|
83
|
+
'n/no-missing-require': 'off',
|
|
84
|
+
'n/shebang': 'off',
|
|
85
|
+
'no-dupe-class-members': 'off',
|
|
86
|
+
'require-atomic-updates': 'off',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = ['dist/', '**/node_modules/', 'template/', 'test/fixtures/'];
|