-
Notifications
You must be signed in to change notification settings - Fork 893
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: Miki <miki@amazon.com> (cherry picked from commit 931b915) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b499a10
commit e4040b9
Showing
12 changed files
with
4,456 additions
and
4,232 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
packages/osd-pm/src/utils/__fixtures__/opensearch-dashboards-dev/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "opensearch-dashboards", | ||
"version": "1.0.0", | ||
"private": "true", | ||
"dependencies": { | ||
"foo": "1.0.0", | ||
"@scoped/baz": "file:../other-plugins/baz" | ||
}, | ||
"workspaces": { | ||
"packages": [ | ||
"packages/*" | ||
] | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/osd-pm/src/utils/__fixtures__/opensearch-dashboards-dev/packages/bar/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "bar", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"foo": "1.0.0", | ||
"@scoped/baz": "file:../../../other-plugins/baz" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/osd-pm/src/utils/__fixtures__/opensearch-dashboards-dev/packages/foo/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "foo", | ||
"version": "1.0.0" | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/osd-pm/src/utils/__fixtures__/opensearch-dashboards-dev/yarn.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
"@scoped/baz@file:../other-plugins/baz": | ||
version "1.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { resolve } from 'path'; | ||
import { OpenSearchDashboards } from './opensearch_dashboards'; | ||
import { readYarnLock } from './yarn_lock'; | ||
|
||
const rootPath = resolve(`${__dirname}/__fixtures__/opensearch-dashboards-dev`); | ||
|
||
const linkedDepmarker = 'file:'; | ||
const linkedDepmarkerLength = linkedDepmarker.length; | ||
|
||
describe('#readYarnLock', () => { | ||
it('includes an entry with the absolute path to a linked dependency', async () => { | ||
const devProject = await OpenSearchDashboards.loadFrom(rootPath); | ||
const { allDependencies } = devProject.getProject('opensearch-dashboards'); | ||
const expectedObject = Object.keys(allDependencies).reduce( | ||
(accumulator: { [key: string]: any }, key) => { | ||
if (allDependencies[key].startsWith('file:')) { | ||
accumulator[ | ||
key + | ||
'@file:' + | ||
resolve( | ||
devProject.getAbsolute(), | ||
allDependencies[key].substring(linkedDepmarkerLength) | ||
) | ||
] = expect.any(Object); | ||
} | ||
return accumulator; | ||
}, | ||
{} | ||
); | ||
|
||
const result = await readYarnLock(devProject); | ||
|
||
expect(result).toMatchObject(expectedObject); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/dev/build/tasks/__fixtures__/opensearch-dashboards-dev/yarn.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
"@scoped/foo@file:../linked/foo": | ||
version "1.0.0" | ||
|
||
"bar@file:../../deeper/linked/bar, @scoped/bar@file:../../deeper/linked/bar": | ||
version "1.0.0" | ||
|
||
"baz@file:/absolute/baz": | ||
version "1.0.0" | ||
|
||
# impossible but used for validating the transformer | ||
"qux@^1.0.0, qux@file:../linked/qux, @scoped/qux@^1.0.0, @scoped/qux@file:../linked/qux": | ||
version "1.0.0" | ||
resolved "https://user@file:password@some.registry/package" |
22 changes: 22 additions & 0 deletions
22
src/dev/build/tasks/__snapshots__/copy_source_task.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { join, resolve } from 'path'; | ||
import { mkdirSync, readFileSync, rmSync } from 'fs'; | ||
import { copyYarnLock } from './copy_source_task'; | ||
|
||
const repoRoot = resolve(`${__dirname}/__fixtures__/opensearch-dashboards-dev`); | ||
const disposableRoot = join(repoRoot, 'build'); | ||
const buildRoot = join(repoRoot, 'build/opensearch-dashboards-dev'); | ||
|
||
describe('copy source task', () => { | ||
beforeEach(() => { | ||
mkdirSync(buildRoot, { recursive: true }); | ||
}); | ||
|
||
afterEach(() => { | ||
rmSync(disposableRoot, { force: true, recursive: true }); | ||
}); | ||
|
||
it('transform relative paths while copying yarn.lock', async () => { | ||
await copyYarnLock(repoRoot, buildRoot); | ||
expect(readFileSync(join(buildRoot, 'yarn.lock'), 'utf8')).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters