@adbayb/create 0.4.0 → 0.8.0

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
@@ -3,6 +3,41 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.8.0](https://github.com/adbayb/stack/compare/v0.7.0...v0.8.0) (2021-11-23)
7
+
8
+
9
+ ### Features
10
+
11
+ * **create:** use husky v4 ([982c8be](https://github.com/adbayb/stack/commit/982c8bea835f1610d578175071b6d52e83cc8e92))
12
+
13
+
14
+
15
+
16
+
17
+ # [0.7.0](https://github.com/adbayb/stack/compare/v0.6.1...v0.7.0) (2021-07-17)
18
+
19
+ ### Features
20
+
21
+ - update dependencies ([6efb186](https://github.com/adbayb/stack/commit/6efb1864152fc7c1a2a697e0795fd2f104cfd09e))
22
+
23
+ # [0.6.0](https://github.com/adbayb/stack/compare/v0.5.0...v0.6.0) (2021-04-05)
24
+
25
+ ### Features
26
+
27
+ - **terminal-kit:** add library ([4c515b0](https://github.com/adbayb/stack/commit/4c515b0094beadf12d7169dc658a7de8917bfbde))
28
+
29
+ # [0.5.0](https://github.com/adbayb/create/compare/v0.4.0...v0.5.0) (2021-04-03)
30
+
31
+ ### Bug Fixes
32
+
33
+ - **eslint-config:** make padding rule compatible with import rule ([80ac540](https://github.com/adbayb/create/commit/80ac5402c6cb319d669d3af261d6b69b6bf49486))
34
+
35
+ ### Features
36
+
37
+ - **create:** remove adbayb pkg from create ([885f3d0](https://github.com/adbayb/create/commit/885f3d09f99cfbfd84729331bf06c2de10eb2bfe))
38
+ - **create:** switch from npm to yarn ([f0021a4](https://github.com/adbayb/create/commit/f0021a4241e04bdca823087a41bb3dac6b040309))
39
+ - **scripts:** add clean command ([977e83f](https://github.com/adbayb/create/commit/977e83fc629a021b5b8f5d501ec363ecb5a5f4c2))
40
+
6
41
  # [0.4.0](https://github.com/adbayb/create/compare/v0.3.0...v0.4.0) (2021-03-27)
7
42
 
8
43
  **Note:** Version bump only for package @adbayb/create
package/README.md CHANGED
@@ -4,12 +4,6 @@
4
4
  </div>
5
5
  <p></p>
6
6
 
7
- Custom configuration presets including:
8
-
9
- - [✍️ Linting](../eslint-config)
10
- - [💄 Formatting](../prettier-config)
11
- - [⚙️ Typing](../ts-config)
12
-
13
7
  ## Usage
14
8
 
15
9
  - `cd my-project-root-folder`
package/cli/constants.js CHANGED
@@ -1,7 +1,5 @@
1
1
  const path = require("path");
2
2
 
3
- // @todo: allow padding-line-between-statements breakline after require (to avoid conflicting with import breakline rule)
4
- // eslint-disable-next-line padding-line-between-statements
5
3
  const PROJECT_FOLDER = process.cwd();
6
4
  const PACKAGE_FOLDER = path.resolve(__dirname, "../");
7
5
  const TEMPLATES_FOLDER = path.join(PACKAGE_FOLDER, "templates");
package/cli/helpers.js CHANGED
@@ -1,10 +1,8 @@
1
1
  const childProcess = require("child_process");
2
- const path = require("path");
3
2
  const fs = require("fs");
4
-
3
+ const path = require("path");
5
4
  const { PROJECT_FOLDER } = require("./constants");
6
5
 
7
- // eslint-disable-next-line padding-line-between-statements
8
6
  const fsPromises = fs.promises;
9
7
  const isObject = (value) => {
10
8
  return value !== null && typeof value === "object";
package/cli/index.js CHANGED
@@ -3,21 +3,29 @@
3
3
  const path = require("path");
4
4
  const fs = require("fs");
5
5
  const ora = require("ora");
6
-
7
6
  const { exec, merge, writeFileToProject, logger } = require("./helpers");
8
7
  const { PROJECT_FOLDER, TEMPLATES_FOLDER } = require("./constants");
9
8
 
10
- // eslint-disable-next-line padding-line-between-statements
11
9
  const fsPromises = fs.promises;
10
+
12
11
  const processPkg = async () => {
13
- const [repositoryUrl, rootPath] = await Promise.all([
14
- exec("git remote get-url --push origin"),
15
- exec("git rev-parse --show-toplevel"),
16
- ]);
12
+ let rootPath = PROJECT_FOLDER;
13
+ let repositoryUrl = "";
14
+
15
+ try {
16
+ [repositoryUrl, rootPath] = await Promise.all([
17
+ exec("git remote get-url --push origin"),
18
+ exec("git rev-parse --show-toplevel"),
19
+ ]);
20
+ } catch (error) {
21
+ // Nothing
22
+ }
23
+
17
24
  const isMonorepo = rootPath !== PROJECT_FOLDER;
18
25
  const directory = isMonorepo
19
26
  ? PROJECT_FOLDER.replace(new RegExp(`^${rootPath}/`), "")
20
27
  : "";
28
+
21
29
  let pkgConfig = {
22
30
  author: {
23
31
  name: "Ayoub Adib",
@@ -31,12 +39,10 @@ const processPkg = async () => {
31
39
  },
32
40
  license: "MIT",
33
41
  scripts: {
34
- "check:format":
35
- "prettier . --ignore-path .gitignore --ignore-path .prettierignore",
36
- "check:lint": "eslint . --ignore-path .gitignore",
37
- "check:types": "tsc --noEmit",
38
- format: "npm run check:format -- --write",
39
- lint: "npm run check:lint -- --fix",
42
+ verify: "yarn lint & tsc --noEmit",
43
+ fix: "yarn lint --fix",
44
+ lint: "eslint . --ignore-path .gitignore",
45
+ format: "prettier . --ignore-path .gitignore --ignore-path .prettierignore --write",
40
46
  },
41
47
  prettier: "@adbayb/prettier-config",
42
48
  eslintConfig: {
@@ -49,10 +55,11 @@ const processPkg = async () => {
49
55
  },
50
56
  },
51
57
  "lint-staged": {
52
- "**/*.{js,jsx,ts,tsx}": ["npm run lint"],
53
- "**/*.{json,md,mdx,html,css}": ["npm run format"],
58
+ "**/*.{js,jsx,ts,tsx}": ["yarn lint"],
59
+ "**/*.{json,md,mdx,html,css}": ["yarn format"],
54
60
  },
55
61
  };
62
+
56
63
  const targetPkg = path.join(PROJECT_FOLDER, "package.json");
57
64
 
58
65
  if (fs.existsSync(targetPkg)) {
@@ -92,13 +99,22 @@ const copyTemplates = async () => {
92
99
  );
93
100
  };
94
101
 
95
- const install = () => {
96
- return exec("npm i @adbayb/create@latest --save-dev");
102
+ const install = async () => {
103
+ await exec("yarn add typescript@latest --dev");
104
+ await exec("yarn add eslint@latest --dev");
105
+ await exec("yarn add prettier@latest --dev");
106
+ await exec("yarn add @adbayb/eslint-config@latest --dev");
107
+ await exec("yarn add @adbayb/prettier-config@latest --dev");
108
+ await exec("yarn add @adbayb/ts-config@latest --dev");
97
109
  };
98
110
 
99
111
  const clean = async () => {
100
- await exec("npm run lint");
101
- await exec("npm run format");
112
+ try {
113
+ await exec("yarn lint");
114
+ await exec("yarn format");
115
+ } catch (error) {
116
+ // @note: encapsulate lint/format logic to be error tolerant in case of new project without any files
117
+ }
102
118
  };
103
119
 
104
120
  const run = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adbayb/create",
3
- "version": "0.4.0",
3
+ "version": "0.8.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,17 +21,14 @@
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",
24
- "url": "https://github.com/adbayb/create.git",
24
+ "url": "https://github.com/adbayb/stack.git",
25
25
  "directory": "packages/create"
26
26
  },
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
- "@adbayb/eslint-config": "0.4.0",
30
- "@adbayb/prettier-config": "0.4.0",
31
- "@adbayb/ts-config": "0.4.0",
32
- "husky": "5.2.0",
33
- "lint-staged": "10.5.4",
34
- "ora": "5.4.0"
29
+ "husky": "4.3.8",
30
+ "lint-staged": "12.1.2",
31
+ "ora": "5.4.1"
35
32
  },
36
- "gitHead": "a2a7baed7eb237de00919586c101a1026bcb90e9"
33
+ "gitHead": "5fcadca7676391c7b48105d068edeabe8cc3641e"
37
34
  }