flowershow 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # flowershow
2
+
3
+ ## 0.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - ebc6872: Disallow installing the template inside the content folder.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowershow",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Publish your digital garden",
5
5
  "bin": {
6
6
  "flowershow": "src/bin/cli.js"
package/project.json CHANGED
@@ -37,6 +37,5 @@
37
37
  "outputs": ["coverage/packages/cli-e2e"]
38
38
  }
39
39
  },
40
- "tags": [],
41
- "implicitDependencies": ["template"]
40
+ "tags": []
42
41
  }
@@ -15,6 +15,7 @@ import {
15
15
  success,
16
16
  logWithSpinner,
17
17
  stopSpinner,
18
+ isSubdir,
18
19
  } from "./utils/index.js";
19
20
 
20
21
  import { FLOWERSHOW_FOLDER_NAME } from "./const.js";
@@ -77,6 +78,20 @@ export default class Creator {
77
78
  ]);
78
79
 
79
80
  const contentDir = path.resolve(context, contentPath);
81
+
82
+ // don't allow for installing the template anywhere within the content folder
83
+ // as it will break esbuild
84
+ if (isSubdir(flowershowDir, contentDir)) {
85
+ log(`Provided content directory: ${contentDir}`);
86
+ log(
87
+ `Provided Flowershow template installation directory: ${flowershowDir}`
88
+ );
89
+ error(
90
+ `You can't install the Flowershow template inside your content folder.`
91
+ );
92
+ exit(1);
93
+ }
94
+
80
95
  const assetFolderChoices = fs
81
96
  .readdirSync(contentDir, { withFileTypes: true })
82
97
  .filter((d) => d.isDirectory())
@@ -1,5 +1,6 @@
1
1
  export { error, info, log, success, warn } from "./logger.js";
2
2
  export { exit } from "./exit.js";
3
+ export { isSubdir } from "./isSubdir.js";
3
4
  export {
4
5
  logWithSpinner,
5
6
  stopSpinner,
@@ -0,0 +1,7 @@
1
+ import path from "path";
2
+
3
+ // test if dir is a subdirectory of or same as ofDir
4
+ export function isSubdir(dir, ofDir) {
5
+ const relative = path.relative(ofDir, dir);
6
+ return relative && !relative.startsWith("..") && !path.isAbsolute(relative);
7
+ }