fabrique 1.0.13 → 1.1.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/.yarn/releases/{yarn-4.10.3.cjs → yarn-4.12.0.cjs} +300 -300
- package/.yarnrc.yml +1 -1
- package/LICENSE +1 -1
- package/package.json +4 -4
- package/src/actions/create.js +21 -1
- package/src/helpers/cmd.js +2 -0
- package/templates/lib/.yarn/releases/{yarn-4.10.3.cjs → yarn-4.12.0.cjs} +300 -300
- package/templates/lib/.yarnrc.yml +1 -1
- package/templates/lib/CONTRIBUTING.md +2 -2
- package/templates/lib/fabrique/actions/build.js +1 -1
- package/templates/lib/fabrique/helpers/cmd.js +2 -0
- package/templates/lib/fabrique/helpers/explore-directory.js +3 -2
- package/templates/lib/fabrique/test/tools.ts +21 -2
- package/templates/lib/package.json +9 -7
- package/templates/lib/src/add.test.ts +1 -1
- package/templates/lib/src/main.ts +3 -0
- package/templates/lib/tsconfig.json +7 -2
|
@@ -4,7 +4,7 @@ This projet is open to everyone. Feel free to test the library, share it, improv
|
|
|
4
4
|
|
|
5
5
|
### Getting started
|
|
6
6
|
|
|
7
|
-
The library requires [Node.js](https://nodejs.org/en) `
|
|
7
|
+
The library requires [Node.js](https://nodejs.org/en) `24+` and [yarn](https://yarnpkg.com/).
|
|
8
8
|
|
|
9
9
|
First, we have to use the correct version of node:
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ First, we have to use the correct version of node:
|
|
|
12
12
|
nvm use
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
If you don't have [nvm](https://github.com/nvm-sh/nvm), you may manually install and use Node.js
|
|
15
|
+
If you don't have [nvm](https://github.com/nvm-sh/nvm), you may manually install and use Node.js 24+.
|
|
16
16
|
|
|
17
17
|
Then, we have to use the proper package manager (here `yarn`):
|
|
18
18
|
|
|
@@ -112,7 +112,7 @@ async function buildTypescript(sourcePath) {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
function generateExportEsmLine(path) {
|
|
115
|
-
return `export * from './${path.replaceAll('\\', '/').slice(0, -3)}.
|
|
115
|
+
return `export * from './${path.replaceAll('\\', '/').slice(0, -3)}.ts';\n`;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
@@ -3,9 +3,11 @@ import process from 'node:process';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Runs "command" into the terminal.
|
|
6
|
+
*
|
|
6
7
|
* @param {string} command
|
|
7
8
|
* @param {readonly string[]} args
|
|
8
9
|
* @param {SpawnOptions | undefined} options
|
|
10
|
+
* @return {Promise<void>} A Promise that resolves when the command exits (ends with code 0) or rejects if the command fails.
|
|
9
11
|
*/
|
|
10
12
|
export async function cmd(command, args = [], options) {
|
|
11
13
|
return new Promise((resolve, reject) => {
|
|
@@ -3,10 +3,11 @@ import { join, relative, resolve } from 'node:path';
|
|
|
3
3
|
import process from 'node:process';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Recursively explore a directory and yield all files.
|
|
7
|
+
*
|
|
7
8
|
* @param {string} path
|
|
8
9
|
* @param {{relativeTo?: string; pick?: (path: string, type: { isFile: boolean; isDirectory: boolean; }) => boolean; }?} options
|
|
9
|
-
* @
|
|
10
|
+
* @returns {AsyncGenerator<string>} A generator that yields all files (path) in the directory.
|
|
10
11
|
*/
|
|
11
12
|
export async function* exploreDirectoryFiles(path, options) {
|
|
12
13
|
const dir = await opendir(resolve(process.cwd(), path));
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
export namespace testTools {
|
|
2
|
-
export function sleep(
|
|
3
|
-
return new Promise((resolve) =>
|
|
2
|
+
export function sleep(duration: number, signal?: AbortSignal): Promise<void> {
|
|
3
|
+
return new Promise<void>((resolve: () => void, reject: (reason?: unknown) => void): void => {
|
|
4
|
+
signal?.throwIfAborted();
|
|
5
|
+
|
|
6
|
+
const end = (): void => {
|
|
7
|
+
signal?.removeEventListener('abort', onAbort);
|
|
8
|
+
clearTimeout(timer);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const onAbort = (): void => {
|
|
12
|
+
end();
|
|
13
|
+
reject(signal!.reason);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
signal?.addEventListener('abort', onAbort);
|
|
17
|
+
|
|
18
|
+
const timer: any = setTimeout((): void => {
|
|
19
|
+
end();
|
|
20
|
+
resolve();
|
|
21
|
+
}, duration);
|
|
22
|
+
});
|
|
4
23
|
}
|
|
5
24
|
|
|
6
25
|
export function polyfillRequestIdleCallback(): void {
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"fb:typedoc": "typedoc --options typedoc.json --tsconfig tsconfig.json",
|
|
13
13
|
"fb:prod": "node fabrique/actions/cli/build-and-publish.cli.js --mode prod",
|
|
14
14
|
"fb:dev": "node fabrique/actions/cli/build-and-publish.cli.js --mode dev",
|
|
15
|
-
"fb:rc": "node fabrique/actions/cli/build-and-publish.cli.js --mode rc"
|
|
15
|
+
"fb:rc": "node fabrique/actions/cli/build-and-publish.cli.js --mode rc",
|
|
16
|
+
"fb:node:dev": "node --experimental-strip-types --watch src/main.ts",
|
|
17
|
+
"fb:node:dev:inspect": "node --experimental-strip-types --watch --inspect src/main.ts"
|
|
16
18
|
},
|
|
17
19
|
"description": "{{description}}",
|
|
18
20
|
"keywords": [],
|
|
@@ -24,13 +26,13 @@
|
|
|
24
26
|
"url": "{{giturl}}"
|
|
25
27
|
},
|
|
26
28
|
"devDependencies": {
|
|
27
|
-
"@types/node": "^
|
|
28
|
-
"@vitest/coverage-istanbul": "^4.0.
|
|
29
|
-
"prettier": "^3.
|
|
29
|
+
"@types/node": "^25.0.3",
|
|
30
|
+
"@vitest/coverage-istanbul": "^4.0.16",
|
|
31
|
+
"prettier": "^3.7.4",
|
|
30
32
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
31
|
-
"typedoc": "^0.28.
|
|
33
|
+
"typedoc": "^0.28.15",
|
|
32
34
|
"typescript": "^5.9.3",
|
|
33
|
-
"vitest": "^4.0.
|
|
35
|
+
"vitest": "^4.0.16"
|
|
34
36
|
},
|
|
35
|
-
"packageManager": "yarn@4.
|
|
37
|
+
"packageManager": "yarn@4.12.0"
|
|
36
38
|
}
|
|
@@ -26,17 +26,21 @@
|
|
|
26
26
|
"resolveJsonModule": true,
|
|
27
27
|
"sourceMap": true,
|
|
28
28
|
"stripInternal": false,
|
|
29
|
-
"preserveConstEnums":
|
|
29
|
+
"preserveConstEnums": true,
|
|
30
30
|
"alwaysStrict": true,
|
|
31
31
|
|
|
32
32
|
/* Mode */
|
|
33
33
|
"esModuleInterop": true,
|
|
34
34
|
"moduleResolution": "NodeNext",
|
|
35
|
-
"allowImportingTsExtensions": false,
|
|
36
35
|
"isolatedModules": false,
|
|
37
36
|
"moduleDetection": "force",
|
|
38
37
|
"noEmit": false,
|
|
38
|
+
|
|
39
|
+
/* Import */
|
|
40
|
+
"allowImportingTsExtensions": true,
|
|
39
41
|
"allowSyntheticDefaultImports": true,
|
|
42
|
+
"rewriteRelativeImportExtensions": true,
|
|
43
|
+
"verbatimModuleSyntax": true,
|
|
40
44
|
|
|
41
45
|
/* Linting */
|
|
42
46
|
"strict": true,
|
|
@@ -57,6 +61,7 @@
|
|
|
57
61
|
"strictFunctionTypes": true,
|
|
58
62
|
"strictNullChecks": true,
|
|
59
63
|
"strictPropertyInitialization": true,
|
|
64
|
+
"erasableSyntaxOnly": true,
|
|
60
65
|
},
|
|
61
66
|
"include": [
|
|
62
67
|
"src/**/*.ts"
|