fabrique 0.3.3 → 1.0.2
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/.nvmrc +1 -1
- package/.yarn/releases/yarn-4.9.3.cjs +942 -0
- package/.yarnrc.yml +1 -1
- package/README.md +18 -13
- package/package.json +8 -8
- package/templates/lib/.nvmrc +1 -1
- package/templates/lib/.yarn/releases/yarn-4.9.3.cjs +942 -0
- package/templates/lib/.yarnrc.yml +1 -1
- package/templates/lib/CONTRIBUTING.md +31 -2
- package/templates/lib/fabrique/actions/build-and-publish.js +5 -0
- package/templates/lib/fabrique/actions/cli/generate-changelog.cli.js +3 -0
- package/templates/lib/fabrique/actions/cli/git-tag.cli.js +1 -0
- package/templates/lib/fabrique/actions/generate-changelog.js +7 -0
- package/templates/lib/fabrique/actions/git-tag.js +27 -0
- package/templates/lib/fabrique/actions/publish.js +1 -1
- package/templates/lib/package.json +8 -8
- package/templates/lib/typedoc.json +6 -0
- package/.yarn/releases/yarn-4.7.0.cjs +0 -935
- package/templates/lib/.yarn/releases/yarn-4.7.0.cjs +0 -935
|
@@ -6,7 +6,7 @@ This projet is open to everyone. Feel free to test the library, share it, improv
|
|
|
6
6
|
|
|
7
7
|
The library requires [Node.js](https://nodejs.org/en) `22+` and [yarn](https://yarnpkg.com/).
|
|
8
8
|
|
|
9
|
-
First, we have to
|
|
9
|
+
First, we have to use the correct version of node:
|
|
10
10
|
|
|
11
11
|
```shell
|
|
12
12
|
nvm use
|
|
@@ -20,6 +20,12 @@ Then, we have to use the proper package manager (here `yarn`):
|
|
|
20
20
|
corepack enable
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
Start a local verdaccio:
|
|
24
|
+
|
|
25
|
+
```shell
|
|
26
|
+
npx fabrique verdaccio
|
|
27
|
+
```
|
|
28
|
+
|
|
23
29
|
And install the dependencies:
|
|
24
30
|
|
|
25
31
|
```shell
|
|
@@ -30,17 +36,40 @@ yarn install
|
|
|
30
36
|
|
|
31
37
|
- The source code is located in the `src` directory.
|
|
32
38
|
- The projet uses [prettier](https://prettier.io/) to format the code. You'll want to enable and configure it in your IDE.
|
|
33
|
-
- The tests
|
|
39
|
+
- The tests run with [vitest](https://vitest.dev)
|
|
34
40
|
|
|
35
41
|
### Commands
|
|
36
42
|
|
|
37
43
|
- `fb:build`: builds the library.
|
|
38
44
|
- converts the typescript files into javascript files, copies the scss files, and assembles all the assets to create a package ready to be published.
|
|
45
|
+
- some files are handled differently:
|
|
46
|
+
- `*.protected.{ts,scss}` or `**/*.protected/**`: these files are exported under `package-name/protected`
|
|
47
|
+
- this is indented to expose parts of the code that should be restricted to advanced users only, or shared to other libraries requiring _internal_ control.
|
|
48
|
+
- `*.private.{ts,scss}` or `/*.private/**`: these files are **not** exported.
|
|
49
|
+
- this is indented to consume parts of the code internally, and not expose them publicly.
|
|
39
50
|
- `fb:format`: formats the code using `prettier`.
|
|
40
51
|
- `fb:test`: runs the tests using `vitest`.
|
|
52
|
+
- `fb:test:coverage`: runs the tests with coverage.
|
|
53
|
+
- by default, 100% code coverage is required, to enforce good quality.
|
|
54
|
+
- `fb:bench`: runs the bench tests.
|
|
55
|
+
- `fb:typedoc`: generates the documentation.
|
|
56
|
+
- if the library exposes publicly only a few and/or simple parts, the documentation may be defined in the `README.md` instead.
|
|
41
57
|
- `fb:prod`: builds the lib in `prod` mode.
|
|
42
58
|
- builds and publishes the lib on npm as a _prod_ version.
|
|
43
59
|
- `fb:dev`: builds the lib in `dev` mode.
|
|
44
60
|
- builds and publishes the lib on a local `verdaccio` with a `dev` tag.
|
|
61
|
+
- a local `verdaccio` is used to debug/test your library in another project:
|
|
62
|
+
- it is better than `npm link`, as it enforce a specific version, and allows some dependencies to be `dev` too.
|
|
45
63
|
- `fb:rc`: builds the lib in `rc` mode.
|
|
46
64
|
- builds and publishes the lib on npm with a `rc` tag.
|
|
65
|
+
- to test before production and final release
|
|
66
|
+
|
|
67
|
+
### To create an MR
|
|
68
|
+
|
|
69
|
+
1. fork the repository
|
|
70
|
+
1. add the feature/fix by modifying the code in the `src/` directory
|
|
71
|
+
1. add/write some tests until 100% code coverage is reached (run the tests with `yarn fb:test:coverage`)
|
|
72
|
+
1. format the code, using the command `yarn fb:format`
|
|
73
|
+
1. commit and push your work following the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) convention
|
|
74
|
+
1. create an MR from your repository to the upstream repository, explaining clearly what was added/fixed.
|
|
75
|
+
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { build } from './build.js';
|
|
2
|
+
import { gitTag } from './git-tag.js';
|
|
2
3
|
import { publish } from './publish.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -9,4 +10,8 @@ import { publish } from './publish.js';
|
|
|
9
10
|
export async function buildAndPublish(options) {
|
|
10
11
|
await build(options);
|
|
11
12
|
await publish(options);
|
|
13
|
+
|
|
14
|
+
if (options.mode === 'prod') {
|
|
15
|
+
await gitTag();
|
|
16
|
+
}
|
|
12
17
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gitTag();
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { ROOT_PATH } from '../constants/root-path.constant.js';
|
|
4
|
+
import { cmd } from '../helpers/cmd.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Git tag and push
|
|
8
|
+
* @return {Promise<void>}
|
|
9
|
+
*/
|
|
10
|
+
export async function gitTag() {
|
|
11
|
+
const packageJsonPath = join(ROOT_PATH, 'package.json');
|
|
12
|
+
|
|
13
|
+
const version = JSON.parse(
|
|
14
|
+
await readFile(packageJsonPath, {
|
|
15
|
+
encoding: 'utf8',
|
|
16
|
+
}),
|
|
17
|
+
).version;
|
|
18
|
+
|
|
19
|
+
console.log(`Git tag v${version}...`);
|
|
20
|
+
|
|
21
|
+
await cmd('git', ['tag', '-a', `v${version}`, '-m', `release v${version}`], {
|
|
22
|
+
cwd: resolve(ROOT_PATH),
|
|
23
|
+
});
|
|
24
|
+
await cmd('git', ['push', '--tags'], { cwd: resolve(ROOT_PATH) });
|
|
25
|
+
|
|
26
|
+
console.log('Tag published with success !');
|
|
27
|
+
}
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"url": "{{giturl}}"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@types/node": "^
|
|
28
|
-
"@vitest/coverage-istanbul": "^3.
|
|
29
|
-
"prettier": "^3.
|
|
30
|
-
"prettier-plugin-organize-imports": "^4.
|
|
31
|
-
"typedoc": "^0.28.
|
|
32
|
-
"typescript": "5.
|
|
33
|
-
"vitest": "^3.
|
|
27
|
+
"@types/node": "^24.3.0",
|
|
28
|
+
"@vitest/coverage-istanbul": "^3.2.4",
|
|
29
|
+
"prettier": "^3.6.2",
|
|
30
|
+
"prettier-plugin-organize-imports": "^4.2.0",
|
|
31
|
+
"typedoc": "^0.28.10",
|
|
32
|
+
"typescript": "^5.9.2",
|
|
33
|
+
"vitest": "^3.2.4"
|
|
34
34
|
},
|
|
35
|
-
"packageManager": "yarn@4.
|
|
35
|
+
"packageManager": "yarn@4.9.3"
|
|
36
36
|
}
|