@storm-software/workspace-tools 1.270.2 → 1.271.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +1 -1
- package/dist/chunk-4QYM3VS4.mjs +282 -0
- package/dist/{chunk-ZP76EMBE.js → chunk-FYXWAGK3.js} +97 -27
- package/dist/chunk-MJMN2T4N.mjs +166 -0
- package/dist/chunk-RZVF4LHT.js +282 -0
- package/dist/executors.js +3 -3
- package/dist/executors.mjs +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.mjs +4 -4
- package/dist/src/executors/npm-publish/executor.js +3 -3
- package/dist/src/executors/npm-publish/executor.mjs +2 -2
- package/dist/src/generators/preset/files/LICENSE +201 -0
- package/dist/src/utils/index.d.mts +1 -1
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/index.js +2 -2
- package/dist/src/utils/index.mjs +3 -3
- package/dist/src/utils/pnpm-deps-update.d.mts +3 -3
- package/dist/src/utils/pnpm-deps-update.d.ts +3 -3
- package/dist/src/utils/pnpm-deps-update.js +2 -2
- package/dist/src/utils/pnpm-deps-update.mjs +3 -3
- package/docs/api/base/base-executor.schema.md +16 -0
- package/docs/api/base/base-generator.schema.md +15 -0
- package/docs/api/base/cargo-base-executor.schema.md +90 -0
- package/docs/api/base/typescript-build-executor.schema.md +126 -0
- package/docs/api/base/typescript-library-generator.schema.md +129 -0
- package/docs/api/executors/cargo-build/schema.md +89 -0
- package/docs/api/executors/cargo-check/schema.md +90 -0
- package/docs/api/executors/cargo-clippy/schema.md +99 -0
- package/docs/api/executors/cargo-doc/schema.md +130 -0
- package/docs/api/executors/cargo-format/schema.md +90 -0
- package/docs/api/executors/cargo-publish/schema.md +117 -0
- package/docs/api/executors/clean-package/schema.md +65 -0
- package/docs/api/executors/esbuild/schema.md +126 -0
- package/docs/api/executors/npm-publish/schema.md +64 -0
- package/docs/api/executors/size-limit/schema.md +25 -0
- package/docs/api/executors/typia/schema.md +46 -0
- package/docs/api/executors/unbuild/schema.md +222 -0
- package/docs/api/generators/browser-library/files/README.md +58 -0
- package/docs/api/generators/browser-library/schema.md +129 -0
- package/docs/api/generators/config-schema/schema.md +25 -0
- package/docs/api/generators/init/schema.md +15 -0
- package/docs/api/generators/neutral-library/files/README.md +58 -0
- package/docs/api/generators/neutral-library/schema.md +129 -0
- package/docs/api/generators/node-library/files/README.md +63 -0
- package/docs/api/generators/node-library/schema.md +129 -0
- package/docs/api/generators/preset/schema.md +110 -0
- package/docs/api/generators/release-version/schema.md +160 -0
- package/package.json +13 -35
- package/dist/chunk-CMH2A42G.js +0 -467
- package/dist/chunk-HMJTTE4A.mjs +0 -96
- package/dist/chunk-I54IKCIV.mjs +0 -467
- package/docs/executors/rollup.md +0 -88
- package/executors.ts +0 -23
- package/generators.ts +0 -14
- package/index.ts +0 -5
- package/project.json +0 -58
- package/src/base/base-executor.ts +0 -200
- package/src/base/base-executor.untyped.ts +0 -18
- package/src/base/base-generator.ts +0 -130
- package/src/base/base-generator.untyped.ts +0 -16
- package/src/base/cargo-base-executor.untyped.ts +0 -73
- package/src/base/index.ts +0 -8
- package/src/base/typescript-build-executor.untyped.ts +0 -153
- package/src/base/typescript-library-generator.ts +0 -415
- package/src/base/typescript-library-generator.untyped.ts +0 -106
- package/src/executors/cargo-build/executor.spec.ts +0 -18
- package/src/executors/cargo-build/executor.ts +0 -28
- package/src/executors/cargo-build/untyped.ts +0 -18
- package/src/executors/cargo-check/executor.spec.ts +0 -18
- package/src/executors/cargo-check/executor.ts +0 -27
- package/src/executors/cargo-check/untyped.ts +0 -11
- package/src/executors/cargo-clippy/executor.spec.ts +0 -18
- package/src/executors/cargo-clippy/executor.ts +0 -28
- package/src/executors/cargo-clippy/untyped.ts +0 -18
- package/src/executors/cargo-doc/executor.spec.ts +0 -18
- package/src/executors/cargo-doc/executor.ts +0 -39
- package/src/executors/cargo-doc/untyped.ts +0 -44
- package/src/executors/cargo-format/executor.spec.ts +0 -18
- package/src/executors/cargo-format/executor.ts +0 -28
- package/src/executors/cargo-format/untyped.ts +0 -11
- package/src/executors/cargo-publish/executor.spec.ts +0 -11
- package/src/executors/cargo-publish/executor.ts +0 -139
- package/src/executors/cargo-publish/untyped.ts +0 -33
- package/src/executors/clean-package/constants.ts +0 -99
- package/src/executors/clean-package/executor.spec.ts +0 -18
- package/src/executors/clean-package/executor.ts +0 -214
- package/src/executors/clean-package/types.ts +0 -6
- package/src/executors/clean-package/untyped.ts +0 -60
- package/src/executors/clean-package/utils.ts +0 -85
- package/src/executors/esbuild/executor.spec.ts +0 -11
- package/src/executors/esbuild/executor.ts +0 -67
- package/src/executors/esbuild/untyped.ts +0 -20
- package/src/executors/npm-publish/executor.spec.ts +0 -11
- package/src/executors/npm-publish/executor.ts +0 -680
- package/src/executors/npm-publish/untyped.ts +0 -56
- package/src/executors/size-limit/executor.spec.ts +0 -18
- package/src/executors/size-limit/executor.ts +0 -88
- package/src/executors/size-limit/untyped.ts +0 -22
- package/src/executors/typia/executor.ts +0 -54
- package/src/executors/typia/untyped.ts +0 -48
- package/src/executors/unbuild/executor.spec.ts +0 -11
- package/src/executors/unbuild/executor.ts +0 -136
- package/src/executors/unbuild/untyped.ts +0 -152
- package/src/generators/browser-library/generator.spec.ts +0 -20
- package/src/generators/browser-library/generator.ts +0 -109
- package/src/generators/browser-library/untyped.ts +0 -29
- package/src/generators/config-schema/generator.spec.ts +0 -20
- package/src/generators/config-schema/generator.ts +0 -90
- package/src/generators/config-schema/untyped.ts +0 -19
- package/src/generators/init/init.ts +0 -32
- package/src/generators/init/untyped.ts +0 -16
- package/src/generators/neutral-library/generator.spec.ts +0 -20
- package/src/generators/neutral-library/generator.ts +0 -81
- package/src/generators/neutral-library/untyped.ts +0 -29
- package/src/generators/node-library/generator.spec.ts +0 -20
- package/src/generators/node-library/generator.ts +0 -84
- package/src/generators/node-library/untyped.ts +0 -29
- package/src/generators/preset/files/.all-contributorsrc.template +0 -48
- package/src/generators/preset/files/.editorconfig +0 -454
- package/src/generators/preset/files/.env.template +0 -38
- package/src/generators/preset/files/.gitattributes +0 -52
- package/src/generators/preset/files/.github/.nvmrc +0 -1
- package/src/generators/preset/files/.github/CODEOWNERS +0 -3
- package/src/generators/preset/files/.github/CODE_OF_CONDUCT.md +0 -125
- package/src/generators/preset/files/.github/CONTRIBUTING.md.template +0 -15
- package/src/generators/preset/files/.github/FUNDING.yml +0 -3
- package/src/generators/preset/files/.github/ISSUE_TEMPLATE/bug-report.yml.template +0 -102
- package/src/generators/preset/files/.github/ISSUE_TEMPLATE/documentation.yml.template +0 -56
- package/src/generators/preset/files/.github/ISSUE_TEMPLATE/feature-request.yml.template +0 -60
- package/src/generators/preset/files/.github/PULL_REQUEST_TEMPLATE.md.template +0 -39
- package/src/generators/preset/files/.github/SECURITY.md +0 -9
- package/src/generators/preset/files/.github/codecov.yml +0 -29
- package/src/generators/preset/files/.github/dependabot.yml +0 -64
- package/src/generators/preset/files/.github/labels.yml +0 -84
- package/src/generators/preset/files/.github/renovate.json +0 -4
- package/src/generators/preset/files/.github/renovate.json.template +0 -63
- package/src/generators/preset/files/.github/stale.yml +0 -55
- package/src/generators/preset/files/.github/workflows/build-release.yml.template +0 -25
- package/src/generators/preset/files/.github/workflows/code-review.yml +0 -18
- package/src/generators/preset/files/.github/workflows/codeql.yml +0 -84
- package/src/generators/preset/files/.github/workflows/dependabot-update.yml +0 -32
- package/src/generators/preset/files/.github/workflows/git-guardian.yml +0 -23
- package/src/generators/preset/files/.github/workflows/greetings.yml +0 -31
- package/src/generators/preset/files/.github/workflows/labels.yml +0 -31
- package/src/generators/preset/files/.github/workflows/lock.yml +0 -26
- package/src/generators/preset/files/.log4brains.yml.template +0 -5
- package/src/generators/preset/files/.markdownlint.json +0 -155
- package/src/generators/preset/files/.verdaccio/config.yml.template +0 -40
- package/src/generators/preset/files/.vscode/README.md +0 -32
- package/src/generators/preset/files/.vscode/cspell.json +0 -3
- package/src/generators/preset/files/.vscode/extensions.json +0 -14
- package/src/generators/preset/files/.vscode/launch.json +0 -37
- package/src/generators/preset/files/.vscode/settings.json +0 -401
- package/src/generators/preset/files/.vscode/tasks.json +0 -4
- package/src/generators/preset/files/.whitesource +0 -14
- package/src/generators/preset/files/assets/diagrams/.gitkeep +0 -0
- package/src/generators/preset/files/assets/icons/dark/.gitkeep +0 -0
- package/src/generators/preset/files/assets/icons/light/.gitkeep +0 -0
- package/src/generators/preset/files/assets/logos/.gitkeep +0 -0
- package/src/generators/preset/files/docs/api-reference/.gitkeep +0 -0
- package/src/generators/preset/generator.spec.ts +0 -20
- package/src/generators/preset/generator.ts +0 -315
- package/src/generators/preset/untyped.ts +0 -88
- package/src/generators/release-version/generator.spec.ts +0 -20
- package/src/generators/release-version/generator.ts +0 -920
- package/src/generators/release-version/untyped.ts +0 -156
- package/src/plugins/rust/cargo-toml.ts +0 -434
- package/src/plugins/rust/index.ts +0 -1
- package/src/plugins/typescript/index.ts +0 -1
- package/src/plugins/typescript/project-config.ts +0 -564
- package/src/plugins/typescript/tsup.ts +0 -198
- package/src/types.ts +0 -130
- package/src/utils/apply-workspace-tokens.ts +0 -73
- package/src/utils/cargo.ts +0 -219
- package/src/utils/create-cli-options.ts +0 -23
- package/src/utils/get-project-configurations.ts +0 -27
- package/src/utils/index.ts +0 -12
- package/src/utils/lock-file.ts +0 -159
- package/src/utils/package-helpers.ts +0 -54
- package/src/utils/plugin-helpers.ts +0 -112
- package/src/utils/pnpm-deps-update.ts +0 -111
- package/src/utils/project-tags.ts +0 -162
- package/src/utils/toml.ts +0 -204
- package/src/utils/typia-transform.ts +0 -8
- package/src/utils/versions.ts +0 -19
- package/tsconfig.json +0 -30
- package/tsup.config.ts +0 -36
- /package/{src/generators/preset/files/LICENSE → LICENSE} +0 -0
- /package/{src → dist/src}/base/base-executor.schema.d.ts +0 -0
- /package/{src → dist/src}/base/base-executor.schema.json +0 -0
- /package/{src → dist/src}/base/base-executor.schema.md +0 -0
- /package/{src → dist/src}/base/base-generator.schema.d.ts +0 -0
- /package/{src → dist/src}/base/base-generator.schema.json +0 -0
- /package/{src → dist/src}/base/base-generator.schema.md +0 -0
- /package/{src → dist/src}/base/cargo-base-executor.schema.d.ts +0 -0
- /package/{src → dist/src}/base/cargo-base-executor.schema.json +0 -0
- /package/{src → dist/src}/base/cargo-base-executor.schema.md +0 -0
- /package/{src → dist/src}/base/typescript-build-executor.schema.d.ts +0 -0
- /package/{src → dist/src}/base/typescript-build-executor.schema.json +0 -0
- /package/{src → dist/src}/base/typescript-build-executor.schema.md +0 -0
- /package/{src → dist/src}/base/typescript-library-generator.schema.d.ts +0 -0
- /package/{src → dist/src}/base/typescript-library-generator.schema.json +0 -0
- /package/{src → dist/src}/base/typescript-library-generator.schema.md +0 -0
- /package/{src → dist/src}/executors/cargo-build/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/cargo-build/schema.json +0 -0
- /package/{src → dist/src}/executors/cargo-build/schema.md +0 -0
- /package/{src → dist/src}/executors/cargo-check/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/cargo-check/schema.json +0 -0
- /package/{src → dist/src}/executors/cargo-check/schema.md +0 -0
- /package/{src → dist/src}/executors/cargo-clippy/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/cargo-clippy/schema.json +0 -0
- /package/{src → dist/src}/executors/cargo-clippy/schema.md +0 -0
- /package/{src → dist/src}/executors/cargo-doc/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/cargo-doc/schema.json +0 -0
- /package/{src → dist/src}/executors/cargo-doc/schema.md +0 -0
- /package/{src → dist/src}/executors/cargo-format/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/cargo-format/schema.json +0 -0
- /package/{src → dist/src}/executors/cargo-format/schema.md +0 -0
- /package/{src → dist/src}/executors/cargo-publish/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/cargo-publish/schema.json +0 -0
- /package/{src → dist/src}/executors/cargo-publish/schema.md +0 -0
- /package/{src → dist/src}/executors/clean-package/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/clean-package/schema.json +0 -0
- /package/{src → dist/src}/executors/clean-package/schema.md +0 -0
- /package/{src → dist/src}/executors/esbuild/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/esbuild/schema.json +0 -0
- /package/{src → dist/src}/executors/esbuild/schema.md +0 -0
- /package/{src → dist/src}/executors/npm-publish/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/npm-publish/schema.json +0 -0
- /package/{src → dist/src}/executors/npm-publish/schema.md +0 -0
- /package/{src → dist/src}/executors/size-limit/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/size-limit/schema.json +0 -0
- /package/{src → dist/src}/executors/size-limit/schema.md +0 -0
- /package/{src → dist/src}/executors/typia/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/typia/schema.json +0 -0
- /package/{src → dist/src}/executors/typia/schema.md +0 -0
- /package/{src → dist/src}/executors/unbuild/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/unbuild/schema.json +0 -0
- /package/{src → dist/src}/executors/unbuild/schema.md +0 -0
- /package/{src → dist/src}/generators/browser-library/files/README.md +0 -0
- /package/{src → dist/src}/generators/browser-library/files/jest.config.ts +0 -0
- /package/{src → dist/src}/generators/browser-library/files/src/index.ts.template +0 -0
- /package/{src → dist/src}/generators/browser-library/files/tsconfig.spec.json +0 -0
- /package/{src → dist/src}/generators/browser-library/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/browser-library/schema.json +0 -0
- /package/{src → dist/src}/generators/browser-library/schema.md +0 -0
- /package/{src → dist/src}/generators/config-schema/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/config-schema/schema.json +0 -0
- /package/{src → dist/src}/generators/config-schema/schema.md +0 -0
- /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/init/schema.json +0 -0
- /package/{src → dist/src}/generators/init/schema.md +0 -0
- /package/{src → dist/src}/generators/neutral-library/files/README.md +0 -0
- /package/{src → dist/src}/generators/neutral-library/files/jest.config.ts +0 -0
- /package/{src → dist/src}/generators/neutral-library/files/src/index.ts.template +0 -0
- /package/{src → dist/src}/generators/neutral-library/files/tsconfig.spec.json +0 -0
- /package/{src → dist/src}/generators/neutral-library/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/neutral-library/schema.json +0 -0
- /package/{src → dist/src}/generators/neutral-library/schema.md +0 -0
- /package/{src → dist/src}/generators/node-library/files/README.md +0 -0
- /package/{src → dist/src}/generators/node-library/files/jest.config.ts +0 -0
- /package/{src → dist/src}/generators/node-library/files/src/index.ts.template +0 -0
- /package/{src → dist/src}/generators/node-library/files/tsconfig.spec.json +0 -0
- /package/{src → dist/src}/generators/node-library/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/node-library/schema.json +0 -0
- /package/{src → dist/src}/generators/node-library/schema.md +0 -0
- /package/{src → dist/src}/generators/preset/files/README.md.template +0 -0
- /package/{src → dist/src}/generators/preset/files/docs/readme-templates/README.footer.md.template +0 -0
- /package/{src → dist/src}/generators/preset/files/docs/readme-templates/README.header.md.template +0 -0
- /package/{src → dist/src}/generators/preset/files/eslint.config.js.template +0 -0
- /package/{src → dist/src}/generators/preset/files/knip.json +0 -0
- /package/{src → dist/src}/generators/preset/files/lefthook.json +0 -0
- /package/{src → dist/src}/generators/preset/files/nx.json +0 -0
- /package/{src → dist/src}/generators/preset/files/pnpm-workspace.yaml +0 -0
- /package/{src → dist/src}/generators/preset/files/socket.yaml +0 -0
- /package/{src → dist/src}/generators/preset/files/storm.json.template +0 -0
- /package/{src → dist/src}/generators/preset/files/tsconfig.base.json.template +0 -0
- /package/{src → dist/src}/generators/preset/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/preset/schema.json +0 -0
- /package/{src → dist/src}/generators/preset/schema.md +0 -0
- /package/{src → dist/src}/generators/release-version/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/release-version/schema.json +0 -0
- /package/{src → dist/src}/generators/release-version/schema.md +0 -0
- /package/{src → dist/src}/plugins/typescript/untyped-schema.ts +0 -0
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineUntypedSchema } from "untyped";
|
|
2
|
-
import cargoBaseExecutorSchema from "../../base/cargo-base-executor.untyped";
|
|
3
|
-
|
|
4
|
-
export default defineUntypedSchema({
|
|
5
|
-
...cargoBaseExecutorSchema,
|
|
6
|
-
$schema: {
|
|
7
|
-
id: "CargoClippyExecutorSchema",
|
|
8
|
-
title: "Cargo Clippy Executor",
|
|
9
|
-
description: "A type definition for a Cargo/rust clippy executor schema",
|
|
10
|
-
},
|
|
11
|
-
fix: {
|
|
12
|
-
$schema: {
|
|
13
|
-
title: "Fix",
|
|
14
|
-
type: "boolean",
|
|
15
|
-
description: "Automatically fix issues",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext } from "@nx/devkit";
|
|
2
|
-
|
|
3
|
-
import executor from "./executor";
|
|
4
|
-
import { CargoDocExecutorSchema } from "./schema.d";
|
|
5
|
-
|
|
6
|
-
const options: CargoDocExecutorSchema = {};
|
|
7
|
-
const context: ExecutorContext = {
|
|
8
|
-
root: "",
|
|
9
|
-
cwd: process.cwd(),
|
|
10
|
-
isVerbose: false,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
describe("CargoDoc Executor", () => {
|
|
14
|
-
it("can run", async () => {
|
|
15
|
-
const output = await executor(options, context);
|
|
16
|
-
expect(output.success).toBe(true);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext, PromiseExecutor } from "@nx/devkit";
|
|
2
|
-
import { withRunExecutor } from "../../base/base-executor";
|
|
3
|
-
import { buildCargoCommand, cargoCommand } from "../../utils/cargo";
|
|
4
|
-
import { CargoDocExecutorSchema } from "./schema.d";
|
|
5
|
-
|
|
6
|
-
export async function cargoDocExecutor(
|
|
7
|
-
options: CargoDocExecutorSchema,
|
|
8
|
-
context: ExecutorContext,
|
|
9
|
-
) {
|
|
10
|
-
const opts = { ...options };
|
|
11
|
-
|
|
12
|
-
opts["no-deps"] = opts.noDeps;
|
|
13
|
-
delete opts.noDeps;
|
|
14
|
-
|
|
15
|
-
const command = buildCargoCommand("doc", options, context);
|
|
16
|
-
return await cargoCommand(...command);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default withRunExecutor<CargoDocExecutorSchema>(
|
|
20
|
-
"Cargo Doc",
|
|
21
|
-
cargoDocExecutor,
|
|
22
|
-
{
|
|
23
|
-
skipReadingConfig: false,
|
|
24
|
-
hooks: {
|
|
25
|
-
applyDefaultOptions: (options: CargoDocExecutorSchema) => {
|
|
26
|
-
options.outputPath ??= "dist/docs/{projectRoot}";
|
|
27
|
-
options.toolchain ??= "stable";
|
|
28
|
-
options.release ??= options.profile ? false : true;
|
|
29
|
-
options.allFeatures ??= true;
|
|
30
|
-
options.lib ??= true;
|
|
31
|
-
options.bins ??= true;
|
|
32
|
-
options.examples ??= true;
|
|
33
|
-
options.noDeps ??= false;
|
|
34
|
-
|
|
35
|
-
return options as CargoDocExecutorSchema;
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
) as PromiseExecutor<CargoDocExecutorSchema>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { defineUntypedSchema } from "untyped";
|
|
2
|
-
import cargoBaseExecutorSchema from "../../base/cargo-base-executor.untyped";
|
|
3
|
-
|
|
4
|
-
export default defineUntypedSchema({
|
|
5
|
-
...cargoBaseExecutorSchema,
|
|
6
|
-
$schema: {
|
|
7
|
-
id: "CargoDocExecutorSchema",
|
|
8
|
-
title: "Cargo Doc Executor",
|
|
9
|
-
description:
|
|
10
|
-
"A type definition for a Cargo/rust documentation executor schema",
|
|
11
|
-
},
|
|
12
|
-
lib: {
|
|
13
|
-
$schema: {
|
|
14
|
-
title: "Library",
|
|
15
|
-
type: "boolean",
|
|
16
|
-
description: "Generate documentation for the library",
|
|
17
|
-
},
|
|
18
|
-
default: true,
|
|
19
|
-
},
|
|
20
|
-
bins: {
|
|
21
|
-
$schema: {
|
|
22
|
-
title: "Bins",
|
|
23
|
-
type: "boolean",
|
|
24
|
-
description: "Generate documentation for the bins",
|
|
25
|
-
},
|
|
26
|
-
default: true,
|
|
27
|
-
},
|
|
28
|
-
examples: {
|
|
29
|
-
$schema: {
|
|
30
|
-
title: "Examples",
|
|
31
|
-
type: "boolean",
|
|
32
|
-
description: "Generate documentation for the examples",
|
|
33
|
-
},
|
|
34
|
-
default: true,
|
|
35
|
-
},
|
|
36
|
-
noDeps: {
|
|
37
|
-
$schema: {
|
|
38
|
-
title: "No Dependencies",
|
|
39
|
-
type: "boolean",
|
|
40
|
-
description: "Do not generate documentation for dependencies",
|
|
41
|
-
},
|
|
42
|
-
default: false,
|
|
43
|
-
},
|
|
44
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext } from "@nx/devkit";
|
|
2
|
-
|
|
3
|
-
import executor from "./executor";
|
|
4
|
-
import { CargoCheckExecutorSchema } from "./schema.d";
|
|
5
|
-
|
|
6
|
-
const options: CargoCheckExecutorSchema = {};
|
|
7
|
-
const context: ExecutorContext = {
|
|
8
|
-
root: "",
|
|
9
|
-
cwd: process.cwd(),
|
|
10
|
-
isVerbose: false,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
describe("CargoCheck Executor", () => {
|
|
14
|
-
it("can run", async () => {
|
|
15
|
-
const output = await executor(options, context);
|
|
16
|
-
expect(output.success).toBe(true);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext, PromiseExecutor } from "@nx/devkit";
|
|
2
|
-
import { withRunExecutor } from "../../base/base-executor";
|
|
3
|
-
import { buildCargoCommand, cargoCommand } from "../../utils/cargo";
|
|
4
|
-
import { CargoFormatExecutorSchema } from "./schema.d";
|
|
5
|
-
|
|
6
|
-
export async function cargoFormatExecutor(
|
|
7
|
-
options: CargoFormatExecutorSchema,
|
|
8
|
-
context: ExecutorContext,
|
|
9
|
-
) {
|
|
10
|
-
const command = buildCargoCommand("fmt", options, context);
|
|
11
|
-
return await cargoCommand(...command);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default withRunExecutor<CargoFormatExecutorSchema>(
|
|
15
|
-
"Cargo Format",
|
|
16
|
-
cargoFormatExecutor,
|
|
17
|
-
{
|
|
18
|
-
skipReadingConfig: false,
|
|
19
|
-
hooks: {
|
|
20
|
-
applyDefaultOptions: (options: CargoFormatExecutorSchema) => {
|
|
21
|
-
options.outputPath ??= "dist/target/{projectRoot}";
|
|
22
|
-
options.toolchain ??= "stable";
|
|
23
|
-
|
|
24
|
-
return options as CargoFormatExecutorSchema;
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
) as PromiseExecutor<CargoFormatExecutorSchema>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { defineUntypedSchema } from "untyped";
|
|
2
|
-
import cargoBaseExecutorSchema from "../../base/cargo-base-executor.untyped";
|
|
3
|
-
|
|
4
|
-
export default defineUntypedSchema({
|
|
5
|
-
...cargoBaseExecutorSchema,
|
|
6
|
-
$schema: {
|
|
7
|
-
id: "CargoFormatExecutorSchema",
|
|
8
|
-
title: "Cargo Format Executor",
|
|
9
|
-
description: "A type definition for a Cargo/rust format executor schema",
|
|
10
|
-
},
|
|
11
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// import { CargoReleasePublishExecutorSchema } from "./schema.d";
|
|
2
|
-
// import executor from "./executor";
|
|
3
|
-
|
|
4
|
-
// const options: CargoReleasePublishExecutorSchema = {};
|
|
5
|
-
|
|
6
|
-
// describe("CargoReleasePublish Executor", () => {
|
|
7
|
-
// it("can run", async () => {
|
|
8
|
-
// const output = await executor(options);
|
|
9
|
-
// expect(output.success).toBe(true);
|
|
10
|
-
// });
|
|
11
|
-
// });
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { type ExecutorContext, joinPathFragments } from "@nx/devkit";
|
|
2
|
-
import { execSync } from "node:child_process";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
import https from "node:https";
|
|
5
|
-
import { parseCargoToml } from "../../utils/toml";
|
|
6
|
-
import type { CargoPublishExecutorSchema } from "./schema.d";
|
|
7
|
-
|
|
8
|
-
const LARGE_BUFFER = 1024 * 1000000;
|
|
9
|
-
|
|
10
|
-
export default async function runExecutor(
|
|
11
|
-
options: CargoPublishExecutorSchema,
|
|
12
|
-
context: ExecutorContext,
|
|
13
|
-
) {
|
|
14
|
-
/**
|
|
15
|
-
* We need to check both the env var and the option because the executor may have been triggered
|
|
16
|
-
* indirectly via dependsOn, in which case the env var will be set, but the option will not.
|
|
17
|
-
*/
|
|
18
|
-
const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
|
|
19
|
-
|
|
20
|
-
if (!context.projectName) {
|
|
21
|
-
throw new Error("The executor requires a projectName.");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
console.info(
|
|
25
|
-
`🚀 Running Storm Cargo Publish executor on the ${context.projectName} crate`,
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
!context.projectName ||
|
|
30
|
-
!context.projectsConfigurations?.projects ||
|
|
31
|
-
!context.projectsConfigurations.projects[context.projectName] ||
|
|
32
|
-
!context.projectsConfigurations.projects[context.projectName]?.root
|
|
33
|
-
) {
|
|
34
|
-
throw new Error("The executor requires projectsConfigurations.");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const registry = options.registry
|
|
38
|
-
? options.registry
|
|
39
|
-
: process.env.STORM_REGISTRY_CARGO
|
|
40
|
-
? process.env.STORM_REGISTRY_CARGO
|
|
41
|
-
: "https://crates.io";
|
|
42
|
-
|
|
43
|
-
const root =
|
|
44
|
-
context.projectsConfigurations.projects[context.projectName]?.root;
|
|
45
|
-
const packageRoot = joinPathFragments(
|
|
46
|
-
context.root,
|
|
47
|
-
(options.packageRoot ? options.packageRoot : root) as string,
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const cargoToml = parseCargoToml(
|
|
51
|
-
readFileSync(joinPathFragments(packageRoot, "Cargo.toml"), "utf-8"),
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
try {
|
|
55
|
-
const result = await getRegistryVersion(
|
|
56
|
-
cargoToml.package.name,
|
|
57
|
-
cargoToml.package.version,
|
|
58
|
-
registry,
|
|
59
|
-
);
|
|
60
|
-
if (result) {
|
|
61
|
-
console.warn(
|
|
62
|
-
`Skipped package "${cargoToml.package.name}" from project "${context.projectName}" because v${cargoToml.package.version} already exists in ${registry} with tag "latest"`,
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
success: true,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
} catch (_: any) {
|
|
70
|
-
// Do nothing
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const cargoPublishCommandSegments = [
|
|
74
|
-
`cargo publish --allow-dirty -p ${cargoToml.package.name}`,
|
|
75
|
-
];
|
|
76
|
-
if (isDryRun) {
|
|
77
|
-
cargoPublishCommandSegments.push("--dry-run");
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
try {
|
|
81
|
-
const cargoPublishCommand = cargoPublishCommandSegments.join(" ");
|
|
82
|
-
console.log("");
|
|
83
|
-
console.log(`Running "${cargoPublishCommand}"...`);
|
|
84
|
-
console.log("");
|
|
85
|
-
|
|
86
|
-
execSync(cargoPublishCommand, {
|
|
87
|
-
maxBuffer: LARGE_BUFFER,
|
|
88
|
-
env: {
|
|
89
|
-
...process.env,
|
|
90
|
-
FORCE_COLOR: "true",
|
|
91
|
-
},
|
|
92
|
-
cwd: packageRoot,
|
|
93
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
console.log("");
|
|
97
|
-
|
|
98
|
-
if (isDryRun) {
|
|
99
|
-
console.log(`Would publish to ${registry}, but [dry-run] was set`);
|
|
100
|
-
} else {
|
|
101
|
-
console.log(`Published to ${registry}`);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return {
|
|
105
|
-
success: true,
|
|
106
|
-
};
|
|
107
|
-
} catch (error: any) {
|
|
108
|
-
console.error(`Failed to publish to ${registry}`);
|
|
109
|
-
console.error(error);
|
|
110
|
-
console.log("");
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
success: false,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export const getRegistryVersion = (
|
|
119
|
-
name: string,
|
|
120
|
-
version: string,
|
|
121
|
-
registry: string,
|
|
122
|
-
): Promise<string> => {
|
|
123
|
-
return new Promise((resolve: (value: string) => void) =>
|
|
124
|
-
https
|
|
125
|
-
.get(
|
|
126
|
-
`${registry}/api/v1/crates/${encodeURIComponent(name)}/${encodeURIComponent(
|
|
127
|
-
version,
|
|
128
|
-
)}`,
|
|
129
|
-
(res) => {
|
|
130
|
-
res.on("data", (d) => {
|
|
131
|
-
resolve(d);
|
|
132
|
-
});
|
|
133
|
-
},
|
|
134
|
-
)
|
|
135
|
-
.on("error", (e) => {
|
|
136
|
-
throw e;
|
|
137
|
-
}),
|
|
138
|
-
);
|
|
139
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineUntypedSchema } from "untyped";
|
|
2
|
-
import cargoBaseExecutorSchema from "../../base/cargo-base-executor.untyped";
|
|
3
|
-
|
|
4
|
-
export default defineUntypedSchema({
|
|
5
|
-
...cargoBaseExecutorSchema,
|
|
6
|
-
$schema: {
|
|
7
|
-
id: "CargoPublishExecutorSchema",
|
|
8
|
-
title: "Cargo Publish Executor",
|
|
9
|
-
description: "A type definition for a Cargo/rust Publish executor schema",
|
|
10
|
-
},
|
|
11
|
-
registry: {
|
|
12
|
-
$schema: {
|
|
13
|
-
title: "Registry",
|
|
14
|
-
type: "string",
|
|
15
|
-
description: "The registry to publish to",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
packageRoot: {
|
|
19
|
-
$schema: {
|
|
20
|
-
title: "Package Root",
|
|
21
|
-
type: "string",
|
|
22
|
-
format: "path",
|
|
23
|
-
description: "The path to the package root",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
dryRun: {
|
|
27
|
-
$schema: {
|
|
28
|
-
title: "Dry Run",
|
|
29
|
-
type: "boolean",
|
|
30
|
-
description: "Perform a dry run",
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
});
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
export const IGNORE_FILES = [
|
|
2
|
-
".circleci",
|
|
3
|
-
".DS_Store",
|
|
4
|
-
".editorconfig",
|
|
5
|
-
".eslintignore",
|
|
6
|
-
".flowconfig",
|
|
7
|
-
".git",
|
|
8
|
-
".github",
|
|
9
|
-
".travis.yml",
|
|
10
|
-
".vscode",
|
|
11
|
-
".watchmanconfig",
|
|
12
|
-
".yarnrc",
|
|
13
|
-
"appveyor.yml",
|
|
14
|
-
"karma.conf.js",
|
|
15
|
-
"node_modules",
|
|
16
|
-
"package-lock.json",
|
|
17
|
-
"pnpm-debug.log",
|
|
18
|
-
"pnpm-lock.yaml",
|
|
19
|
-
".devcontainer.json",
|
|
20
|
-
"test",
|
|
21
|
-
"yarn-error.log",
|
|
22
|
-
"yarn.lock",
|
|
23
|
-
/^(babel|commitlint|jest|vitest)\.config\.[cm]?(j|t)s$/,
|
|
24
|
-
/^\.?nano-staged\.(c|m)?js(on)?$/,
|
|
25
|
-
/^\.?simple-git-hooks.js(on)?$/,
|
|
26
|
-
/^\.?simple-pre-commit.js(on)?$/,
|
|
27
|
-
/^\.babelrc/,
|
|
28
|
-
/^\.clean-publish/,
|
|
29
|
-
/^\.commitlintrc/,
|
|
30
|
-
/^\.eslintrc/,
|
|
31
|
-
/^\.jsconfig/,
|
|
32
|
-
/^\.jsdocrc/,
|
|
33
|
-
/^\.lintstagedrc/,
|
|
34
|
-
/^\.nanostagedrc/,
|
|
35
|
-
/^\.prettierrc/,
|
|
36
|
-
/^\.remarkrc/,
|
|
37
|
-
/^\.renovaterc/,
|
|
38
|
-
/^\.size-limit/,
|
|
39
|
-
/^\.yaspellerrc/,
|
|
40
|
-
/^changelog/i,
|
|
41
|
-
/eslint.config.(c|m)?js/,
|
|
42
|
-
/README\.[\w-]+\.md/,
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
export const IGNORE_FIELDS = [
|
|
46
|
-
"babel",
|
|
47
|
-
"browserslist",
|
|
48
|
-
"c8",
|
|
49
|
-
"clean-publish",
|
|
50
|
-
"commitlint",
|
|
51
|
-
"devDependencies",
|
|
52
|
-
"eslintConfig",
|
|
53
|
-
"eslintIgnore",
|
|
54
|
-
"husky",
|
|
55
|
-
"jest",
|
|
56
|
-
"lint-staged",
|
|
57
|
-
"nano-staged",
|
|
58
|
-
"pre-commit",
|
|
59
|
-
"prettier",
|
|
60
|
-
"pwmetrics",
|
|
61
|
-
"remarkConfig",
|
|
62
|
-
"renovate",
|
|
63
|
-
"resolutions",
|
|
64
|
-
"sharec",
|
|
65
|
-
"simple-git-hooks",
|
|
66
|
-
"simple-pre-commit",
|
|
67
|
-
"size-limit",
|
|
68
|
-
"typeCoverage",
|
|
69
|
-
"yaspeller",
|
|
70
|
-
];
|
|
71
|
-
|
|
72
|
-
export const NPM_SCRIPTS = [
|
|
73
|
-
"postinstall",
|
|
74
|
-
"postpack",
|
|
75
|
-
"postpublish",
|
|
76
|
-
"postversion",
|
|
77
|
-
"prepublish",
|
|
78
|
-
"publish",
|
|
79
|
-
"uninstall",
|
|
80
|
-
"version",
|
|
81
|
-
];
|
|
82
|
-
|
|
83
|
-
// https://pnpm.io/package_json#publishconfig
|
|
84
|
-
export const PUBLISH_CONFIG_FIELDS = [
|
|
85
|
-
"bin",
|
|
86
|
-
"main",
|
|
87
|
-
"exports",
|
|
88
|
-
"types",
|
|
89
|
-
"typings",
|
|
90
|
-
"module",
|
|
91
|
-
"browser",
|
|
92
|
-
"esnext",
|
|
93
|
-
"es2015",
|
|
94
|
-
"unpkg",
|
|
95
|
-
"umd:main",
|
|
96
|
-
"typesVersions",
|
|
97
|
-
"cpu",
|
|
98
|
-
"os",
|
|
99
|
-
];
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext } from "@nx/devkit";
|
|
2
|
-
|
|
3
|
-
import executor from "./executor";
|
|
4
|
-
import { CleanPublishExecutorSchema } from "./schema.d";
|
|
5
|
-
|
|
6
|
-
const options: CleanPublishExecutorSchema = {};
|
|
7
|
-
const context: ExecutorContext = {
|
|
8
|
-
root: "",
|
|
9
|
-
cwd: process.cwd(),
|
|
10
|
-
isVerbose: false,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
describe("CleanPublish Executor", () => {
|
|
14
|
-
it("can run", async () => {
|
|
15
|
-
const output = await executor(options, context);
|
|
16
|
-
expect(output.success).toBe(true);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import type { ExecutorContext } from "@nx/devkit";
|
|
2
|
-
import { joinPathFragments } from "@nx/devkit";
|
|
3
|
-
import type { StormWorkspaceConfig } from "@storm-software/config";
|
|
4
|
-
import { writeInfo } from "@storm-software/config-tools/logger/console";
|
|
5
|
-
import { joinPaths } from "@storm-software/config-tools/utilities/correct-paths";
|
|
6
|
-
import {
|
|
7
|
-
copy,
|
|
8
|
-
mkdir,
|
|
9
|
-
pathExists,
|
|
10
|
-
readFile,
|
|
11
|
-
readJson,
|
|
12
|
-
remove,
|
|
13
|
-
writeFile,
|
|
14
|
-
writeJson
|
|
15
|
-
} from "fs-extra";
|
|
16
|
-
import { Glob } from "glob";
|
|
17
|
-
import { withRunExecutor } from "../../base/base-executor";
|
|
18
|
-
import { IGNORE_FIELDS, NPM_SCRIPTS, PUBLISH_CONFIG_FIELDS } from "./constants";
|
|
19
|
-
import { CleanPackageExecutorSchema } from "./schema.d";
|
|
20
|
-
import { PackageJson } from "./types";
|
|
21
|
-
import { createFilesFilter, filterObjectByKey, isObject } from "./utils";
|
|
22
|
-
|
|
23
|
-
export async function cleanPackageExecutorFn(
|
|
24
|
-
options: CleanPackageExecutorSchema,
|
|
25
|
-
context: ExecutorContext,
|
|
26
|
-
config: StormWorkspaceConfig
|
|
27
|
-
) {
|
|
28
|
-
const tempDirectoryName = joinPathFragments(
|
|
29
|
-
config.workspaceRoot,
|
|
30
|
-
"tmp",
|
|
31
|
-
context.root
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const exists = await pathExists(tempDirectoryName);
|
|
35
|
-
if (exists) {
|
|
36
|
-
writeInfo(
|
|
37
|
-
`🧹 Cleaning temporary directory path: ${tempDirectoryName}`,
|
|
38
|
-
config
|
|
39
|
-
);
|
|
40
|
-
await remove(tempDirectoryName);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
await mkdir(tempDirectoryName);
|
|
44
|
-
writeInfo(`Created temporary directory: ${tempDirectoryName}`, config);
|
|
45
|
-
|
|
46
|
-
const packageJson = await readJson<PackageJson>(options.packageJsonPath);
|
|
47
|
-
|
|
48
|
-
await copy(options.outputPath, tempDirectoryName, {
|
|
49
|
-
filter: createFilesFilter(options.ignoredFiles, options.outputPath!)
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
if (options.cleanReadMe) {
|
|
53
|
-
await cleanReadMe(
|
|
54
|
-
tempDirectoryName,
|
|
55
|
-
packageJson.repository,
|
|
56
|
-
packageJson.homepage
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (options.cleanComments) {
|
|
61
|
-
await cleanComments(tempDirectoryName);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const tempPackageJson = clearPackageJSON(packageJson, options.fields);
|
|
65
|
-
writeJson(
|
|
66
|
-
joinPathFragments(tempDirectoryName, "package.json"),
|
|
67
|
-
tempPackageJson
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
await copy(tempDirectoryName, options.outputPath, {
|
|
71
|
-
override: true,
|
|
72
|
-
preserveTimestamps: true
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
await remove(tempDirectoryName);
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
success: true
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function getReadmeUrlFromRepository(repository: PackageJson["repository"]) {
|
|
83
|
-
const repoUrl = typeof repository === "object" ? repository.url : repository;
|
|
84
|
-
if (repoUrl) {
|
|
85
|
-
const name = repoUrl.match(/[^/:]+\/[^/:]+$/)?.[0]?.replace(/\.git$/, "");
|
|
86
|
-
return `https://github.com/${name}#README.md`;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async function cleanReadMe(
|
|
93
|
-
directoryName: string,
|
|
94
|
-
repository: PackageJson["repository"],
|
|
95
|
-
homepage: PackageJson["homepage"]
|
|
96
|
-
) {
|
|
97
|
-
const readmePath = joinPathFragments(directoryName, "README.md");
|
|
98
|
-
const readme = await readFile(readmePath);
|
|
99
|
-
const readmeUrl = getReadmeUrlFromRepository(repository);
|
|
100
|
-
if (homepage || readmeUrl) {
|
|
101
|
-
const cleaned =
|
|
102
|
-
readme.toString().split(/\n##\s*\w/m)[0] +
|
|
103
|
-
"\n## Documentation\n" +
|
|
104
|
-
`Read full docs **[here](${homepage || readmeUrl})**.\n`;
|
|
105
|
-
|
|
106
|
-
await writeFile(readmePath, cleaned);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async function cleanComments(directoryName: string) {
|
|
111
|
-
const glob = new Glob(["**/*.js"], { cwd: directoryName });
|
|
112
|
-
|
|
113
|
-
const files = await glob.walk();
|
|
114
|
-
await Promise.all(
|
|
115
|
-
files.map(async i => {
|
|
116
|
-
const file = joinPathFragments(directoryName, i);
|
|
117
|
-
const content = await readFile(file);
|
|
118
|
-
const cleaned = content
|
|
119
|
-
.toString()
|
|
120
|
-
.replace(/\s*\/\/.*\n/gm, "\n")
|
|
121
|
-
.replace(/\s*\/\*[^/]+\*\/\n?/gm, "\n")
|
|
122
|
-
.replace(/\n+/gm, "\n")
|
|
123
|
-
.replace(/^\n+/gm, "");
|
|
124
|
-
|
|
125
|
-
await writeFile(file, cleaned);
|
|
126
|
-
})
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function clearPackageJSON(packageJson, inputIgnoreFields) {
|
|
131
|
-
const ignoreFields = inputIgnoreFields
|
|
132
|
-
? IGNORE_FIELDS.concat(inputIgnoreFields)
|
|
133
|
-
: IGNORE_FIELDS;
|
|
134
|
-
|
|
135
|
-
if (!packageJson.publishConfig) {
|
|
136
|
-
return packageJson;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const publishConfig = {
|
|
140
|
-
...packageJson.publishConfig
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
PUBLISH_CONFIG_FIELDS.forEach(field => {
|
|
144
|
-
if (publishConfig[field]) {
|
|
145
|
-
packageJson[field] = publishConfig[field];
|
|
146
|
-
delete publishConfig[field];
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
if (!Object.keys(publishConfig).length) {
|
|
151
|
-
// delete property by destructuring
|
|
152
|
-
// eslint-disable-next-line no-unused-vars
|
|
153
|
-
const { publishConfig: _, ...pkg } = packageJson;
|
|
154
|
-
|
|
155
|
-
return pkg;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const cleanPackageJSON = filterObjectByKey(
|
|
159
|
-
{
|
|
160
|
-
...packageJson,
|
|
161
|
-
publishConfig
|
|
162
|
-
},
|
|
163
|
-
key => !!(key && !ignoreFields.includes(key) && key !== "scripts")
|
|
164
|
-
) as PackageJson;
|
|
165
|
-
|
|
166
|
-
if (packageJson.scripts && !ignoreFields.includes("scripts")) {
|
|
167
|
-
cleanPackageJSON.scripts = filterObjectByKey(
|
|
168
|
-
packageJson.scripts,
|
|
169
|
-
script => !!(script && NPM_SCRIPTS.includes(script))
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
if (
|
|
173
|
-
cleanPackageJSON.scripts.publish &&
|
|
174
|
-
/^clean-publish( |$)/.test(cleanPackageJSON.scripts.publish)
|
|
175
|
-
) {
|
|
176
|
-
// "custom" publish script is actually calling clean-publish
|
|
177
|
-
delete cleanPackageJSON.scripts.publish;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
for (const i in cleanPackageJSON) {
|
|
182
|
-
if (
|
|
183
|
-
isObject(cleanPackageJSON[i]) &&
|
|
184
|
-
Object.keys(cleanPackageJSON[i]).length === 0
|
|
185
|
-
) {
|
|
186
|
-
delete cleanPackageJSON[i];
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return cleanPackageJSON;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export default withRunExecutor<CleanPackageExecutorSchema>(
|
|
193
|
-
"Storm Clean-Package executor",
|
|
194
|
-
cleanPackageExecutorFn,
|
|
195
|
-
{
|
|
196
|
-
skipReadingConfig: false,
|
|
197
|
-
hooks: {
|
|
198
|
-
applyDefaultOptions: (
|
|
199
|
-
options: CleanPackageExecutorSchema
|
|
200
|
-
): CleanPackageExecutorSchema => {
|
|
201
|
-
options.outputPath ??= "dist/{projectRoot}";
|
|
202
|
-
options.packageJsonPath ??= joinPaths(
|
|
203
|
-
options.outputPath,
|
|
204
|
-
"package.json"
|
|
205
|
-
);
|
|
206
|
-
|
|
207
|
-
options.cleanReadMe ??= true;
|
|
208
|
-
options.cleanComments ??= true;
|
|
209
|
-
|
|
210
|
-
return options;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
);
|