fabrique 2.0.5 → 2.0.8
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/CONTRIBUTING.md +120 -0
- package/README.md +50 -1
- package/package.json +1 -1
- package/src/cli/actions.private/build-project/build-project.js +3 -3
- package/src/cli/actions.private/ci-workflow/ci-workflow.js +4 -4
- package/src/cli/actions.private/create-project/create-project.js +9 -9
- package/src/cli/actions.private/refactor/refactor.js +1 -1
- package/src/cli/actions.private/release-project/release-project.js +11 -8
- package/src/cli/actions.private/release-project/release-project.js.map +1 -1
- package/src/cli/actions.private/upgrade-project/upgrade-project.js +7 -7
- package/src/cli/cli.js +10 -10
- package/src/helpers.private/build/build-mode/build-mode.schema.d.ts +1 -1
- package/src/helpers.private/build/other-files/copy-other-package-files.js +2 -2
- package/src/helpers.private/build/package-json/generate-build-package-json-file/generate-build-package-json-file.js +4 -4
- package/src/helpers.private/build/package-json/generate-build-package-json-file/generate-build-package-json-file.js.map +1 -1
- package/src/helpers.private/build/package-json/generate-build-package-json-file/typescript/generate-typescript-build-package-json-file.js +2 -2
- package/src/helpers.private/build/package-json/generate-build-package-json-file/typescript/replace/replace-package-json-exports-entry-object-ts-extensions-with-js-extensions.js +1 -1
- package/src/helpers.private/build/package-json/generate-build-package-json-file/typescript/replace/replace-package-json-exports-entry-or-fallback-ts-extensions-with-js-extensions.js +3 -3
- package/src/helpers.private/build/package-json/generate-build-package-json-file/typescript/replace/replace-package-json-exports-entry-path-ts-extensions-with-js-extensions.js +1 -1
- package/src/helpers.private/build/package-json/generate-build-package-json-file/typescript/replace/replace-package-json-exports-entry-ts-extensions-with-js-extensions.js +3 -3
- package/src/helpers.private/build/package-json/generate-build-package-json-file/typescript/replace/replace-package-json-exports-fallback-ts-extensions-with-js-extensions.js +1 -1
- package/src/helpers.private/build/package-json/generate-build-package-json-file/typescript/replace/replace-package-json-exports-list-ts-extensions-with-js-extensions.js +2 -2
- package/src/helpers.private/build/package-json/generate-build-package-json-file/typescript/replace/replace-package-json-exports-ts-extensions-with-js-extensions.js +5 -5
- package/src/helpers.private/build/package-json/generate-build-package-json-file/typescript/replace/replace-ts-extension-with-js-extension.js +1 -1
- package/src/helpers.private/build/typescript/build-typescript-index-file.js +3 -3
- package/src/helpers.private/build/typescript/build-typescript-index-file.js.map +1 -1
- package/src/helpers.private/build/typescript/build-typescript-project.js +8 -8
- package/src/helpers.private/cmd/exec-command.js +1 -1
- package/src/helpers.private/cmd/exec-command.js.map +1 -1
- package/src/helpers.private/env/env-file/env-file-path.js.map +1 -1
- package/src/helpers.private/env/env-file/get-env-ignore-env-file.js +1 -1
- package/src/helpers.private/env/env-file/load-env-file.js +1 -1
- package/src/helpers.private/env/env-file/load-optionally-env-file.js +2 -2
- package/src/helpers.private/env/types/get-boolean-env-variable.js +1 -1
- package/src/helpers.private/env/types/get-json-env-variable.js.map +1 -1
- package/src/helpers.private/file/package-json/package-json.schema.js +2 -2
- package/src/helpers.private/file/package-json/read-package-json-file.js +2 -2
- package/src/helpers.private/file/write-json-file-safe.js +1 -1
- package/src/helpers.private/file/write-text-file-safe.js +1 -1
- package/src/helpers.private/git/git-add-all-files.js +1 -1
- package/src/helpers.private/github/github-ci-config/env/get-env-github-ci-config.js +1 -1
- package/src/helpers.private/log/log-level/defaults/default-log-level.js +5 -5
- package/src/helpers.private/log/log-level/log-level-source-to-readonly-map.js +3 -3
- package/src/helpers.private/log/log-level/log-level-source.js +2 -2
- package/src/helpers.private/log/logger.js +4 -4
- package/src/helpers.private/log/logger.js.map +1 -1
- package/src/helpers.private/log/raw/ansi-fatal-raw-logger.js +2 -2
- package/src/helpers.private/log/raw/ansi-raw-logger.js +2 -2
- package/src/helpers.private/misc/list-available-templates.js +1 -1
- package/src/helpers.private/misc/paths.constant.js.map +1 -1
- package/src/helpers.private/misc/semver/semver.d.ts +9 -0
- package/src/helpers.private/misc/semver/semver.js +22 -0
- package/src/helpers.private/misc/semver/semver.js.map +1 -0
- package/src/helpers.private/path/relative-path.js.map +1 -1
- package/src/helpers.private/path/to-absolute-path.js.map +1 -1
- package/src/helpers.private/release/env/get-env-ci-release-dry-run.js +1 -1
- package/src/helpers.private/release/release-mode/release-mode.schema.d.ts +1 -1
- package/src/index.js +1 -1
- package/static/templates/lib/CONTRIBUTING.md +61 -23
- package/static/templates/lib/package.json +6 -6
- package/static/templates/lib/tsconfig.json +0 -1
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
This projet is open to everyone. Feel free to test the library, share it, improve it, and create merge requests.
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
### Tools
|
|
8
|
+
|
|
9
|
+
#### [nvm](https://github.com/nvm-sh/nvm)
|
|
10
|
+
|
|
11
|
+
We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage your Node.js versions.
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
#### [Node](https://nodejs.org)
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
nvm use
|
|
21
|
+
|
|
22
|
+
# Verify the Node.js version:
|
|
23
|
+
node -v
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### [Yarn](https://yarnpkg.com)
|
|
27
|
+
|
|
28
|
+
```shell
|
|
29
|
+
corepack enable yarn
|
|
30
|
+
|
|
31
|
+
# Verify Yarn version:
|
|
32
|
+
yarn -v
|
|
33
|
+
|
|
34
|
+
# Install the dependencies:
|
|
35
|
+
yarn install
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Code
|
|
39
|
+
|
|
40
|
+
- The source code is located in the `src` directory.
|
|
41
|
+
- The projet uses [prettier](https://prettier.io/) to format the code. You'll want to enable and configure it in your IDE.
|
|
42
|
+
- The tests run with [vitest](https://vitest.dev)
|
|
43
|
+
|
|
44
|
+
### Commands
|
|
45
|
+
|
|
46
|
+
- `fb:build`: builds the library.
|
|
47
|
+
- converts the typescript files into javascript files, copies the scss files, and assembles all the assets to create a package ready to be published.
|
|
48
|
+
- some files are handled differently:
|
|
49
|
+
- `*.protected.{ts,scss}` or `**/*.protected/**`: these files are exported under `package-name/protected`
|
|
50
|
+
- 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.
|
|
51
|
+
- `*.private.{ts,scss}` or `/*.private/**`: these files are **not** exported.
|
|
52
|
+
- this is indented to consume parts of the code internally, and not expose them publicly.
|
|
53
|
+
- `fb:format`: formats the code using `prettier`.
|
|
54
|
+
|
|
55
|
+
### To create a PR
|
|
56
|
+
|
|
57
|
+
1. fork the repository
|
|
58
|
+
1. add the feature/fix by modifying the code in the `src/` directory
|
|
59
|
+
1. add/write some tests until 100% code coverage is reached (run the tests with `yarn fb:test:coverage`)
|
|
60
|
+
1. format the code, using the command `yarn fb:format`
|
|
61
|
+
1. commit and push your work following the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) convention
|
|
62
|
+
1. create a PR from your repository to the upstream repository, explaining clearly what was added/fixed.
|
|
63
|
+
|
|
64
|
+
## Release Workflow
|
|
65
|
+
|
|
66
|
+
### 1. Pull Request to `main` or `develop`
|
|
67
|
+
|
|
68
|
+
- The `release.yml` workflow runs on `pull_request`
|
|
69
|
+
- The `yarn fb:ci:release` step runs **only if** the PR has the `dev` label
|
|
70
|
+
- Impacted packages are published as:
|
|
71
|
+
- `x.y.z-dev.<timestamp>`
|
|
72
|
+
- npm dist-tag: `dev`
|
|
73
|
+
|
|
74
|
+
### 2. Push to `develop`
|
|
75
|
+
|
|
76
|
+
- Impacted packages are published as:
|
|
77
|
+
- `x.y.z-rc.<timestamp>`
|
|
78
|
+
- npm dist-tag: `rc`
|
|
79
|
+
|
|
80
|
+
### 3. Push to `main`
|
|
81
|
+
|
|
82
|
+
- Stable publication:
|
|
83
|
+
- `x.y.z`
|
|
84
|
+
- npm dist-tag: `latest`
|
|
85
|
+
- Only if `name@x.y.z` does not already exist on npm
|
|
86
|
+
|
|
87
|
+
### Graph
|
|
88
|
+
|
|
89
|
+
```mermaid
|
|
90
|
+
flowchart LR
|
|
91
|
+
EVENT("EVENT")
|
|
92
|
+
HAS_DEV_TAG{"has "dev" tag ?"}
|
|
93
|
+
SKIP_BUILD(["skip build"])
|
|
94
|
+
BUILD_DEV_PACKAGES["build "dev" package"]
|
|
95
|
+
PUBLISH_DEV_PACKAGES["publish "dev" package"]
|
|
96
|
+
BUILD_RC_PACKAGES["build "rc" package"]
|
|
97
|
+
PUBLISH_RC_PACKAGES["publish "rc" package"]
|
|
98
|
+
BUILD_PROD_PACKAGES["build "prod" package"]
|
|
99
|
+
PUBLISH_PROD_PACKAGES["publish "prod" package"]
|
|
100
|
+
TARGET_BRANCH{"branch"}
|
|
101
|
+
|
|
102
|
+
EVENT -- "pull_request" --> HAS_DEV_TAG
|
|
103
|
+
HAS_DEV_TAG -- "no" --> SKIP_BUILD
|
|
104
|
+
HAS_DEV_TAG -- "yes" --> BUILD_DEV_PACKAGES
|
|
105
|
+
BUILD_DEV_PACKAGES --> PUBLISH_DEV_PACKAGES
|
|
106
|
+
|
|
107
|
+
EVENT -- "push" --> TARGET_BRANCH
|
|
108
|
+
|
|
109
|
+
TARGET_BRANCH -- "develop" --> BUILD_RC_PACKAGES
|
|
110
|
+
BUILD_RC_PACKAGES --> PUBLISH_RC_PACKAGES
|
|
111
|
+
|
|
112
|
+
TARGET_BRANCH -- "main" --> BUILD_PROD_PACKAGES
|
|
113
|
+
BUILD_PROD_PACKAGES --> PUBLISH_PROD_PACKAGES
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Important Rules
|
|
117
|
+
|
|
118
|
+
- if the version already exists on npm: the release is skipped
|
|
119
|
+
- the `package.json` file in the repo must keep stable versions (`x.y.z`)
|
|
120
|
+
- `-dev` / `-rc` suffixes are generated in CI
|
package/README.md
CHANGED
|
@@ -154,7 +154,56 @@ Summary:
|
|
|
154
154
|
|
|
155
155
|
##### options
|
|
156
156
|
|
|
157
|
-
- `--
|
|
157
|
+
- `--mode <mode>` (one of `dev`, `rc`, `prod`, default `prod`): build the project using a specific mode:
|
|
158
|
+
- `dev`: appends `-dev.{prereleaseId}` into the package's version
|
|
159
|
+
- `rc`: appends `-rc.{prereleaseId}` into the package's version
|
|
160
|
+
- `prod`: ready for production
|
|
161
|
+
|
|
162
|
+
#### \[cmd\]: release
|
|
163
|
+
|
|
164
|
+
```shell
|
|
165
|
+
# from the root of a "fabrique" project
|
|
166
|
+
npx fabrique release
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
##### action
|
|
170
|
+
|
|
171
|
+
This command releases an existing `fabrique` project. In order:
|
|
172
|
+
|
|
173
|
+
- runs `fb:test` command to ensure that tests fulfill.
|
|
174
|
+
- if `fb:test` does not exists, runs `test` as a replacement.
|
|
175
|
+
- runs `fb:build` command to build the project.
|
|
176
|
+
- if `fb:build` does not exists, runs `build` as a replacement.
|
|
177
|
+
- if `build` does not exists, runs `fabrique build` as a replacement.
|
|
178
|
+
- checks that the resulting _build artifact_ can be published on npm.
|
|
179
|
+
- publishes the package on npm.
|
|
180
|
+
|
|
181
|
+
> INFO: run the command **inside** the `fabrique` project.
|
|
182
|
+
|
|
183
|
+
##### options
|
|
184
|
+
|
|
185
|
+
- `--mode <mode>` (one of `dev`, `rc`, `prod`, default `prod`): see `fabrique build --mode <mode>`
|
|
186
|
+
`--dry` (default: false): runs without publishing the package. This is useful to check if the output is correct or not.
|
|
187
|
+
|
|
188
|
+
#### \[cmd\]: ci
|
|
189
|
+
|
|
190
|
+
```shell
|
|
191
|
+
npx fabrique ci [type]
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
##### \[type\]: release
|
|
195
|
+
|
|
196
|
+
###### example
|
|
197
|
+
|
|
198
|
+
```shell
|
|
199
|
+
npx fabrique ci release
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
###### action
|
|
203
|
+
|
|
204
|
+
Starts the CI `release` workflow.
|
|
205
|
+
|
|
206
|
+
> INFO: this command is automatically run from the github action `release.yml`.
|
|
158
207
|
|
|
159
208
|
#### \[cmd\]: refactor
|
|
160
209
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { rm } from 'node:fs/promises';
|
|
2
2
|
import process from 'node:process';
|
|
3
|
-
import { buildTypescriptProject, } from
|
|
4
|
-
import { readPackageJsonFile } from
|
|
5
|
-
import { toAbsolutePath } from
|
|
3
|
+
import { buildTypescriptProject, } from '../../../helpers.private/build/typescript/build-typescript-project.js';
|
|
4
|
+
import { readPackageJsonFile } from '../../../helpers.private/file/package-json/read-package-json-file.js';
|
|
5
|
+
import { toAbsolutePath } from '../../../helpers.private/path/to-absolute-path.js';
|
|
6
6
|
/**
|
|
7
7
|
* Builds a npm package.
|
|
8
8
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { loadOptionallyEnvFile } from
|
|
2
|
-
import { getEnvGithubCiConfig } from
|
|
3
|
-
import { getEnvCiReleaseDryRun } from
|
|
4
|
-
import { releaseProject } from
|
|
1
|
+
import { loadOptionallyEnvFile } from '../../../helpers.private/env/env-file/load-optionally-env-file.js';
|
|
2
|
+
import { getEnvGithubCiConfig } from '../../../helpers.private/github/github-ci-config/env/get-env-github-ci-config.js';
|
|
3
|
+
import { getEnvCiReleaseDryRun } from '../../../helpers.private/release/env/get-env-ci-release-dry-run.js';
|
|
4
|
+
import { releaseProject } from '../release-project/release-project.js';
|
|
5
5
|
/**
|
|
6
6
|
* Runs a CI workflow.
|
|
7
7
|
*/
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { confirm, input } from '@inquirer/prompts';
|
|
2
2
|
import { cp, glob, readFile, rm } from 'node:fs/promises';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import { execCommandInherit } from
|
|
5
|
-
import { doesFileExist } from
|
|
6
|
-
import { readPackageJsonFile } from
|
|
7
|
-
import { writeFileSafe } from
|
|
8
|
-
import { writeJsonFileSafe } from
|
|
9
|
-
import { getTemplateDirectoryPath, ROOT_DIRECTORY, } from
|
|
10
|
-
import { replacePattern } from
|
|
11
|
-
import { normalizeGitUrlForNpm } from
|
|
12
|
-
import { removeTrailingSlash } from
|
|
4
|
+
import { execCommandInherit } from '../../../helpers.private/cmd/exec-command.js';
|
|
5
|
+
import { doesFileExist } from '../../../helpers.private/file/does-file-exist.js';
|
|
6
|
+
import { readPackageJsonFile } from '../../../helpers.private/file/package-json/read-package-json-file.js';
|
|
7
|
+
import { writeFileSafe } from '../../../helpers.private/file/write-file-safe.js';
|
|
8
|
+
import { writeJsonFileSafe } from '../../../helpers.private/file/write-json-file-safe.js';
|
|
9
|
+
import { getTemplateDirectoryPath, ROOT_DIRECTORY, } from '../../../helpers.private/misc/paths.constant.js';
|
|
10
|
+
import { replacePattern } from '../../../helpers.private/misc/replace-pattern.js';
|
|
11
|
+
import { normalizeGitUrlForNpm } from '../../../helpers.private/npm/normalize-git-url-for-npm.js';
|
|
12
|
+
import { removeTrailingSlash } from '../../../helpers.private/path/remove-traling-slash.js';
|
|
13
13
|
/**
|
|
14
14
|
* Creates a new project.
|
|
15
15
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { glob, readFile, rename, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { basename, dirname, join } from 'node:path';
|
|
4
|
-
import { removeTrailingSlash } from
|
|
4
|
+
import { removeTrailingSlash } from '../../../helpers.private/path/remove-traling-slash.js';
|
|
5
5
|
/**
|
|
6
6
|
* Refactor recursively many files
|
|
7
7
|
*/
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import process from 'node:process';
|
|
3
|
-
import { execCommandInherit } from
|
|
4
|
-
import { readPackageJsonFile } from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { execCommandInherit } from '../../../helpers.private/cmd/exec-command.js';
|
|
4
|
+
import { readPackageJsonFile } from '../../../helpers.private/file/package-json/read-package-json-file.js';
|
|
5
|
+
import { parseSemverStrict } from '../../../helpers.private/misc/semver/semver.js';
|
|
6
|
+
import { isNpmPackagePublished } from '../../../helpers.private/npm/is-npm-version-published/is-npm-package-published.js';
|
|
7
|
+
import { toAbsolutePath } from '../../../helpers.private/path/to-absolute-path.js';
|
|
8
|
+
import { releaseModeToNpmTag } from '../../../helpers.private/release/release-mode/release-mode-to-npm-tag.js';
|
|
9
|
+
import { buildProject } from '../build-project/build-project.js';
|
|
9
10
|
/**
|
|
10
11
|
* Releases an npm package.
|
|
11
12
|
*/
|
|
@@ -38,11 +39,13 @@ export function releaseProject({ mode = 'prod', dry = false, cwd = process.cwd()
|
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
const outputPackageJson = await readPackageJsonFile(toAbsolutePath(join(output, 'package.json'), cwd));
|
|
42
|
+
const outputVersion = parseSemverStrict(outputPackageJson.version);
|
|
43
|
+
const baseOutputVersion = `${outputVersion.major}.${outputVersion.minor}.${outputVersion.patch}`;
|
|
41
44
|
if (await isNpmPackagePublished({
|
|
42
45
|
name: outputPackageJson.name,
|
|
43
|
-
version:
|
|
46
|
+
version: baseOutputVersion,
|
|
44
47
|
})) {
|
|
45
|
-
throw new Error(`Package ${outputPackageJson.name}@${
|
|
48
|
+
throw new Error(`Package ${outputPackageJson.name}@${baseOutputVersion} already exists on npm.`);
|
|
46
49
|
}
|
|
47
50
|
{
|
|
48
51
|
const tag = releaseModeToNpmTag(mode);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-project.js","sourceRoot":"","sources":["../../../../../src/cli/actions.private/release-project/release-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,OAAO,MAAM,cAAc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OAAO,CAAC,EAAE,CAAC;YACpF,MAAM,OAAO,GACX,SAAS,CAAC,gBAAgB,EAAE,UAAU,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;YAE/E,MAAM,kBAAkB,CACtB,MAAM,EACN,MAAM,EACN,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EACpD;gBACE,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,GAAG;aACJ,CACF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,YAAY,CAAC;gBACjB,IAAI;gBACJ,GAAG;gBACH,MAAM;gBACN,MAAM;aACP,CAAC,CAAC;QACL,CAAC;QAED,MAAM,iBAAiB,GAAgB,MAAM,mBAAmB,CAC9D,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,GAAG,CAAC,CAClD,CAAC;QAEF,IACE,MAAM,qBAAqB,CAAC;YAC1B,IAAI,EAAE,iBAAiB,CAAC,IAAI;YAC5B,OAAO,EAAE,iBAAiB
|
|
1
|
+
{"version":3,"file":"release-project.js","sourceRoot":"","sources":["../../../../../src/cli/actions.private/release-project/release-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAElF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sEAAsE,CAAC;AAE3G,OAAO,EAAE,iBAAiB,EAAe,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mFAAmF,CAAC;AAC1H,OAAO,EAAE,cAAc,EAAE,MAAM,mDAAmD,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0EAA0E,CAAC;AAE/G,OAAO,EAAE,YAAY,EAAE,MAA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AG;oBAChB,GAAG,EAAE,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC;iBACjC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,CAAC;YACC,MAAM,GAAG,GAAW,IAAI,iBAAiB,CAAC,OAAO,EAAE,CAAC;YAEpD,IAAI,GAAG,EAAE,CAAC;gBACR,MAAM,CAAC,KAAK,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAC;gBACxC,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;YACxC,CAAC;iBAAM,CAAC;gBACN,0BAA0B;gBAC1B,yBAAyB;gBACzB,YAAY;gBACZ,SAAS;gBACT,MAAM;gBACN,EAAE;gBACF,wBAAwB;gBACxB,SAAS;gBACT,+BAA+B;gBAC/B,SAAS;gBACT,YAAY;gBACZ,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,cAAc;AAEd,SAAS,SAAS,CAAC,WAAwB,EAAE,UAAkB;IAC7D,OAAO,WAAW,CAAC,OAAO,KAAK,SAAS,IAAI,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC;AAC5F,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { confirm, select } from '@inquirer/prompts';
|
|
2
2
|
import { cp, glob, rm } from 'node:fs/promises';
|
|
3
3
|
import { join, relative } from 'node:path';
|
|
4
|
-
import { execCommandInherit } from
|
|
5
|
-
import { readPackageJsonFile } from
|
|
6
|
-
import { writeJsonFileSafe } from
|
|
7
|
-
import { gitAddAllFiles } from
|
|
8
|
-
import { listAvailableTemplates } from
|
|
9
|
-
import { ROOT_DIRECTORY, getTemplateDirectoryPath, } from
|
|
10
|
-
import { removeTrailingSlash } from
|
|
4
|
+
import { execCommandInherit } from '../../../helpers.private/cmd/exec-command.js';
|
|
5
|
+
import { readPackageJsonFile } from '../../../helpers.private/file/package-json/read-package-json-file.js';
|
|
6
|
+
import { writeJsonFileSafe } from '../../../helpers.private/file/write-json-file-safe.js';
|
|
7
|
+
import { gitAddAllFiles } from '../../../helpers.private/git/git-add-all-files.js';
|
|
8
|
+
import { listAvailableTemplates } from '../../../helpers.private/misc/list-available-templates.js';
|
|
9
|
+
import { ROOT_DIRECTORY, getTemplateDirectoryPath, } from '../../../helpers.private/misc/paths.constant.js';
|
|
10
|
+
import { removeTrailingSlash } from '../../../helpers.private/path/remove-traling-slash.js';
|
|
11
11
|
/**
|
|
12
12
|
* Upgrades an existing project.
|
|
13
13
|
*/
|
package/src/cli/cli.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { program } from 'commander';
|
|
3
3
|
import pkg from '../../package.json' with { type: 'json' };
|
|
4
|
-
import { buildModeSchema } from
|
|
5
|
-
import { DEFAULT_LOG_LEVEL } from
|
|
6
|
-
import { Logger } from
|
|
7
|
-
import { releaseModeSchema } from
|
|
8
|
-
import { buildProject } from
|
|
9
|
-
import { ciWorkflow } from
|
|
10
|
-
import { createProject } from
|
|
11
|
-
import { refactor } from
|
|
12
|
-
import { releaseProject } from
|
|
13
|
-
import { upgradeProject } from
|
|
4
|
+
import { buildModeSchema } from '../helpers.private/build/build-mode/build-mode.schema.js';
|
|
5
|
+
import { DEFAULT_LOG_LEVEL } from '../helpers.private/log/log-level/defaults/default-log-level.js';
|
|
6
|
+
import { Logger } from '../helpers.private/log/logger.js';
|
|
7
|
+
import { releaseModeSchema } from '../helpers.private/release/release-mode/release-mode.schema.js';
|
|
8
|
+
import { buildProject } from './actions.private/build-project/build-project.js';
|
|
9
|
+
import { ciWorkflow } from './actions.private/ci-workflow/ci-workflow.js';
|
|
10
|
+
import { createProject } from './actions.private/create-project/create-project.js';
|
|
11
|
+
import { refactor } from './actions.private/refactor/refactor.js';
|
|
12
|
+
import { releaseProject } from './actions.private/release-project/release-project.js';
|
|
13
|
+
import { upgradeProject } from './actions.private/upgrade-project/upgrade-project.js';
|
|
14
14
|
// tuto: https://medium.com/nmc-techblog/building-a-cli-with-node-js-in-2024-c278802a3ef5
|
|
15
15
|
const logger = Logger.root({ logLevel: DEFAULT_LOG_LEVEL });
|
|
16
16
|
program.name('fabrique').description('CLI to build typescript libraries.').version(pkg.version);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import process from 'node:process';
|
|
3
|
-
import { optionalCopy } from
|
|
4
|
-
import { toAbsolutePath } from
|
|
3
|
+
import { optionalCopy } from '../../file/optional-copy.js';
|
|
4
|
+
import { toAbsolutePath } from '../../path/to-absolute-path.js';
|
|
5
5
|
export async function copyOtherPackageFiles({ cwd = process.cwd(), outputDirectory = 'dist', logger, }) {
|
|
6
6
|
outputDirectory = toAbsolutePath(outputDirectory, cwd);
|
|
7
7
|
await Promise.all(['README.md', 'CONTRIBUTING.md', 'LICENSE'].map(async (entry) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { removeUndefinedProperties } from
|
|
2
|
-
import { generatePackageJsonBuildVersion } from
|
|
3
|
-
import { replacePackageJsonExportsTsExtensionsWithJsExtensions } from
|
|
4
|
-
import { replaceTsExtensionWithJsExtension } from
|
|
1
|
+
import { removeUndefinedProperties } from '../../../misc/object/remove-undefined-properties.js';
|
|
2
|
+
import { generatePackageJsonBuildVersion } from '../generate-package-json-build-version/generate-package-json-build-version.js';
|
|
3
|
+
import { replacePackageJsonExportsTsExtensionsWithJsExtensions } from './typescript/replace/replace-package-json-exports-ts-extensions-with-js-extensions.js';
|
|
4
|
+
import { replaceTsExtensionWithJsExtension } from './typescript/replace/replace-ts-extension-with-js-extension.js';
|
|
5
5
|
export function generateBuildPackageJsonFile({ name, version, type, description, keywords, author, license, repository, main, bin, module, types, exports, dependencies, peerDependencies, optionalDependencies, }, { mode = 'prod' } = {}) {
|
|
6
6
|
return removeUndefinedProperties({
|
|
7
7
|
name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-build-package-json-file.js","sourceRoot":"","sources":["../../../../../../src/helpers.private/build/package-json/generate-build-package-json-file/generate-build-package-json-file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qDAAqD,CAAC;AAEhG,OAAO,EAAE,+BAA+B,EAAE,MAAM,+EAA+E,CAAC;AAChI,OAAO,EAAE,qDAAqD,EAAE,MAAM,uFAAuF,CAAC;AAC9J,OAAO,EAAE,iCAAiC,EAAE,MAAM,gEAAgE,CAAC;AAMnH,MAAM,UAAU,4BAA4B,CAC1C,EACE,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,MAAM,EACN,OAAO,EACP,UAAU,EACV,IAAI,EACJ,GAAG,EACH,MAAM,EACN,KAAK,EACL,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,GACR,EACd,EAAE,IAAI,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"generate-build-package-json-file.js","sourceRoot":"","sources":["../../../../../../src/helpers.private/build/package-json/generate-build-package-json-file/generate-build-package-json-file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qDAAqD,CAAC;AAEhG,OAAO,EAAE,+BAA+B,EAAE,MAAM,+EAA+E,CAAC;AAChI,OAAO,EAAE,qDAAqD,EAAE,MAAM,uFAAuF,CAAC;AAC9J,OAAO,EAAE,iCAAiC,EAAE,MAAM,gEAAgE,CAAC;AAMnH,MAAM,UAAU,4BAA4B,CAC1C,EACE,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,MAAM,EACN,OAAO,EACP,UAAU,EACV,IAAI,EACJ,GAAG,EACH,MAAM,EACN,KAAK,EACL,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,GACR,EACd,EAAE,IAAI,GAAG,MAAM,EAAE,GAAwC,EAAE;IAE3D,OAAO,yBAAyB,CAAC;QAC/B,IAAI;QACJ,OAAO,EAAE,+BAA+B,CAAC;YACvC,OAAO;YACP,IAAI;SACL,CAAC;QACF,IAAI;QACJ,WAAW;QACX,QAAQ;QACR,MAAM;QACN,OAAO;QACP,UAAU;QACV,IAAI,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iCAAiC,CAAC,IAAI,CAAC;QAC9E,GAAG,EAAE,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iCAAiC,CAAC,GAAG,CAAC;QAC3E,MAAM,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iCAAiC,CAAC,MAAM,CAAC;QACpF,KAAK;QACL,OAAO,EACL,OAAO,KAAK,SAAS;YACnB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,qDAAqD,CAAC,OAAO,CAAC;QACpE,YAAY;QACZ,gBAAgB;QAChB,oBAAoB;KACrB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { generateBuildPackageJsonFile, } from
|
|
2
|
-
import { replaceTsExtensionWithDTsExtension } from
|
|
1
|
+
import { generateBuildPackageJsonFile, } from '../generate-build-package-json-file.js';
|
|
2
|
+
import { replaceTsExtensionWithDTsExtension } from './replace/replace-ts-extension-with-js-extension.js';
|
|
3
3
|
export function generateTypescriptBuildPackageJsonFile({ types, exports, ...packageJson }, { indexFilePath, protectedIndexFilePath, ...options }) {
|
|
4
4
|
return generateBuildPackageJsonFile({
|
|
5
5
|
...packageJson,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { replacePackageJsonExportsEntryOrFallbackTsExtensionsWithJsExtensions } from
|
|
1
|
+
import { replacePackageJsonExportsEntryOrFallbackTsExtensionsWithJsExtensions } from './replace-package-json-exports-entry-or-fallback-ts-extensions-with-js-extensions.js';
|
|
2
2
|
export function replacePackageJsonExportsEntryObjectTsExtensionsWithJsExtensions(input) {
|
|
3
3
|
return Object.fromEntries(Object.entries(input).map(([key, value]) => {
|
|
4
4
|
return [key, replacePackageJsonExportsEntryOrFallbackTsExtensionsWithJsExtensions(value)];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isPackageJsonExportsEntry, isPackageJsonExportsFallback, } from
|
|
2
|
-
import { replacePackageJsonExportsEntryTsExtensionsWithJsExtensions } from
|
|
3
|
-
import { replacePackageJsonExportsFallbackTsExtensionsWithJsExtensions } from
|
|
1
|
+
import { isPackageJsonExportsEntry, isPackageJsonExportsFallback, } from '../../../../../file/package-json/package-json-exports/package-json-exports.js';
|
|
2
|
+
import { replacePackageJsonExportsEntryTsExtensionsWithJsExtensions } from './replace-package-json-exports-entry-ts-extensions-with-js-extensions.js';
|
|
3
|
+
import { replacePackageJsonExportsFallbackTsExtensionsWithJsExtensions } from './replace-package-json-exports-fallback-ts-extensions-with-js-extensions.js';
|
|
4
4
|
export function replacePackageJsonExportsEntryOrFallbackTsExtensionsWithJsExtensions(input) {
|
|
5
5
|
if (isPackageJsonExportsEntry(input)) {
|
|
6
6
|
return replacePackageJsonExportsEntryTsExtensionsWithJsExtensions(input);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { replaceTsExtensionWithJsExtension } from
|
|
1
|
+
import { replaceTsExtensionWithJsExtension } from './replace-ts-extension-with-js-extension.js';
|
|
2
2
|
export function replacePackageJsonExportsEntryPathTsExtensionsWithJsExtensions(input) {
|
|
3
3
|
return input === null ? null : replaceTsExtensionWithJsExtension(input);
|
|
4
4
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isPackageJsonExportsEntryObject, isPackageJsonExportsEntryPath, } from
|
|
2
|
-
import { replacePackageJsonExportsEntryObjectTsExtensionsWithJsExtensions } from
|
|
3
|
-
import { replacePackageJsonExportsEntryPathTsExtensionsWithJsExtensions } from
|
|
1
|
+
import { isPackageJsonExportsEntryObject, isPackageJsonExportsEntryPath, } from '../../../../../file/package-json/package-json-exports/package-json-exports.js';
|
|
2
|
+
import { replacePackageJsonExportsEntryObjectTsExtensionsWithJsExtensions } from './replace-package-json-exports-entry-object-ts-extensions-with-js-extensions.js';
|
|
3
|
+
import { replacePackageJsonExportsEntryPathTsExtensionsWithJsExtensions } from './replace-package-json-exports-entry-path-ts-extensions-with-js-extensions.js';
|
|
4
4
|
export function replacePackageJsonExportsEntryTsExtensionsWithJsExtensions(input) {
|
|
5
5
|
if (isPackageJsonExportsEntryPath(input)) {
|
|
6
6
|
return replacePackageJsonExportsEntryPathTsExtensionsWithJsExtensions(input);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { replacePackageJsonExportsEntryTsExtensionsWithJsExtensions } from
|
|
1
|
+
import { replacePackageJsonExportsEntryTsExtensionsWithJsExtensions } from './replace-package-json-exports-entry-ts-extensions-with-js-extensions.js';
|
|
2
2
|
export function replacePackageJsonExportsFallbackTsExtensionsWithJsExtensions(input) {
|
|
3
3
|
return input.map(replacePackageJsonExportsEntryTsExtensionsWithJsExtensions);
|
|
4
4
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { replacePackageJsonExportsEntryOrFallbackTsExtensionsWithJsExtensions } from
|
|
2
|
-
import { replacePackageJsonExportsEntryTsExtensionsWithJsExtensions } from
|
|
1
|
+
import { replacePackageJsonExportsEntryOrFallbackTsExtensionsWithJsExtensions } from './replace-package-json-exports-entry-or-fallback-ts-extensions-with-js-extensions.js';
|
|
2
|
+
import { replacePackageJsonExportsEntryTsExtensionsWithJsExtensions } from './replace-package-json-exports-entry-ts-extensions-with-js-extensions.js';
|
|
3
3
|
export function replacePackageJsonExportsListTsExtensionsWithJsExtensions({ '.': main, ...others }) {
|
|
4
4
|
return {
|
|
5
5
|
['.']: replacePackageJsonExportsEntryTsExtensionsWithJsExtensions(main),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isPackageJsonExportsEntryObject, isPackageJsonExportsEntryPath, isPackageJsonExportsFallback, isPackageJsonExportsList, } from
|
|
2
|
-
import { replacePackageJsonExportsEntryObjectTsExtensionsWithJsExtensions } from
|
|
3
|
-
import { replacePackageJsonExportsEntryPathTsExtensionsWithJsExtensions } from
|
|
4
|
-
import { replacePackageJsonExportsFallbackTsExtensionsWithJsExtensions } from
|
|
5
|
-
import { replacePackageJsonExportsListTsExtensionsWithJsExtensions } from
|
|
1
|
+
import { isPackageJsonExportsEntryObject, isPackageJsonExportsEntryPath, isPackageJsonExportsFallback, isPackageJsonExportsList, } from '../../../../../file/package-json/package-json-exports/package-json-exports.js';
|
|
2
|
+
import { replacePackageJsonExportsEntryObjectTsExtensionsWithJsExtensions } from './replace-package-json-exports-entry-object-ts-extensions-with-js-extensions.js';
|
|
3
|
+
import { replacePackageJsonExportsEntryPathTsExtensionsWithJsExtensions } from './replace-package-json-exports-entry-path-ts-extensions-with-js-extensions.js';
|
|
4
|
+
import { replacePackageJsonExportsFallbackTsExtensionsWithJsExtensions } from './replace-package-json-exports-fallback-ts-extensions-with-js-extensions.js';
|
|
5
|
+
import { replacePackageJsonExportsListTsExtensionsWithJsExtensions } from './replace-package-json-exports-list-ts-extensions-with-js-extensions.js';
|
|
6
6
|
export function replacePackageJsonExportsTsExtensionsWithJsExtensions(input) {
|
|
7
7
|
if (isPackageJsonExportsEntryPath(input)) {
|
|
8
8
|
return replacePackageJsonExportsEntryPathTsExtensionsWithJsExtensions(input);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toRelativePath } from
|
|
1
|
+
import { toRelativePath } from '../../../../../path/to-relative-path.js';
|
|
2
2
|
export function replaceTsExtensionWithJsExtension(path) {
|
|
3
3
|
return toRelativePath(path.endsWith('.d.ts') ? path : path.replace(/\.ts$/, '.js'));
|
|
4
4
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { glob } from 'node:fs/promises';
|
|
2
2
|
import { join, relative } from 'node:path';
|
|
3
3
|
import { normalize } from 'node:path/posix';
|
|
4
|
-
import { writeTextFileSafe } from
|
|
5
|
-
import { removeTrailingSlash } from
|
|
6
|
-
import { toAbsolutePath } from
|
|
4
|
+
import { writeTextFileSafe } from '../../file/write-text-file-safe.js';
|
|
5
|
+
import { removeTrailingSlash } from '../../path/remove-traling-slash.js';
|
|
6
|
+
import { toAbsolutePath } from '../../path/to-absolute-path.js';
|
|
7
7
|
export async function buildTypescriptIndexFile({ sourceDirectory, type = 'public', cwd = process.cwd(), }) {
|
|
8
8
|
sourceDirectory = removeTrailingSlash(sourceDirectory);
|
|
9
9
|
let fileName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-typescript-index-file.js","sourceRoot":"","sources":["../../../../../src/helpers.private/build/typescript/build-typescript-index-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAUhE,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,EAC7C,eAAe,EACf,IAAI,GAAG,QAAQ,EACf,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,GACa;IAChC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAC;IAEvD,IAAI,QAAgB,CAAC;IACrB,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"build-typescript-index-file.js","sourceRoot":"","sources":["../../../../../src/helpers.private/build/typescript/build-typescript-index-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAA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AK,IAAI,IAAI,CAAC,OAAO,EAAE;QACtC,OAAO;QACP,GAAG;KACJ,CAAC,EAAE,CAAC;QACH,OAAO,IAAI,oBAAoB,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC;IACnF,CAAC;IAED,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,UAAU,GAAW,cAAc,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC;IAEhF,MAAM,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAE7C,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { rm } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import process from 'node:process';
|
|
4
|
-
import { execCommandInherit } from
|
|
5
|
-
import { readPackageJsonFile } from
|
|
6
|
-
import { writeJsonFileSafe } from
|
|
7
|
-
import { relativePath } from
|
|
8
|
-
import { toAbsolutePath } from
|
|
9
|
-
import { copyOtherPackageFiles } from
|
|
10
|
-
import { generateTypescriptBuildPackageJsonFile, } from
|
|
11
|
-
import { buildTypescriptIndexFile } from
|
|
4
|
+
import { execCommandInherit } from '../../cmd/exec-command.js';
|
|
5
|
+
import { readPackageJsonFile } from '../../file/package-json/read-package-json-file.js';
|
|
6
|
+
import { writeJsonFileSafe } from '../../file/write-json-file-safe.js';
|
|
7
|
+
import { relativePath } from '../../path/relative-path.js';
|
|
8
|
+
import { toAbsolutePath } from '../../path/to-absolute-path.js';
|
|
9
|
+
import { copyOtherPackageFiles } from '../other-files/copy-other-package-files.js';
|
|
10
|
+
import { generateTypescriptBuildPackageJsonFile, } from '../package-json/generate-build-package-json-file/typescript/generate-typescript-build-package-json-file.js';
|
|
11
|
+
import { buildTypescriptIndexFile } from './build-typescript-index-file.js';
|
|
12
12
|
export async function buildTypescriptProject({ sourceDirectory = 'src', outputDirectory = 'dist', cwd = process.cwd(), logger, ...options }) {
|
|
13
13
|
await using stack = new AsyncDisposableStack();
|
|
14
14
|
const include = [];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import process from 'node:process';
|
|
3
3
|
import { Readable } from 'node:stream';
|
|
4
|
-
import { Logger } from
|
|
4
|
+
import { Logger } from '../log/logger.js';
|
|
5
5
|
export class ExecCommandError extends Error {
|
|
6
6
|
command;
|
|
7
7
|
stderr;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec-command.js","sourceRoot":"","sources":["../../../../src/helpers.private/cmd/exec-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AACjF,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAS1C,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,QAAQ,CAAS,CAAC,gBAAgB;IAE3C,YAAY,EACV,OAAO,EACP,MAAM,GAAG,EAAE,EACX,QAAQ,EACR,OAAO,GAAG,aAAa,OAAO,aAAa,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,EAAE,EAC7I,GAAG,OAAO,EACc;QACxB,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,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CAAC,CAAC;gBAC7D,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,IAAI,YAAY,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;oBACjC,MAAM,CAAC,IAAI,gBAAgB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;gBACtD,CAAC;qBAAM,CAAC;oBACN,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,CACvC,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,gBAAgB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,EAC/E,MAAM,CACP,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAQ,EAAE;YAC5C,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,+BAA+B;QAC/B,iCAAiC;QACjC,MAAM;QACN,EAAE;QACF,gCAAgC;QAChC,kCAAkC;QAClC,MAAM;QACN,EAAE;QACF,iCAAiC;QACjC,mCAAmC;QACnC,MAAM;IACR,CAAC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,MAAc,EACd,OAAe,EACf,IAAI,GAAa,EAAE,EACnB,OAAsB;IAEtB,OAAO,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;QACxC,KAAK,EAAE,SAAS;QAChB,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-file-path.js","sourceRoot":"","sources":["../../../../../src/helpers.private/env/env-file/env-file-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,aAAa,GAAW,IAAI,CACvC,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"env-file-path.js","sourceRoot":"","sources":["../../../../../src/helpers.private/env/env-file/env-file-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,aAAa,GAAW,IAAI,CACvC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EACvC,aAAa,EACb,MAAM,CACP,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getBooleanEnvVariable } from
|
|
1
|
+
import { getBooleanEnvVariable } from '../types/get-boolean-env-variable.js';
|
|
2
2
|
export const ENV_IGNORE_ENV_FILE = 'IGNORE_ENV_FILE';
|
|
3
3
|
export function getEnvIgnoreEnvFile() {
|
|
4
4
|
return getBooleanEnvVariable(ENV_IGNORE_ENV_FILE, false);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getEnvIgnoreEnvFile } from
|
|
2
|
-
import { loadEnvFile } from
|
|
1
|
+
import { getEnvIgnoreEnvFile } from './get-env-ignore-env-file.js';
|
|
2
|
+
import { loadEnvFile } from './load-env-file.js';
|
|
3
3
|
export function loadOptionallyEnvFile(logger) {
|
|
4
4
|
if (getEnvIgnoreEnvFile()) {
|
|
5
5
|
logger.info('SKIP (non-blocking): .env file ignored.');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
import { getJsonEnvVariable } from
|
|
2
|
+
import { getJsonEnvVariable } from './get-json-env-variable.js';
|
|
3
3
|
const booleanSchema = z.boolean();
|
|
4
4
|
export function getBooleanEnvVariable(name, defaultValue) {
|
|
5
5
|
return getJsonEnvVariable(name, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-json-env-variable.js","sourceRoot":"","sources":["../../../../../src/helpers.private/env/types/get-json-env-variable.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAOzB,MAAM,UAAU,kBAAkB,CAChC,IAAY,EACZ,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"get-json-env-variable.js","sourceRoot":"","sources":["../../../../../src/helpers.private/env/types/get-json-env-variable.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAOzB,MAAM,UAAU,kBAAkB,CAChC,IAAY,EACZ,EAAE,YAAY,EAAE,MAAM,EAAE,GAAsC,EAAE;IAEhE,IAAI,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACxB,MAAM,IAAI,GAAW,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,CAAC;QACpD,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;SAAM,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,GAAG,CAAC,CAAC;IACrD,CAAC;SAAM,CAAC;QACN,OAAO,YAAY,CAAC;IACtB,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
import { fabriqueConfigSchema } from
|
|
3
|
-
import { packageJsonDependenciesSchema } from
|
|
2
|
+
import { fabriqueConfigSchema } from '../../fabrique/fabrique-config.schema.js';
|
|
3
|
+
import { packageJsonDependenciesSchema } from './package-json-dependencies/package-json-dependencies.schema.js';
|
|
4
4
|
export const packageJsonSchema = z
|
|
5
5
|
.object({
|
|
6
6
|
name: z.string().nonempty(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { readJsonFile } from
|
|
2
|
-
import { packageJsonSchema } from
|
|
1
|
+
import { readJsonFile } from '../read-json-file.js';
|
|
2
|
+
import { packageJsonSchema } from './package-json.schema.js';
|
|
3
3
|
export async function readPackageJsonFile(...args) {
|
|
4
4
|
try {
|
|
5
5
|
return packageJsonSchema.parse(await readJsonFile(...args));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises';
|
|
2
|
-
import { writeTextFileSafe } from
|
|
2
|
+
import { writeTextFileSafe } from './write-text-file-safe.js';
|
|
3
3
|
export async function writeJsonFileSafe(...args) {
|
|
4
4
|
await writeTextFileSafe(args[0], JSON.stringify(args[1], null, 2), args[2]);
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises';
|
|
2
|
-
import { writeFileSafe } from
|
|
2
|
+
import { writeFileSafe } from './write-file-safe.js';
|
|
3
3
|
export async function writeTextFileSafe(...args) {
|
|
4
4
|
await writeFileSafe(args[0], args[1], {
|
|
5
5
|
...(typeof args[2] === 'object' ? args[2] : {}),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ANSI_ESCAPE_SET_BACKGROUND_COLOR_BLUE, ANSI_ESCAPE_SET_BACKGROUND_COLOR_CYAN, ANSI_ESCAPE_SET_BACKGROUND_COLOR_GREEN, ANSI_ESCAPE_SET_BACKGROUND_COLOR_MAGENTA, ANSI_ESCAPE_SET_BACKGROUND_COLOR_RED, ANSI_ESCAPE_SET_BACKGROUND_COLOR_YELLOW, ANSI_ESCAPE_SET_BOLD_MODE, ANSI_ESCAPE_SET_FOREGROUND_BRIGHT_COLOR_WHITE, } from
|
|
2
|
-
import { ansiFatalRawLogger } from
|
|
3
|
-
import { ansiRawLogger } from
|
|
4
|
-
import {} from
|
|
5
|
-
import {} from
|
|
1
|
+
import { ANSI_ESCAPE_SET_BACKGROUND_COLOR_BLUE, ANSI_ESCAPE_SET_BACKGROUND_COLOR_CYAN, ANSI_ESCAPE_SET_BACKGROUND_COLOR_GREEN, ANSI_ESCAPE_SET_BACKGROUND_COLOR_MAGENTA, ANSI_ESCAPE_SET_BACKGROUND_COLOR_RED, ANSI_ESCAPE_SET_BACKGROUND_COLOR_YELLOW, ANSI_ESCAPE_SET_BOLD_MODE, ANSI_ESCAPE_SET_FOREGROUND_BRIGHT_COLOR_WHITE, } from '../../ansi/ansi.js';
|
|
2
|
+
import { ansiFatalRawLogger } from '../../raw/ansi-fatal-raw-logger.js';
|
|
3
|
+
import { ansiRawLogger } from '../../raw/ansi-raw-logger.js';
|
|
4
|
+
import {} from '../../raw/raw-logger.js';
|
|
5
|
+
import {} from '../log-level.js';
|
|
6
6
|
export const DEFAULT_LOG_LEVEL = new Map([
|
|
7
7
|
[
|
|
8
8
|
'log',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {} from
|
|
2
|
-
import {} from
|
|
3
|
-
import {} from
|
|
1
|
+
import {} from '../raw/raw-logger.js';
|
|
2
|
+
import {} from './log-level-source.js';
|
|
3
|
+
import {} from './log-level.js';
|
|
4
4
|
export function logLevelSourceToReadonlyMap(input) {
|
|
5
5
|
return input instanceof Map
|
|
6
6
|
? input
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {} from
|
|
2
|
-
import {} from
|
|
1
|
+
import {} from '../raw/raw-logger.js';
|
|
2
|
+
import {} from './log-level.js';
|
|
3
3
|
//# sourceMappingURL=log-level-source.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { logLevelSourceToReadonlyMap } from
|
|
2
|
-
import {} from
|
|
3
|
-
import {} from
|
|
4
|
-
import {} from
|
|
1
|
+
import { logLevelSourceToReadonlyMap } from './log-level/log-level-source-to-readonly-map.js';
|
|
2
|
+
import {} from './log-level/log-level-source.js';
|
|
3
|
+
import {} from './log-level/log-level.js';
|
|
4
|
+
import {} from './raw/raw-logger.js';
|
|
5
5
|
export class Logger {
|
|
6
6
|
static root(options) {
|
|
7
7
|
return new Logger('$ROOT', options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../src/helpers.private/log/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAuB,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAiB,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAkB,MAAM,qBAAqB,CAAC;AAMrD,MAAM,OAAO,MAAM;IACjB,MAAM,CAAC,IAAI,CAAC,OAAuB;QACjC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,KAAK;QACV,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE;YAC1B,QAAQ,EAAE,EAAE;SACb,CAAC,CAAC;IACL,CAAC;IAEQ,KAAK,CAAS;IACd,SAAS,CAAmC;IAErD,YAAY,IAAY,EAAE,EAAE,QAAQ,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../src/helpers.private/log/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAuB,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAiB,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAkB,MAAM,qBAAqB,CAAC;AAMrD,MAAM,OAAO,MAAM;IACjB,MAAM,CAAC,IAAI,CAAC,OAAuB;QACjC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,KAAK;QACV,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE;YAC1B,QAAQ,EAAE,EAAE;SACb,CAAC,CAAC;IACL,CAAC;IAEQ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AM,CAAC;gBACN,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE;oBACxB,QAAQ,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;iBACjF,CAAC,CAAC;gBACH,MAAM,MAAM,CAAC,KAAK,CAAC;YACrB,CAAC;YAED,OAAO,MAAM,CAAC,KAAK,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ansiEscapeGraphicModeString } from
|
|
2
|
-
import {} from
|
|
1
|
+
import { ansiEscapeGraphicModeString } from '../ansi/ansi.js';
|
|
2
|
+
import {} from './raw-logger.js';
|
|
3
3
|
export function ansiFatalRawLogger(...parameters) {
|
|
4
4
|
return (name, args) => {
|
|
5
5
|
console.log('');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ansiEscapeGraphicModeString } from
|
|
2
|
-
import {} from
|
|
1
|
+
import { ansiEscapeGraphicModeString } from '../ansi/ansi.js';
|
|
2
|
+
import {} from './raw-logger.js';
|
|
3
3
|
export function ansiRawLogger(...parameters) {
|
|
4
4
|
return (name, args) => {
|
|
5
5
|
console.log(ansiEscapeGraphicModeString(`[${name}]`, ...parameters), ...args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.constant.js","sourceRoot":"","sources":["../../../../src/helpers.private/misc/paths.constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,cAAc,GAAW,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"paths.constant.js","sourceRoot":"","sources":["../../../../src/helpers.private/misc/paths.constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,cAAc,GAAW,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AAEhG,MAAM,CAAC,MAAM,mBAAmB,GAAW,IAAI,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;AAEpF;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAY;IACnD,OAAO,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface Semver {
|
|
2
|
+
readonly major: number;
|
|
3
|
+
readonly minor: number;
|
|
4
|
+
readonly patch: number;
|
|
5
|
+
readonly prerelease: string | undefined;
|
|
6
|
+
readonly build: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseSemver(input: string): Semver | null;
|
|
9
|
+
export declare function parseSemverStrict(input: string): Semver;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function parseSemver(input) {
|
|
2
|
+
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
|
3
|
+
const match = input.match(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/);
|
|
4
|
+
if (match === null) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
return {
|
|
8
|
+
major: Number(match[1]),
|
|
9
|
+
minor: Number(match[2]),
|
|
10
|
+
patch: Number(match[3]),
|
|
11
|
+
prerelease: match[4],
|
|
12
|
+
build: match[5],
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function parseSemverStrict(input) {
|
|
16
|
+
const semver = parseSemver(input);
|
|
17
|
+
if (semver === null) {
|
|
18
|
+
throw new Error('Invalid semver');
|
|
19
|
+
}
|
|
20
|
+
return semver;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=semver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semver.js","sourceRoot":"","sources":["../../../../../src/helpers.private/misc/semver/semver.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,6FAA6F;IAC7F,MAAM,KAAK,GAA4B,KAAK,CAAC,KAAK,CAChD,qLAAqL,CACtL,CAAC;IAEF,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACvB,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;QACpB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;KAChB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,MAAM,MAAM,GAAkB,WAAW,CAAC,KAAK,CAAC,CAAC;IAEjD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relative-path.js","sourceRoot":"","sources":["../../../../src/helpers.private/path/relative-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"relative-path.js","sourceRoot":"","sources":["../../../../src/helpers.private/path/relative-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,GAAG,GAAW,OAAO,CAAC,GAAG,EAAE;IACpE,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IACvB,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAErB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-absolute-path.js","sourceRoot":"","sources":["../../../../src/helpers.private/path/to-absolute-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"to-absolute-path.js","sourceRoot":"","sources":["../../../../src/helpers.private/path/to-absolute-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,GAAG,GAAW,OAAO,CAAC,GAAG,EAAE;IACtE,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getBooleanEnvVariable } from
|
|
1
|
+
import { getBooleanEnvVariable } from '../../env/types/get-boolean-env-variable.js';
|
|
2
2
|
export const ENV_CI_RELEASE_DRY_RUN = 'CI_RELEASE_DRY_RUN';
|
|
3
3
|
export function getEnvCiReleaseDryRun() {
|
|
4
4
|
return getBooleanEnvVariable(ENV_CI_RELEASE_DRY_RUN, false);
|
package/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './cli/cli.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -35,17 +35,6 @@ yarn -v
|
|
|
35
35
|
yarn install
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
### Environment variables
|
|
39
|
-
|
|
40
|
-
```shell
|
|
41
|
-
# Copy the example file into .env:
|
|
42
|
-
cp .env.example .env
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
And replace the corresponding variables:
|
|
46
|
-
|
|
47
|
-
- [NPM_AUTH_TOKEN](https://docs.npmjs.com/creating-and-viewing-access-tokens)
|
|
48
|
-
|
|
49
38
|
### Code
|
|
50
39
|
|
|
51
40
|
- The source code is located in the `src` directory.
|
|
@@ -68,21 +57,70 @@ And replace the corresponding variables:
|
|
|
68
57
|
- `fb:bench`: runs the bench tests.
|
|
69
58
|
- `fb:typedoc`: generates the documentation.
|
|
70
59
|
- if the library exposes publicly only a few and/or simple parts, the documentation may be defined in the `README.md` instead.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
- `fb:dev`: builds the lib in `dev` mode.
|
|
74
|
-
- builds and publishes the lib on a local `verdaccio` with a `dev` tag.
|
|
75
|
-
- a local `verdaccio` is used to debug/test your library in another project:
|
|
76
|
-
- it is better than `npm link`, as it enforce a specific version, and allows some dependencies to be `dev` too.
|
|
77
|
-
- `fb:rc`: builds the lib in `rc` mode.
|
|
78
|
-
- builds and publishes the lib on npm with a `rc` tag.
|
|
79
|
-
- to test before production and final release
|
|
80
|
-
|
|
81
|
-
### To create an MR
|
|
60
|
+
|
|
61
|
+
### To create a PR
|
|
82
62
|
|
|
83
63
|
1. fork the repository
|
|
84
64
|
1. add the feature/fix by modifying the code in the `src/` directory
|
|
85
65
|
1. add/write some tests until 100% code coverage is reached (run the tests with `yarn fb:test:coverage`)
|
|
86
66
|
1. format the code, using the command `yarn fb:format`
|
|
87
67
|
1. commit and push your work following the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) convention
|
|
88
|
-
1. create
|
|
68
|
+
1. create a PR from your repository to the upstream repository, explaining clearly what was added/fixed.
|
|
69
|
+
|
|
70
|
+
## Release Workflow
|
|
71
|
+
|
|
72
|
+
### 1. Pull Request to `main` or `develop`
|
|
73
|
+
|
|
74
|
+
- The `release.yml` workflow runs on `pull_request`
|
|
75
|
+
- The `yarn fb:ci:release` step runs **only if** the PR has the `dev` label
|
|
76
|
+
- Impacted packages are published as:
|
|
77
|
+
- `x.y.z-dev.<timestamp>`
|
|
78
|
+
- npm dist-tag: `dev`
|
|
79
|
+
|
|
80
|
+
### 2. Push to `develop`
|
|
81
|
+
|
|
82
|
+
- Impacted packages are published as:
|
|
83
|
+
- `x.y.z-rc.<timestamp>`
|
|
84
|
+
- npm dist-tag: `rc`
|
|
85
|
+
|
|
86
|
+
### 3. Push to `main`
|
|
87
|
+
|
|
88
|
+
- Stable publication:
|
|
89
|
+
- `x.y.z`
|
|
90
|
+
- npm dist-tag: `latest`
|
|
91
|
+
- Only if `name@x.y.z` does not already exist on npm
|
|
92
|
+
|
|
93
|
+
### Graph
|
|
94
|
+
|
|
95
|
+
```mermaid
|
|
96
|
+
flowchart LR
|
|
97
|
+
EVENT("EVENT")
|
|
98
|
+
HAS_DEV_TAG{"has "dev" tag ?"}
|
|
99
|
+
SKIP_BUILD(["skip build"])
|
|
100
|
+
BUILD_DEV_PACKAGES["build "dev" package"]
|
|
101
|
+
PUBLISH_DEV_PACKAGES["publish "dev" package"]
|
|
102
|
+
BUILD_RC_PACKAGES["build "rc" package"]
|
|
103
|
+
PUBLISH_RC_PACKAGES["publish "rc" package"]
|
|
104
|
+
BUILD_PROD_PACKAGES["build "prod" package"]
|
|
105
|
+
PUBLISH_PROD_PACKAGES["publish "prod" package"]
|
|
106
|
+
TARGET_BRANCH{"branch"}
|
|
107
|
+
|
|
108
|
+
EVENT -- "pull_request" --> HAS_DEV_TAG
|
|
109
|
+
HAS_DEV_TAG -- "no" --> SKIP_BUILD
|
|
110
|
+
HAS_DEV_TAG -- "yes" --> BUILD_DEV_PACKAGES
|
|
111
|
+
BUILD_DEV_PACKAGES --> PUBLISH_DEV_PACKAGES
|
|
112
|
+
|
|
113
|
+
EVENT -- "push" --> TARGET_BRANCH
|
|
114
|
+
|
|
115
|
+
TARGET_BRANCH -- "develop" --> BUILD_RC_PACKAGES
|
|
116
|
+
BUILD_RC_PACKAGES --> PUBLISH_RC_PACKAGES
|
|
117
|
+
|
|
118
|
+
TARGET_BRANCH -- "main" --> BUILD_PROD_PACKAGES
|
|
119
|
+
BUILD_PROD_PACKAGES --> PUBLISH_PROD_PACKAGES
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Important Rules
|
|
123
|
+
|
|
124
|
+
- if the version already exists on npm: the release is skipped
|
|
125
|
+
- the `package.json` file in the repo must keep stable versions (`x.y.z`)
|
|
126
|
+
- `-dev` / `-rc` suffixes are generated in CI
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"url": "{{giturl}}"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/node": "^26.1.
|
|
35
|
-
"@vitest/coverage-istanbul": "^4.1.
|
|
36
|
-
"prettier": "^3.9.
|
|
34
|
+
"@types/node": "^26.1.1",
|
|
35
|
+
"@vitest/coverage-istanbul": "^4.1.10",
|
|
36
|
+
"prettier": "^3.9.6",
|
|
37
37
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
38
|
-
"typedoc": "^0.28.
|
|
39
|
-
"typescript": "^
|
|
40
|
-
"vitest": "^4.1.
|
|
38
|
+
"typedoc": "^0.28.20",
|
|
39
|
+
"typescript": "^7.0.2",
|
|
40
|
+
"vitest": "^4.1.10"
|
|
41
41
|
},
|
|
42
42
|
"packageManager": "yarn@4.17.0"
|
|
43
43
|
}
|