flowershow 0.1.7 → 0.1.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # flowershow
2
2
 
3
+ ## 0.1.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Adjust the CLI Installer after migrating Flowershow template to datopian/flowershow-template.
8
+
3
9
  ## 0.1.7
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowershow",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Publish your digital garden",
5
5
  "bin": {
6
6
  "flowershow": "src/bin/cli.js"
@@ -10,15 +10,10 @@ import { exit, error, log, info, success, logWithSpinner, stopSpinner, isSubdir,
10
10
  import { FLOWERSHOW_FOLDER_NAME } from "./const.js";
11
11
  export default class Installer {
12
12
  constructor(context, targetDir) {
13
+ this.templateRepo = "https://github.com/datopian/flowershow-template";
13
14
  this.context = context;
14
15
  this.targetDir = targetDir;
15
16
  }
16
- get templateRepo() {
17
- // simplify importing data from package.json with this line after we no longer want to support node 16
18
- // import packageJson from "#package.json" assert { type: "json" };
19
- const flowershowRepo = require("../../package.json").repository.url.replace("git+", "");
20
- return `${flowershowRepo}/packages/template`;
21
- }
22
17
  async install() {
23
18
  const { context, targetDir, templateRepo } = this;
24
19
  const flowershowDir = path.resolve(targetDir, FLOWERSHOW_FOLDER_NAME);
@@ -131,10 +126,10 @@ export default class Installer {
131
126
  symbol: "🌷",
132
127
  msg: `Creating Flowershow template in ${chalk.magenta(flowershowDir)}`,
133
128
  });
134
- if (existsAction === "overwrite") {
135
- fs.rmSync(flowershowDir, { recursive: true, force: true });
136
- }
137
129
  try {
130
+ if (existsAction === "overwrite") {
131
+ fs.rmSync(flowershowDir, { recursive: true, force: true });
132
+ }
138
133
  const emitter = degit(templateRepo);
139
134
  await emitter.clone(flowershowDir);
140
135
  }
@@ -143,19 +138,29 @@ export default class Installer {
143
138
  log(err);
144
139
  exit(1);
145
140
  }
146
- // remove unneeded dev files
147
- fs.rmSync(`${flowershowDir}/project.json`, { force: true });
148
- fs.rmSync(`${flowershowDir}/.eslintrc.json`, { force: true });
149
- fs.rmSync(`${flowershowDir}/jest.config.js`, { force: true });
150
- // TODO (temporary here) remove Flowershow app home page
151
- fs.rmSync(`${flowershowDir}/pages/index.tsx`, { force: true });
152
- fs.rename(`${flowershowDir}/pages/[...slug].tsx`, `${flowershowDir}/pages/[[...slug]].tsx`, () => { });
153
141
  // update content and assets symlinks
154
- const contentSymlinkPath = path.relative(`${flowershowDir}`, contentDir);
155
- fs.symlinkSync(contentSymlinkPath, `${flowershowDir}/content`, "junction");
156
- if (assetsFolder !== "none") {
157
- const assetsSymlinkPath = path.relative(`${flowershowDir}/public`, `${contentDir}/${assetsFolder}`);
158
- fs.symlinkSync(assetsSymlinkPath, `${flowershowDir}/public/${assetsFolder}`, "junction");
142
+ try {
143
+ // flowershow template includes starter content folder, so we need
144
+ // to remove it before creating symlinks
145
+ if (fs.existsSync(`${flowershowDir}/content`)) {
146
+ fs.rmSync(`${flowershowDir}/content`, { recursive: true, force: true });
147
+ }
148
+ const contentSymlinkPath = path.relative(`${flowershowDir}`, contentDir);
149
+ fs.symlinkSync(contentSymlinkPath, `${flowershowDir}/content`, "junction");
150
+ if (assetsFolder !== "none") {
151
+ const assetsSymlinkPath = path.relative(`${flowershowDir}/public`, `${contentDir}/${assetsFolder}`);
152
+ fs.symlinkSync(assetsSymlinkPath, `${flowershowDir}/public/${assetsFolder}`, "junction");
153
+ }
154
+ stopSpinner();
155
+ log("Created symlinks:");
156
+ log(`${chalk.cyan(`${flowershowDir}/content`)} -> ${chalk.magenta(contentDir)}`);
157
+ if (assetsFolder !== "none") {
158
+ log(`${chalk.cyan(`${flowershowDir}/public/${assetsFolder}`)} -> ${chalk.magenta(`${contentDir}/${assetsFolder}`)}`);
159
+ }
160
+ }
161
+ catch (err) {
162
+ error(`Failed to create symlinks to content and assets folders: ${err.message}`);
163
+ exit(err.exitCode);
159
164
  }
160
165
  // install flowershow dependencies
161
166
  logWithSpinner({ symbol: "🌸", msg: `Installing Flowershow dependencies` });