Skip to content

Commit

Permalink
fix(core): generator fix for projects grouped under folders (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder authored Jan 25, 2021
1 parent 611c7b1 commit d1451d3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
7 changes: 7 additions & 0 deletions packages/xplat-utils/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,10 @@ export function sanitizeCommaDelimitedArg(input: string): Array<string> {
}
return [];
}

export function parseProjectNameFromPath(input: string): string {
if (input && input.indexOf('/') > -1) {
input = input.split('/').pop();
}
return input;
}
13 changes: 6 additions & 7 deletions packages/xplat/src/utils/xplat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
supportedNxExtraPlatforms,
PlatformNxExtraTypes,
supportedPlatformsWithNx,
parseProjectNameFromPath,
} from '@nstudio/xplat-utils';
import {
updateJsonInTree,
Expand Down Expand Up @@ -977,9 +978,10 @@ export namespace XplatComponentHelpers {
// building feature in shared code and in projects
projectNames = sanitizeCommaDelimitedArg(projects);
for (const name of projectNames) {
const projectParts = name.split('-');
const platPrefix = projectParts[0];
const platSuffix = projectParts.pop();
let projectName = parseProjectNameFromPath(name);
const projectParts = projectName.split('-');
const platPrefix = <PlatformTypes>projectParts[0];
const platSuffix = <PlatformTypes>projectParts.pop();
if (
supportedPlatforms.includes(platPrefix) &&
!platforms.includes(platPrefix)
Expand Down Expand Up @@ -1102,10 +1104,7 @@ export namespace XplatFeatureHelpers {
// building feature in shared code and in projects
projectNames = sanitizeCommaDelimitedArg(projects);
for (const name of projectNames) {
let projectName = name;
if (name.indexOf('/') > -1) {
projectName = name.split('/').pop();
}
let projectName = parseProjectNameFromPath(name);
const projectParts = projectName.split('-');
const platPrefix = <PlatformTypes>projectParts[0];
const platSuffix = <PlatformTypes>projectParts.pop();
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12828,6 +12828,13 @@ open@7.3.0:
is-docker "^2.0.0"
is-wsl "^2.1.1"

open@~6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/open/-/open-6.0.0.tgz#cae5e2c1a3a1bfaee0d0acc8c4b7609374750346"
integrity sha512-/yb5mVZBz7mHLySMiSj2DcLtMBbFPJk5JBKEkHVZFxZAPzeg3L026O0T+lbdz1B2nyDnkClRSwRQJdeVUIF7zw==
dependencies:
is-wsl "^1.1.0"

opencollective-postinstall@^2.0.0, opencollective-postinstall@^2.0.2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz#7a0fff978f6dbfa4d006238fbac98ed4198c3259"
Expand All @@ -12845,13 +12852,6 @@ opn@^5.3.0, opn@^5.5.0:
dependencies:
is-wsl "^1.1.0"

opn@~6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/opn/-/opn-6.0.0.tgz#3c5b0db676d5f97da1233d1ed42d182bc5a27d2d"
integrity sha512-I9PKfIZC+e4RXZ/qr1RhgyCnGgYX0UEIlXgWnCOVACIvFgaC9rz6Won7xbdhoHrd8IIhV7YEpHjreNUNkqCGkQ==
dependencies:
is-wsl "^1.1.0"

optionator@^0.8.1:
version "0.8.3"
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495"
Expand Down

0 comments on commit d1451d3

Please sign in to comment.