Skip to content

Commit 3917c42

Browse files
Fix pattern lab create script (#1263)
* Fix create script * Update path resolving of source folder Co-authored-by: Salem Ghoweri <me@salemghoweri.com>
1 parent 1fd6b45 commit 3917c42

File tree

5 files changed

+24
-14
lines changed

5 files changed

+24
-14
lines changed

packages/cli/bin/cli-actions/init.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const init = options =>
4646
); // 1
4747

4848
yield scaffold(projectDir, sourceDir, publicDir, exportDir); // 2
49+
process.env.projectDir = path.join(process.cwd(), projectDir);
4950

5051
if (edition) {
5152
spinner.text = `⊙ patternlab → Installing edition: ${edition}`;

packages/cli/bin/install-starterkit.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ const installStarterkit = (starterkit, config) =>
1717
const sourceDir = config.paths.source.root;
1818
const name = starterkit.value || starterkit;
1919
yield checkAndInstallPackage(name);
20-
yield copyAsync(resolveDirInPackage(name, 'dist'), path.resolve(sourceDir));
20+
yield copyAsync(
21+
resolveDirInPackage(name, 'dist'),
22+
path.resolve(process.env.projectDir || '', sourceDir)
23+
);
2124
let kitConfig;
2225
const kitConfigPath = path.join(
2326
resolvePackageFolder(name),

packages/cli/bin/utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ const fetchPackage = packageName =>
135135
const installCmd = useYarn ? 'add' : 'install';
136136
try {
137137
if (packageName) {
138-
const cmd = yield spawn(pm, [installCmd, packageName]);
138+
const opts = {};
139+
if (process.env.projectDir) {
140+
opts.cwd = process.env.projectDir;
141+
}
142+
const cmd = yield spawn(pm, [installCmd, packageName], opts);
139143
error(cmd.stderr);
140144
}
141145
} catch (err) {

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"chalk": "2.4.1",
1717
"commander": "2.15.1",
1818
"deepmerge": "^2.1.1",
19-
"execa": "0.10.0",
19+
"execa": "4.0.3",
2020
"fs-extra": "6.0.1",
2121
"glob": "7.1.2",
2222
"has-yarn": "1.0.0",

yarn.lock

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7907,18 +7907,20 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3:
79077907
md5.js "^1.3.4"
79087908
safe-buffer "^5.1.1"
79097909

7910-
execa@0.10.0:
7911-
version "0.10.0"
7912-
resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50"
7913-
integrity sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==
7910+
execa@4.0.3:
7911+
version "4.0.3"
7912+
resolved "https://registry.yarnpkg.com/execa/-/execa-4.0.3.tgz#0a34dabbad6d66100bd6f2c576c8669403f317f2"
7913+
integrity sha512-WFDXGHckXPWZX19t1kCsXzOpqX9LWYNqn4C+HqZlk/V0imTkzJZqf87ZBhvpHaftERYknpk0fjSylnXVlVgI0A==
79147914
dependencies:
7915-
cross-spawn "^6.0.0"
7916-
get-stream "^3.0.0"
7917-
is-stream "^1.1.0"
7918-
npm-run-path "^2.0.0"
7919-
p-finally "^1.0.0"
7920-
signal-exit "^3.0.0"
7921-
strip-eof "^1.0.0"
7915+
cross-spawn "^7.0.0"
7916+
get-stream "^5.0.0"
7917+
human-signals "^1.1.1"
7918+
is-stream "^2.0.0"
7919+
merge-stream "^2.0.0"
7920+
npm-run-path "^4.0.0"
7921+
onetime "^5.1.0"
7922+
signal-exit "^3.0.2"
7923+
strip-final-newline "^2.0.0"
79227924

79237925
execa@^0.7.0:
79247926
version "0.7.0"

0 commit comments

Comments
 (0)