flowershow 0.0.8 → 0.0.9

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,7 +1,14 @@
1
1
  # flowershow
2
2
 
3
+ ## 0.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - CLI support for Windows. Symlink files removed from the template.
8
+ - Add information about missing index.md and/or config.js files that the CLI will automatically create for the user.
9
+
3
10
  ## 0.0.8
4
11
 
5
12
  ### Patch Changes
6
13
 
7
- - ebc6872: Disallow installing the template inside the content folder.
14
+ - 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.8",
3
+ "version": "0.0.9",
4
4
  "description": "Publish your digital garden",
5
5
  "bin": {
6
6
  "flowershow": "src/bin/cli.js"
@@ -35,4 +35,4 @@
35
35
  "engines": {
36
36
  "node": ">=12.2.0 || >=14.13.0"
37
37
  }
38
- }
38
+ }
@@ -12,6 +12,7 @@ import {
12
12
  exit,
13
13
  error,
14
14
  log,
15
+ info,
15
16
  success,
16
17
  logWithSpinner,
17
18
  stopSpinner,
@@ -20,7 +21,7 @@ import {
20
21
 
21
22
  import { FLOWERSHOW_FOLDER_NAME } from "./const.js";
22
23
 
23
- export default class Creator {
24
+ export default class Installer {
24
25
  constructor(context, targetDir) {
25
26
  this.context = context;
26
27
  this.targetDir = targetDir;
@@ -97,7 +98,7 @@ export default class Creator {
97
98
  .filter((d) => d.isDirectory())
98
99
  .map((d) => ({ name: d.name, value: d.name }));
99
100
 
100
- let assetsFolder = "none";
101
+ let assetsFolder;
101
102
 
102
103
  if (!assetFolderChoices.length) {
103
104
  const { foldersAction } = await inquirer.prompt([
@@ -137,40 +138,13 @@ export default class Creator {
137
138
  }
138
139
 
139
140
  // install flowershow template
140
- logWithSpinner({
141
- symbol: "🌷",
142
- msg: `Installing Flowershow template in ${chalk.magenta(
143
- flowershowDir
144
- )}...`,
145
- });
146
-
147
- if (existsAction === "overwrite") {
148
- fs.rmSync(flowershowDir, { recursive: true, force: true });
149
- }
150
-
151
- try {
152
- const emitter = degit(templateRepo);
153
- await emitter.clone(flowershowDir);
154
- } catch {
155
- error(`Failed to install Flowershow template in ${flowershowDir}.`);
156
- exit(1);
157
- }
158
-
159
- // update content and assets symlinks
160
- fs.unlinkSync(`${flowershowDir}/content`);
161
- fs.symlinkSync(contentDir, `${flowershowDir}/content`);
162
-
163
- fs.unlinkSync(`${flowershowDir}/public/assets`);
164
- if (assetsFolder !== "none") {
165
- fs.symlinkSync(
166
- path.resolve(contentDir, assetsFolder),
167
- `${flowershowDir}/public/${assetsFolder}`
168
- );
169
- }
170
-
171
141
  // // if there is no index.md file, create one
172
142
  if (!fs.existsSync(`${contentPath}/index.md`)) {
143
+ info(
144
+ `No index.md file found in ${contentDir}. Flowershow will create one for you.`
145
+ );
173
146
  const homePageContent = "# Welcome to my Flowershow site!";
147
+ // eslint-disable-next-line no-unused-vars
174
148
  fs.writeFile(
175
149
  `${contentPath}/index.md`,
176
150
  homePageContent,
@@ -181,6 +155,9 @@ export default class Creator {
181
155
 
182
156
  // // if there is no config.js file, create one
183
157
  if (!fs.existsSync(`${contentPath}/config.js`)) {
158
+ info(
159
+ `No config.js file found in ${contentDir}. Flowershow will create one for you.`
160
+ );
184
161
  fs.writeFile(
185
162
  `${contentPath}/config.js`,
186
163
  "{}",
@@ -189,15 +166,42 @@ export default class Creator {
189
166
  );
190
167
  }
191
168
 
192
- // install flowershow dependencies
169
+ // create flowershow template
193
170
  logWithSpinner({
194
- symbol: "🌸",
195
- msg: `Installing Flowershow dependencies...`,
171
+ symbol: "🌷",
172
+ msg: `Creating Flowershow template in ${chalk.magenta(flowershowDir)}`,
196
173
  });
197
174
 
175
+ if (existsAction === "overwrite") {
176
+ fs.rmSync(flowershowDir, { recursive: true, force: true });
177
+ }
178
+
179
+ try {
180
+ const emitter = degit(templateRepo);
181
+ await emitter.clone(flowershowDir);
182
+ } catch {
183
+ error(`Failed to create Flowershow template in ${flowershowDir}.`);
184
+ exit(1);
185
+ }
186
+
187
+ // update content and assets symlinks
188
+ const contentSymlinkPath = path.relative(`${flowershowDir}`, contentDir);
189
+ fs.symlinkSync(contentSymlinkPath, `${flowershowDir}/content`);
190
+
191
+ if (assetsFolder !== "none") {
192
+ const assetsSymlinkPath = path.relative(
193
+ `${flowershowDir}/public`,
194
+ `${contentDir}/${assetsFolder}`
195
+ );
196
+ fs.symlinkSync(
197
+ assetsSymlinkPath,
198
+ `${flowershowDir}/public/${assetsFolder}`
199
+ );
200
+ }
201
+
202
+ // install flowershow dependencies
203
+ logWithSpinner({ symbol: "🌸", msg: `Installing Flowershow dependencies` });
198
204
  try {
199
- // TODO this can be removed after monorepo has been set up correctly
200
- await execa("npm", ["set-script", "prepare", ""], { cwd: flowershowDir });
201
205
  const { stdout, stderr } = await execa("npm", ["install"], {
202
206
  cwd: flowershowDir,
203
207
  });
@@ -206,7 +210,7 @@ export default class Creator {
206
210
  stopSpinner();
207
211
  success("Successfuly installed Flowershow!");
208
212
  } catch (err) {
209
- error(`Installing dependencies failed: ${err.message}`);
213
+ error(`Failed to install Flowershow dependencies: ${err.message}`);
210
214
  exit(err.exitCode);
211
215
  }
212
216
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Life Itself
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.