@icebreakers/stylelint-config 0.0.0 → 0.0.2

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/README.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  Run `npx @icebreakers/stylelint-config` for init `.vscode/settings.json`
4
4
 
5
+ ## init
6
+
5
7
  ```sh
6
8
  npx @icebreakers/stylelint-config
7
9
  ```
10
+
11
+ ## config
12
+
13
+ create a `stylelint.config.[cm]js`:
14
+
15
+ ```ts
16
+ import { icebreaker } from '@icebreakers/stylelint-config'
17
+
18
+ export default icebreaker()
19
+ ```
package/bin/init.js CHANGED
File without changes
package/dist/cli.cjs CHANGED
@@ -309,6 +309,7 @@ init_cjs_shims();
309
309
  var import_node_process = __toESM(require("process"), 1);
310
310
  var import_node_fs = __toESM(require("fs"), 1);
311
311
  var import_node_path = require("path");
312
+ var import_comment_json = __toESM(require("comment-json"), 1);
312
313
 
313
314
  // src/shared.ts
314
315
  init_cjs_shims();
@@ -320,6 +321,8 @@ function setVscodeSettingsJson(json2 = {}) {
320
321
  (0, import_set_value.default)(json2, "scss\\.validate", false);
321
322
  const stylelintValidates = new Set((0, import_get_value.default)(json2, "stylelint\\.validate", { default: [] }));
322
323
  stylelintValidates.add("vue");
324
+ stylelintValidates.add("css");
325
+ stylelintValidates.add("scss");
323
326
  (0, import_set_value.default)(json2, "stylelint\\.validate", Array.from(stylelintValidates));
324
327
  return json2;
325
328
  }
@@ -331,11 +334,16 @@ import_node_fs.default.mkdirSync((0, import_node_path.resolve)(cwd, ".vscode"),
331
334
  });
332
335
  var vscodeSettingsFilename = (0, import_node_path.resolve)(cwd, ".vscode/settings.json");
333
336
  var json = {};
