flowershow 0.0.3 → 0.0.5
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/README.md +3 -5
- package/bin/flowershow.js +77 -0
- package/lib/Installer.js +167 -0
- package/lib/build.js +20 -0
- package/lib/buildStatic.js +15 -0
- package/lib/const.js +1 -0
- package/lib/install.js +36 -0
- package/lib/preview.js +21 -0
- package/{commands → lib}/publish.js +0 -0
- package/{commands → lib}/upgrade.js +0 -0
- package/lib/utils/exit.js +3 -0
- package/lib/utils/index.js +3 -0
- package/lib/utils/logger.js +20 -0
- package/lib/utils/spinner.js +54 -0
- package/package.json +25 -14
- package/commands/build.js +0 -12
- package/commands/create.js +0 -12
- package/index.js +0 -39
- package/upgrade.sh +0 -28
package/README.md
CHANGED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// TODO check current vs required node version (package.json engines)
|
|
9
|
+
// const requiredNodeVersion = require("../package.json").engines.node;
|
|
10
|
+
|
|
11
|
+
const program = new Command();
|
|
12
|
+
|
|
13
|
+
program
|
|
14
|
+
.description('(Package under development)\nCLI tool for creating, publishing and upgrading Flowershow apps')
|
|
15
|
+
.version(require("../package.json").version)
|
|
16
|
+
.usage('<command> [options]')
|
|
17
|
+
|
|
18
|
+
// choose template
|
|
19
|
+
program
|
|
20
|
+
.command('install')
|
|
21
|
+
.description('install Flowershow template in target directory')
|
|
22
|
+
.argument('[target-dir]', 'Path to the folder where you want Flowershow template to be installed', '.')
|
|
23
|
+
// .option('-t, --template [template-name]', 'Flowershow template name to use', 'default')
|
|
24
|
+
.action(async (targetDir, options) => {
|
|
25
|
+
const { default: install } = await import ('../lib/install.js');
|
|
26
|
+
install(targetDir, options);
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
program
|
|
30
|
+
.command('build')
|
|
31
|
+
.description('build Flowershow website')
|
|
32
|
+
.argument('[project-dir]', 'Path to the folder where Flowershow template is installed (root folder of .flowershow)', '.')
|
|
33
|
+
.action(async (projectPath) => {
|
|
34
|
+
const { default: build } = await import ('../lib/build.js');
|
|
35
|
+
build(projectPath);
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
program
|
|
40
|
+
.command('build-static')
|
|
41
|
+
.description('build static Flowershow website')
|
|
42
|
+
.argument('[project-dir]', 'Path to the folder where Flowershow template is installed (root folder of .flowershow)', '.')
|
|
43
|
+
.action(async (projectPath) => {
|
|
44
|
+
const { default: buildStatic } = await import ('../lib/buildStatic.js');
|
|
45
|
+
buildStatic(projectPath);
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
program
|
|
49
|
+
.command('preview')
|
|
50
|
+
.description('preview your Flowershow site')
|
|
51
|
+
.argument('[project-dir]', 'Path to the folder where Flowershow template is installed (root folder of .flowershow)', '.')
|
|
52
|
+
.action(async (projectPath) => {
|
|
53
|
+
const { default: preview } = await import ('../lib/preview.js');
|
|
54
|
+
preview(projectPath);
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
// TBD
|
|
58
|
+
program
|
|
59
|
+
.command('publish')
|
|
60
|
+
.description('publish files or directories')
|
|
61
|
+
.argument('[path]', 'path to a file or a directory', '.')
|
|
62
|
+
.option('-g, --glob <pattern>', 'glob pattern')
|
|
63
|
+
.action(async () => {
|
|
64
|
+
const { default: publish } = await import ('../lib/publish.js');
|
|
65
|
+
publish();
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
// TBD
|
|
69
|
+
program
|
|
70
|
+
.command('upgrade')
|
|
71
|
+
.description('upgrade your Flowershow template to the latest version')
|
|
72
|
+
.action(async () => {
|
|
73
|
+
const { default: upgrade } = await import ('../lib/upgrade.js');
|
|
74
|
+
upgrade();
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
program.parse();
|
package/lib/Installer.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import degit from 'degit';
|
|
8
|
+
import { execa } from 'execa';
|
|
9
|
+
import inquirer from 'inquirer';
|
|
10
|
+
|
|
11
|
+
import { exit, error, log, success, logWithSpinner, stopSpinner, pauseSpinner, resumeSpinner } from './utils/index.js';
|
|
12
|
+
|
|
13
|
+
import { FLOWERSHOW_FOLDER_NAME } from './const.js';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export default class Creator {
|
|
17
|
+
constructor(context, targetDir, template = 'default') {
|
|
18
|
+
this.context = context;
|
|
19
|
+
this.targetDir = targetDir;
|
|
20
|
+
this.template = template; // tb configurable via command option in the future
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get templateRepo() {
|
|
24
|
+
const flowershowRepo = require('../package.json').repository.url.replace("git+", "");
|
|
25
|
+
return `${flowershowRepo}/templates/${this.template}`
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async install(options) {
|
|
29
|
+
const { context, targetDir, templateRepo } = this;
|
|
30
|
+
const flowershowDir = path.resolve(targetDir, FLOWERSHOW_FOLDER_NAME)
|
|
31
|
+
|
|
32
|
+
let existsAction;
|
|
33
|
+
if (fs.existsSync(flowershowDir)) {
|
|
34
|
+
let { action } = await inquirer.prompt([
|
|
35
|
+
{
|
|
36
|
+
name: 'action',
|
|
37
|
+
type: 'list',
|
|
38
|
+
message: `Flowershow template is already installed in directory ${chalk.magenta(targetDir)}. What do you want to do?:`,
|
|
39
|
+
choices: [
|
|
40
|
+
{ name: 'Overwrite', value: 'overwrite' },
|
|
41
|
+
// { name: 'Merge', value: 'merge' },
|
|
42
|
+
{ name: 'Cancel', value: null }
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
])
|
|
46
|
+
|
|
47
|
+
if (!action) {
|
|
48
|
+
exit(0)
|
|
49
|
+
}
|
|
50
|
+
existsAction = action;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let { contentPath } = await inquirer.prompt([
|
|
54
|
+
{
|
|
55
|
+
name: 'contentPath',
|
|
56
|
+
type: 'input',
|
|
57
|
+
message: 'Path to the folder with your markdown files',
|
|
58
|
+
validate(input) {
|
|
59
|
+
const contentDir = path.resolve(context, input);
|
|
60
|
+
if (!fs.existsSync(contentDir)) {
|
|
61
|
+
error(`Directory ${contentDir} does not exist.`);
|
|
62
|
+
exit(1);
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
const contentDir = path.resolve(context, contentPath);
|
|
71
|
+
const assetFolderChoices = fs.readdirSync(contentDir, { withFileTypes: true })
|
|
72
|
+
.filter(d => d.isDirectory())
|
|
73
|
+
.map(d => ({ name: d.name, value: d.name }))
|
|
74
|
+
|
|
75
|
+
let assetsFolder = 'none';
|
|
76
|
+
|
|
77
|
+
if (!assetFolderChoices.length) {
|
|
78
|
+
const { foldersAction } = await inquirer.prompt([
|
|
79
|
+
{
|
|
80
|
+
name: 'foldersAction',
|
|
81
|
+
type: 'list',
|
|
82
|
+
message: 'There are no subfolders in your content folder, that could be used as assets folder',
|
|
83
|
+
choices: [
|
|
84
|
+
{ name: "I don't need assets folder", value: 'none' },
|
|
85
|
+
{ name: 'Cancel', value: null }
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
])
|
|
89
|
+
|
|
90
|
+
assetsFolder = foldersAction;
|
|
91
|
+
|
|
92
|
+
} else {
|
|
93
|
+
|
|
94
|
+
const { assets } = await inquirer.prompt([
|
|
95
|
+
{
|
|
96
|
+
name: 'assets',
|
|
97
|
+
type: 'list',
|
|
98
|
+
message: 'Select a folder with your assets (attachments)',
|
|
99
|
+
choices: [
|
|
100
|
+
...assetFolderChoices,
|
|
101
|
+
new inquirer.Separator(),
|
|
102
|
+
{ name: "I don't need assets folder", value: 'none' },
|
|
103
|
+
{ name: 'Cancel', value: null }
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
])
|
|
107
|
+
|
|
108
|
+
assetsFolder = assets;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!assetsFolder) {
|
|
112
|
+
exit(0)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// install flowershow template
|
|
116
|
+
logWithSpinner({ symbol: '🌷', msg: `Installing Flowershow template in ${chalk.magenta(flowershowDir)}...` });
|
|
117
|
+
|
|
118
|
+
if (existsAction === 'overwrite') {
|
|
119
|
+
fs.rmSync(flowershowDir, { recursive: true, force: true });
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
const emitter = degit(templateRepo);
|
|
124
|
+
await emitter.clone(flowershowDir);
|
|
125
|
+
} catch {
|
|
126
|
+
error(`Failed to install Flowershow template in ${flowershowDir}.`)
|
|
127
|
+
exit(1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// update content and assets symlinks
|
|
131
|
+
fs.unlinkSync(`${flowershowDir}/content`);
|
|
132
|
+
fs.symlinkSync(contentDir, `${flowershowDir}/content`);
|
|
133
|
+
|
|
134
|
+
fs.unlinkSync(`${flowershowDir}/public/assets`);
|
|
135
|
+
if (assetsFolder !== 'none') {
|
|
136
|
+
fs.symlinkSync(path.resolve(contentDir, assetsFolder), `${flowershowDir}/public/${assetsFolder}`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// // if there is no index.md file, create one
|
|
140
|
+
if (!fs.existsSync(`${contentPath}/index.md`)) {
|
|
141
|
+
const homePageContent = '# Welcome to my Flowershow site!';
|
|
142
|
+
fs.writeFile(`${contentPath}/index.md`, homePageContent, { flag: 'a' }, err => {});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// // if there is no config.js file, create one
|
|
146
|
+
if (!fs.existsSync(`${contentPath}/config.js`)) {
|
|
147
|
+
fs.writeFile(`${contentPath}/config.js`, '{}', { flag: 'a' }, err => {});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// install flowershow dependencies
|
|
151
|
+
logWithSpinner({ symbol: '🌸', msg: `Installing Flowershow dependencies...` });
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
await execa('npm', [ 'set-script', 'prepare', '' ], { cwd: flowershowDir });
|
|
155
|
+
const { stdout, stderr } = await execa('npm', [ 'install'], { cwd: flowershowDir });
|
|
156
|
+
log(stdout);
|
|
157
|
+
log(stderr);
|
|
158
|
+
stopSpinner();
|
|
159
|
+
success("Successfuly installed Flowershow!")
|
|
160
|
+
} catch (err) {
|
|
161
|
+
error(
|
|
162
|
+
`Installing dependencies failed: ${err.message}`
|
|
163
|
+
);
|
|
164
|
+
exit(err.exitCode);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
package/lib/build.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { execa } from 'execa';
|
|
4
|
+
|
|
5
|
+
import { exit, error, log } from './utils/index.js';
|
|
6
|
+
import { FLOWERSHOW_FOLDER_NAME } from './const.js';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export default async function build(dir) {
|
|
10
|
+
const flowershowDir = path.resolve(dir, FLOWERSHOW_FOLDER_NAME);
|
|
11
|
+
|
|
12
|
+
// check if flowershow is installed
|
|
13
|
+
if (!fs.existsSync(flowershowDir)) {
|
|
14
|
+
error(`Directory ${flowershowDir} does not exist.`)
|
|
15
|
+
exit(1);
|
|
16
|
+
}
|
|
17
|
+
const subprocess = execa('npm', [ 'run', 'build' ], { cwd: flowershowDir });
|
|
18
|
+
|
|
19
|
+
subprocess.stdout.pipe(process.stdout);
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { execa } from 'execa';
|
|
4
|
+
|
|
5
|
+
import { exit, error, log } from './utils/index.js';
|
|
6
|
+
import { FLOWERSHOW_FOLDER_NAME } from './const.js';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export default async function buildStatic(dir) {
|
|
10
|
+
const flowershowDir = path.resolve(dir, FLOWERSHOW_FOLDER_NAME);
|
|
11
|
+
|
|
12
|
+
const subprocess = execa('npm', [ 'run', 'export' ], { cwd: flowershowDir });
|
|
13
|
+
|
|
14
|
+
subprocess.stdout.pipe(process.stdout);
|
|
15
|
+
}
|
package/lib/const.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const FLOWERSHOW_FOLDER_NAME = '.flowershow';
|
package/lib/install.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import inquirer from 'inquirer';
|
|
5
|
+
|
|
6
|
+
import Installer from './Installer.js';
|
|
7
|
+
import { error, log, exit } from './utils/index.js';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export default async function install(dir, options) {
|
|
11
|
+
const currentDir = process.cwd();
|
|
12
|
+
const inCurrentDir = dir === '.';
|
|
13
|
+
|
|
14
|
+
if (inCurrentDir) {
|
|
15
|
+
const { ok } = await inquirer.prompt([
|
|
16
|
+
{
|
|
17
|
+
name: "ok",
|
|
18
|
+
type: "confirm",
|
|
19
|
+
message: "Create Flowershow project in current directory?"
|
|
20
|
+
}
|
|
21
|
+
])
|
|
22
|
+
if (!ok) {
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const targetDir = path.resolve(dir);
|
|
28
|
+
|
|
29
|
+
if (!fs.existsSync(targetDir)) {
|
|
30
|
+
error(`Directory ${targetDir} does not exist.`);
|
|
31
|
+
exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const installer = new Installer(currentDir, targetDir);
|
|
35
|
+
await installer.install(options);
|
|
36
|
+
}
|
package/lib/preview.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { execa } from 'execa';
|
|
4
|
+
|
|
5
|
+
import { exit, error, log } from './utils/index.js';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import { FLOWERSHOW_FOLDER_NAME } from './const.js';
|
|
9
|
+
|
|
10
|
+
export default async function preview(dir) {
|
|
11
|
+
const flowershowDir = path.resolve(dir, FLOWERSHOW_FOLDER_NAME);
|
|
12
|
+
|
|
13
|
+
// check if flowershow is installed
|
|
14
|
+
if (!fs.existsSync(flowershowDir)) {
|
|
15
|
+
error(`Directory ${flowershowDir} does not exist.`)
|
|
16
|
+
exit(1);
|
|
17
|
+
}
|
|
18
|
+
const subprocess = execa('npm', [ 'run', 'dev' ], { cwd: flowershowDir });
|
|
19
|
+
|
|
20
|
+
subprocess.stdout.pipe(process.stdout);
|
|
21
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
|
|
3
|
+
export const log = (msg = '') => {
|
|
4
|
+
console.log(msg);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const info = (msg) => {
|
|
8
|
+
console.log(`${chalk.bgBlueBright.black(' INFO ')} ${msg}`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const error = (msg) => {
|
|
12
|
+
console.error(`\n${chalk.bgRed(' ERROR ')} ${chalk.red(msg)}`)
|
|
13
|
+
if (msg instanceof Error) {
|
|
14
|
+
console.error(msg.stack)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const success = (msg) => {
|
|
19
|
+
console.log(`${chalk.blue('🎊')} ${msg}`);
|
|
20
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import ora from 'ora';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
|
|
4
|
+
const spinner = ora({ color: 'magenta' });
|
|
5
|
+
let lastMsg = null;
|
|
6
|
+
let isPaused = false
|
|
7
|
+
|
|
8
|
+
export const logWithSpinner = ({ msg, symbol }) => {
|
|
9
|
+
if (!symbol) {
|
|
10
|
+
symbol = chalk.green('✔')
|
|
11
|
+
}
|
|
12
|
+
if (lastMsg) {
|
|
13
|
+
spinner.stopAndPersist({
|
|
14
|
+
symbol: lastMsg.symbol,
|
|
15
|
+
text: lastMsg.text
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
spinner.text = ' ' + msg
|
|
19
|
+
lastMsg = {
|
|
20
|
+
symbol: symbol + ' ',
|
|
21
|
+
text: msg
|
|
22
|
+
}
|
|
23
|
+
spinner.start()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const stopSpinner = () => {
|
|
27
|
+
if (!spinner.isSpinning) {
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (lastMsg) {
|
|
32
|
+
spinner.stopAndPersist({
|
|
33
|
+
symbol: lastMsg.symbol,
|
|
34
|
+
text: lastMsg.text
|
|
35
|
+
})
|
|
36
|
+
} else {
|
|
37
|
+
spinner.stop()
|
|
38
|
+
}
|
|
39
|
+
lastMsg = null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const pauseSpinner = () => {
|
|
43
|
+
if (spinner.isSpinning) {
|
|
44
|
+
spinner.stop()
|
|
45
|
+
isPaused = true
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const resumeSpinner = () => {
|
|
50
|
+
if (isPaused) {
|
|
51
|
+
spinner.start()
|
|
52
|
+
isPaused = false
|
|
53
|
+
}
|
|
54
|
+
}
|
package/package.json
CHANGED
|
@@ -1,31 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowershow",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"engines": {
|
|
5
|
-
"node": ">=14.16"
|
|
6
|
-
},
|
|
7
|
-
"author": "Rufus Pollock",
|
|
3
|
+
"version": "0.0.5",
|
|
8
4
|
"description": "Publish your digital garden",
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"bin": "./index.js",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
5
|
+
"bin": {
|
|
6
|
+
"flowershow": "bin/flowershow.js"
|
|
14
7
|
},
|
|
15
8
|
"repository": {
|
|
16
9
|
"type": "git",
|
|
17
10
|
"url": "git+https://github.com/flowershow/flowershow",
|
|
18
|
-
"directory": "packages/
|
|
11
|
+
"directory": "packages/cli"
|
|
19
12
|
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"flowershow",
|
|
15
|
+
"cli"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "./e2e/bats/bin/bats ./e2e/test.bats --verbose-run"
|
|
19
|
+
},
|
|
20
|
+
"author": "Rufus Pollock",
|
|
20
21
|
"license": "MIT",
|
|
21
22
|
"bugs": {
|
|
22
23
|
"url": "https://github.com/flowershow/flowershow/issues"
|
|
23
24
|
},
|
|
24
25
|
"homepage": "https://github.com/flowershow/flowershow#readme",
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
25
29
|
"dependencies": {
|
|
26
|
-
"chalk": "^
|
|
30
|
+
"chalk": "^5.0.1",
|
|
27
31
|
"commander": "^9.4.0",
|
|
28
|
-
"
|
|
32
|
+
"degit": "^2.8.4",
|
|
33
|
+
"execa": "^6.1.0",
|
|
34
|
+
"inquirer": "^9.1.1",
|
|
35
|
+
"ora": "^6.1.2",
|
|
36
|
+
"validate-npm-package-name": "^4.0.0"
|
|
29
37
|
},
|
|
30
|
-
"type": "module"
|
|
38
|
+
"type": "module",
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=12.2.0 || >=14.13.0"
|
|
41
|
+
}
|
|
31
42
|
}
|
package/commands/build.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const log = console.log;
|
|
5
|
-
|
|
6
|
-
export default function build () {
|
|
7
|
-
log(chalk.redBright.bold('Command under construction...\n'));
|
|
8
|
-
log(chalk.blue(
|
|
9
|
-
'Check ' +
|
|
10
|
-
chalk.green.underline('https://flowershow.app') +
|
|
11
|
-
' to learn more about Flowershow development stage and subscribe to get notified when it\'s ready!'))
|
|
12
|
-
}
|
package/commands/create.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const log = console.log;
|
|
5
|
-
|
|
6
|
-
export default function create () {
|
|
7
|
-
log(chalk.redBright.bold('Command under construction...\n'));
|
|
8
|
-
log(chalk.blue(
|
|
9
|
-
'Check ' +
|
|
10
|
-
chalk.green.underline('https://flowershow.app') +
|
|
11
|
-
' to learn more about Flowershow development stage and subscribe to get notified when it\'s ready!'))
|
|
12
|
-
}
|
package/index.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
#! /usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { Command } from "commander";
|
|
4
|
-
|
|
5
|
-
import publish from './commands/publish.js';
|
|
6
|
-
import create from './commands/create.js';
|
|
7
|
-
import build from './commands/build.js';
|
|
8
|
-
import upgrade from './commands/upgrade.js';
|
|
9
|
-
|
|
10
|
-
const program = new Command();
|
|
11
|
-
|
|
12
|
-
program
|
|
13
|
-
.name('flowershow')
|
|
14
|
-
.description('(Package under development)\nCLI tool for creating, publishing and upgrading Flowershow apps')
|
|
15
|
-
.version('0.0.1');
|
|
16
|
-
|
|
17
|
-
program
|
|
18
|
-
.command('publish')
|
|
19
|
-
.description('Publish files or directories')
|
|
20
|
-
.argument('[path]', 'path to a file or a directory', '.')
|
|
21
|
-
.option('-g, --glob <pattern>', 'glob pattern')
|
|
22
|
-
.action(publish);
|
|
23
|
-
|
|
24
|
-
program
|
|
25
|
-
.command('create')
|
|
26
|
-
.description('Create a new app template')
|
|
27
|
-
.action(create);
|
|
28
|
-
|
|
29
|
-
program
|
|
30
|
-
.command('build')
|
|
31
|
-
.description('Build Flowershow website')
|
|
32
|
-
.action(build);
|
|
33
|
-
|
|
34
|
-
program
|
|
35
|
-
.command('upgrade')
|
|
36
|
-
.description('Upgrade your Flowershow template to the latest version')
|
|
37
|
-
.action(upgrade);
|
|
38
|
-
|
|
39
|
-
program.parse();
|
package/upgrade.sh
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# upgrade an existing standard nextjs site
|
|
2
|
-
|
|
3
|
-
npx degit flowershow/flowershow/templates/default --force
|
|
4
|
-
|
|
5
|
-
# files that we should keep the original (probably)
|
|
6
|
-
git checkout README.md
|
|
7
|
-
git checkout .gitignore
|
|
8
|
-
|
|
9
|
-
# stuff that shouldn't be there
|
|
10
|
-
rm .env.example
|
|
11
|
-
rm -Rf tests
|
|
12
|
-
rm netlify.toml
|
|
13
|
-
rm netlify.toml
|
|
14
|
-
# data seems to be exampleData
|
|
15
|
-
rm -Rf data
|
|
16
|
-
rm -Rf components/TempCallout.jsx
|
|
17
|
-
|
|
18
|
-
# set up custom components
|
|
19
|
-
rm -Rf components/custom
|
|
20
|
-
|
|
21
|
-
# set up assets
|
|
22
|
-
mkdir -p content/assets
|
|
23
|
-
rm public/assets
|
|
24
|
-
ln -s content/assets public/assets
|
|
25
|
-
|
|
26
|
-
# notes
|
|
27
|
-
echo "You may need to hand merge the following files:"
|
|
28
|
-
echo "pacakge.json, package-lock.json"
|