@shibanet0/datamitsu-config 0.0.1-alpha-5 → 0.0.1-alpha-6

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.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { cleanPackage } from "../dist/clean-package/index.js";
4
+
5
+ cleanPackage();
package/datamitsu.js CHANGED
@@ -864,6 +864,57 @@ var mapOfApps = {
864
864
  // package.json
865
865
  var name = "@shibanet0/datamitsu-config";
866
866
  var version = "0.0.1-alpha-5";
867
+ var dependencies = {
868
+ "@antebudimir/eslint-plugin-vanilla-extract": "1.16.0",
869
+ "@commitlint/cli": "20.2.0",
870
+ "@commitlint/config-conventional": "20.2.0",
871
+ "@commitlint/format": "20.2.0",
872
+ "@commitlint/types": "20.2.0",
873
+ "@datamitsu/datamitsu": "0.0.1-alpha-13",
874
+ "@eslint/config-helpers": "0.5.0",
875
+ "@eslint/js": "9.39.2",
876
+ "@prettier/plugin-xml": "3.4.2",
877
+ "@typescript/native-preview": "7.0.0-dev.20251215.1",
878
+ "conventional-changelog-conventionalcommits": "9.1.0",
879
+ eslint: "9.39.2",
880
+ "eslint-config-prettier": "10.1.8",
881
+ "eslint-plugin-array-func": "5.1.0",
882
+ "eslint-plugin-import": "2.32.0",
883
+ "eslint-plugin-json": "4.0.1",
884
+ "eslint-plugin-json-schema-validator": "5.5.0",
885
+ "eslint-plugin-jsx-a11y": "6.10.2",
886
+ "eslint-plugin-n": "17.23.1",
887
+ "eslint-plugin-no-use-extend-native": "0.7.2",
888
+ "eslint-plugin-perfectionist": "4.15.1",
889
+ "eslint-plugin-playwright": "2.4.0",
890
+ "eslint-plugin-promise": "7.2.1",
891
+ "eslint-plugin-react": "7.37.5",
892
+ "eslint-plugin-react-hooks": "7.0.1",
893
+ "eslint-plugin-react-perf": "3.3.3",
894
+ "eslint-plugin-react-prefer-function-component": "5.0.0",
895
+ "eslint-plugin-react-refresh": "0.4.26",
896
+ "eslint-plugin-security": "3.0.1",
897
+ "eslint-plugin-sonarjs": "3.0.5",
898
+ "eslint-plugin-storybook": "10.1.10",
899
+ "eslint-plugin-toml": "0.12.0",
900
+ "eslint-plugin-turbo": "2.6.3",
901
+ "eslint-plugin-unicorn": "62.0.0",
902
+ "eslint-plugin-unused-imports": "4.3.0",
903
+ "eslint-plugin-yaml": "1.1.3",
904
+ "eslint-plugin-yml": "1.19.1",
905
+ knip: "5.75.1",
906
+ prettier: "3.7.4",
907
+ "prettier-plugin-embed": "0.5.0",
908
+ "prettier-plugin-jsdoc": "1.8.0",
909
+ "prettier-plugin-sql": "0.19.2",
910
+ publint: "0.3.16",
911
+ "sort-package-json": "3.6.0",
912
+ syncpack: "14.0.0-alpha.32",
913
+ tsup: "8.5.1",
914
+ tsx: "4.21.0",
915
+ "type-fest": "5.3.1",
916
+ "typescript-eslint": "8.50.0"
917
+ };
867
918
 
868
919
  // src/datamitsu-config/env.ts
869
920
  var env = () => {
@@ -981,6 +1032,24 @@ var ignoreGroups = {
981
1032
  ]
982
1033
  };
983
1034
 
1035
+ // src/datamitsu-config/utils/cleanDependencies.ts
1036
+ var cleanDependencies = (deps) => {
1037
+ if (env().DATAMITSU_DEV_MODE) {
1038
+ return deps;
1039
+ }
1040
+ if (!deps) return;
1041
+ const excludeDependencyNameList = [...Object.keys(dependencies), "typescript"];
1042
+ return Object.entries(deps).reduce(
1043
+ (acc, [name2, version2]) => {
1044
+ if (!excludeDependencyNameList.includes(name2)) {
1045
+ acc[name2] = version2;
1046
+ }
1047
+ return acc;
1048
+ },
1049
+ {}
1050
+ );
1051
+ };
1052
+
984
1053
  // src/datamitsu-config/cmdInit.ts
985
1054
  var init = {
986
1055
  ".dockerignore": {
@@ -1447,40 +1516,42 @@ var init = {
1447
1516
  "package.json": {
1448
1517
  content: ({ existingContent, isRoot }) => {
1449
1518
  const data = JSON.parse(existingContent || "{}");
1450
- return JSON.stringify(
1451
- {
1452
- ...data,
1453
- eslintConfig: void 0,
1454
- prettier: void 0,
1455
- scripts: {
1456
- ...data.scripts,
1457
- ...isRoot ? {
1458
- postinstall: env().DATAMITSU_DEV_MODE ? "pnpm build:lib && pnpm datamitsu init" : "datamitsu init"
1459
- } : {},
1460
- ...env().DATAMITSU_DEV_MODE ? {
1461
- fix: "pnpm datamitsu fix",
1462
- lint: "pnpm datamitsu lint"
1463
- } : {
1464
- fix: "datamitsu fix",
1465
- lint: "datamitsu lint"
1466
- }
1467
- },
1468
- syncpack: void 0,
1469
- type: "module",
1470
- ...typeof data.config === "object" ? {
1471
- config: {
1472
- ...data.config,
1473
- syncpack: void 0
1474
- }
1519
+ const config = {
1520
+ ...data,
1521
+ scripts: {
1522
+ ...data.scripts,
1523
+ ...isRoot ? {
1524
+ postinstall: env().DATAMITSU_DEV_MODE ? "pnpm build:lib && pnpm datamitsu init" : "datamitsu init"
1475
1525
  } : {},
1476
- devDependencies: {
1477
- ...data.devDependencies,
1478
- ...env().DATAMITSU_DEV_MODE ? {} : { [name]: version }
1526
+ ...env().DATAMITSU_DEV_MODE ? {
1527
+ fix: "pnpm datamitsu fix",
1528
+ lint: "pnpm datamitsu lint"
1529
+ } : {
1530
+ fix: "datamitsu fix",
1531
+ lint: "datamitsu lint"
1479
1532
  }
1480
1533
  },
1481
- null,
1482
- 2
1483
- );
1534
+ type: "module",
1535
+ ...typeof data.config === "object" ? {
1536
+ config: {
1537
+ ...data.config,
1538
+ syncpack: void 0
1539
+ }
1540
+ } : {},
1541
+ dependencies: cleanDependencies(data.dependencies),
1542
+ devDependencies: {
1543
+ ...cleanDependencies(data.devDependencies),
1544
+ ...env().DATAMITSU_DEV_MODE ? {} : { [name]: version }
1545
+ },
1546
+ optionalDependencies: cleanDependencies(data.optionalDependencies),
1547
+ peerDependencies: cleanDependencies(data.peerDependencies),
1548
+ ...{
1549
+ eslintConfig: void 0,
1550
+ prettier: void 0,
1551
+ syncpack: void 0
1552
+ }
1553
+ };
1554
+ return JSON.stringify(config, null, 2);
1484
1555
  },
1485
1556
  projectTypes: ["npm-package"]
1486
1557
  },
@@ -0,0 +1,40 @@
1
+ // src/clean-package/index.ts
2
+ import { readFileSync, writeFileSync } from "fs";
3
+ import { resolve } from "path";
4
+ var DEFAULT_FIELDS_TO_REMOVE = [
5
+ "scripts",
6
+ "devDependencies",
7
+ "packageManager"
8
+ ];
9
+ var cleanPackage = (options = {}) => {
10
+ const {
11
+ packagePath = "package.json",
12
+ fieldsToRemove = DEFAULT_FIELDS_TO_REMOVE,
13
+ dryRun = false
14
+ } = options;
15
+ const absolutePath = resolve(process.cwd(), packagePath);
16
+ try {
17
+ const packageJson = JSON.parse(readFileSync(absolutePath, "utf-8"));
18
+ const cleaned = { ...packageJson };
19
+ for (const field of fieldsToRemove) {
20
+ delete cleaned[field];
21
+ }
22
+ if (dryRun) {
23
+ console.log("Dry run - would remove fields:", fieldsToRemove);
24
+ console.log("Cleaned package.json:", JSON.stringify(cleaned, null, 2));
25
+ return;
26
+ }
27
+ writeFileSync(absolutePath, JSON.stringify(cleaned, null, 2) + "\n", "utf-8");
28
+ console.log(`\u2713 Cleaned ${packagePath}, removed fields:`, fieldsToRemove);
29
+ } catch (error) {
30
+ console.error(`Error cleaning package.json:`, error);
31
+ throw error;
32
+ }
33
+ };
34
+ var main = () => {
35
+ cleanPackage();
36
+ };
37
+ export {
38
+ cleanPackage,
39
+ main
40
+ };
@@ -0,0 +1 @@
1
+ export declare const cleanDependencies: (deps: Partial<Record<string, string>> | undefined) => Partial<Record<string, string>> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shibanet0/datamitsu-config",
3
- "version": "0.0.1-alpha-5",
3
+ "version": "0.0.1-alpha-6",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -37,13 +37,19 @@
37
37
  "import": {
38
38
  "types": "./dist/type-fest/index.d.ts"
39
39
  }
40
+ },
41
+ "./clean-package": {
42
+ "import": {
43
+ "types": "./dist/clean-package/index.d.ts",
44
+ "default": "./dist/clean-package/index.js"
45
+ }
40
46
  }
41
47
  },
42
48
  "bin": {
49
+ "clean-package": "bin/clean-package.mjs",
43
50
  "datamitsu": "bin/datamitsu.mjs",
44
51
  "tsc": "bin/tsc.mjs",
45
- "tsx": "bin/tsx.mjs",
46
- "tsx2": "bin/tsx.mjs"
52
+ "tsx": "bin/tsx.mjs"
47
53
  },
48
54
  "files": [
49
55
  "datamitsu.js",
@@ -51,29 +57,13 @@
51
57
  "dist/**",
52
58
  "bin/**"
53
59
  ],
54
- "scripts": {
55
- "build": "pnpm build:lib && tsup && tsgo --emitDeclarationOnly",
56
- "build:datamitsu-config": "tsup --config ./tsup.config.datamitsu.ts && mv dist-datamitsu-config/main.js datamitsu.js",
57
- "build:lib": "pnpm build:lib:datamitsu-types && pnpm build:datamitsu-config",
58
- "build:lib:datamitsu-types": "pnpm build:lib:datamitsu-types:1 && pnpm build:lib:datamitsu-types:2",
59
- "build:lib:datamitsu-types:1": "echo \"// prettier-ignore\" > src/datamitsu-config/datamitsu.d.ts && datamitsu config types >> src/datamitsu-config/datamitsu.d.ts",
60
- "build:lib:datamitsu-types:2": "echo \"// prettier-ignore\" > scripts/datamitsu.d.ts && datamitsu config types >> scripts/datamitsu.d.ts",
61
- "datamitsu": "DATAMITSU_DEV_MODE=true DATAMITSU_PACKAGE_NAME=\"./dist\" bin/datamitsu.mjs --binary-command \"node bin/datamitsu.mjs\"",
62
- "fix": "pnpm datamitsu fix",
63
- "preinstall": "npx only-allow@1.2.2 pnpm",
64
- "postinstall": "pnpm build:lib && pnpm datamitsu init",
65
- "knip": "knip",
66
- "lint": "pnpm datamitsu lint",
67
- "pull": "tsx scripts/pull.ts",
68
- "temp:publish": "npm publish --tag next --access public"
69
- },
70
60
  "dependencies": {
71
61
  "@antebudimir/eslint-plugin-vanilla-extract": "1.16.0",
72
62
  "@commitlint/cli": "20.2.0",
73
63
  "@commitlint/config-conventional": "20.2.0",
74
64
  "@commitlint/format": "20.2.0",
75
65
  "@commitlint/types": "20.2.0",
76
- "@datamitsu/datamitsu": "0.0.1-alpha-13",
66
+ "@datamitsu/datamitsu": "0.0.1-alpha-16",
77
67
  "@eslint/config-helpers": "0.5.0",
78
68
  "@eslint/js": "9.39.2",
79
69
  "@prettier/plugin-xml": "3.4.2",
@@ -117,10 +107,5 @@
117
107
  "tsx": "4.21.0",
118
108
  "type-fest": "5.3.1",
119
109
  "typescript-eslint": "8.50.0"
120
- },
121
- "devDependencies": {
122
- "@octokit/rest": "22.0.1",
123
- "@types/node": "25.0.2"
124
- },
125
- "packageManager": "pnpm@10.20.0"
110
+ }
126
111
  }