create-uix-app 1.2.1 → 1.2.2

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 +19 -13
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.2.1",
4
+ "version": "1.2.2",
5
5
  "author": {
6
6
  "name": "Roman Liutikov"
7
7
  },
package/src/index.js CHANGED
@@ -40,35 +40,41 @@ if (!projectName) {
40
40
  .then(
41
41
  (r) =>
42
42
  new Promise((resolve, reject) => {
43
- console.log(`Unpacking into ${projectName}...`);
44
- r.data.pipe(
45
- tar.extract({ file: projectName }, (err) => {
46
- if (err) {
47
- reject(err);
48
- } else {
49
- resolve();
50
- }
43
+ r.data
44
+ .pipe(tar.extract({ cwd: process.cwd() }))
45
+ .on("end", () => {
46
+ fs.renameSync(
47
+ path.join(
48
+ process.cwd(),
49
+ reFrame ? "uix-starter-re-frame" : "uix-starter-main"
50
+ ),
51
+ path.join(process.cwd(), projectName)
52
+ );
53
+ resolve();
51
54
  })
52
- );
55
+ .on("error", (err) => reject(err));
53
56
  })
54
57
  )
55
58
  .then(() => {
56
59
  const pkgjson = JSON.parse(
57
- fs.readFileSync(path.join(projectName, "package.json"), "utf8")
60
+ fs.readFileSync(
61
+ path.join(process.cwd(), projectName, "package.json"),
62
+ "utf8"
63
+ )
58
64
  );
59
65
  pkgjson.name = projectName;
60
66
  fs.writeFileSync(
61
- path.join(projectName, "package.json"),
67
+ path.join(process.cwd(), projectName, "package.json"),
62
68
  prettier.format(JSON.stringify(pkgjson), {
63
69
  parser: "json",
64
70
  })
65
71
  );
66
72
  const readme = fs.readFileSync(
67
- path.join(projectName, "README.md"),
73
+ path.join(process.cwd(), projectName, "README.md"),
68
74
  "utf8"
69
75
  );
70
76
  fs.writeFileSync(
71
- path.join(projectName, "README.md"),
77
+ path.join(process.cwd(), projectName, "README.md"),
72
78
  readme
73
79
  .replace("uix-starter", projectName)
74
80
  .split("\n")