@jakubmazanec/carson-templates 0.1.0-11dd4a3 → 0.1.0-2d1145f
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 +3 -1
- package/dist/main.d.ts +4 -0
- package/dist/main.js +24 -0
- package/dist/main.js.map +1 -1
- package/package.json +4 -2
- package/src/main.ts +34 -0
- package/templates/projects/carson-templates/.swcrc.ejs +28 -0
- package/templates/projects/carson-templates/README.md.insert.header.ejs +12 -0
- package/templates/projects/carson-templates/config.json +4 -0
- package/templates/projects/carson-templates/jest.config.ts.ejs +30 -0
- package/templates/projects/carson-templates/package.json.create.ejs +12 -0
- package/templates/projects/carson-templates/package.json.ejs +37 -0
- package/templates/projects/carson-templates/src/main.ts.check.ejs +5 -0
- package/templates/projects/carson-templates/src/main.ts.create.ejs +4 -0
- package/templates/projects/carson-templates/tests/tsconfig.json.ejs +17 -0
- package/templates/projects/carson-templates/tsconfig.json.ejs +34 -0
- package/templates/projects/carson-templates/tsconfig.typecheck.json.ejs +14 -0
- package/templates/projects/carson-templates/typedoc.config.cjs.ejs +12 -0
- package/templates/projects/changesets-changelog/.swcrc.ejs +30 -0
- package/templates/projects/changesets-changelog/README.md.insert.header.ejs +12 -0
- package/templates/projects/changesets-changelog/config.json +4 -0
- package/templates/projects/changesets-changelog/jest.config.ts.ejs +24 -0
- package/templates/projects/changesets-changelog/package.json.create.ejs +12 -0
- package/templates/projects/changesets-changelog/package.json.ejs +29 -0
- package/templates/projects/changesets-changelog/src/main.ts.check.ejs +5 -0
- package/templates/projects/changesets-changelog/src/main.ts.create.ejs +4 -0
- package/templates/projects/changesets-changelog/tests/tsconfig.json.ejs +17 -0
- package/templates/projects/changesets-changelog/tsconfig.json.ejs +34 -0
- package/templates/projects/changesets-changelog/tsconfig.typecheck.json.ejs +15 -0
- package/templates/projects/eslint-config/.swcrc.ejs +30 -0
- package/templates/projects/eslint-config/README.md.insert.header.ejs +12 -0
- package/templates/projects/eslint-config/config.json +4 -0
- package/templates/projects/eslint-config/jest.config.ts.ejs +24 -0
- package/templates/projects/eslint-config/package.json.create.ejs +12 -0
- package/templates/projects/eslint-config/package.json.ejs +34 -0
- package/templates/projects/eslint-config/src/main.ts.check.ejs +5 -0
- package/templates/projects/eslint-config/src/main.ts.create.ejs +4 -0
- package/templates/projects/eslint-config/tests/tsconfig.json.ejs +17 -0
- package/templates/projects/eslint-config/tsconfig.json.ejs +34 -0
- package/templates/projects/eslint-config/tsconfig.typecheck.json.ejs +14 -0
- package/templates/projects/library/.swcrc.ejs +28 -0
- package/templates/projects/library/README.md.insert.header.ejs +12 -0
- package/templates/projects/library/config.json +4 -0
- package/templates/projects/library/jest.config.ts.ejs +30 -0
- package/templates/projects/library/package.json.create.ejs +12 -0
- package/templates/projects/library/package.json.ejs +38 -0
- package/templates/projects/library/src/main.ts.check.ejs +5 -0
- package/templates/projects/library/src/main.ts.create.ejs +4 -0
- package/templates/projects/library/tests/tsconfig.json.ejs +17 -0
- package/templates/projects/library/tsconfig.json.ejs +34 -0
- package/templates/projects/library/tsconfig.typecheck.json.ejs +14 -0
- package/templates/projects/library/typedoc.config.cjs.ejs +12 -0
- package/templates/workspace/.changeset/config.json.ejs +28 -0
- package/templates/workspace/.editorconfig.ejs +20 -0
- package/templates/workspace/.eslintrc.cjs.ejs +28 -0
- package/templates/workspace/.github/workflows/merge-to-main.yaml.ejs +53 -0
- package/templates/workspace/.github/workflows/pull-request.yaml.ejs +33 -0
- package/templates/workspace/.github/workflows/release.yaml.ejs +248 -0
- package/templates/workspace/.gitignore.ejs +249 -0
- package/templates/workspace/.prettierignore.ejs +14 -0
- package/templates/workspace/README.md.insert.ejs +10 -0
- package/templates/workspace/config.json +4 -0
- package/templates/workspace/package.json.create.ejs +10 -0
- package/templates/workspace/package.json.ejs +50 -0
- package/templates/workspace/prettier.config.js.ejs +19 -0
- package/templates/workspace/tsconfig.options.json.ejs +24 -0
- package/templates/workspace/tsconfig.typecheck.json.ejs +13 -0
- package/templates/workspace/turbo.json.ejs +46 -0
package/README.md
CHANGED
package/dist/main.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import { type Workspace } from '@jakubmazanec/carson';
|
|
1
2
|
export { default as lodash } from 'lodash';
|
|
2
3
|
export declare function getMajorVersion(version: string): number;
|
|
4
|
+
export declare function getDependencies(defaultDependencies: Record<string, string>, workspace: Workspace | Workspace<false>): {
|
|
5
|
+
[x: string]: string;
|
|
6
|
+
};
|
package/dist/main.js
CHANGED
|
@@ -2,5 +2,29 @@ export { default as lodash } from 'lodash';
|
|
|
2
2
|
export function getMajorVersion(version) {
|
|
3
3
|
return Number(version.split('.')[0].replace(/\D/, ''));
|
|
4
4
|
}
|
|
5
|
+
export function getDependencies(defaultDependencies, workspace) {
|
|
6
|
+
let dependencies = {
|
|
7
|
+
...defaultDependencies
|
|
8
|
+
};
|
|
9
|
+
let projectNames = workspace.projects.map((project)=>project.name);
|
|
10
|
+
for (let [dependencyName, dependencyVersion] of Object.entries(dependencies)){
|
|
11
|
+
let installedDependency = workspace.allDependencies.find((dependency)=>dependencyName === dependency.name);
|
|
12
|
+
// if the dependency is already installed in the workspace, we might want to use that existing version
|
|
13
|
+
if (installedDependency) {
|
|
14
|
+
let version = [
|
|
15
|
+
...installedDependency.exactVersions
|
|
16
|
+
].sort().reverse()[0];
|
|
17
|
+
// if the dependency is actually a project in the workspace, we use existing version
|
|
18
|
+
if (projectNames.includes(dependencyName)) {
|
|
19
|
+
dependencies[dependencyName] = `^${version}`;
|
|
20
|
+
}
|
|
21
|
+
// we use existing version only if major versions match; we don't want the user of this template to be able to overwrite any major version number and use potentially incompatible version
|
|
22
|
+
if (getMajorVersion(version) === getMajorVersion(dependencyVersion)) {
|
|
23
|
+
dependencies[dependencyName] = `^${version}`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return dependencies;
|
|
28
|
+
}
|
|
5
29
|
|
|
6
30
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/main.ts"],"sourcesContent":["import {type Workspace} from '@jakubmazanec/carson';\n\nexport {default as lodash} from 'lodash';\n\nexport function getMajorVersion(version: string) {\n return Number(version.split('.')[0]!.replace(/\\D/, ''));\n}\n\nexport function getDependencies(\n defaultDependencies: Record<string, string>,\n workspace: Workspace | Workspace<false>,\n) {\n let dependencies = {...defaultDependencies};\n\n let projectNames = workspace.projects.map((project) => project.name);\n\n for (let [dependencyName, dependencyVersion] of Object.entries(dependencies)) {\n let 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 let 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.includes(dependencyName)) {\n dependencies[dependencyName] = `^${version}`;\n }\n\n // we use existing version only if major versions match; we don't want the user of this template to be able to overwrite any major version number and use potentially incompatible version\n if (getMajorVersion(version) === getMajorVersion(dependencyVersion)) {\n dependencies[dependencyName] = `^${version}`;\n }\n }\n }\n\n return dependencies;\n}\n"],"names":["default","lodash","getMajorVersion","version","Number","split","replace","getDependencies","defaultDependencies","workspace","dependencies","projectNames","projects","map","project","name","dependencyName","dependencyVersion","Object","entries","installedDependency","allDependencies","find","dependency","exactVersions","sort","reverse","includes"],"mappings":"AAEA,SAAQA,WAAWC,MAAM,QAAO,SAAS;AAEzC,OAAO,SAASC,gBAAgBC,OAAe;IAC7C,OAAOC,OAAOD,QAAQE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAEC,OAAO,CAAC,MAAM;AACrD;AAEA,OAAO,SAASC,gBACdC,mBAA2C,EAC3CC,SAAuC;IAEvC,IAAIC,eAAe;QAAC,GAAGF,mBAAmB;IAAA;IAE1C,IAAIG,eAAeF,UAAUG,QAAQ,CAACC,GAAG,CAAC,CAACC,UAAYA,QAAQC,IAAI;IAEnE,KAAK,IAAI,CAACC,gBAAgBC,kBAAkB,IAAIC,OAAOC,OAAO,CAACT,cAAe;QAC5E,IAAIU,sBAAsBX,UAAUY,eAAe,CAACC,IAAI,CACtD,CAACC,aAAeP,mBAAmBO,WAAWR,IAAI;QAGpD,sGAAsG;QACtG,IAAIK,qBAAqB;YACvB,IAAIjB,UAAU;mBAAIiB,oBAAoBI,aAAa;aAAC,CAACC,IAAI,GAAGC,OAAO,EAAE,CAAC,EAAE;YAExE,oFAAoF;YACpF,IAAIf,aAAagB,QAAQ,CAACX,iBAAiB;gBACzCN,YAAY,CAACM,eAAe,GAAG,CAAC,CAAC,EAAEb,QAAQ,CAAC;YAC9C;YAEA,0LAA0L;YAC1L,IAAID,gBAAgBC,aAAaD,gBAAgBe,oBAAoB;gBACnEP,YAAY,CAACM,eAAe,GAAG,CAAC,CAAC,EAAEb,QAAQ,CAAC;YAC9C;QACF;IACF;IAEA,OAAOO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jakubmazanec/carson-templates",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-2d1145f",
|
|
4
4
|
"description": "Collection of Carson templates.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist",
|
|
20
|
-
"src"
|
|
20
|
+
"src",
|
|
21
|
+
"templates"
|
|
21
22
|
],
|
|
22
23
|
"scripts": {
|
|
23
24
|
"build": "swc src -d dist && tsc",
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
"typecheck": "tsc --project tsconfig.typecheck.json"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
33
|
+
"@jakubmazanec/carson": "0.1.0-2d1145f",
|
|
32
34
|
"lodash": "^4.17.21"
|
|
33
35
|
},
|
|
34
36
|
"devDependencies": {
|
package/src/main.ts
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
|
+
import {type Workspace} from '@jakubmazanec/carson';
|
|
2
|
+
|
|
1
3
|
export {default as lodash} from 'lodash';
|
|
2
4
|
|
|
3
5
|
export function getMajorVersion(version: string) {
|
|
4
6
|
return Number(version.split('.')[0]!.replace(/\D/, ''));
|
|
5
7
|
}
|
|
8
|
+
|
|
9
|
+
export function getDependencies(
|
|
10
|
+
defaultDependencies: Record<string, string>,
|
|
11
|
+
workspace: Workspace | Workspace<false>,
|
|
12
|
+
) {
|
|
13
|
+
let dependencies = {...defaultDependencies};
|
|
14
|
+
|
|
15
|
+
let projectNames = workspace.projects.map((project) => project.name);
|
|
16
|
+
|
|
17
|
+
for (let [dependencyName, dependencyVersion] of Object.entries(dependencies)) {
|
|
18
|
+
let installedDependency = workspace.allDependencies.find(
|
|
19
|
+
(dependency) => dependencyName === dependency.name,
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
// if the dependency is already installed in the workspace, we might want to use that existing version
|
|
23
|
+
if (installedDependency) {
|
|
24
|
+
let version = [...installedDependency.exactVersions].sort().reverse()[0] as string;
|
|
25
|
+
|
|
26
|
+
// if the dependency is actually a project in the workspace, we use existing version
|
|
27
|
+
if (projectNames.includes(dependencyName)) {
|
|
28
|
+
dependencies[dependencyName] = `^${version}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// we use existing version only if major versions match; we don't want the user of this template to be able to overwrite any major version number and use potentially incompatible version
|
|
32
|
+
if (getMajorVersion(version) === getMajorVersion(dependencyVersion)) {
|
|
33
|
+
dependencies[dependencyName] = `^${version}`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return dependencies;
|
|
39
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: '.swcrc'
|
|
3
|
+
strategy: overwrite
|
|
4
|
+
---
|
|
5
|
+
{
|
|
6
|
+
"jsc": {
|
|
7
|
+
"parser": {
|
|
8
|
+
"syntax": "typescript",
|
|
9
|
+
"tsx": true,
|
|
10
|
+
"dynamicImport": true
|
|
11
|
+
},
|
|
12
|
+
"transform": {
|
|
13
|
+
"react": {
|
|
14
|
+
"runtime": "automatic"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"target": "es2022"
|
|
18
|
+
},
|
|
19
|
+
"module": {
|
|
20
|
+
"type": "es6"
|
|
21
|
+
},
|
|
22
|
+
"env": {
|
|
23
|
+
"targets": {
|
|
24
|
+
"node": 16
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"sourceMaps": true
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: 'jest.config.ts'
|
|
3
|
+
strategy: overwrite
|
|
4
|
+
---
|
|
5
|
+
export default {
|
|
6
|
+
preset: 'ts-jest/presets/default-esm',
|
|
7
|
+
globals: {
|
|
8
|
+
'ts-jest': {
|
|
9
|
+
useESM: true,
|
|
10
|
+
isolatedModules: true,
|
|
11
|
+
tsconfig: 'tsconfig.typecheck.json',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
|
15
|
+
moduleNameMapper: {
|
|
16
|
+
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
collectCoverage: true,
|
|
20
|
+
coverageDirectory: '<rootDir>/coverage/',
|
|
21
|
+
collectCoverageFrom: ['<rootDir>/src/**/*.{ts,tsx}'],
|
|
22
|
+
coverageThreshold: {
|
|
23
|
+
global: {
|
|
24
|
+
branches: 0,
|
|
25
|
+
functions: 0,
|
|
26
|
+
lines: 0,
|
|
27
|
+
statements: 0,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: 'package.json'
|
|
3
|
+
strategy: merge
|
|
4
|
+
---
|
|
5
|
+
{
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "<%- workspace.repository?.url ?? '' %>",
|
|
9
|
+
"directory": "<%- project.relativePath %>"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": "./dist/main.js",
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"src",
|
|
19
|
+
"templates"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "swc src -d dist && tsc",
|
|
23
|
+
"clean": "del-cli dist *.tsbuildinfo",
|
|
24
|
+
"document": "typedoc --options typedoc.config.cjs",
|
|
25
|
+
"format": "prettier . --write --ignore-unknown --ignore-path ../../.prettierignore",
|
|
26
|
+
"lint": "eslint .",
|
|
27
|
+
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests",
|
|
28
|
+
"typecheck": "tsc --project tsconfig.typecheck.json"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@jest/globals": "^29.5.0"
|
|
32
|
+
},
|
|
33
|
+
"packageManager": "npm@8.19.4",
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=16.20.0"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: 'tests/tsconfig.json'
|
|
3
|
+
strategy: overwrite
|
|
4
|
+
---
|
|
5
|
+
{
|
|
6
|
+
"extends": "../../../tsconfig.options.json",
|
|
7
|
+
"compilerOptions": {
|
|
8
|
+
"composite": false,
|
|
9
|
+
"noEmit": true
|
|
10
|
+
},
|
|
11
|
+
"include": ["./**/*"],
|
|
12
|
+
"references": [
|
|
13
|
+
{
|
|
14
|
+
"path": ".."
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: 'tsconfig.json'
|
|
3
|
+
strategy: overwrite
|
|
4
|
+
---
|
|
5
|
+
<%
|
|
6
|
+
let references = [];
|
|
7
|
+
let currentProject = project;
|
|
8
|
+
|
|
9
|
+
for (let dependency of workspace.allDependencies) {
|
|
10
|
+
for (let project of workspace.projects) {
|
|
11
|
+
if (dependency.name === project.name) {
|
|
12
|
+
for (let dependencyProject of dependency.projects) {
|
|
13
|
+
if (dependencyProject.name === currentProject.name) {
|
|
14
|
+
references.push({
|
|
15
|
+
path: currentProject.relativePath.split('/').map(() => '..').join('/') + '/' + project.relativePath
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
references.sort((a, b) => a.path.localeCompare(b.path));
|
|
24
|
+
-%>
|
|
25
|
+
{
|
|
26
|
+
"extends": "../../tsconfig.options.json",
|
|
27
|
+
"compilerOptions": {
|
|
28
|
+
"emitDeclarationOnly": true,
|
|
29
|
+
"outDir": "./dist",
|
|
30
|
+
"rootDir": "./src"
|
|
31
|
+
},
|
|
32
|
+
"include": ["./src/**/*"],
|
|
33
|
+
"references": <%- JSON.stringify(references, null, 2) %>
|
|
34
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: 'tsconfig.typecheck.json'
|
|
3
|
+
strategy: overwrite
|
|
4
|
+
---
|
|
5
|
+
{
|
|
6
|
+
"extends": "./tsconfig.json",
|
|
7
|
+
"compilerOptions": {
|
|
8
|
+
"composite": false,
|
|
9
|
+
"emitDeclarationOnly": false,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"rootDir": "."
|
|
12
|
+
},
|
|
13
|
+
"include": ["./src/**/*", "./tests/**/*", "./*"]
|
|
14
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: '.swcrc'
|
|
3
|
+
strategy: overwrite
|
|
4
|
+
---
|
|
5
|
+
{
|
|
6
|
+
"jsc": {
|
|
7
|
+
"parser": {
|
|
8
|
+
"syntax": "typescript",
|
|
9
|
+
"tsx": true,
|
|
10
|
+
"dynamicImport": true
|
|
11
|
+
},
|
|
12
|
+
"transform": {
|
|
13
|
+
"react": {
|
|
14
|
+
"runtime": "automatic"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"target": "es2022"
|
|
18
|
+
},
|
|
19
|
+
"module": {
|
|
20
|
+
"type": "commonjs",
|
|
21
|
+
"strict": true,
|
|
22
|
+
"noInterop": true
|
|
23
|
+
},
|
|
24
|
+
"env": {
|
|
25
|
+
"targets": {
|
|
26
|
+
"node": 16
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"sourceMaps": true
|
|
30
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: 'jest.config.ts'
|
|
3
|
+
strategy: overwrite
|
|
4
|
+
---
|
|
5
|
+
export default {
|
|
6
|
+
preset: 'ts-jest/presets/default',
|
|
7
|
+
globals: {
|
|
8
|
+
'ts-jest': {
|
|
9
|
+
tsconfig: 'tsconfig.typecheck.json',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
collectCoverage: true,
|
|
14
|
+
coverageDirectory: '<rootDir>/coverage/',
|
|
15
|
+
collectCoverageFrom: ['<rootDir>/src/**/*.{ts,tsx}'],
|
|
16
|
+
coverageThreshold: {
|
|
17
|
+
global: {
|
|
18
|
+
branches: 0,
|
|
19
|
+
functions: 0,
|
|
20
|
+
lines: 0,
|
|
21
|
+
statements: 0,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: 'package.json'
|
|
3
|
+
strategy: merge
|
|
4
|
+
---
|
|
5
|
+
{
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "<%- workspace.repository?.url ?? '' %>",
|
|
9
|
+
"directory": "<%- project.relativePath %>"
|
|
10
|
+
},
|
|
11
|
+
"type": "commonjs",
|
|
12
|
+
"exports": "./dist/main.js",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"src"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "swc src -d dist && tsc",
|
|
19
|
+
"clean": "del-cli dist *.tsbuildinfo",
|
|
20
|
+
"format": "prettier . --write --ignore-unknown --ignore-path ../../.prettierignore",
|
|
21
|
+
"lint": "eslint .",
|
|
22
|
+
"test": "jest --passWithNoTests",
|
|
23
|
+
"typecheck": "tsc --project tsconfig.typecheck.json"
|
|
24
|
+
},
|
|
25
|
+
"packageManager": "npm@8.19.4",
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=16.20.0"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: 'tests/tsconfig.json'
|
|
3
|
+
strategy: overwrite
|
|
4
|
+
---
|
|
5
|
+
{
|
|
6
|
+
"extends": "../../../tsconfig.options.json",
|
|
7
|
+
"compilerOptions": {
|
|
8
|
+
"composite": false,
|
|
9
|
+
"noEmit": true
|
|
10
|
+
},
|
|
11
|
+
"include": ["./**/*"],
|
|
12
|
+
"references": [
|
|
13
|
+
{
|
|
14
|
+
"path": ".."
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: 'tsconfig.json'
|
|
3
|
+
strategy: overwrite
|
|
4
|
+
---
|
|
5
|
+
<%
|
|
6
|
+
let references = [];
|
|
7
|
+
let currentProject = project;
|
|
8
|
+
|
|
9
|
+
for (let dependency of workspace.allDependencies) {
|
|
10
|
+
for (let project of workspace.projects) {
|
|
11
|
+
if (dependency.name === project.name) {
|
|
12
|
+
for (let dependencyProject of dependency.projects) {
|
|
13
|
+
if (dependencyProject.name === currentProject.name) {
|
|
14
|
+
references.push({
|
|
15
|
+
path: currentProject.relativePath.split('/').map(() => '..').join('/') + '/' + project.relativePath
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
references.sort((a, b) => a.path.localeCompare(b.path));
|
|
24
|
+
-%>
|
|
25
|
+
{
|
|
26
|
+
"extends": "../../tsconfig.options.json",
|
|
27
|
+
"compilerOptions": {
|
|
28
|
+
"emitDeclarationOnly": true,
|
|
29
|
+
"outDir": "./dist",
|
|
30
|
+
"rootDir": "./src"
|
|
31
|
+
},
|
|
32
|
+
"include": ["./src/**/*"],
|
|
33
|
+
"references": <%- JSON.stringify(references, null, 2) %>
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: 'tsconfig.typecheck.json'
|
|
3
|
+
strategy: overwrite
|
|
4
|
+
---
|
|
5
|
+
{
|
|
6
|
+
"extends": "./tsconfig.json",
|
|
7
|
+
"compilerOptions": {
|
|
8
|
+
"composite": false,
|
|
9
|
+
"emitDeclarationOnly": false,
|
|
10
|
+
"exactOptionalPropertyTypes": false, // TODO: remove
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"rootDir": "."
|
|
13
|
+
},
|
|
14
|
+
"include": ["./src/**/*", "./tests/**/*", "./*"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: '.swcrc'
|
|
3
|
+
strategy: overwrite
|
|
4
|
+
---
|
|
5
|
+
{
|
|
6
|
+
"jsc": {
|
|
7
|
+
"parser": {
|
|
8
|
+
"syntax": "typescript",
|
|
9
|
+
"tsx": true,
|
|
10
|
+
"dynamicImport": true
|
|
11
|
+
},
|
|
12
|
+
"transform": {
|
|
13
|
+
"react": {
|
|
14
|
+
"runtime": "automatic"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"target": "es2022"
|
|
18
|
+
},
|
|
19
|
+
"module": {
|
|
20
|
+
"type": "commonjs",
|
|
21
|
+
"strict": true,
|
|
22
|
+
"noInterop": true
|
|
23
|
+
},
|
|
24
|
+
"env": {
|
|
25
|
+
"targets": {
|
|
26
|
+
"node": 16
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"sourceMaps": true
|
|
30
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: 'jest.config.ts'
|
|
3
|
+
strategy: overwrite
|
|
4
|
+
---
|
|
5
|
+
export default {
|
|
6
|
+
preset: 'ts-jest/presets/default',
|
|
7
|
+
globals: {
|
|
8
|
+
'ts-jest': {
|
|
9
|
+
tsconfig: 'tsconfig.typecheck.json',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
collectCoverage: true,
|
|
14
|
+
coverageDirectory: '<rootDir>/coverage/',
|
|
15
|
+
collectCoverageFrom: ['<rootDir>/src/**/*.{ts,tsx}'],
|
|
16
|
+
coverageThreshold: {
|
|
17
|
+
global: {
|
|
18
|
+
branches: 50,
|
|
19
|
+
functions: 50,
|
|
20
|
+
lines: 50,
|
|
21
|
+
statements: 50,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|