build: add npm package manifest to npm_integration_test (#35669)
PR Close #35669
This commit is contained in:
parent
f9f44bf743
commit
1f3dd000ad
43
.bazelignore
43
.bazelignore
|
@ -1,18 +1,22 @@
|
||||||
|
# Bazel does not yet support wildcards or other .gitignore semantics for
|
||||||
|
# .bazelignore. Two issues for this feature request are outstanding:
|
||||||
|
# https://github.com/bazelbuild/bazel/issues/7093
|
||||||
|
# https://github.com/bazelbuild/bazel/issues/8106
|
||||||
.git
|
.git
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
aio/content
|
aio/content
|
||||||
aio/node_modules
|
aio/node_modules
|
||||||
aio/tools/examples/shared/node_modules
|
aio/tools/examples/shared/node_modules
|
||||||
|
packages/bazel/node_modules
|
||||||
integration/bazel/bazel-bazel
|
integration/bazel/bazel-bazel
|
||||||
integration/bazel/bazel-bin
|
integration/bazel/bazel-bin
|
||||||
integration/bazel/bazel-out
|
integration/bazel/bazel-out
|
||||||
integration/bazel/bazel-testlogs
|
integration/bazel/bazel-testlogs
|
||||||
integration/bazel/node_modules
|
|
||||||
integration/bazel/.yarn_local_cache
|
|
||||||
integration/bazel-schematics/node_modules
|
|
||||||
integration/bazel-schematics/.yarn_local_cache
|
|
||||||
integration/bazel-schematics/demo
|
integration/bazel-schematics/demo
|
||||||
|
# All integration test node_modules folders
|
||||||
|
integration/bazel/node_modules
|
||||||
|
integration/bazel-schematics/node_modules
|
||||||
integration/cli-hello-world/node_modules
|
integration/cli-hello-world/node_modules
|
||||||
integration/cli-hello-world-ivy-compat/node_modules
|
integration/cli-hello-world-ivy-compat/node_modules
|
||||||
integration/cli-hello-world-ivy-i18n/node_modules
|
integration/cli-hello-world-ivy-i18n/node_modules
|
||||||
|
@ -37,6 +41,9 @@ integration/side-effects/node_modules
|
||||||
integration/terser/node_modules
|
integration/terser/node_modules
|
||||||
integration/typings_test_ts36/node_modules
|
integration/typings_test_ts36/node_modules
|
||||||
integration/typings_test_ts37/node_modules
|
integration/typings_test_ts37/node_modules
|
||||||
|
# All integration test .yarn_local_cache folders
|
||||||
|
integration/bazel/.yarn_local_cache
|
||||||
|
integration/bazel-schematics/.yarn_local_cache
|
||||||
integration/cli-hello-world/.yarn_local_cache
|
integration/cli-hello-world/.yarn_local_cache
|
||||||
integration/cli-hello-world-ivy-compat/.yarn_local_cache
|
integration/cli-hello-world-ivy-compat/.yarn_local_cache
|
||||||
integration/cli-hello-world-ivy-i18n/.yarn_local_cache
|
integration/cli-hello-world-ivy-i18n/.yarn_local_cache
|
||||||
|
@ -61,4 +68,30 @@ integration/side-effects/.yarn_local_cache
|
||||||
integration/terser/.yarn_local_cache
|
integration/terser/.yarn_local_cache
|
||||||
integration/typings_test_ts36/.yarn_local_cache
|
integration/typings_test_ts36/.yarn_local_cache
|
||||||
integration/typings_test_ts37/.yarn_local_cache
|
integration/typings_test_ts37/.yarn_local_cache
|
||||||
packages/bazel/node_modules
|
# All integration test NPM_PACKAGE_MANIFEST.json folders
|
||||||
|
integration/bazel/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/bazel-schematics/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/cli-hello-world/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/cli-hello-world-ivy-compat/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/cli-hello-world-ivy-i18n/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/cli-hello-world-ivy-minimal/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/cli-hello-world-lazy/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/cli-hello-world-lazy-rollup/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/dynamic-compiler/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/hello_world__closure/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/hello_world__systemjs_umd/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/i18n/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/injectable-def/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/ivy-i18n/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/language_service_plugin/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/ng_elements/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/ng_elements_schematics/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/ng_update/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/ng_update_migrations/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/ngcc/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/platform-server/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/service-worker-schema/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/side-effects/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/terser/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/typings_test_ts36/NPM_PACKAGE_MANIFEST.json
|
||||||
|
integration/typings_test_ts37/NPM_PACKAGE_MANIFEST.json
|
||||||
|
|
|
@ -9,3 +9,4 @@ tmp/
|
||||||
**/*.ngsummary.json
|
**/*.ngsummary.json
|
||||||
**/*.ngsummary.ts
|
**/*.ngsummary.ts
|
||||||
**/.yarn_local_cache*
|
**/.yarn_local_cache*
|
||||||
|
**/NPM_PACKAGE_MANIFEST.json
|
|
@ -140,6 +140,7 @@ class TestRunner {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.successful = 0;
|
this.successful = 0;
|
||||||
this._setupTestFiles();
|
this._setupTestFiles();
|
||||||
|
this._writeNpmPackageManifest();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -297,6 +298,27 @@ class TestRunner {
|
||||||
log(`test files from '${rootDirectory(this.config.testFiles)}' copied to tmp folder ${this.testRoot}`);
|
log(`test files from '${rootDirectory(this.config.testFiles)}' copied to tmp folder ${this.testRoot}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* Write an NPM_PACKAGE_MANIFEST.json file to the test root with a mapping of
|
||||||
|
* the npm package mappings for this this test. Integration tests can opt
|
||||||
|
* to use this mappings file instead of the built-in `patch-package-json`
|
||||||
|
* command.
|
||||||
|
*/
|
||||||
|
_writeNpmPackageManifest() {
|
||||||
|
if (!this.testRoot) {
|
||||||
|
fail(`test files not yet setup`);
|
||||||
|
}
|
||||||
|
const manifest = {};
|
||||||
|
for (const key of Object.keys(this.config.npmPackages)) {
|
||||||
|
manifest[key] = runfiles.resolveWorkspaceRelative(this.config.npmPackages[key]);
|
||||||
|
}
|
||||||
|
const manifestPath = `${this.testRoot}/NPM_PACKAGE_MANIFEST.json`;
|
||||||
|
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
||||||
|
log(`npm package manifest written to ${manifestPath}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = require(process.argv[2]);
|
const config = require(process.argv[2]);
|
||||||
|
|
Loading…
Reference in New Issue