334
- if (import_node_fs.default.existsSync(vscodeSettingsFilename)) {
335
- json = JSON.parse(import_node_fs.default.readFileSync(vscodeSettingsFilename, "utf8"));
337
+ var isExisted = import_node_fs.default.existsSync(vscodeSettingsFilename);
338
+ if (isExisted) {
339
+ const value = import_comment_json.default.parse(import_node_fs.default.readFileSync(vscodeSettingsFilename, "utf8"));
340
+ if (value) {
341
+ json = value;
342
+ }
336
343
  }
337
344
  setVscodeSettingsJson(json);
338
- import_node_fs.default.writeFileSync(vscodeSettingsFilename, JSON.stringify(json, void 0, 2), "utf8");
345
+ import_node_fs.default.writeFileSync(vscodeSettingsFilename, import_comment_json.default.stringify(json, void 0, 2), "utf8");
346
+ console.info(`[@icebreakers/stylelint-config] ${isExisted ? "update" : "init"} '.vscode/settings.json' finished`);
339
347
  /*! Bundled license information:
340
348
 
341
349
  is-primitive/index.js:
package/dist/cli.js CHANGED
@@ -278,6 +278,7 @@ init_esm_shims();
278
278
  import process from "node:process";
279
279
  import fs from "node:fs";
280
280
  import { resolve } from "node:path";
281
+ import jsonc from "comment-json";
281
282
 
282
283
  // src/shared.ts
283
284
  init_esm_shims();
@@ -289,6 +290,8 @@ function setVscodeSettingsJson(json2 = {}) {
289
290
  (0, import_set_value.default)(json2, "scss\\.validate", false);
290
291
  const stylelintValidates = new Set((0, import_get_value.default)(json2, "stylelint\\.validate", { default: [] }));
291
292
  stylelintValidates.add("vue");
293
+ stylelintValidates.add("css");
294
+ stylelintValidates.add("scss");
292
295
  (0, import_set_value.default)(json2, "stylelint\\.validate", Array.from(stylelintValidates));
293
296
  return json2;
294
297
  }
@@ -300,11 +303,16 @@ fs.mkdirSync(resolve(cwd, ".vscode"), {
300
303
  });
301
304
  var vscodeSettingsFilename = resolve(cwd, ".vscode/settings.json");
302
305
  var json = {};
303
- if (fs.existsSync(vscodeSettingsFilename)) {
304
- json = JSON.parse(fs.readFileSync(vscodeSettingsFilename, "utf8"));
306
+ var isExisted = fs.existsSync(vscodeSettingsFilename);
307
+ if (isExisted) {
308
+ const value = jsonc.parse(fs.readFileSync(vscodeSettingsFilename, "utf8"));
309
+ if (value) {
310
+ json = value;
311
+ }
305
312
  }
306
313
  setVscodeSettingsJson(json);
307
- fs.writeFileSync(vscodeSettingsFilename, JSON.stringify(json, void 0, 2), "utf8");
314
+ fs.writeFileSync(vscodeSettingsFilename, jsonc.stringify(json, void 0, 2), "utf8");
315
+ console.info(`[@icebreakers/stylelint-config] ${isExisted ? "update" : "init"} '.vscode/settings.json' finished`);
308
316
  /*! Bundled license information:
309
317
 
310
318
  is-primitive/index.js:
package/dist/index.cjs CHANGED
@@ -32,6 +32,7 @@ function icebreaker() {
32
32
  // https://github.com/ota-meshi/stylelint-config-recommended-vue/blob/main/scss/index.js
33
33
  "stylelint-config-recommended-vue/scss"
34
34
  ],
35
+ // .map(module => require.resolve(module)),
35
36
  overrides: [
36
37
  // {
37
38
  // files: ['*.vue', '**/*.vue'],
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ function icebreaker() {
13
13
  // https://github.com/ota-meshi/stylelint-config-recommended-vue/blob/main/scss/index.js
14
14
  "stylelint-config-recommended-vue/scss"
15
15
  ],
16
+ // .map(module => require.resolve(module)),
16
17
  overrides: [
17
18
  // {
18
19
  // files: ['*.vue', '**/*.vue'],
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "@icebreakers/stylelint-config",
3
3
  "type": "module",
4
- "version": "0.0.0",
5
- "description": "my foo your bar pkg",
6
- "author": "",
7
- "license": "ISC",
8
- "keywords": [],
4
+ "version": "0.0.2",
5
+ "description": "icebreaker's stylelint config",
6
+ "author": "SonOfMagic <qq1324318532@gmail.com>",
7
+ "license": "MIT",
8
+ "keywords": [
9
+ "stylelint"
10
+ ],
9
11
  "sideEffects": false,
10
12
  "exports": {
11
13
  ".": {
@@ -17,15 +19,17 @@
17
19
  "main": "./dist/index.cjs",
18
20
  "module": "./dist/index.js",
19
21
  "types": "./dist/index.d.ts",
20
- "bin": "./dev/bin.js",
22
+ "bin": "./bin/init.js",
21
23
  "files": [
22
24
  "bin",
23
25
  "dist"
24
26
  ],
25
27
  "dependencies": {
28
+ "comment-json": "^4.2.5",
26
29
  "postcss-html": "^1.7.0",
27
30
  "stylelint-config-recommended-scss": "^14.1.0",
28
- "stylelint-config-recommended-vue": "^1.5.0"
31
+ "stylelint-config-recommended-vue": "^1.5.0",
32
+ "stylelint-config-standard-scss": "^13.1.0"
29
33
  },
30
34
  "publishConfig": {
31
35
  "access": "public",
@@ -36,6 +40,7 @@
36
40
  "build": "tsup",
37
41
  "test": "vitest run",
38
42
  "test:dev": "vitest",
39
- "release": "pnpm publish"
43
+ "release": "pnpm publish",
44
+ "sync": "cnpm sync @icebreakers/eslint-config"
40
45
  }
41
46
  }
package/dev/bin.js DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env -S npx tsx
2
- import '../src/cli.ts'