@jakubmazanec/carson-templates 9.0.0 → 9.0.1-unstable.72f063e3

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../source/getDependencies.ts"],
4
- "sourcesContent": ["import {type Workspace} from '@jakubmazanec/carson';\nimport semver from 'semver';\n\nimport {DEPENDENCY_VERSIONS, TEMPLATE_PACKAGE_NAME} from './constants.js';\n\nfunction getMajorVersion(version: string) {\n return Number(version.split('.')[0]!.replace(/\\D/, ''));\n}\n\nexport function getDependencies(dependencies: string[], workspace: Workspace | Workspace<false>) {\n const result: Record<string, string> = {};\n\n for (const dependency of dependencies) {\n const version = DEPENDENCY_VERSIONS[dependency];\n\n if (version) {\n result[dependency] = version;\n }\n }\n\n const projectNames = new Set(workspace.projects.map((project) => project.name));\n\n for (const [dependencyName, dependencyVersion] of Object.entries(result)) {\n if (dependencyName === TEMPLATE_PACKAGE_NAME) {\n continue;\n }\n\n const installedDependency = workspace.allDependencies.find(\n (dependency) => dependencyName === dependency.name,\n );\n\n // if the dependency is already installed in the workspace, we might want to use that existing version\n if (installedDependency) {\n const version = [...installedDependency.exactVersions].sort().reverse()[0] as string;\n\n // if the dependency is actually a project in the workspace, we use existing version\n if (projectNames.has(dependencyName)) {\n if (semver.prerelease(version)?.length) {\n result[dependencyName] = version;\n } else {\n result[dependencyName] = `^${version}`;\n }\n }\n\n // we use existing version if its major version is equal or greater than major version recommended by the template\n if (getMajorVersion(version) >= getMajorVersion(dependencyVersion)) {\n if (semver.prerelease(version)?.length) {\n result[dependencyName] = version;\n } else {\n result[dependencyName] = `^${version}`;\n }\n }\n }\n }\n\n return result;\n}\n"],
5
- "mappings": "AACA,OAAO,YAAY;AAEnB,SAAQ,qBAAqB,6BAA4B;AAEzD,SAAS,gBAAgB,SAAiB;AACxC,SAAO,OAAO,QAAQ,MAAM,GAAG,EAAE,CAAC,EAAG,QAAQ,MAAM,EAAE,CAAC;AACxD;AAEO,gBAAS,gBAAgB,cAAwB,WAAyC;AAC/F,QAAM,SAAiC,CAAC;AAExC,aAAW,cAAc,cAAc;AACrC,UAAM,UAAU,oBAAoB,UAAU;AAE9C,QAAI,SAAS;AACX,aAAO,UAAU,IAAI;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,eAAe,IAAI,IAAI,UAAU,SAAS,IAAI,CAAC,YAAY,QAAQ,IAAI,CAAC;AAE9E,aAAW,CAAC,gBAAgB,iBAAiB,KAAK,OAAO,QAAQ,MAAM,GAAG;AACxE,QAAI,mBAAmB,uBAAuB;AAC5C;AAAA,IACF;AAEA,UAAM,sBAAsB,UAAU,gBAAgB;AAAA,MACpD,CAAC,eAAe,mBAAmB,WAAW;AAAA,IAChD;AAGA,QAAI,qBAAqB;AACvB,YAAM,UAAU,CAAC,GAAG,oBAAoB,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAGzE,UAAI,aAAa,IAAI,cAAc,GAAG;AACpC,YAAI,OAAO,WAAW,OAAO,GAAG,QAAQ;AACtC,iBAAO,cAAc,IAAI;AAAA,QAC3B,OAAO;AACL,iBAAO,cAAc,IAAI,IAAI,OAAO;AAAA,QACtC;AAAA,MACF;AAGA,UAAI,gBAAgB,OAAO,KAAK,gBAAgB,iBAAiB,GAAG;AAClE,YAAI,OAAO,WAAW,OAAO,GAAG,QAAQ;AACtC,iBAAO,cAAc,IAAI;AAAA,QAC3B,OAAO;AACL,iBAAO,cAAc,IAAI,IAAI,OAAO;AAAA,QACtC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
4
+ "sourcesContent": ["import {type Workspace} from '@jakubmazanec/carson';\nimport semver from 'semver';\n\nimport {DEPENDENCY_VERSIONS, TEMPLATE_PACKAGE_NAME} from './constants.js';\n\nfunction getMajorVersion(version: string) {\n return Number(version.split('.')[0]!.replace(/\\D/, ''));\n}\n\nexport function getDependencies(dependencies: string[], workspace: Workspace | Workspace<false>) {\n const result: Record<string, string> = {};\n\n for (const dependency of dependencies) {\n const version = DEPENDENCY_VERSIONS[dependency];\n\n if (version) {\n result[dependency] = version;\n }\n }\n\n const projectNames = new Set(workspace.projects.map((project) => project.name));\n\n for (const [dependencyName, dependencyVersion] of Object.entries(result)) {\n if (dependencyName === TEMPLATE_PACKAGE_NAME) {\n continue;\n }\n\n const installedDependency = workspace.allDependencies.find(\n (dependency) => dependencyName === dependency.name,\n );\n\n // if the dependency is already installed in the workspace, we might want to use that existing\n // version\n if (installedDependency) {\n const version = [...installedDependency.exactVersions].sort().reverse()[0] as string;\n\n // if the dependency is actually a project in the workspace, we use existing version\n if (projectNames.has(dependencyName)) {\n if (semver.prerelease(version)?.length) {\n result[dependencyName] = version;\n } else {\n result[dependencyName] = `^${version}`;\n }\n }\n\n // we use existing version if its major version is equal or greater than major version\n // recommended by the template\n if (getMajorVersion(version) >= getMajorVersion(dependencyVersion)) {\n if (semver.prerelease(version)?.length) {\n result[dependencyName] = version;\n } else {\n result[dependencyName] = `^${version}`;\n }\n }\n }\n }\n\n return result;\n}\n"],
5
+ "mappings": "AACA,OAAO,YAAY;AAEnB,SAAQ,qBAAqB,6BAA4B;AAEzD,SAAS,gBAAgB,SAAiB;AACxC,SAAO,OAAO,QAAQ,MAAM,GAAG,EAAE,CAAC,EAAG,QAAQ,MAAM,EAAE,CAAC;AACxD;AAEO,gBAAS,gBAAgB,cAAwB,WAAyC;AAC/F,QAAM,SAAiC,CAAC;AAExC,aAAW,cAAc,cAAc;AACrC,UAAM,UAAU,oBAAoB,UAAU;AAE9C,QAAI,SAAS;AACX,aAAO,UAAU,IAAI;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,eAAe,IAAI,IAAI,UAAU,SAAS,IAAI,CAAC,YAAY,QAAQ,IAAI,CAAC;AAE9E,aAAW,CAAC,gBAAgB,iBAAiB,KAAK,OAAO,QAAQ,MAAM,GAAG;AACxE,QAAI,mBAAmB,uBAAuB;AAC5C;AAAA,IACF;AAEA,UAAM,sBAAsB,UAAU,gBAAgB;AAAA,MACpD,CAAC,eAAe,mBAAmB,WAAW;AAAA,IAChD;AAIA,QAAI,qBAAqB;AACvB,YAAM,UAAU,CAAC,GAAG,oBAAoB,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAGzE,UAAI,aAAa,IAAI,cAAc,GAAG;AACpC,YAAI,OAAO,WAAW,OAAO,GAAG,QAAQ;AACtC,iBAAO,cAAc,IAAI;AAAA,QAC3B,OAAO;AACL,iBAAO,cAAc,IAAI,IAAI,OAAO;AAAA,QACtC;AAAA,MACF;AAIA,UAAI,gBAAgB,OAAO,KAAK,gBAAgB,iBAAiB,GAAG;AAClE,YAAI,OAAO,WAAW,OAAO,GAAG,QAAQ;AACtC,iBAAO,cAAc,IAAI;AAAA,QAC3B,OAAO;AACL,iBAAO,cAAc,IAAI,IAAI,OAAO;AAAA,QACtC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jakubmazanec/carson-templates",
3
- "version": "9.0.0",
3
+ "version": "9.0.1-unstable.72f063e3",
4
4
  "description": "Collection of Carson templates.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,9 +36,9 @@
