Add apply-templates check (#4907)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
Co-authored-by: Eduard Aksamitov <e@euaaaio.ru>
This commit is contained in:
Andrey Sobolev 2024-03-11 11:24:46 +07:00 committed by GitHub
parent 79b4390911
commit 5cadf883c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 38 additions and 11 deletions

View File

@ -129,6 +129,17 @@ jobs:
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
- name: Apply templates...
run: node common/scripts/install-run-rush.js apply-templates
- name: Check templates
run: |
echo '================================================================'
echo 'Checking for diff files'
echo '================================================================'
git diff '*.js' '*.ts' '*.svelte' '*.json' | cat
[ -z "$(git diff --name-only '*.js' '*.ts' '*.svelte' '*.json' | cat)" ]
echo '================================================================'
- name: Formatting...
run: node common/scripts/install-run-rush.js fast-format
- name: Check files formatting
@ -136,8 +147,8 @@ jobs:
echo '================================================================'
echo 'Checking for diff files'
echo '================================================================'
git diff '*.ts' '*.svelte' | cat
[ -z "$(git diff --name-only '*.ts' '*.svelte' | cat)" ]
git diff '*.js' '*.ts' '*.svelte' '*.json' | cat
[ -z "$(git diff --name-only '*.js' '*.ts' '*.svelte' '*.json' | cat)" ]
echo '================================================================'
test:
needs: build

View File

@ -16,6 +16,7 @@
"esModuleInterop": true,
"rootDir": "./src",
"outDir": "./lib",
"incremental": true
"incremental": true,
"isolatedModules": true
}
}

View File

@ -11,6 +11,8 @@
"skipDefaultLibCheck": true,
"declarationMap": true,
"esModuleInterop": true,
"incremental": true
"incremental": true,
"types" : [],
"isolatedModules": true
}
}

View File

@ -14,6 +14,7 @@
"esModuleInterop": true,
"rootDir": "./src",
"outDir": "./lib",
"incremental": true
"incremental": true,
"isolatedModules": true
}
}

View File

@ -14,6 +14,7 @@
"esModuleInterop": true,
"rootDir": "./src",
"outDir": "./lib",
"incremental": true
"incremental": true,
"isolatedModules": true
}
}

View File

@ -16,6 +16,8 @@
"esnext",
"dom"
],
"incremental": true
"incremental": true,
"types": ["jest"],
"isolatedModules": true
}
}

View File

@ -29,8 +29,8 @@
"prettier-plugin-svelte": "^3.1.0",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"@types/jest":"^29.5.5",
"typescript":"^5.3.3"
"@types/jest": "^29.5.5",
"typescript": "^5.3.3"
},
"dependencies": {
"lexorank": "~1.0.4"

View File

@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
"rigPackageName": "@hcengineering/platform-rig"
}

View File

@ -66,7 +66,7 @@ function updatePackage(packageRoot, templates) {
let template
for (const t of templates) {
if( t.isDefault) {
if( t.isDefault && currentPackage.template === undefined) {
template = t
}
@ -76,7 +76,7 @@ function updatePackage(packageRoot, templates) {
break
}
if (t.package.peerDependencies !== undefined) {
if (t.package.peerDependencies !== undefined && currentPackage.template === undefined) {
const peers = Object.keys(t.package.peerDependencies)
const deps = Object.keys(currentPackage.dependencies ?? {})
const devDeps = Object.keys(currentPackage.devDependencies ?? {})
@ -86,6 +86,11 @@ function updatePackage(packageRoot, templates) {
}
}
}
if( template === undefined) {
console.warn('No template found for package', currentPackage.template)
return
}
console.log('updating => ', currentPackage.name, ' with template', template.package.name)
const packageJson = template.package