@abinnovision/prettier-config 1.1.0 → 2.1.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
@@ -1,35 +1,48 @@
1
1
  # Changelog
2
2
 
3
- ## [1.1.0](https://github.com/abinnovision/js-commons/compare/prettier-config-v1.0.2...prettier-config-v1.1.0) (2023-04-21)
3
+ ## [2.1.0](https://github.com/abinnovision/js-commons/compare/prettier-config-v2.0.0...prettier-config-v2.1.0) (2024-08-05)
4
4
 
5
5
 
6
6
  ### Features
7
7
 
8
- * add shared prettier config ([fc08209](https://github.com/abinnovision/js-commons/commit/fc082096c0d1553d0bb64cf67d4b1ef3f39e91f3))
8
+ * migrate to esm ([#278](https://github.com/abinnovision/js-commons/issues/278)) ([fed850d](https://github.com/abinnovision/js-commons/commit/fed850d979f7ba83fae75adadcfd0024f2acd242))
9
+
10
+ ## [2.0.0](https://github.com/abinnovision/js-commons/compare/prettier-config-v1.1.0...prettier-config-v2.0.0) (2023-11-03)
11
+
12
+
13
+ ### ⚠ BREAKING CHANGES
9
14
 
15
+ * will drop support for legacy eslint configs
16
+
17
+ ### Features
18
+
19
+ * migrate to eslint flat config ([#93](https://github.com/abinnovision/js-commons/issues/93)) ([7568ba1](https://github.com/abinnovision/js-commons/commit/7568ba1782f912357e18619ab3e4e56a0c738a1c))
20
+
21
+ ## [1.1.0](https://github.com/abinnovision/js-commons/compare/prettier-config-v1.0.2...prettier-config-v1.1.0) (2023-04-21)
22
+
23
+ ### Features
24
+
25
+ - add shared prettier config ([fc08209](https://github.com/abinnovision/js-commons/commit/fc082096c0d1553d0bb64cf67d4b1ef3f39e91f3))
10
26
 
11
27
  ### Bug Fixes
12
28
 
13
- * add correct license to all packages ([af7343d](https://github.com/abinnovision/js-commons/commit/af7343dbdb93329a0321a369f81e9b37da9068fa))
14
- * emit declarations ([616f817](https://github.com/abinnovision/js-commons/commit/616f817ca7701e160325e1e81d633df345244cc3))
29
+ - add correct license to all packages ([af7343d](https://github.com/abinnovision/js-commons/commit/af7343dbdb93329a0321a369f81e9b37da9068fa))
30
+ - emit declarations ([616f817](https://github.com/abinnovision/js-commons/commit/616f817ca7701e160325e1e81d633df345244cc3))
15
31
 
16
32
  ## [1.0.2](https://github.com/abinnovision/js-commons/compare/prettier-config-v1.0.1...prettier-config-v1.0.2) (2023-04-21)
17
33
 
18
-
19
34
  ### Bug Fixes
20
35
 
21
- * emit declarations ([616f817](https://github.com/abinnovision/js-commons/commit/616f817ca7701e160325e1e81d633df345244cc3))
36
+ - emit declarations ([616f817](https://github.com/abinnovision/js-commons/commit/616f817ca7701e160325e1e81d633df345244cc3))
22
37
 
23
38
  ## [1.0.1](https://github.com/abinnovision/js-commons/compare/prettier-config-v1.0.0...prettier-config-v1.0.1) (2023-04-21)
24
39
 
25
-
26
40
  ### Bug Fixes
27
41
 
28
- * add correct license to all packages ([af7343d](https://github.com/abinnovision/js-commons/commit/af7343dbdb93329a0321a369f81e9b37da9068fa))
42
+ - add correct license to all packages ([af7343d](https://github.com/abinnovision/js-commons/commit/af7343dbdb93329a0321a369f81e9b37da9068fa))
29
43
 
30
44
  ## 1.0.0 (2023-02-24)
31
45
 
32
-
33
46
  ### Features
34
47
 
35
- * add shared prettier config ([fc08209](https://github.com/abinnovision/js-commons/commit/fc082096c0d1553d0bb64cf67d4b1ef3f39e91f3))
48
+ - add shared prettier config ([fc08209](https://github.com/abinnovision/js-commons/commit/fc082096c0d1553d0bb64cf67d4b1ef3f39e91f3))
package/README.md CHANGED
@@ -7,8 +7,7 @@ is compatible with most editors.
7
7
  ## Installation
8
8
 
9
9
  ```shell
10
- yarn add --dev \
11
- @abinnovision/prettier-config
10
+ yarn add --dev @abinnovision/prettier-config
12
11
  ```
13
12
 
14
13
  ## EditorConfig
@@ -29,9 +28,9 @@ with the one defined in this project.
29
28
  ```json5
30
29
  {
31
30
  // ...
32
- "scripts": {
31
+ scripts: {
33
32
  // ...
34
- "postinstall": "sync-editorconfig"
33
+ postinstall: "sync-editorconfig",
35
34
  },
36
35
  // ...
37
36
  }
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+
26
+ // src/bin/sync-editorconfig.ts
27
+ var fs = __toESM(require("fs/promises"), 1);
28
+ var path = __toESM(require("path"), 1);
29
+ var process = __toESM(require("process"), 1);
30
+ var DISABLE_ENV_VAR = "DISABLE_SYNC_EDITORCONFIG";
31
+ (async function() {
32
+ if ([true, "true"].includes(process.env[DISABLE_ENV_VAR] ?? false)) {
33
+ return;
34
+ }
35
+ await fs.copyFile(
36
+ path.resolve(__dirname, "../../assets/.editorconfig"),
37
+ path.resolve(process.cwd(), ".editorconfig")
38
+ );
39
+ })();
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
- import type { Config } from "prettier";
1
+ import { Config } from 'prettier';
2
+
2
3
  declare const config: Config;
3
- export = config;
4
+
5
+ export { config as default };
package/dist/index.js CHANGED
@@ -1,12 +1,15 @@
1
- "use strict";
1
+ // src/index.ts
2
2
  var config = {
3
- printWidth: 80,
4
- useTabs: true,
5
- tabWidth: 2,
6
- semi: true,
7
- trailingComma: "es5",
8
- bracketSpacing: true,
9
- arrowParens: "always",
10
- endOfLine: "lf",
3
+ printWidth: 80,
4
+ useTabs: true,
5
+ tabWidth: 2,
6
+ semi: true,
7
+ trailingComma: "es5",
8
+ bracketSpacing: true,
9
+ arrowParens: "always",
10
+ endOfLine: "lf"
11
+ };
12
+ var src_default = config;
13
+ export {
14
+ src_default as default
11
15
  };
12
- module.exports = config;
package/package.json CHANGED
@@ -1,31 +1,53 @@
1
1
  {
2
2
  "name": "@abinnovision/prettier-config",
3
- "packageManager": "yarn@3.4.1",
4
- "version": "1.1.0",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
3
+ "version": "2.1.0",
4
+ "type": "module",
5
+ "repository": {
6
+ "url": "https://github.com/abinnovision/js-commons"
7
+ },
7
8
  "license": "Apache-2.0",
8
9
  "author": {
9
- "name": "AB INNOVISION UG (limited liability)",
10
+ "name": "AB INNOVISION GmbH",
10
11
  "email": "info@abinnovision.com",
11
12
  "url": "https://abinnovision.com/"
12
13
  },
13
- "repository": {
14
- "url": "https://github.com/abinnovision/js-commons"
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "bin": {
17
+ "sync-editorconfig": "./dist/bin/sync-editorconfig.cjs"
15
18
  },
16
19
  "files": [
17
20
  "dist/",
18
21
  "assets/"
19
22
  ],
20
- "bin": {
21
- "sync-editorconfig": "./dist/sync-editorconfig.js"
22
- },
23
23
  "scripts": {
24
- "build": "tsc"
24
+ "build": "tsup src/index.ts --dts --format esm --clean && tsup src/bin/* --format cjs --clean -d dist/bin",
25
+ "format:check": "prettier --check 'src/**/*.{ts,js}' '**/*.{md,json,json5,yaml,yml}'",
26
+ "format:fix": "prettier --write 'src/**/*.{ts,js}' '**/*.{md,json,json5,yaml,yml}'",
27
+ "lint:check": "eslint 'src/**/*.{ts,js}'",
28
+ "lint:fix": "eslint --fix 'src/**/*.{ts,js}'"
29
+ },
30
+ "lint-staged": {
31
+ "src/**/*.{ts,js}": [
32
+ "prettier --write",
33
+ "eslint --fix"
34
+ ],
35
+ "{**/*,*}.{md,json,json5,yaml,yml}": [
36
+ "prettier --write"
37
+ ]
25
38
  },
39
+ "prettier": "./dist/index.js",
26
40
  "devDependencies": {
27
- "@types/node": "^18.14.1",
28
- "@types/prettier": "^2.7.2",
29
- "typescript": "^4.9.5"
30
- }
41
+ "@types/node": "^20.11.30",
42
+ "@types/prettier": "^3.0.0",
43
+ "eslint": "^9.8.0",
44
+ "globals": "^15.9.0",
45
+ "prettier": "^3.3.3",
46
+ "tsup": "^8.2.4",
47
+ "typescript": "^5.5.4"
48
+ },
49
+ "peerDependencies": {
50
+ "prettier": "^2.4.0 || ^3.0.0"
51
+ },
52
+ "packageManager": "yarn@3.4.1"
31
53
  }
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,60 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
- var __generator = (this && this.__generator) || function (thisArg, body) {
13
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
- function verb(n) { return function (v) { return step([n, v]); }; }
16
- function step(op) {
17
- if (f) throw new TypeError("Generator is already executing.");
18
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
- if (y = 0, t) op = [op[0] & 2, t.value];
21
- switch (op[0]) {
22
- case 0: case 1: t = op; break;
23
- case 4: _.label++; return { value: op[1], done: false };
24
- case 5: _.label++; y = op[1]; op = [0]; continue;
25
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
- default:
27
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
- if (t[2]) _.ops.pop();
32
- _.trys.pop(); continue;
33
- }
34
- op = body.call(thisArg, _);
35
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
- }
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- var fs = require("fs/promises");
41
- var path = require("path");
42
- var process = require("process");
43
- var DISABLE_ENV_VAR = "DISABLE_SYNC_EDITORCONFIG";
44
- (function () {
45
- var _a;
46
- return __awaiter(this, void 0, void 0, function () {
47
- return __generator(this, function (_b) {
48
- switch (_b.label) {
49
- case 0:
50
- if ([true, "true"].includes((_a = process.env[DISABLE_ENV_VAR]) !== null && _a !== void 0 ? _a : false)) {
51
- return [2];
52
- }
53
- return [4, fs.copyFile(path.resolve(__dirname, "../assets/.editorconfig"), path.resolve(process.cwd(), ".editorconfig"))];
54
- case 1:
55
- _b.sent();
56
- return [2];
57
- }
58
- });
59
- });
60
- })();