36
36
  "semver": "^7.8.5"
37
37
  },
38
38
  "devDependencies": {
39
- "@jakubmazanec/carson": "^3.0.0",
40
- "@jakubmazanec/eslint-config": "^5.0.0",
41
- "@jakubmazanec/fs-utils": "^0.2.0",
39
+ "@jakubmazanec/carson": "3.0.7-unstable.72f063e3",
40
+ "@jakubmazanec/eslint-config": "6.0.0-unstable.72f063e3",
41
+ "@jakubmazanec/fs-utils": "0.2.19-unstable.72f063e3",
42
42
  "@types/fs-extra": "^11.0.4",
43
43
  "@types/lodash": "^4.17.24",
44
44
  "@types/node": "^24.0.4",
@@ -60,7 +60,7 @@
60
60
  "zen-observable": "^0.10.0"
61
61
  },
62
62
  "peerDependencies": {
63
- "@jakubmazanec/carson": "^3.0.0"
63
+ "@jakubmazanec/carson": "3.0.7-unstable.72f063e3"
64
64
  },
65
65
  "packageManager": "npm@11.3.0",
66
66
  "engines": {
@@ -29,7 +29,8 @@ export function getDependencies(dependencies: string[], workspace: Workspace | W
29
29
  (dependency) => dependencyName === dependency.name,
30
30
  );
31
31
 
32
- // if the dependency is already installed in the workspace, we might want to use that existing version
32
+ // if the dependency is already installed in the workspace, we might want to use that existing
33
+ // version
33
34
  if (installedDependency) {
34
35
  const version = [...installedDependency.exactVersions].sort().reverse()[0] as string;
35
36
 
@@ -42,7 +43,8 @@ export function getDependencies(dependencies: string[], workspace: Workspace | W
42
43
  }
43
44
  }
44
45
 
45
- // we use existing version if its major version is equal or greater than major version recommended by the template
46
+ // we use existing version if its major version is equal or greater than major version
47
+ // recommended by the template
46
48
  if (getMajorVersion(version) >= getMajorVersion(dependencyVersion)) {
47
49
  if (semver.prerelease(version)?.length) {
48
50
  result[dependencyName] = version;