create-uix-app 1.4.2 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +36 -25
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-uix-app",
3
3
  "description": "Creates a starter project for UIx web app",
4
- "version": "1.4.2",
4
+ "version": "1.5.0",
5
5
  "author": {
6
6
  "name": "Roman Liutikov"
7
7
  },
package/src/index.js CHANGED
@@ -20,12 +20,13 @@ program
20
20
  .argument("<project-name>", "directory where a project will be created")
21
21
  .option("--re-frame", "add re-frame setup")
22
22
  .option("--react-native", "setup in existing React Native project")
23
- .option("--expo", "create a new React Native project using Expo");
23
+ .option("--expo", "create a new React Native project using Expo")
24
+ .option("--fly-io", "creates full stack app with Fly.io");
24
25
 
25
26
  program.parse();
26
27
 
27
28
  const [projectName] = program.args;
28
- const { reFrame, reactNative, expo } = program.opts();
29
+ const { reFrame, reactNative, expo, flyIo } = program.opts();
29
30
 
30
31
  const masterUrl =
31
32
  "https://github.com/pitch-io/uix-starter/archive/master.tar.gz";
@@ -35,6 +36,8 @@ const reactNativeUrl =
35
36
  "https://github.com/pitch-io/uix-starter/archive/react-native.tar.gz";
36
37
  const reactNativeExpoUrl =
37
38
  "https://github.com/pitch-io/uix-starter/archive/react-native-expo.tar.gz";
39
+ const flyioUrl =
40
+ "https://github.com/pitch-io/uix-starter/archive/fly-io.tar.gz";
38
41
 
39
42
  let downloadUrl;
40
43
 
@@ -44,13 +47,25 @@ if (reactNative) {
44
47
  downloadUrl = reactNativeExpoUrl;
45
48
  } else if (reFrame) {
46
49
  downloadUrl = reframeUrl;
50
+ } else if (flyIo) {
51
+ downloadUrl = flyioUrl;
47
52
  } else {
48
53
  downloadUrl = masterUrl;
49
54
  }
50
55
 
51
- if (!projectName && !reFrame && !reactNative && !expo) {
56
+ if (!projectName && !reFrame && !reactNative && !expo && !flyIo) {
52
57
  program.help();
53
58
  } else {
59
+ let folderName;
60
+ if (reFrame) {
61
+ folderName = "uix-starter-re-frame";
62
+ } else if (expo) {
63
+ folderName = "uix-starter-react-native-expo";
64
+ } else if (flyIo) {
65
+ folderName = "uix-starter-fly-io";
66
+ } else {
67
+ pfolderName = "uix-starter-main";
68
+ }
54
69
  console.log(
55
70
  "Downloading project template from https://github.com/pitch-io/uix-starter..."
56
71
  );
@@ -66,14 +81,7 @@ if (!projectName && !reFrame && !reactNative && !expo) {
66
81
  .on("end", () => {
67
82
  if (!reactNative) {
68
83
  fs.renameSync(
69
- path.join(
70
- process.cwd(),
71
- reFrame
72
- ? "uix-starter-re-frame"
73
- : expo
74
- ? "uix-starter-react-native-expo"
75
- : "uix-starter-main"
76
- ),
84
+ path.join(process.cwd(), folderName),
77
85
  path.join(process.cwd(), projectName)
78
86
  );
79
87
  }
@@ -129,13 +137,6 @@ if (!projectName && !reFrame && !reactNative && !expo) {
129
137
  if (err) {
130
138
  console.error(err);
131
139
  } else {
132
- console.log();
133
- console.log("Using:");
134
- console.log(
135
- Object.entries(pkgjson.dependencies)
136
- .map(([k, v]) => `${k}@${v}`)
137
- .join("\n")
138
- );
139
140
  console.log();
140
141
  console.log(
141
142
  "npm run dev # run dev build with Expo and cljs build in watch mode"
@@ -247,23 +248,33 @@ app/`
247
248
  .filter((l) => !l.startsWith("Template project"))
248
249
  .join("\n")
249
250
  );
251
+ const toml = fs.readFileSync(
252
+ path.join(process.cwd(), projectName, "fly.toml"),
253
+ "utf8"
254
+ );
255
+ fs.writeFileSync(
256
+ path.join(process.cwd(), projectName, "fly.toml"),
257
+ toml.replace("uix-starter", projectName)
258
+ );
250
259
  console.log("Installing dependencies...");
251
260
  const pDeps = exec(`cd ${projectName} && npm install`, (err) => {
252
261
  if (err) {
253
262
  console.error(err);
254
263
  } else {
255
264
  console.log();
256
- console.log("Using:");
257
265
  console.log(
258
- Object.entries(pkgjson.devDependencies)
259
- .map(([k, v]) => `${k}@${v}`)
260
- .join("\n")
266
+ "=========================\n" +
267
+ "Development:\n" +
268
+ "npm run dev # run dev build in watch mode with CLJS REPL\n" +
269
+ "clojure -M -m app.core # or run the server from REPL\n\n"
261
270
  );
262
- console.log();
263
271
  console.log(
264
- "npm run dev # run dev build in watch mode with CLJS REPL"
272
+ "=========================\n" +
273
+ "Deployment:\n" +
274
+ "install Fly.io CLI https://fly.io/docs/flyctl/install/\n" +
275
+ "fly app create uix-starter # create a new Fly.io app, run once\n" +
276
+ "fly deploy"
265
277
  );
266
- console.log("npm run release # build production bundle");
267
278
  }
268
279
  });
269
280
  pDeps.stdout.pipe(process.stdout);