create-uix-app 1.0.1 → 1.2.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 +2 -2
  2. package/src/index.js +13 -4
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-uix-app",
3
3
  "description": "Creates a starter project for UIx2 web app",
4
- "version": "1.0.1",
4
+ "version": "1.2.0",
5
5
  "author": {
6
6
  "name": "Roman Liutikov"
7
7
  },
@@ -19,6 +19,6 @@
19
19
  "axios": "^1.3.4",
20
20
  "commander": "^10.0.0",
21
21
  "prettier": "^2.8.7",
22
- "tar-pack": "^3.4.1"
22
+ "tar": "^6.1.13"
23
23
  }
24
24
  }
package/src/index.js CHANGED
@@ -3,7 +3,7 @@ const fs = require("fs");
3
3
  const path = require("path");
4
4
  const { exec } = require("child_process");
5
5
  const axios = require("axios");
6
- const pack = require("tar-pack");
6
+ const tar = require("tar");
7
7
  const { program } = require("commander");
8
8
  const prettier = require("prettier");
9
9
  const pkg = require("../package.json");
@@ -12,11 +12,20 @@ program
12
12
  .name(pkg.name)
13
13
  .description(pkg.description)
14
14
  .version(pkg.version)
15
- .argument("<project-name>", "directory where a project will be created");
15
+ .argument("<project-name>", "directory where a project will be created")
16
+ .option("--re-frame", "add re-frame setup");
16
17
 
17
18
  program.parse();
18
19
 
19
20
  const [projectName] = program.args;
21
+ const { reFrame } = program.opts();
22
+
23
+ const masterUrl =
24
+ "https://github.com/pitch-io/uix-starter/archive/master.tar.gz";
25
+ const reframeUrl =
26
+ "https://github.com/pitch-io/uix-starter/archive/re-frame.tar.gz";
27
+
28
+ const downloadUrl = reFrame ? reframeUrl : masterUrl;
20
29
 
21
30
  if (!projectName) {
22
31
  program.help();
@@ -25,7 +34,7 @@ if (!projectName) {
25
34
  "Downloading project template from https://github.com/pitch-io/uix-starter..."
26
35
  );
27
36
  axios
28
- .get("https://github.com/pitch-io/uix-starter/archive/master.tar.gz", {
37
+ .get(downloadUrl, {
29
38
  responseType: "stream",
30
39
  })
31
40
  .then(
@@ -33,7 +42,7 @@ if (!projectName) {
33
42
  new Promise((resolve, reject) => {
34
43
  console.log(`Unpacking into ${projectName}...`);
35
44
  r.data.pipe(
36
- pack.unpack(projectName, (err) => {
45
+ tar.extract(projectName, (err) => {
37
46
  if (err) {
38
47
  reject(err);
39
48
  } else {