@xylabs/ts-scripts-yarn3 3.1.10 → 3.1.11
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/actions/package/compile/copyTypeFiles.js +18 -14
- package/dist/actions/package/compile/copyTypeFiles.js.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs +18 -14
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/package.json +5 -4
- package/src/actions/package/compile/copyTypeFiles.ts +21 -15
|
@@ -21,7 +21,9 @@ __export(copyTypeFiles_exports, {
|
|
|
21
21
|
copyTypeFiles: () => copyTypeFiles
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(copyTypeFiles_exports);
|
|
24
|
+
var import_async_mutex = require("async-mutex");
|
|
24
25
|
var import_promises = require("fs/promises");
|
|
26
|
+
const copyFileMutex = new import_async_mutex.Mutex();
|
|
25
27
|
const getDistTypeFiles = async (compilerOptions) => {
|
|
26
28
|
const outDir = compilerOptions.outDir ?? "dist";
|
|
27
29
|
return (await (0, import_promises.readdir)(outDir, { recursive: true })).filter((file) => file.endsWith("d.ts")).map((file) => `${outDir}/${file}`);
|
|
@@ -31,20 +33,22 @@ const getDistTypeMapFiles = async (compilerOptions) => {
|
|
|
31
33
|
return (await (0, import_promises.readdir)(outDir, { recursive: true })).filter((file) => file.endsWith("d.ts.map")).map((file) => `${outDir}/${file}`);
|
|
32
34
|
};
|
|
33
35
|
const copyTypeFiles = async (compilerOptions) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
await copyFileMutex.runExclusive(async () => {
|
|
37
|
+
const distTypeFiles = await getDistTypeFiles(compilerOptions);
|
|
38
|
+
await Promise.all(
|
|
39
|
+
distTypeFiles.map(async (file) => {
|
|
40
|
+
await (0, import_promises.copyFile)(file, file.replace("d.ts", "d.mts"));
|
|
41
|
+
await (0, import_promises.copyFile)(file, file.replace("d.ts", "d.cts"));
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions);
|
|
45
|
+
await Promise.all(
|
|
46
|
+
distTypeMapFiles.map(async (file) => {
|
|
47
|
+
await (0, import_promises.copyFile)(file, file.replace("d.ts.map", "d.mts.map"));
|
|
48
|
+
await (0, import_promises.copyFile)(file, file.replace("d.ts.map", "d.cts.map"));
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
});
|
|
48
52
|
};
|
|
49
53
|
// Annotate the CommonJS export names for ESM import in node:
|
|
50
54
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/copyTypeFiles.ts"],"sourcesContent":["import { copyFile, readdir } from 'fs/promises'\nimport { TsConfigCompilerOptions } from 'tsc-prog'\n\nconst getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts')).map((file) => `${outDir}/${file}`)\n}\n\nconst getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts.map')).map((file) => `${outDir}/${file}`)\n}\n\nexport const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n //hybrid packages want two copies of the types\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/copyTypeFiles.ts"],"sourcesContent":["import { Mutex } from 'async-mutex'\nimport { copyFile, readdir } from 'fs/promises'\nimport { TsConfigCompilerOptions } from 'tsc-prog'\n\nconst copyFileMutex = new Mutex()\n\nconst getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts')).map((file) => `${outDir}/${file}`)\n}\n\nconst getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts.map')).map((file) => `${outDir}/${file}`)\n}\n\nexport const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n //using a mutex since sometimes two compiles are running at once and cause a lock on windows\n await copyFileMutex.runExclusive(async () => {\n //hybrid packages want two copies of the types\n const distTypeFiles = await getDistTypeFiles(compilerOptions)\n await Promise.all(\n distTypeFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts', 'd.mts'))\n await copyFile(file, file.replace('d.ts', 'd.cts'))\n }),\n )\n\n const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions)\n await Promise.all(\n distTypeMapFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))\n await copyFile(file, file.replace('d.ts.map', 'd.cts.map'))\n }),\n )\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAsB;AACtB,sBAAkC;AAGlC,MAAM,gBAAgB,IAAI,yBAAM;AAEhC,MAAM,mBAAmB,OAAO,oBAA6C;AAC3E,QAAM,SAAS,gBAAgB,UAAU;AACzC,UAAQ,UAAM,yBAAQ,QAAQ,EAAE,WAAW,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,EAAE;AAC/H;AAEA,MAAM,sBAAsB,OAAO,oBAA6C;AAC9E,QAAM,SAAS,gBAAgB,UAAU;AACzC,UAAQ,UAAM,yBAAQ,QAAQ,EAAE,WAAW,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,UAAU,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,EAAE;AACnI;AAEO,MAAM,gBAAgB,OAAO,oBAA6C;AAE/E,QAAM,cAAc,aAAa,YAAY;AAE3C,UAAM,gBAAgB,MAAM,iBAAiB,eAAe;AAC5D,UAAM,QAAQ;AAAA,MACZ,cAAc,IAAI,OAAO,SAAS;AAChC,kBAAM,0BAAS,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC;AAClD,kBAAM,0BAAS,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC;AAAA,MACpD,CAAC;AAAA,IACH;AAEA,UAAM,mBAAmB,MAAM,oBAAoB,eAAe;AAClE,UAAM,QAAQ;AAAA,MACZ,iBAAiB,IAAI,OAAO,SAAS;AACnC,kBAAM,0BAAS,MAAM,KAAK,QAAQ,YAAY,WAAW,CAAC;AAC1D,kBAAM,0BAAS,MAAM,KAAK,QAAQ,YAAY,WAAW,CAAC;AAAA,MAC5D,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Mutex } from "async-mutex";
|
|
1
2
|
import { copyFile, readdir } from "fs/promises";
|
|
3
|
+
const copyFileMutex = new Mutex();
|
|
2
4
|
const getDistTypeFiles = async (compilerOptions) => {
|
|
3
5
|
const outDir = compilerOptions.outDir ?? "dist";
|
|
4
6
|
return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith("d.ts")).map((file) => `${outDir}/${file}`);
|
|
@@ -8,20 +10,22 @@ const getDistTypeMapFiles = async (compilerOptions) => {
|
|
|
8
10
|
return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith("d.ts.map")).map((file) => `${outDir}/${file}`);
|
|
9
11
|
};
|
|
10
12
|
const copyTypeFiles = async (compilerOptions) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
await copyFileMutex.runExclusive(async () => {
|
|
14
|
+
const distTypeFiles = await getDistTypeFiles(compilerOptions);
|
|
15
|
+
await Promise.all(
|
|
16
|
+
distTypeFiles.map(async (file) => {
|
|
17
|
+
await copyFile(file, file.replace("d.ts", "d.mts"));
|
|
18
|
+
await copyFile(file, file.replace("d.ts", "d.cts"));
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions);
|
|
22
|
+
await Promise.all(
|
|
23
|
+
distTypeMapFiles.map(async (file) => {
|
|
24
|
+
await copyFile(file, file.replace("d.ts.map", "d.mts.map"));
|
|
25
|
+
await copyFile(file, file.replace("d.ts.map", "d.cts.map"));
|
|
26
|
+
})
|
|
27
|
+
);
|
|
28
|
+
});
|
|
25
29
|
};
|
|
26
30
|
export {
|
|
27
31
|
copyTypeFiles
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/copyTypeFiles.ts"],"sourcesContent":["import { copyFile, readdir } from 'fs/promises'\nimport { TsConfigCompilerOptions } from 'tsc-prog'\n\nconst getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts')).map((file) => `${outDir}/${file}`)\n}\n\nconst getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts.map')).map((file) => `${outDir}/${file}`)\n}\n\nexport const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n //hybrid packages want two copies of the types\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/copyTypeFiles.ts"],"sourcesContent":["import { Mutex } from 'async-mutex'\nimport { copyFile, readdir } from 'fs/promises'\nimport { TsConfigCompilerOptions } from 'tsc-prog'\n\nconst copyFileMutex = new Mutex()\n\nconst getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts')).map((file) => `${outDir}/${file}`)\n}\n\nconst getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts.map')).map((file) => `${outDir}/${file}`)\n}\n\nexport const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n //using a mutex since sometimes two compiles are running at once and cause a lock on windows\n await copyFileMutex.runExclusive(async () => {\n //hybrid packages want two copies of the types\n const distTypeFiles = await getDistTypeFiles(compilerOptions)\n await Promise.all(\n distTypeFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts', 'd.mts'))\n await copyFile(file, file.replace('d.ts', 'd.cts'))\n }),\n )\n\n const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions)\n await Promise.all(\n distTypeMapFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))\n await copyFile(file, file.replace('d.ts.map', 'd.cts.map'))\n }),\n )\n })\n}\n"],"mappings":"AAAA,SAAS,aAAa;AACtB,SAAS,UAAU,eAAe;AAGlC,MAAM,gBAAgB,IAAI,MAAM;AAEhC,MAAM,mBAAmB,OAAO,oBAA6C;AAC3E,QAAM,SAAS,gBAAgB,UAAU;AACzC,UAAQ,MAAM,QAAQ,QAAQ,EAAE,WAAW,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,EAAE;AAC/H;AAEA,MAAM,sBAAsB,OAAO,oBAA6C;AAC9E,QAAM,SAAS,gBAAgB,UAAU;AACzC,UAAQ,MAAM,QAAQ,QAAQ,EAAE,WAAW,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,UAAU,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,EAAE;AACnI;AAEO,MAAM,gBAAgB,OAAO,oBAA6C;AAE/E,QAAM,cAAc,aAAa,YAAY;AAE3C,UAAM,gBAAgB,MAAM,iBAAiB,eAAe;AAC5D,UAAM,QAAQ;AAAA,MACZ,cAAc,IAAI,OAAO,SAAS;AAChC,cAAM,SAAS,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC;AAClD,cAAM,SAAS,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC;AAAA,MACpD,CAAC;AAAA,IACH;AAEA,UAAM,mBAAmB,MAAM,oBAAoB,eAAe;AAClE,UAAM,QAAQ;AAAA,MACZ,iBAAiB,IAAI,OAAO,SAAS;AACnC,cAAM,SAAS,MAAM,KAAK,QAAQ,YAAY,WAAW,CAAC;AAC1D,cAAM,SAAS,MAAM,KAAK,QAAQ,YAAY,WAAW,CAAC;AAAA,MAC5D,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
|
package/package.json
CHANGED
|
@@ -64,7 +64,8 @@
|
|
|
64
64
|
"@types/yargs": "^17.0.26",
|
|
65
65
|
"@typescript-eslint/eslint-plugin": "^6.7.3",
|
|
66
66
|
"@typescript-eslint/parser": "^6.7.3",
|
|
67
|
-
"@xylabs/tsconfig": "~3.1.
|
|
67
|
+
"@xylabs/tsconfig": "~3.1.11",
|
|
68
|
+
"async-mutex": "^0.4.0",
|
|
68
69
|
"chalk": "^4.1.2",
|
|
69
70
|
"cosmiconfig": "^8.3.6",
|
|
70
71
|
"cosmiconfig-typescript-loader": "^5.0.0",
|
|
@@ -110,8 +111,8 @@
|
|
|
110
111
|
"@types/license-checker": "^25.0.4",
|
|
111
112
|
"@types/lodash": "^4.14.199",
|
|
112
113
|
"@types/parse-git-config": "^3.0.2",
|
|
113
|
-
"@xylabs/eslint-config": "^3.1.
|
|
114
|
-
"@xylabs/tsconfig": "^3.1.
|
|
114
|
+
"@xylabs/eslint-config": "^3.1.11",
|
|
115
|
+
"@xylabs/tsconfig": "^3.1.11",
|
|
115
116
|
"publint": "^0.2.3",
|
|
116
117
|
"typescript": "^5.2.2"
|
|
117
118
|
},
|
|
@@ -167,5 +168,5 @@
|
|
|
167
168
|
"package-clean": "echo Not cleaning..."
|
|
168
169
|
},
|
|
169
170
|
"sideEffects": false,
|
|
170
|
-
"version": "3.1.
|
|
171
|
+
"version": "3.1.11"
|
|
171
172
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { Mutex } from 'async-mutex'
|
|
1
2
|
import { copyFile, readdir } from 'fs/promises'
|
|
2
3
|
import { TsConfigCompilerOptions } from 'tsc-prog'
|
|
3
4
|
|
|
5
|
+
const copyFileMutex = new Mutex()
|
|
6
|
+
|
|
4
7
|
const getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {
|
|
5
8
|
const outDir = compilerOptions.outDir ?? 'dist'
|
|
6
9
|
return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts')).map((file) => `${outDir}/${file}`)
|
|
@@ -12,20 +15,23 @@ const getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) =>
|
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
export const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
distTypeFiles
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
//using a mutex since sometimes two compiles are running at once and cause a lock on windows
|
|
19
|
+
await copyFileMutex.runExclusive(async () => {
|
|
20
|
+
//hybrid packages want two copies of the types
|
|
21
|
+
const distTypeFiles = await getDistTypeFiles(compilerOptions)
|
|
22
|
+
await Promise.all(
|
|
23
|
+
distTypeFiles.map(async (file) => {
|
|
24
|
+
await copyFile(file, file.replace('d.ts', 'd.mts'))
|
|
25
|
+
await copyFile(file, file.replace('d.ts', 'd.cts'))
|
|
26
|
+
}),
|
|
27
|
+
)
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions)
|
|
30
|
+
await Promise.all(
|
|
31
|
+
distTypeMapFiles.map(async (file) => {
|
|
32
|
+
await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))
|
|
33
|
+
await copyFile(file, file.replace('d.ts.map', 'd.cts.map'))
|
|
34
|
+
}),
|
|
35
|
+
)
|
|
36
|
+
})
|
|
31
37
|
}
|