diff --git a/packages/toolkit/scripts/project/bash/init.sh b/packages/toolkit/scripts/project/bash/init.sh index bb9bb398..21271073 100644 --- a/packages/toolkit/scripts/project/bash/init.sh +++ b/packages/toolkit/scripts/project/bash/init.sh @@ -13,10 +13,9 @@ fi # If template is not empty, git clone template to init_path if [ ! -z "$template" ]; then git clone "$template" "$init_path" + rm -rf "$init_path/.git" fi -rm -rf "$init_path/.git" - # Fixes weird sed error LANG=C diff --git a/packages/toolkit/utils/package.js b/packages/toolkit/utils/package.js index 46101f89..1117aa54 100644 --- a/packages/toolkit/utils/package.js +++ b/packages/toolkit/utils/package.js @@ -11,10 +11,17 @@ const readPkg = require('read-pkg'); */ const { getCurrentWorkingDirectory } = require('./process'); -const { packageJson: pkg, path: pkgPath } = readPkgUp.sync({ +let pkg; +let pkgPath; +const packageData = readPkgUp.sync({ cwd: realpathSync(getCurrentWorkingDirectory()), }); +if (packageData && packageData.packageJson && packageData.path) { + pkg = packageData.packageJson; + pkgPath = packageData.path; +} + const getPackage = () => pkg; const getPackagePath = () => pkgPath;