fabrique 2.0.6 → 2.0.9
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 +0 -58
- 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/.yarn/releases/{yarn-4.17.0.cjs → yarn-4.17.1.cjs} +144 -144
- package/static/templates/lib/.yarnrc.yml +1 -1
- package/static/templates/lib/package.json +9 -8
- 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
|
@@ -294,61 +294,3 @@ You may get help on individual commands:
|
|
|
294
294
|
```shell
|
|
295
295
|
npx fabrique create -h
|
|
296
296
|
```
|
|
297
|
-
|
|
298
|
-
## Release Workflow
|
|
299
|
-
|
|
300
|
-
### 1. Pull Request to `main` or `develop`
|
|
301
|
-
|
|
302
|
-
- The `release.yml` workflow runs on `pull_request`
|
|
303
|
-
- The `yarn fb:ci:release` step runs **only if** the PR has the `dev` label
|
|
304
|
-
- Impacted packages are published as:
|
|
305
|
-
- `x.y.z-dev.<timestamp>`
|
|
306
|
-
- npm dist-tag: `dev`
|
|
307
|
-
|
|
308
|
-
### 2. Push to `develop`
|
|
309
|
-
|
|
310
|
-
- Impacted packages are published as:
|
|
311
|
-
- `x.y.z-rc.<timestamp>`
|
|
312
|
-
- npm dist-tag: `rc`
|
|
313
|
-
|
|
314
|
-
### 3. Push to `main`
|
|
315
|
-
|
|
316
|
-
- Stable publication:
|
|
317
|
-
- `x.y.z`
|
|
318
|
-
- npm dist-tag: `latest`
|
|
319
|
-
- Only if `name@x.y.z` does not already exist on npm
|
|
320
|
-
|
|
321
|
-
### Graph
|
|
322
|
-
|
|
323
|
-
```mermaid
|
|
324
|
-
flowchart LR
|
|
325
|
-
EVENT("EVENT")
|
|
326
|
-
HAS_DEV_TAG{"has "dev" tag ?"}
|
|
327
|
-
SKIP_BUILD(["skip build"])
|
|
328
|
-
BUILD_DEV_PACKAGES["build "dev" package"]
|
|
329
|
-
PUBLISH_DEV_PACKAGES["publish "dev" package"]
|
|
330
|
-
BUILD_RC_PACKAGES["build "rc" package"]
|
|
331
|
-
PUBLISH_RC_PACKAGES["publish "rc" package"]
|
|
332
|
-
BUILD_PROD_PACKAGES["build "prod" package"]
|
|
333
|
-
PUBLISH_PROD_PACKAGES["publish "prod" package"]
|
|
334
|
-
TARGET_BRANCH{"branch"}
|
|
335
|
-
|
|
336
|
-
EVENT -- "pull_request" --> HAS_DEV_TAG
|
|
337
|
-
HAS_DEV_TAG -- "no" --> SKIP_BUILD
|
|
338
|
-
HAS_DEV_TAG -- "yes" --> BUILD_DEV_PACKAGES
|
|
339
|
-
BUILD_DEV_PACKAGES --> PUBLISH_DEV_PACKAGES
|
|
340
|
-
|
|
341
|
-
EVENT -- "push" --> TARGET_BRANCH
|
|
342
|
-
|
|
343
|
-
TARGET_BRANCH -- "develop" --> BUILD_RC_PACKAGES
|
|
344
|
-
BUILD_RC_PACKAGES --> PUBLISH_RC_PACKAGES
|
|
345
|
-
|
|
346
|
-
TARGET_BRANCH -- "main" --> BUILD_PROD_PACKAGES
|
|
347
|
-
BUILD_PROD_PACKAGES --> PUBLISH_PROD_PACKAGES
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
## Important Rules
|
|
351
|
-
|
|
352
|
-
- if the version already exists on npm: the release is skipped
|
|
353
|
-
- the `package.json` file in the repo must keep stable versions (`x.y.z`)
|
|
354
|
-
- `-dev` / `-rc` suffixes are generated in CI
|
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,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAElF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sEAAsE,CAAC;AAE3G,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,MAAM,mCAAmC,CAAC;AAUjE;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,IAAI,GAAG,MAAM,EACb,GAAG,GAAG,KAAK,EACX,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,EACnB,MAAM,GAAG,MAAM,EACf,MAAM,GACgB;IACtB,OAAO,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,EAAE,MAAc,EAAiB,EAAE;QACzE,MAAM,gBAAgB,GAAgB,MAAM,mBAAmB,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC;QAE3F,IAAI,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC,IAAI,SAAS,CAAC,gBA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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,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,EAAE,CAAC;YACd,QAAQ,GAAG,UAAU,CAAC;YACtB,OAAO,CAAC,IAAI,CAAC,GAAG,eAAe,UAAU,CAAC,CAAC;YAC3C,OAAO,CAAC,IAAI,CACV,GAAG,eAAe,8CAA8C,EAChE,GAAG,eAAe,mDAAmD,CACtE,CAAC;YACF,MAAM;QACR,CAAC;QACD,KAAK,WAAW,EAAE,CAAC;YACjB,QAAQ,GAAG,oBAAoB,CAAC;YAChC,OAAO,CAAC,IAAI,CACV,GAAG,eAAe,mBAAmB,EACrC,GAAG,eAAe,yBAAyB,CAC5C,CAAC;YACF,OAAO,CAAC,IAAI,CACV,GAAG,eAAe,oCAAoC,EACtD,GAAG,eAAe,yCAAyC,CAC5D,CAAC;YACF,MAAM;QACR,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,gBAAgB,IAAI,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,OAAO,GAAW,EAAE,CAAC;IAEzB,IAAI,KAAK,EAAE,MAAM,KAAK,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,CA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AAC,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.');
|