projen 0.91.17 → 0.91.19
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/.jsii +39 -15
- package/lib/awscdk/auto-discover.js +5 -5
- package/lib/awscdk/awscdk-app-java.js +1 -1
- package/lib/awscdk/awscdk-app-py.js +1 -1
- package/lib/awscdk/awscdk-app-ts.js +1 -1
- package/lib/awscdk/awscdk-construct.js +2 -2
- package/lib/awscdk/awscdk-deps-java.js +1 -1
- package/lib/awscdk/awscdk-deps-js.js +1 -1
- package/lib/awscdk/awscdk-deps-py.js +1 -1
- package/lib/awscdk/awscdk-deps.js +1 -1
- package/lib/awscdk/cdk-config.js +1 -1
- package/lib/awscdk/cdk-tasks.js +1 -1
- package/lib/awscdk/integration-test.js +1 -1
- package/lib/awscdk/lambda-extension.js +1 -1
- package/lib/awscdk/lambda-function.js +2 -2
- package/lib/build/build-workflow.js +1 -1
- package/lib/cdk/auto-discover-base.js +2 -2
- package/lib/cdk/construct-lib.js +1 -1
- package/lib/cdk/integration-test-base.js +1 -1
- package/lib/cdk/jsii-docgen.js +1 -1
- package/lib/cdk/jsii-project.js +1 -1
- package/lib/cdk8s/auto-discover.js +2 -2
- package/lib/cdk8s/cdk8s-app-py.js +1 -1
- package/lib/cdk8s/cdk8s-app-ts.js +1 -1
- package/lib/cdk8s/cdk8s-construct.js +1 -1
- package/lib/cdk8s/cdk8s-deps-py.js +1 -1
- package/lib/cdk8s/cdk8s-deps.js +1 -1
- package/lib/cdk8s/integration-test.js +1 -1
- package/lib/cdktf/cdktf-construct.js +1 -1
- package/lib/circleci/circleci.js +1 -1
- package/lib/component.js +1 -1
- package/lib/dependencies.js +1 -1
- package/lib/dev-env.js +1 -1
- package/lib/docker-compose/docker-compose-service.js +1 -1
- package/lib/docker-compose/docker-compose.js +1 -1
- package/lib/file.js +1 -1
- package/lib/gitattributes.js +1 -1
- package/lib/github/actions-provider.js +1 -1
- package/lib/github/auto-approve.js +1 -1
- package/lib/github/auto-merge.d.ts +7 -1
- package/lib/github/auto-merge.js +9 -3
- package/lib/github/auto-queue.d.ts +31 -0
- package/lib/github/auto-queue.js +25 -6
- package/lib/github/dependabot.js +1 -1
- package/lib/github/github-credentials.js +1 -1
- package/lib/github/github-project.js +1 -1
- package/lib/github/github.js +1 -1
- package/lib/github/merge-queue.js +26 -3
- package/lib/github/mergify.js +1 -1
- package/lib/github/pr-template.js +1 -1
- package/lib/github/private/util.d.ts +4 -0
- package/lib/github/private/util.js +22 -1
- package/lib/github/pull-request-backport.js +1 -1
- package/lib/github/pull-request-lint.js +1 -1
- package/lib/github/stale.js +1 -1
- package/lib/github/task-workflow-job.js +1 -1
- package/lib/github/task-workflow.js +1 -1
- package/lib/github/workflow-actions.js +1 -1
- package/lib/github/workflow-jobs.js +1 -1
- package/lib/github/workflow-steps.js +1 -1
- package/lib/github/workflows.js +1 -1
- package/lib/gitlab/configuration.js +1 -1
- package/lib/gitlab/gitlab-configuration.js +1 -1
- package/lib/gitlab/nested-configuration.js +1 -1
- package/lib/gitpod.js +1 -1
- package/lib/ignore-file.js +1 -1
- package/lib/ini.js +1 -1
- package/lib/java/java-project.js +1 -1
- package/lib/java/junit.js +1 -1
- package/lib/java/maven-compile.js +1 -1
- package/lib/java/maven-packaging.js +1 -1
- package/lib/java/maven-sample.js +1 -1
- package/lib/java/pom.js +2 -2
- package/lib/java/projenrc.js +1 -1
- package/lib/javascript/bundler.js +1 -1
- package/lib/javascript/eslint.js +1 -1
- package/lib/javascript/jest.js +4 -4
- package/lib/javascript/license-checker.js +1 -1
- package/lib/javascript/node-package.js +1 -1
- package/lib/javascript/node-project.js +1 -1
- package/lib/javascript/npm-config.js +1 -1
- package/lib/javascript/prettier.js +1 -1
- package/lib/javascript/projenrc.js +1 -1
- package/lib/javascript/typescript-config.js +2 -2
- package/lib/javascript/upgrade-dependencies.js +2 -2
- package/lib/javascript/yarnrc.js +1 -1
- package/lib/json-patch.js +1 -1
- package/lib/json.js +1 -1
- package/lib/license.js +1 -1
- package/lib/logger.js +1 -1
- package/lib/makefile.js +1 -1
- package/lib/object-file.js +1 -1
- package/lib/project-build.js +1 -1
- package/lib/project-tree.js +1 -1
- package/lib/project.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/projenrc-json.js +2 -2
- package/lib/projenrc.js +1 -1
- package/lib/python/pip.js +1 -1
- package/lib/python/poetry.js +2 -2
- package/lib/python/projenrc.js +1 -1
- package/lib/python/pytest-sample.js +1 -1
- package/lib/python/pytest.js +1 -1
- package/lib/python/python-project.js +1 -1
- package/lib/python/python-sample.js +1 -1
- package/lib/python/requirements-file.js +1 -1
- package/lib/python/setuppy.js +1 -1
- package/lib/python/setuptools.js +1 -1
- package/lib/python/venv.js +1 -1
- package/lib/readme.js +1 -1
- package/lib/release/publisher.js +1 -1
- package/lib/release/release-trigger.js +1 -1
- package/lib/release/release.js +1 -1
- package/lib/renovatebot.js +1 -1
- package/lib/sample-file.js +2 -2
- package/lib/semver.js +1 -1
- package/lib/source-code.js +1 -1
- package/lib/task-runtime.js +1 -1
- package/lib/task.js +1 -1
- package/lib/tasks.js +1 -1
- package/lib/testing.js +1 -1
- package/lib/textfile.js +1 -1
- package/lib/toml.js +1 -1
- package/lib/typescript/projenrc-ts.js +1 -1
- package/lib/typescript/projenrc.js +1 -1
- package/lib/typescript/typescript-typedoc.js +1 -1
- package/lib/typescript/typescript.js +6 -6
- package/lib/version.js +2 -2
- package/lib/vscode/devcontainer.js +1 -1
- package/lib/vscode/extensions.js +1 -1
- package/lib/vscode/launch-config.js +1 -1
- package/lib/vscode/settings.js +1 -1
- package/lib/vscode/vscode.js +1 -1
- package/lib/web/next.js +3 -3
- package/lib/web/postcss.js +1 -1
- package/lib/web/react.js +4 -4
- package/lib/web/tailwind.js +1 -1
- package/lib/xmlfile.js +1 -1
- package/lib/yaml.js +1 -1
- package/node_modules/{minimatch/node_modules/brace-expansion → @nodelib/fs.scandir}/LICENSE +2 -2
- package/node_modules/@nodelib/fs.scandir/README.md +171 -0
- package/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts +20 -0
- package/node_modules/@nodelib/fs.scandir/out/adapters/fs.js +19 -0
- package/node_modules/@nodelib/fs.scandir/out/constants.d.ts +4 -0
- package/node_modules/@nodelib/fs.scandir/out/constants.js +17 -0
- package/node_modules/@nodelib/fs.scandir/out/index.d.ts +12 -0
- package/node_modules/@nodelib/fs.scandir/out/index.js +26 -0
- package/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts +7 -0
- package/node_modules/@nodelib/fs.scandir/out/providers/async.js +104 -0
- package/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts +1 -0
- package/node_modules/@nodelib/fs.scandir/out/providers/common.js +13 -0
- package/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts +5 -0
- package/node_modules/@nodelib/fs.scandir/out/providers/sync.js +54 -0
- package/node_modules/@nodelib/fs.scandir/out/settings.d.ts +20 -0
- package/node_modules/@nodelib/fs.scandir/out/settings.js +24 -0
- package/node_modules/@nodelib/fs.scandir/out/types/index.d.ts +20 -0
- package/node_modules/@nodelib/fs.scandir/out/types/index.js +2 -0
- package/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts +2 -0
- package/node_modules/@nodelib/fs.scandir/out/utils/fs.js +19 -0
- package/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts +2 -0
- package/node_modules/@nodelib/fs.scandir/out/utils/index.js +5 -0
- package/node_modules/@nodelib/fs.scandir/package.json +44 -0
- package/node_modules/@nodelib/fs.stat/LICENSE +21 -0
- package/node_modules/@nodelib/fs.stat/README.md +126 -0
- package/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts +13 -0
- package/node_modules/@nodelib/fs.stat/out/adapters/fs.js +17 -0
- package/node_modules/@nodelib/fs.stat/out/index.d.ts +12 -0
- package/node_modules/@nodelib/fs.stat/out/index.js +26 -0
- package/node_modules/@nodelib/fs.stat/out/providers/async.d.ts +4 -0
- package/node_modules/@nodelib/fs.stat/out/providers/async.js +36 -0
- package/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts +3 -0
- package/node_modules/@nodelib/fs.stat/out/providers/sync.js +23 -0
- package/node_modules/@nodelib/fs.stat/out/settings.d.ts +16 -0
- package/node_modules/@nodelib/fs.stat/out/settings.js +16 -0
- package/node_modules/@nodelib/fs.stat/out/types/index.d.ts +4 -0
- package/node_modules/@nodelib/fs.stat/out/types/index.js +2 -0
- package/node_modules/@nodelib/fs.stat/package.json +37 -0
- package/node_modules/@nodelib/fs.walk/LICENSE +21 -0
- package/node_modules/@nodelib/fs.walk/README.md +215 -0
- package/node_modules/@nodelib/fs.walk/out/index.d.ts +14 -0
- package/node_modules/@nodelib/fs.walk/out/index.js +34 -0
- package/node_modules/@nodelib/fs.walk/out/providers/async.d.ts +12 -0
- package/node_modules/@nodelib/fs.walk/out/providers/async.js +30 -0
- package/node_modules/@nodelib/fs.walk/out/providers/index.d.ts +4 -0
- package/node_modules/@nodelib/fs.walk/out/providers/index.js +9 -0
- package/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts +12 -0
- package/node_modules/@nodelib/fs.walk/out/providers/stream.js +34 -0
- package/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts +10 -0
- package/node_modules/@nodelib/fs.walk/out/providers/sync.js +14 -0
- package/node_modules/@nodelib/fs.walk/out/readers/async.d.ts +30 -0
- package/node_modules/@nodelib/fs.walk/out/readers/async.js +97 -0
- package/node_modules/@nodelib/fs.walk/out/readers/common.d.ts +7 -0
- package/node_modules/@nodelib/fs.walk/out/readers/common.js +31 -0
- package/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts +6 -0
- package/node_modules/@nodelib/fs.walk/out/readers/reader.js +11 -0
- package/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts +15 -0
- package/node_modules/@nodelib/fs.walk/out/readers/sync.js +59 -0
- package/node_modules/@nodelib/fs.walk/out/settings.d.ts +30 -0
- package/node_modules/@nodelib/fs.walk/out/settings.js +26 -0
- package/node_modules/@nodelib/fs.walk/out/types/index.d.ts +8 -0
- package/node_modules/@nodelib/fs.walk/out/types/index.js +2 -0
- package/node_modules/@nodelib/fs.walk/package.json +44 -0
- package/node_modules/braces/LICENSE +21 -0
- package/node_modules/braces/README.md +586 -0
- package/node_modules/braces/index.js +170 -0
- package/node_modules/braces/lib/compile.js +60 -0
- package/node_modules/braces/lib/constants.js +57 -0
- package/node_modules/braces/lib/expand.js +113 -0
- package/node_modules/braces/lib/parse.js +331 -0
- package/node_modules/braces/lib/stringify.js +32 -0
- package/node_modules/braces/lib/utils.js +122 -0
- package/node_modules/braces/package.json +77 -0
- package/node_modules/end-of-stream/LICENSE +21 -0
- package/node_modules/end-of-stream/README.md +54 -0
- package/node_modules/end-of-stream/index.js +94 -0
- package/node_modules/end-of-stream/package.json +37 -0
- package/node_modules/execa/index.js +361 -0
- package/node_modules/execa/lib/errname.js +39 -0
- package/node_modules/execa/lib/stdio.js +41 -0
- package/node_modules/execa/license +9 -0
- package/node_modules/execa/node_modules/cross-spawn/LICENSE +21 -0
- package/node_modules/execa/node_modules/cross-spawn/README.md +94 -0
- package/node_modules/execa/node_modules/cross-spawn/index.js +39 -0
- package/node_modules/execa/node_modules/cross-spawn/lib/enoent.js +59 -0
- package/node_modules/execa/node_modules/cross-spawn/lib/parse.js +125 -0
- package/node_modules/execa/node_modules/cross-spawn/lib/util/escape.js +47 -0
- package/node_modules/execa/node_modules/cross-spawn/lib/util/readShebang.js +32 -0
- package/node_modules/execa/node_modules/cross-spawn/lib/util/resolveCommand.js +51 -0
- package/node_modules/execa/node_modules/cross-spawn/package.json +75 -0
- package/node_modules/execa/node_modules/semver/README.md +412 -0
- package/node_modules/execa/node_modules/semver/bin/semver +160 -0
- package/node_modules/execa/node_modules/semver/package.json +38 -0
- package/node_modules/execa/node_modules/semver/range.bnf +16 -0
- package/node_modules/execa/node_modules/semver/semver.js +1525 -0
- package/node_modules/execa/node_modules/shebang-command/index.js +19 -0
- package/node_modules/execa/node_modules/shebang-command/license +21 -0
- package/node_modules/execa/node_modules/shebang-command/package.json +39 -0
- package/node_modules/execa/node_modules/shebang-command/readme.md +39 -0
- package/node_modules/execa/node_modules/shebang-regex/index.js +2 -0
- package/node_modules/execa/node_modules/shebang-regex/package.json +32 -0
- package/node_modules/execa/node_modules/shebang-regex/readme.md +29 -0
- package/node_modules/{shelljs/node_modules/glob → execa/node_modules/which}/LICENSE +0 -6
- package/node_modules/execa/node_modules/which/README.md +51 -0
- package/node_modules/execa/node_modules/which/bin/which +52 -0
- package/node_modules/execa/node_modules/which/package.json +30 -0
- package/node_modules/execa/node_modules/which/which.js +135 -0
- package/node_modules/execa/package.json +69 -0
- package/node_modules/execa/readme.md +327 -0
- package/node_modules/fast-glob/LICENSE +21 -0
- package/node_modules/fast-glob/README.md +830 -0
- package/node_modules/fast-glob/node_modules/glob-parent/LICENSE +15 -0
- package/node_modules/fast-glob/node_modules/glob-parent/README.md +137 -0
- package/node_modules/fast-glob/node_modules/glob-parent/index.js +42 -0
- package/node_modules/fast-glob/node_modules/glob-parent/package.json +48 -0
- package/node_modules/fast-glob/out/index.d.ts +40 -0
- package/node_modules/fast-glob/out/index.js +102 -0
- package/node_modules/fast-glob/out/managers/tasks.d.ts +22 -0
- package/node_modules/fast-glob/out/managers/tasks.js +110 -0
- package/node_modules/fast-glob/out/providers/async.d.ts +9 -0
- package/node_modules/fast-glob/out/providers/async.js +23 -0
- package/node_modules/fast-glob/out/providers/filters/deep.d.ts +16 -0
- package/node_modules/fast-glob/out/providers/filters/deep.js +62 -0
- package/node_modules/fast-glob/out/providers/filters/entry.d.ts +17 -0
- package/node_modules/fast-glob/out/providers/filters/entry.js +85 -0
- package/node_modules/fast-glob/out/providers/filters/error.d.ts +8 -0
- package/node_modules/fast-glob/out/providers/filters/error.js +15 -0
- package/node_modules/fast-glob/out/providers/matchers/matcher.d.ts +33 -0
- package/node_modules/fast-glob/out/providers/matchers/matcher.js +45 -0
- package/node_modules/fast-glob/out/providers/matchers/partial.d.ts +4 -0
- package/node_modules/fast-glob/out/providers/matchers/partial.js +38 -0
- package/node_modules/fast-glob/out/providers/provider.d.ts +19 -0
- package/node_modules/fast-glob/out/providers/provider.js +48 -0
- package/node_modules/fast-glob/out/providers/stream.d.ts +11 -0
- package/node_modules/fast-glob/out/providers/stream.js +31 -0
- package/node_modules/fast-glob/out/providers/sync.d.ts +9 -0
- package/node_modules/fast-glob/out/providers/sync.js +23 -0
- package/node_modules/fast-glob/out/providers/transformers/entry.d.ts +8 -0
- package/node_modules/fast-glob/out/providers/transformers/entry.js +26 -0
- package/node_modules/fast-glob/out/readers/async.d.ts +10 -0
- package/node_modules/fast-glob/out/readers/async.js +35 -0
- package/node_modules/fast-glob/out/readers/reader.d.ts +15 -0
- package/node_modules/fast-glob/out/readers/reader.js +33 -0
- package/node_modules/fast-glob/out/readers/stream.d.ts +14 -0
- package/node_modules/fast-glob/out/readers/stream.js +55 -0
- package/node_modules/fast-glob/out/readers/sync.d.ts +12 -0
- package/node_modules/fast-glob/out/readers/sync.js +43 -0
- package/node_modules/fast-glob/out/settings.d.ts +164 -0
- package/node_modules/fast-glob/out/settings.js +59 -0
- package/node_modules/fast-glob/out/types/index.d.ts +31 -0
- package/node_modules/fast-glob/out/types/index.js +2 -0
- package/node_modules/fast-glob/out/utils/array.d.ts +2 -0
- package/node_modules/fast-glob/out/utils/array.js +22 -0
- package/node_modules/fast-glob/out/utils/errno.d.ts +2 -0
- package/node_modules/fast-glob/out/utils/errno.js +7 -0
- package/node_modules/fast-glob/out/utils/fs.d.ts +4 -0
- package/node_modules/fast-glob/out/utils/fs.js +19 -0
- package/node_modules/fast-glob/out/utils/index.d.ts +8 -0
- package/node_modules/fast-glob/out/utils/index.js +17 -0
- package/node_modules/fast-glob/out/utils/path.d.ts +13 -0
- package/node_modules/fast-glob/out/utils/path.js +68 -0
- package/node_modules/fast-glob/out/utils/pattern.d.ts +49 -0
- package/node_modules/fast-glob/out/utils/pattern.js +206 -0
- package/node_modules/fast-glob/out/utils/stream.d.ts +4 -0
- package/node_modules/fast-glob/out/utils/stream.js +17 -0
- package/node_modules/fast-glob/out/utils/string.d.ts +2 -0
- package/node_modules/fast-glob/out/utils/string.js +11 -0
- package/node_modules/fast-glob/package.json +81 -0
- package/node_modules/fastq/.github/dependabot.yml +11 -0
- package/node_modules/fastq/.github/workflows/ci.yml +75 -0
- package/node_modules/fastq/LICENSE +13 -0
- package/node_modules/fastq/README.md +312 -0
- package/node_modules/fastq/SECURITY.md +15 -0
- package/node_modules/fastq/bench.js +66 -0
- package/node_modules/fastq/example.js +14 -0
- package/node_modules/fastq/example.mjs +11 -0
- package/node_modules/fastq/index.d.ts +57 -0
- package/node_modules/fastq/package.json +53 -0
- package/node_modules/fastq/queue.js +311 -0
- package/node_modules/fastq/test/example.ts +83 -0
- package/node_modules/fastq/test/promise.js +291 -0
- package/node_modules/fastq/test/test.js +653 -0
- package/node_modules/fastq/test/tsconfig.json +11 -0
- package/node_modules/fill-range/LICENSE +21 -0
- package/node_modules/fill-range/README.md +237 -0
- package/node_modules/fill-range/index.js +248 -0
- package/node_modules/fill-range/package.json +74 -0
- package/node_modules/get-stream/buffer-stream.js +51 -0
- package/node_modules/get-stream/index.js +50 -0
- package/node_modules/get-stream/license +9 -0
- package/node_modules/get-stream/package.json +46 -0
- package/node_modules/get-stream/readme.md +123 -0
- package/node_modules/is-extglob/LICENSE +21 -0
- package/node_modules/is-extglob/README.md +107 -0
- package/node_modules/is-extglob/index.js +20 -0
- package/node_modules/is-extglob/package.json +69 -0
- package/node_modules/is-glob/LICENSE +21 -0
- package/node_modules/is-glob/README.md +206 -0
- package/node_modules/is-glob/index.js +150 -0
- package/node_modules/is-glob/package.json +81 -0
- package/node_modules/is-number/LICENSE +21 -0
- package/node_modules/is-number/README.md +187 -0
- package/node_modules/is-number/index.js +18 -0
- package/node_modules/is-number/package.json +82 -0
- package/node_modules/is-stream/index.js +21 -0
- package/node_modules/is-stream/license +21 -0
- package/node_modules/is-stream/package.json +38 -0
- package/node_modules/is-stream/readme.md +42 -0
- package/node_modules/isexe/.npmignore +2 -0
- package/node_modules/isexe/LICENSE +15 -0
- package/node_modules/isexe/README.md +51 -0
- package/node_modules/isexe/index.js +57 -0
- package/node_modules/isexe/mode.js +41 -0
- package/node_modules/isexe/package.json +31 -0
- package/node_modules/isexe/test/basic.js +221 -0
- package/node_modules/isexe/windows.js +42 -0
- package/node_modules/merge2/LICENSE +21 -0
- package/node_modules/merge2/README.md +144 -0
- package/node_modules/merge2/index.js +144 -0
- package/node_modules/merge2/package.json +43 -0
- package/node_modules/micromatch/LICENSE +21 -0
- package/node_modules/micromatch/README.md +1024 -0
- package/node_modules/micromatch/index.js +474 -0
- package/node_modules/micromatch/package.json +119 -0
- package/node_modules/nice-try/LICENSE +21 -0
- package/node_modules/nice-try/README.md +32 -0
- package/node_modules/nice-try/package.json +33 -0
- package/node_modules/nice-try/src/index.js +12 -0
- package/node_modules/npm-run-path/index.js +39 -0
- package/node_modules/npm-run-path/license +21 -0
- package/node_modules/npm-run-path/package.json +45 -0
- package/node_modules/npm-run-path/readme.md +81 -0
- package/node_modules/p-finally/index.js +15 -0
- package/node_modules/p-finally/license +21 -0
- package/node_modules/p-finally/package.json +42 -0
- package/node_modules/p-finally/readme.md +47 -0
- package/node_modules/path-key/index.js +13 -0
- package/node_modules/path-key/license +21 -0
- package/node_modules/path-key/package.json +39 -0
- package/node_modules/path-key/readme.md +51 -0
- package/node_modules/picomatch/LICENSE +21 -0
- package/node_modules/picomatch/README.md +708 -0
- package/node_modules/picomatch/index.js +3 -0
- package/node_modules/picomatch/lib/constants.js +179 -0
- package/node_modules/picomatch/lib/parse.js +1091 -0
- package/node_modules/picomatch/lib/picomatch.js +342 -0
- package/node_modules/picomatch/lib/scan.js +391 -0
- package/node_modules/picomatch/lib/utils.js +64 -0
- package/node_modules/picomatch/package.json +81 -0
- package/node_modules/pump/.github/FUNDING.yml +2 -0
- package/node_modules/pump/.travis.yml +5 -0
- package/node_modules/pump/LICENSE +21 -0
- package/node_modules/pump/README.md +74 -0
- package/node_modules/pump/SECURITY.md +5 -0
- package/node_modules/pump/index.js +86 -0
- package/node_modules/pump/package.json +24 -0
- package/node_modules/pump/test-browser.js +66 -0
- package/node_modules/pump/test-node.js +53 -0
- package/node_modules/{concat-map → queue-microtask}/LICENSE +3 -1
- package/node_modules/queue-microtask/README.md +90 -0
- package/node_modules/queue-microtask/index.d.ts +2 -0
- package/node_modules/queue-microtask/index.js +9 -0
- package/node_modules/queue-microtask/package.json +55 -0
- package/node_modules/reusify/.github/dependabot.yml +7 -0
- package/node_modules/reusify/.github/workflows/ci.yml +96 -0
- package/node_modules/reusify/LICENSE +22 -0
- package/node_modules/reusify/README.md +139 -0
- package/node_modules/reusify/SECURITY.md +15 -0
- package/node_modules/reusify/benchmarks/createNoCodeFunction.js +30 -0
- package/node_modules/reusify/benchmarks/fib.js +13 -0
- package/node_modules/reusify/benchmarks/reuseNoCodeFunction.js +38 -0
- package/node_modules/reusify/eslint.config.js +14 -0
- package/node_modules/reusify/package.json +50 -0
- package/node_modules/reusify/reusify.d.ts +14 -0
- package/node_modules/reusify/reusify.js +33 -0
- package/node_modules/reusify/test.js +66 -0
- package/node_modules/reusify/tsconfig.json +11 -0
- package/node_modules/run-parallel/LICENSE +20 -0
- package/node_modules/run-parallel/README.md +85 -0
- package/node_modules/run-parallel/index.js +51 -0
- package/node_modules/run-parallel/package.json +58 -0
- package/node_modules/shelljs/LICENSE +23 -20
- package/node_modules/shelljs/README.md +173 -65
- package/node_modules/shelljs/package.json +38 -22
- package/node_modules/shelljs/plugin.js +1 -1
- package/node_modules/shelljs/shell.js +70 -12
- package/node_modules/shelljs/src/cat.js +3 -3
- package/node_modules/shelljs/src/cd.js +2 -1
- package/node_modules/shelljs/src/chmod.js +17 -11
- package/node_modules/shelljs/src/cmd.js +122 -0
- package/node_modules/shelljs/src/common.js +103 -29
- package/node_modules/shelljs/src/cp.js +24 -14
- package/node_modules/shelljs/src/dirs.js +7 -9
- package/node_modules/shelljs/src/echo.js +1 -2
- package/node_modules/shelljs/src/errorCode.js +10 -0
- package/node_modules/shelljs/src/exec-child.js +60 -28
- package/node_modules/shelljs/src/exec.js +39 -10
- package/node_modules/shelljs/src/find.js +8 -3
- package/node_modules/shelljs/src/grep.js +15 -4
- package/node_modules/shelljs/src/head.js +1 -1
- package/node_modules/shelljs/src/ln.js +3 -1
- package/node_modules/shelljs/src/ls.js +29 -15
- package/node_modules/shelljs/src/mkdir.js +13 -11
- package/node_modules/shelljs/src/mv.js +4 -3
- package/node_modules/shelljs/src/pwd.js +1 -1
- package/node_modules/shelljs/src/rm.js +11 -11
- package/node_modules/shelljs/src/sed.js +12 -4
- package/node_modules/shelljs/src/set.js +0 -1
- package/node_modules/shelljs/src/sort.js +3 -2
- package/node_modules/shelljs/src/tail.js +12 -2
- package/node_modules/shelljs/src/test.js +3 -2
- package/node_modules/shelljs/src/to.js +2 -1
- package/node_modules/shelljs/src/toEnd.js +2 -1
- package/node_modules/shelljs/src/touch.js +13 -7
- package/node_modules/shelljs/src/uniq.js +5 -4
- package/node_modules/shelljs/src/which.js +5 -4
- package/node_modules/shx/README.md +27 -15
- package/node_modules/shx/lib/help.js +1 -1
- package/node_modules/shx/lib/shx.js +13 -8
- package/node_modules/shx/package.json +17 -25
- package/node_modules/signal-exit/LICENSE.txt +16 -0
- package/node_modules/signal-exit/README.md +39 -0
- package/node_modules/signal-exit/index.js +202 -0
- package/node_modules/signal-exit/package.json +38 -0
- package/node_modules/signal-exit/signals.js +53 -0
- package/node_modules/strip-eof/index.js +15 -0
- package/node_modules/strip-eof/license +21 -0
- package/node_modules/strip-eof/package.json +39 -0
- package/node_modules/strip-eof/readme.md +28 -0
- package/node_modules/to-regex-range/LICENSE +21 -0
- package/node_modules/to-regex-range/README.md +305 -0
- package/node_modules/to-regex-range/index.js +288 -0
- package/node_modules/to-regex-range/package.json +88 -0
- package/package.json +2 -2
- package/node_modules/concat-map/.travis.yml +0 -4
- package/node_modules/concat-map/README.markdown +0 -62
- package/node_modules/concat-map/example/map.js +0 -6
- package/node_modules/concat-map/index.js +0 -13
- package/node_modules/concat-map/package.json +0 -43
- package/node_modules/concat-map/test/map.js +0 -39
- package/node_modules/minimatch/README.md +0 -230
- package/node_modules/minimatch/minimatch.js +0 -947
- package/node_modules/minimatch/node_modules/brace-expansion/README.md +0 -129
- package/node_modules/minimatch/node_modules/brace-expansion/index.js +0 -201
- package/node_modules/minimatch/node_modules/brace-expansion/package.json +0 -47
- package/node_modules/minimatch/package.json +0 -33
- package/node_modules/path-is-absolute/index.js +0 -20
- package/node_modules/path-is-absolute/package.json +0 -43
- package/node_modules/path-is-absolute/readme.md +0 -59
- package/node_modules/shelljs/commands.js +0 -29
- package/node_modules/shelljs/node_modules/glob/README.md +0 -378
- package/node_modules/shelljs/node_modules/glob/common.js +0 -238
- package/node_modules/shelljs/node_modules/glob/glob.js +0 -790
- package/node_modules/shelljs/node_modules/glob/package.json +0 -55
- package/node_modules/shelljs/node_modules/glob/sync.js +0 -486
- /package/node_modules/{minimatch → execa/node_modules/semver}/LICENSE +0 -0
- /package/node_modules/{path-is-absolute → execa/node_modules/shebang-regex}/license +0 -0
|
@@ -11,7 +11,7 @@ var common = require('./src/common');
|
|
|
11
11
|
//@
|
|
12
12
|
//@ All commands run synchronously, unless otherwise stated.
|
|
13
13
|
//@ All commands accept standard bash globbing characters (`*`, `?`, etc.),
|
|
14
|
-
//@ compatible with
|
|
14
|
+
//@ compatible with [`fast-glob`](https://www.npmjs.com/package/fast-glob).
|
|
15
15
|
//@
|
|
16
16
|
//@ For less-commonly used commands and features, please check out our [wiki
|
|
17
17
|
//@ page](https://github.com/shelljs/shelljs/wiki).
|
|
@@ -20,21 +20,68 @@ var common = require('./src/common');
|
|
|
20
20
|
// Include the docs for all the default commands
|
|
21
21
|
//@commands
|
|
22
22
|
|
|
23
|
-
// Load all default commands
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
// Load all default commands. We import these for their side effect of loading
|
|
24
|
+
// using the plugin architecture via `common.register()`.
|
|
25
|
+
require('./src/cat');
|
|
26
|
+
require('./src/cd');
|
|
27
|
+
require('./src/chmod');
|
|
28
|
+
require('./src/cmd');
|
|
29
|
+
require('./src/cp');
|
|
30
|
+
require('./src/dirs');
|
|
31
|
+
require('./src/echo');
|
|
32
|
+
require('./src/exec');
|
|
33
|
+
require('./src/exec-child'); // A hint to the bundler to keep exec-child.js
|
|
34
|
+
require('./src/find');
|
|
35
|
+
require('./src/grep');
|
|
36
|
+
require('./src/head');
|
|
37
|
+
require('./src/ln');
|
|
38
|
+
require('./src/ls');
|
|
39
|
+
require('./src/mkdir');
|
|
40
|
+
require('./src/mv');
|
|
41
|
+
require('./src/popd');
|
|
42
|
+
require('./src/pushd');
|
|
43
|
+
require('./src/pwd');
|
|
44
|
+
require('./src/rm');
|
|
45
|
+
require('./src/sed');
|
|
46
|
+
require('./src/set');
|
|
47
|
+
require('./src/sort');
|
|
48
|
+
require('./src/tail');
|
|
49
|
+
require('./src/tempdir');
|
|
50
|
+
require('./src/test');
|
|
51
|
+
require('./src/to');
|
|
52
|
+
require('./src/toEnd');
|
|
53
|
+
require('./src/touch');
|
|
54
|
+
require('./src/uniq');
|
|
55
|
+
require('./src/which');
|
|
27
56
|
|
|
28
57
|
//@
|
|
29
58
|
//@ ### exit(code)
|
|
30
59
|
//@
|
|
31
60
|
//@ Exits the current process with the given exit `code`.
|
|
32
|
-
exports.exit =
|
|
33
|
-
|
|
34
|
-
|
|
61
|
+
exports.exit = function exit(code) {
|
|
62
|
+
common.state.error = null;
|
|
63
|
+
common.state.errorCode = 0;
|
|
64
|
+
if (code) {
|
|
65
|
+
common.error('exit', {
|
|
66
|
+
continue: true,
|
|
67
|
+
code: code,
|
|
68
|
+
prefix: '',
|
|
69
|
+
silent: true,
|
|
70
|
+
fatal: false,
|
|
71
|
+
});
|
|
72
|
+
process.exit(code);
|
|
73
|
+
} else {
|
|
74
|
+
process.exit();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//@include ./src/error.js
|
|
35
79
|
exports.error = require('./src/error');
|
|
36
80
|
|
|
37
|
-
//@include ./src/
|
|
81
|
+
//@include ./src/errorCode.js
|
|
82
|
+
exports.errorCode = require('./src/errorCode');
|
|
83
|
+
|
|
84
|
+
//@include ./src/common.js
|
|
38
85
|
exports.ShellString = common.ShellString;
|
|
39
86
|
|
|
40
87
|
//@
|
|
@@ -51,7 +98,7 @@ exports.env = process.env;
|
|
|
51
98
|
//@
|
|
52
99
|
//@ ```javascript
|
|
53
100
|
//@ grep('foo', 'file1.txt', 'file2.txt').sed(/o/g, 'a').to('output.txt');
|
|
54
|
-
//@ echo(
|
|
101
|
+
//@ echo("files with o's in the name:\n" + ls().grep('o'));
|
|
55
102
|
//@ cat('test.js').exec('node'); // pipe to exec() call
|
|
56
103
|
//@ ```
|
|
57
104
|
//@
|
|
@@ -118,7 +165,14 @@ exports.config = common.config;
|
|
|
118
165
|
//@ ```
|
|
119
166
|
|
|
120
167
|
//@
|
|
121
|
-
//@ ### config.globOptions
|
|
168
|
+
//@ ### config.globOptions (deprecated)
|
|
169
|
+
//@
|
|
170
|
+
//@ **Deprecated**: we recommend that you do not edit `config.globOptions`.
|
|
171
|
+
//@ Support for this configuration option may be changed or removed in a future
|
|
172
|
+
//@ ShellJS release.
|
|
173
|
+
//@
|
|
174
|
+
//@ **Breaking change**: ShellJS v0.8.x uses `node-glob`. Starting with ShellJS
|
|
175
|
+
//@ v0.9.x, `config.globOptions` is compatible with `fast-glob`.
|
|
122
176
|
//@
|
|
123
177
|
//@ Example:
|
|
124
178
|
//@
|
|
@@ -126,7 +180,11 @@ exports.config = common.config;
|
|
|
126
180
|
//@ config.globOptions = {nodir: true};
|
|
127
181
|
//@ ```
|
|
128
182
|
//@
|
|
129
|
-
//@
|
|
183
|
+
//@ `config.globOptions` changes how ShellJS expands glob (wildcard)
|
|
184
|
+
//@ expressions. See
|
|
185
|
+
//@ [fast-glob](https://github.com/mrmlnc/fast-glob?tab=readme-ov-file#options-3)
|
|
186
|
+
//@ for available options. Be aware that modifying `config.globOptions` **may
|
|
187
|
+
//@ break ShellJS functionality.**
|
|
130
188
|
|
|
131
189
|
//@
|
|
132
190
|
//@ ### config.reset()
|
|
@@ -24,9 +24,9 @@ common.register('cat', _cat, {
|
|
|
24
24
|
//@ var str = cat(['file1', 'file2']); // same as above
|
|
25
25
|
//@ ```
|
|
26
26
|
//@
|
|
27
|
-
//@ Returns a
|
|
28
|
-
//@ containing the files if more than one file is given (a
|
|
29
|
-
//@ introduced between each file).
|
|
27
|
+
//@ Returns a [ShellString](#shellstringstr) containing the given file, or a
|
|
28
|
+
//@ concatenated string containing the files if more than one file is given (a
|
|
29
|
+
//@ new line character is introduced between each file).
|
|
30
30
|
function _cat(options, files) {
|
|
31
31
|
var cat = common.readFromPipe();
|
|
32
32
|
|
|
@@ -7,7 +7,8 @@ common.register('cd', _cd, {});
|
|
|
7
7
|
//@ ### cd([dir])
|
|
8
8
|
//@
|
|
9
9
|
//@ Changes to directory `dir` for the duration of the script. Changes to home
|
|
10
|
-
//@ directory if no argument is supplied.
|
|
10
|
+
//@ directory if no argument is supplied. Returns a
|
|
11
|
+
//@ [ShellString](#shellstringstr) to indicate success or failure.
|
|
11
12
|
function _cd(options, dir) {
|
|
12
13
|
if (!dir) dir = os.homedir();
|
|
13
14
|
|
|
@@ -59,6 +59,12 @@ common.register('chmod', _chmod, {
|
|
|
59
59
|
//@ + In symbolic modes, `a-r` and `-r` are identical. No consideration is
|
|
60
60
|
//@ given to the `umask`.
|
|
61
61
|
//@ + There is no "quiet" option, since default behavior is to run silent.
|
|
62
|
+
//@ + Windows OS uses a very different permission model than POSIX. `chmod()`
|
|
63
|
+
//@ does its best on Windows, but there are limits to how file permissions can
|
|
64
|
+
//@ be set. Note that WSL (Windows subsystem for Linux) **does** follow POSIX,
|
|
65
|
+
//@ so cross-platform compatibility should not be a concern there.
|
|
66
|
+
//@
|
|
67
|
+
//@ Returns a [ShellString](#shellstringstr) indicating success or failure.
|
|
62
68
|
function _chmod(options, mode, filePattern) {
|
|
63
69
|
if (!filePattern) {
|
|
64
70
|
if (options.length > 0 && options.charAt(0) === '-') {
|
|
@@ -119,10 +125,10 @@ function _chmod(options, mode, filePattern) {
|
|
|
119
125
|
|
|
120
126
|
var newPerms = perms;
|
|
121
127
|
|
|
122
|
-
if (isNaN(parseInt(mode, 8))) {
|
|
128
|
+
if (Number.isNaN(parseInt(mode, 8))) {
|
|
123
129
|
// parse options
|
|
124
130
|
mode.split(',').forEach(function (symbolicMode) {
|
|
125
|
-
var pattern = /([ugoa]*)([
|
|
131
|
+
var pattern = /([ugoa]*)([=+-])([rwxXst]*)/i;
|
|
126
132
|
var matches = pattern.exec(symbolicMode);
|
|
127
133
|
|
|
128
134
|
if (matches) {
|
|
@@ -130,16 +136,16 @@ function _chmod(options, mode, filePattern) {
|
|
|
130
136
|
var operator = matches[2];
|
|
131
137
|
var change = matches[3];
|
|
132
138
|
|
|
133
|
-
var changeOwner = applyTo.
|
|
134
|
-
var changeGroup = applyTo.
|
|
135
|
-
var changeOther = applyTo.
|
|
139
|
+
var changeOwner = applyTo.includes('u') || applyTo === 'a' || applyTo === '';
|
|
140
|
+
var changeGroup = applyTo.includes('g') || applyTo === 'a' || applyTo === '';
|
|
141
|
+
var changeOther = applyTo.includes('o') || applyTo === 'a' || applyTo === '';
|
|
136
142
|
|
|
137
|
-
var changeRead = change.
|
|
138
|
-
var changeWrite = change.
|
|
139
|
-
var changeExec = change.
|
|
140
|
-
var changeExecDir = change.
|
|
141
|
-
var changeSticky = change.
|
|
142
|
-
var changeSetuid = change.
|
|
143
|
+
var changeRead = change.includes('r');
|
|
144
|
+
var changeWrite = change.includes('w');
|
|
145
|
+
var changeExec = change.includes('x');
|
|
146
|
+
var changeExecDir = change.includes('X');
|
|
147
|
+
var changeSticky = change.includes('t');
|
|
148
|
+
var changeSetuid = change.includes('s');
|
|
143
149
|
|
|
144
150
|
if (changeExecDir && isDir) {
|
|
145
151
|
changeExec = true;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
var common = require('./common');
|
|
2
|
+
var execa = require('execa');
|
|
3
|
+
|
|
4
|
+
var DEFAULT_MAXBUFFER_SIZE = 20 * 1024 * 1024;
|
|
5
|
+
var COMMAND_NOT_FOUND_ERROR_CODE = 127;
|
|
6
|
+
|
|
7
|
+
common.register('cmd', _cmd, {
|
|
8
|
+
cmdOptions: null,
|
|
9
|
+
globStart: 1,
|
|
10
|
+
canReceivePipe: true,
|
|
11
|
+
wrapOutput: true,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
function commandNotFound(execaResult) {
|
|
15
|
+
if (process.platform === 'win32') {
|
|
16
|
+
var str = 'is not recognized as an internal or external command';
|
|
17
|
+
return execaResult.code && execaResult.stderr.includes(str);
|
|
18
|
+
} else {
|
|
19
|
+
return execaResult.code &&
|
|
20
|
+
execaResult.stdout === null && execaResult.stderr === null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//@
|
|
25
|
+
//@ ### cmd(arg1[, arg2, ...] [, options])
|
|
26
|
+
//@
|
|
27
|
+
//@ Available options:
|
|
28
|
+
//@
|
|
29
|
+
//@ + `cwd: directoryPath`: change the current working directory only for this
|
|
30
|
+
//@ cmd() invocation.
|
|
31
|
+
//@ + `maxBuffer: num`: Raise or decrease the default buffer size for
|
|
32
|
+
//@ stdout/stderr.
|
|
33
|
+
//@ + `timeout`: Change the default timeout.
|
|
34
|
+
//@
|
|
35
|
+
//@ Examples:
|
|
36
|
+
//@
|
|
37
|
+
//@ ```javascript
|
|
38
|
+
//@ var version = cmd('node', '--version').stdout;
|
|
39
|
+
//@ cmd('git', 'commit', '-am', `Add suport for node ${version}`);
|
|
40
|
+
//@ console.log(cmd('echo', '1st arg', '2nd arg', '3rd arg').stdout)
|
|
41
|
+
//@ console.log(cmd('echo', 'this handles ;, |, &, etc. as literal characters').stdout)
|
|
42
|
+
//@ ```
|
|
43
|
+
//@
|
|
44
|
+
//@ Executes the given command synchronously. This is intended as an easier
|
|
45
|
+
//@ alternative for [exec()](#execcommand--options--callback), with better
|
|
46
|
+
//@ security around globbing, comamnd injection, and variable expansion. This is
|
|
47
|
+
//@ guaranteed to only run one external command, and won't give special
|
|
48
|
+
//@ treatment for any shell characters (ex. this treats `|` as a literal
|
|
49
|
+
//@ character, not as a shell pipeline).
|
|
50
|
+
//@ This returns a [ShellString](#shellstringstr).
|
|
51
|
+
//@
|
|
52
|
+
//@ By default, this performs globbing on all platforms, but you can disable
|
|
53
|
+
//@ this with `set('-f')`.
|
|
54
|
+
//@
|
|
55
|
+
//@ This **does not** support asynchronous mode. If you need asynchronous
|
|
56
|
+
//@ command execution, check out [execa](https://www.npmjs.com/package/execa) or
|
|
57
|
+
//@ the node builtin `child_process.execFile()` instead.
|
|
58
|
+
function _cmd(options, command, commandArgs, userOptions) {
|
|
59
|
+
if (!command) {
|
|
60
|
+
common.error('Must specify a non-empty string as a command');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// `options` will usually not have a value: it's added by our commandline flag
|
|
64
|
+
// parsing engine.
|
|
65
|
+
commandArgs = [].slice.call(arguments, 2);
|
|
66
|
+
|
|
67
|
+
// `userOptions` may or may not be provided. We need to check the last
|
|
68
|
+
// argument. If it's an object, assume it's meant to be passed as
|
|
69
|
+
// userOptions (since ShellStrings are already flattened to strings).
|
|
70
|
+
if (commandArgs.length === 0) {
|
|
71
|
+
userOptions = {};
|
|
72
|
+
} else {
|
|
73
|
+
var lastArg = commandArgs.pop();
|
|
74
|
+
if (common.isObject(lastArg)) {
|
|
75
|
+
userOptions = lastArg;
|
|
76
|
+
} else {
|
|
77
|
+
userOptions = {};
|
|
78
|
+
commandArgs.push(lastArg);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
var pipe = common.readFromPipe();
|
|
83
|
+
|
|
84
|
+
// Some of our defaults differ from execa's defaults. These can be overridden
|
|
85
|
+
// by the user.
|
|
86
|
+
var defaultOptions = {
|
|
87
|
+
maxBuffer: DEFAULT_MAXBUFFER_SIZE,
|
|
88
|
+
stripEof: false, // Preserve trailing newlines for consistency with unix.
|
|
89
|
+
reject: false, // Use ShellJS's error handling system.
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// For other options, we forbid the user from overriding them (either for
|
|
93
|
+
// correctness or security).
|
|
94
|
+
var requiredOptions = {
|
|
95
|
+
input: pipe,
|
|
96
|
+
shell: false,
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
var execaOptions =
|
|
100
|
+
Object.assign(defaultOptions, userOptions, requiredOptions);
|
|
101
|
+
|
|
102
|
+
var result = execa.sync(command, commandArgs, execaOptions);
|
|
103
|
+
var stdout;
|
|
104
|
+
var stderr;
|
|
105
|
+
var code;
|
|
106
|
+
if (commandNotFound(result)) {
|
|
107
|
+
// This can happen if `command` is not an executable binary, or possibly
|
|
108
|
+
// under other conditions.
|
|
109
|
+
stdout = '';
|
|
110
|
+
stderr = "'" + command + "': command not found";
|
|
111
|
+
code = COMMAND_NOT_FOUND_ERROR_CODE;
|
|
112
|
+
} else {
|
|
113
|
+
stdout = result.stdout.toString();
|
|
114
|
+
stderr = result.stderr.toString();
|
|
115
|
+
code = result.code;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Pass `continue: true` so we can specify a value for stdout.
|
|
119
|
+
if (code) common.error(stderr, code, { silent: true, continue: true });
|
|
120
|
+
return new common.ShellString(stdout, stderr, code);
|
|
121
|
+
}
|
|
122
|
+
module.exports = _cmd;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
// Ignore warning about 'new String()'
|
|
2
|
-
/* eslint no-new-wrappers:
|
|
1
|
+
// Ignore warning about 'new String()' and use of the Buffer constructor
|
|
2
|
+
/* eslint no-new-wrappers: "off",
|
|
3
|
+
no-buffer-constructor: "off" */
|
|
4
|
+
|
|
3
5
|
'use strict';
|
|
4
6
|
|
|
5
7
|
var os = require('os');
|
|
6
8
|
var fs = require('fs');
|
|
7
|
-
var glob = require('glob');
|
|
9
|
+
var glob = require('fast-glob');
|
|
8
10
|
var shell = require('..');
|
|
9
11
|
|
|
10
12
|
var shellMethods = Object.create(shell);
|
|
@@ -77,7 +79,16 @@ function convertErrorOutput(msg) {
|
|
|
77
79
|
}
|
|
78
80
|
exports.convertErrorOutput = convertErrorOutput;
|
|
79
81
|
|
|
80
|
-
//
|
|
82
|
+
// An exception class to help propagate command errors (e.g., non-zero exit
|
|
83
|
+
// status) up to the top-level. {@param value} should be a ShellString.
|
|
84
|
+
function CommandError(value) {
|
|
85
|
+
this.returnValue = value;
|
|
86
|
+
}
|
|
87
|
+
CommandError.prototype = Object.create(Error.prototype);
|
|
88
|
+
CommandError.prototype.constructor = CommandError;
|
|
89
|
+
exports.CommandError = CommandError; // visible for testing
|
|
90
|
+
|
|
91
|
+
// Shows error message. Throws if fatal is true (defaults to config.fatal, overridable with options.fatal)
|
|
81
92
|
function error(msg, _code, options) {
|
|
82
93
|
// Validate input
|
|
83
94
|
if (typeof msg !== 'string') throw new Error('msg must be a string');
|
|
@@ -87,6 +98,7 @@ function error(msg, _code, options) {
|
|
|
87
98
|
code: 1,
|
|
88
99
|
prefix: state.currentCmd + ': ',
|
|
89
100
|
silent: false,
|
|
101
|
+
fatal: config.fatal,
|
|
90
102
|
};
|
|
91
103
|
|
|
92
104
|
if (typeof _code === 'number' && isObject(options)) {
|
|
@@ -107,14 +119,15 @@ function error(msg, _code, options) {
|
|
|
107
119
|
state.error += logEntry;
|
|
108
120
|
|
|
109
121
|
// Throw an error, or log the entry
|
|
110
|
-
if (
|
|
122
|
+
if (options.fatal) {
|
|
123
|
+
var err = new Error(logEntry);
|
|
124
|
+
err.code = options.code;
|
|
125
|
+
throw err;
|
|
126
|
+
}
|
|
111
127
|
if (msg.length > 0 && !options.silent) log(logEntry);
|
|
112
128
|
|
|
113
129
|
if (!options.continue) {
|
|
114
|
-
throw
|
|
115
|
-
msg: 'earlyExit',
|
|
116
|
-
retValue: (new ShellString('', state.error, state.errorCode)),
|
|
117
|
-
};
|
|
130
|
+
throw new CommandError(new ShellString('', state.error, state.errorCode));
|
|
118
131
|
}
|
|
119
132
|
}
|
|
120
133
|
exports.error = error;
|
|
@@ -125,11 +138,19 @@ exports.error = error;
|
|
|
125
138
|
//@ Examples:
|
|
126
139
|
//@
|
|
127
140
|
//@ ```javascript
|
|
128
|
-
//@ var foo = ShellString('hello world');
|
|
141
|
+
//@ var foo = new ShellString('hello world');
|
|
129
142
|
//@ ```
|
|
130
143
|
//@
|
|
131
|
-
//@
|
|
132
|
-
//@
|
|
144
|
+
//@ This is a dedicated type returned by most ShellJS methods, which wraps a
|
|
145
|
+
//@ string (or array) value. This has all the string (or array) methods, but
|
|
146
|
+
//@ also exposes extra methods: [`.to()`](#shellstringprototypetofile),
|
|
147
|
+
//@ [`.toEnd()`](#shellstringprototypetoendfile), and all the pipe-able methods
|
|
148
|
+
//@ (ex. `.cat()`, `.grep()`, etc.). This can be easily converted into a string
|
|
149
|
+
//@ by calling `.toString()`.
|
|
150
|
+
//@
|
|
151
|
+
//@ This type also exposes the corresponding command's stdout, stderr, and
|
|
152
|
+
//@ return status code via the `.stdout` (string), `.stderr` (string), and
|
|
153
|
+
//@ `.code` (number) properties respectively.
|
|
133
154
|
function ShellString(stdout, stderr, code) {
|
|
134
155
|
var that;
|
|
135
156
|
if (stdout instanceof Array) {
|
|
@@ -159,13 +180,16 @@ exports.ShellString = ShellString;
|
|
|
159
180
|
// Throws an error when passed a string that does not start with '-':
|
|
160
181
|
// parseOptions('a', {'a':'alice'}); // throws
|
|
161
182
|
function parseOptions(opt, map, errorOptions) {
|
|
183
|
+
errorOptions = errorOptions || {};
|
|
162
184
|
// Validate input
|
|
163
185
|
if (typeof opt !== 'string' && !isObject(opt)) {
|
|
164
|
-
throw new
|
|
186
|
+
throw new TypeError('options must be strings or key-value pairs');
|
|
165
187
|
} else if (!isObject(map)) {
|
|
166
|
-
throw new
|
|
167
|
-
} else if (
|
|
168
|
-
throw new
|
|
188
|
+
throw new TypeError('parseOptions() internal error: map must be an object');
|
|
189
|
+
} else if (!isObject(errorOptions)) {
|
|
190
|
+
throw new TypeError(
|
|
191
|
+
'parseOptions() internal error: errorOptions must be object'
|
|
192
|
+
);
|
|
169
193
|
}
|
|
170
194
|
|
|
171
195
|
if (opt === '--') {
|
|
@@ -201,18 +225,25 @@ function parseOptions(opt, map, errorOptions) {
|
|
|
201
225
|
options[optionName] = true;
|
|
202
226
|
}
|
|
203
227
|
} else {
|
|
204
|
-
error('option not recognized: ' + c, errorOptions
|
|
228
|
+
error('option not recognized: ' + c, errorOptions);
|
|
205
229
|
}
|
|
206
230
|
});
|
|
207
231
|
} else { // opt is an Object
|
|
208
232
|
Object.keys(opt).forEach(function (key) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
233
|
+
if (key[0] === '-') {
|
|
234
|
+
// key is a string of the form '-r', '-d', etc.
|
|
235
|
+
var c = key[1];
|
|
236
|
+
if (c in map) {
|
|
237
|
+
var optionName = map[c];
|
|
238
|
+
options[optionName] = opt[key]; // assign the given value
|
|
239
|
+
} else {
|
|
240
|
+
error('option not recognized: ' + c, errorOptions);
|
|
241
|
+
}
|
|
242
|
+
} else if (key in options) {
|
|
243
|
+
// key is a "long option", so it should be the same
|
|
244
|
+
options[key] = opt[key];
|
|
214
245
|
} else {
|
|
215
|
-
error('option not recognized: ' +
|
|
246
|
+
error('option not recognized: {' + key + ':...}', errorOptions);
|
|
216
247
|
}
|
|
217
248
|
});
|
|
218
249
|
}
|
|
@@ -220,6 +251,42 @@ function parseOptions(opt, map, errorOptions) {
|
|
|
220
251
|
}
|
|
221
252
|
exports.parseOptions = parseOptions;
|
|
222
253
|
|
|
254
|
+
function globOptions() {
|
|
255
|
+
// These options are just to make fast-glob be compatible with POSIX (bash)
|
|
256
|
+
// wildcard behavior.
|
|
257
|
+
var defaultGlobOptions = {
|
|
258
|
+
onlyFiles: false,
|
|
259
|
+
followSymbolicLinks: false,
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
var newGlobOptions = Object.assign({}, config.globOptions);
|
|
263
|
+
var optionRenames = {
|
|
264
|
+
// node-glob's 'nodir' is not quote the same as fast-glob's 'onlyFiles'.
|
|
265
|
+
// Compatibility for this is implemented at the call site.
|
|
266
|
+
mark: 'markDirectories',
|
|
267
|
+
matchBase: 'baseNameMatch',
|
|
268
|
+
};
|
|
269
|
+
Object.keys(optionRenames).forEach(function (oldKey) {
|
|
270
|
+
var newKey = optionRenames[oldKey];
|
|
271
|
+
if (oldKey in config.globOptions) {
|
|
272
|
+
newGlobOptions[newKey] = config.globOptions[oldKey];
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
var invertedOptionRenames = {
|
|
276
|
+
nobrace: 'braceExpansion',
|
|
277
|
+
noglobstar: 'globstar',
|
|
278
|
+
noext: 'extglob',
|
|
279
|
+
nocase: 'caseSensitiveMatch',
|
|
280
|
+
};
|
|
281
|
+
Object.keys(invertedOptionRenames).forEach(function (oldKey) {
|
|
282
|
+
var newKey = invertedOptionRenames[oldKey];
|
|
283
|
+
if (oldKey in config.globOptions) {
|
|
284
|
+
newGlobOptions[newKey] = !config.globOptions[oldKey];
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
return Object.assign({}, defaultGlobOptions, newGlobOptions);
|
|
288
|
+
}
|
|
289
|
+
|
|
223
290
|
// Expands wildcards with matching (ie. existing) file names.
|
|
224
291
|
// For example:
|
|
225
292
|
// expand(['file*.js']) = ['file1.js', 'file2.js', ...]
|
|
@@ -235,14 +302,20 @@ function expand(list) {
|
|
|
235
302
|
expanded.push(listEl);
|
|
236
303
|
} else {
|
|
237
304
|
var ret;
|
|
305
|
+
var globOpts = globOptions();
|
|
238
306
|
try {
|
|
239
|
-
ret = glob.sync(listEl,
|
|
240
|
-
// if nothing matched, interpret the string literally
|
|
241
|
-
ret = ret.length > 0 ? ret : [listEl];
|
|
307
|
+
ret = glob.sync(listEl, globOpts);
|
|
242
308
|
} catch (e) {
|
|
243
309
|
// if glob fails, interpret the string literally
|
|
244
310
|
ret = [listEl];
|
|
245
311
|
}
|
|
312
|
+
// if nothing matched, interpret the string literally
|
|
313
|
+
ret = ret.length > 0 ? ret.sort() : [listEl];
|
|
314
|
+
if (globOpts.nodir) {
|
|
315
|
+
ret = ret.filter(function (file) {
|
|
316
|
+
return !statNoFollowLinks(file).isDirectory();
|
|
317
|
+
});
|
|
318
|
+
}
|
|
246
319
|
expanded = expanded.concat(ret);
|
|
247
320
|
}
|
|
248
321
|
});
|
|
@@ -384,8 +457,8 @@ function wrap(cmd, fn, options) {
|
|
|
384
457
|
retValue = fn.apply(this, args);
|
|
385
458
|
} catch (e) {
|
|
386
459
|
/* istanbul ignore else */
|
|
387
|
-
if (e
|
|
388
|
-
retValue = e.
|
|
460
|
+
if (e instanceof CommandError) {
|
|
461
|
+
retValue = e.returnValue;
|
|
389
462
|
} else {
|
|
390
463
|
throw e; // this is probably a bug that should be thrown up the call stack
|
|
391
464
|
}
|
|
@@ -398,7 +471,7 @@ function wrap(cmd, fn, options) {
|
|
|
398
471
|
e.name = 'ShellJSInternalError';
|
|
399
472
|
throw e;
|
|
400
473
|
}
|
|
401
|
-
if (config.fatal) throw e;
|
|
474
|
+
if (config.fatal || options.handlesFatalDynamically) throw e;
|
|
402
475
|
}
|
|
403
476
|
|
|
404
477
|
if (options.wrapOutput &&
|
|
@@ -424,6 +497,7 @@ var DEFAULT_WRAP_OPTIONS = {
|
|
|
424
497
|
canReceivePipe: false,
|
|
425
498
|
cmdOptions: null,
|
|
426
499
|
globStart: 1,
|
|
500
|
+
handlesFatalDynamically: false,
|
|
427
501
|
pipeOnly: false,
|
|
428
502
|
wrapOutput: true,
|
|
429
503
|
unix: true,
|
|
@@ -11,6 +11,7 @@ common.register('cp', _cp, {
|
|
|
11
11
|
'r': 'recursive',
|
|
12
12
|
'L': 'followsymlink',
|
|
13
13
|
'P': 'noFollowsymlink',
|
|
14
|
+
'p': 'preserve',
|
|
14
15
|
},
|
|
15
16
|
wrapOutput: false,
|
|
16
17
|
});
|
|
@@ -51,6 +52,7 @@ function copyFileSync(srcFile, destFile, options) {
|
|
|
51
52
|
var pos = 0;
|
|
52
53
|
var fdr = null;
|
|
53
54
|
var fdw = null;
|
|
55
|
+
var srcStat = common.statFollowLinks(srcFile);
|
|
54
56
|
|
|
55
57
|
try {
|
|
56
58
|
fdr = fs.openSync(srcFile, 'r');
|
|
@@ -60,7 +62,7 @@ function copyFileSync(srcFile, destFile, options) {
|
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
try {
|
|
63
|
-
fdw = fs.openSync(destFile, 'w');
|
|
65
|
+
fdw = fs.openSync(destFile, 'w', srcStat.mode);
|
|
64
66
|
} catch (e) {
|
|
65
67
|
/* istanbul ignore next */
|
|
66
68
|
common.error('copyFileSync: could not write to dest file (code=' + e.code + '):' + destFile);
|
|
@@ -72,10 +74,15 @@ function copyFileSync(srcFile, destFile, options) {
|
|
|
72
74
|
pos += bytesRead;
|
|
73
75
|
}
|
|
74
76
|
|
|
77
|
+
if (options.preserve) {
|
|
78
|
+
fs.fchownSync(fdw, srcStat.uid, srcStat.gid);
|
|
79
|
+
// Note: utimesSync does not work (rounds to seconds), but futimesSync has
|
|
80
|
+
// millisecond precision.
|
|
81
|
+
fs.futimesSync(fdw, srcStat.atime, srcStat.mtime);
|
|
82
|
+
}
|
|
83
|
+
|
|
75
84
|
fs.closeSync(fdr);
|
|
76
85
|
fs.closeSync(fdw);
|
|
77
|
-
|
|
78
|
-
fs.chmodSync(destFile, common.statFollowLinks(srcFile).mode);
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
88
|
|
|
@@ -96,8 +103,9 @@ function cpdirSyncRecursive(sourceDir, destDir, currentDepth, opts) {
|
|
|
96
103
|
|
|
97
104
|
var isWindows = process.platform === 'win32';
|
|
98
105
|
|
|
99
|
-
// Create the directory where all our junk is moving to; read the mode of
|
|
100
|
-
// source directory
|
|
106
|
+
// Create the directory where all our junk is moving to; read the mode/etc. of
|
|
107
|
+
// the source directory (we'll set this on the destDir at the end).
|
|
108
|
+
var checkDir = common.statFollowLinks(sourceDir);
|
|
101
109
|
try {
|
|
102
110
|
fs.mkdirSync(destDir);
|
|
103
111
|
} catch (e) {
|
|
@@ -141,19 +149,19 @@ function cpdirSyncRecursive(sourceDir, destDir, currentDepth, opts) {
|
|
|
141
149
|
} else {
|
|
142
150
|
copyFileSync(srcFile, destFile, opts);
|
|
143
151
|
}
|
|
152
|
+
} else if (fs.existsSync(destFile) && opts.no_force) {
|
|
153
|
+
common.log('skipping existing file: ' + files[i]);
|
|
144
154
|
} else {
|
|
145
|
-
|
|
146
|
-
if (fs.existsSync(destFile) && opts.no_force) {
|
|
147
|
-
common.log('skipping existing file: ' + files[i]);
|
|
148
|
-
} else {
|
|
149
|
-
copyFileSync(srcFile, destFile, opts);
|
|
150
|
-
}
|
|
155
|
+
copyFileSync(srcFile, destFile, opts);
|
|
151
156
|
}
|
|
152
157
|
} // for files
|
|
153
158
|
|
|
154
159
|
// finally change the mode for the newly created directory (otherwise, we
|
|
155
160
|
// couldn't add files to a read-only directory).
|
|
156
|
-
var checkDir = common.statFollowLinks(sourceDir);
|
|
161
|
+
// var checkDir = common.statFollowLinks(sourceDir);
|
|
162
|
+
if (opts.preserve) {
|
|
163
|
+
fs.utimesSync(destDir, checkDir.atime, checkDir.mtime);
|
|
164
|
+
}
|
|
157
165
|
fs.chmodSync(destDir, checkDir.mode);
|
|
158
166
|
} // cpdirSyncRecursive
|
|
159
167
|
|
|
@@ -199,6 +207,7 @@ function cpcheckcycle(sourceDir, srcFile) {
|
|
|
199
207
|
//@ + `-r`, `-R`: recursive
|
|
200
208
|
//@ + `-L`: follow symlinks
|
|
201
209
|
//@ + `-P`: don't follow symlinks
|
|
210
|
+
//@ + `-p`: preserve file mode, ownership, and timestamps
|
|
202
211
|
//@
|
|
203
212
|
//@ Examples:
|
|
204
213
|
//@
|
|
@@ -209,7 +218,8 @@ function cpcheckcycle(sourceDir, srcFile) {
|
|
|
209
218
|
//@ cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above
|
|
210
219
|
//@ ```
|
|
211
220
|
//@
|
|
212
|
-
//@ Copies files.
|
|
221
|
+
//@ Copies files. Returns a [ShellString](#shellstringstr) indicating success
|
|
222
|
+
//@ or failure.
|
|
213
223
|
function _cp(options, sources, dest) {
|
|
214
224
|
// If we're missing -R, it actually implies -L (unless -P is explicit)
|
|
215
225
|
if (options.followsymlink) {
|
|
@@ -260,7 +270,7 @@ function _cp(options, sources, dest) {
|
|
|
260
270
|
|
|
261
271
|
try {
|
|
262
272
|
common.statFollowLinks(path.dirname(dest));
|
|
263
|
-
cpdirSyncRecursive(src, newDest, 0,
|
|
273
|
+
cpdirSyncRecursive(src, newDest, 0, options);
|
|
264
274
|
} catch (e) {
|
|
265
275
|
/* istanbul ignore next */
|
|
266
276
|
common.error("cannot create directory '" + dest + "': No such file or directory");
|