Skip to content

Commit

Permalink
Fix pattern lab create script (#1263)
Browse files Browse the repository at this point in the history
* Fix create script

* Update path resolving of source folder

Co-authored-by: Salem Ghoweri <[email protected]>
  • Loading branch information
JosefBredereck and sghoweri authored Nov 12, 2020
1 parent 1fd6b45 commit 3917c42
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
1 change: 1 addition & 0 deletions packages/cli/bin/cli-actions/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const init = options =>
); // 1

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

if (edition) {
spinner.text = `⊙ patternlab → Installing edition: ${edition}`;
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/bin/install-starterkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ const installStarterkit = (starterkit, config) =>
const sourceDir = config.paths.source.root;
const name = starterkit.value || starterkit;
yield checkAndInstallPackage(name);
yield copyAsync(resolveDirInPackage(name, 'dist'), path.resolve(sourceDir));
yield copyAsync(
resolveDirInPackage(name, 'dist'),
path.resolve(process.env.projectDir || '', sourceDir)
);
let kitConfig;
const kitConfigPath = path.join(
resolvePackageFolder(name),
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/bin/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ const fetchPackage = packageName =>
const installCmd = useYarn ? 'add' : 'install';
try {
if (packageName) {
const cmd = yield spawn(pm, [installCmd, packageName]);
const opts = {};
if (process.env.projectDir) {
opts.cwd = process.env.projectDir;
}
const cmd = yield spawn(pm, [installCmd, packageName], opts);
error(cmd.stderr);
}
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"chalk": "2.4.1",
"commander": "2.15.1",
"deepmerge": "^2.1.1",
"execa": "0.10.0",
"execa": "4.0.3",
"fs-extra": "6.0.1",
"glob": "7.1.2",
"has-yarn": "1.0.0",
Expand Down
24 changes: 13 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7907,18 +7907,20 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3:
md5.js "^1.3.4"
safe-buffer "^5.1.1"

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

execa@^0.7.0:
version "0.7.0"
Expand Down

0 comments on commit 3917c42

Please sign in to comment.