Skip to content

Commit

Permalink
Release 5.11.18
Browse files Browse the repository at this point in the history
### Changelog:
* Fix(frontend): Npm package types generation.

See merge request vst/vst-utils!682
  • Loading branch information
onegreyonewhite committed Dec 6, 2024
2 parents 9fa8b2e + 73ed29d commit bd091ef
Show file tree
Hide file tree
Showing 9 changed files with 206 additions and 107 deletions.
13 changes: 3 additions & 10 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,15 @@ code_style:
- flake,bandit
- mypy,pylint

js_style:
frontend:
<<: *branch_js_tests
stage: code_standarts
cache:
<<: *global_cache
policy: pull-push
coverage: '/^\[test\] Statements\s*:\s*([^%]+)/'
script:
- yarn lint
- yarn run ci

functional_test:
<<: *branch_tests
Expand All @@ -83,14 +84,6 @@ functional_test:
- TOX_ENVS:
- py313-django51-coverage

js_tests:
<<: *branch_js_tests
needs: ["js_style"]
coverage: '/^Statements\s*:\s*([^%]+)/'
script:
- yarn test


pages:
<<: *branch_tests
stage: release
Expand Down
32 changes: 0 additions & 32 deletions frontend_src/build-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ await Promise.all([
fs.cp(join(frontendSrc, 'README.md'), join(dist, 'README.md')),
copyPackageJsonWithAdjustedPaths(dist),
]);
await assertAllExportedFilesExist(dist);

type PackageJsonExports = Record<string, string | Record<string, string>>;

Expand Down Expand Up @@ -39,34 +38,3 @@ async function copyPackageJsonWithAdjustedPaths(outDir: string) {

await fs.writeFile(join(outDir, 'package.json'), JSON.stringify(packageCopy, undefined, 2));
}

async function assertAllExportedFilesExist(outDir: string) {
const missingFiles: string[] = [];
const packageJsonContent = await fs.readFile(join(outDir, 'package.json'), { encoding: 'utf-8' });
const packageJson = JSON.parse(packageJsonContent) as { exports: PackageJsonExports };

async function checkPath(path: string) {
try {
await fs.stat(join(outDir, path));
} catch (e) {
if (e instanceof Error && 'code' in e && e.code === 'ENOENT') {
return false;
}
throw e;
}
return true;
}

for (const value of Object.values(packageJson.exports)) {
const expectedFiles = typeof value === 'string' ? [value] : Object.values(value);
for (const path of expectedFiles) {
if (!(await checkPath(path))) {
missingFiles.push(path);
}
}
}

if (missingFiles.length > 0) {
throw new Error(`Missing files: ${missingFiles.join(', ')}`);
}
}
7 changes: 7 additions & 0 deletions frontend_src/package-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "package-test",
"version": "1.0.0",
"dependencies": {
"@vstconsulting/vstutils": "link:../../dist"
}
}
13 changes: 13 additions & 0 deletions frontend_src/package-test/package.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { initApp } from '@vstconsulting/vstutils';
import { createAuthAppFactory } from '@vstconsulting/vstutils/auth-app';
import styles from '@vstconsulting/vstutils/style.css';

test('built npm package', () => {
expectTypeOf(initApp).toBeFunction();
expect(initApp).toBeTypeOf('function');

expectTypeOf(createAuthAppFactory).toBeFunction();
expect(createAuthAppFactory).toBeTypeOf('function');

expect(styles).toBeTypeOf('string');
});
115 changes: 115 additions & 0 deletions frontend_src/package-test/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


"@toast-ui/editor@^3.2.2":
version "3.2.2"
resolved "https://registry.yarnpkg.com/@toast-ui/editor/-/editor-3.2.2.tgz#1f2837271c5c9c3e29e090d7440bfc6ab23fb4c4"
integrity sha512-ASX7LFjN2ZYQJrwmkUajPs7DRr9FsM1+RQ82CfTO0Y5ZXorBk1VZS4C2Dpxinx9kl55V4F8/A2h2QF4QMDtRbA==
dependencies:
dompurify "^2.3.3"
prosemirror-commands "^1.1.9"
prosemirror-history "^1.1.3"
prosemirror-inputrules "^1.1.3"
prosemirror-keymap "^1.1.4"
prosemirror-model "^1.14.1"
prosemirror-state "^1.3.4"
prosemirror-view "^1.18.7"

"@toast-ui/vue-editor@^3.2.3":
version "3.2.3"
resolved "https://registry.yarnpkg.com/@toast-ui/vue-editor/-/vue-editor-3.2.3.tgz#01ced013c2ebbfc46a3fad577acfbca40ac55b69"
integrity sha512-IjoV5tBh/yesIuqRqmOQx1+F0oeeAbIeBA7edMTawIXHQXBeJ1qzGHLTY5NWrUQ6BBtV8CDBeedjnVsJ+mHjKQ==
dependencies:
"@toast-ui/editor" "^3.2.2"

"@vstconsulting/vstutils@link:../../dist":
version "0.0.0"
uid ""

dompurify@^2.3.3:
version "2.5.7"
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.5.7.tgz#6e0d36b9177db5a99f18ade1f28579db5ab839d7"
integrity sha512-2q4bEI+coQM8f5ez7kt2xclg1XsecaV9ASJk/54vwlfRRNQfDqJz2pzQ8t0Ix/ToBpXlVjrRIx7pFC/o8itG2Q==

orderedmap@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/orderedmap/-/orderedmap-2.1.1.tgz#61481269c44031c449915497bf5a4ad273c512d2"
integrity sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==

prosemirror-commands@^1.1.9:
version "1.6.2"
resolved "https://registry.yarnpkg.com/prosemirror-commands/-/prosemirror-commands-1.6.2.tgz#d9cf6654912442cff47daa1677eb43ebd0b1f117"
integrity sha512-0nDHH++qcf/BuPLYvmqZTUUsPJUCPBUXt0J1ErTcDIS369CTp773itzLGIgIXG4LJXOlwYCr44+Mh4ii6MP1QA==
dependencies:
prosemirror-model "^1.0.0"
prosemirror-state "^1.0.0"
prosemirror-transform "^1.10.2"

prosemirror-history@^1.1.3:
version "1.4.1"
resolved "https://registry.yarnpkg.com/prosemirror-history/-/prosemirror-history-1.4.1.tgz#cc370a46fb629e83a33946a0e12612e934ab8b98"
integrity sha512-2JZD8z2JviJrboD9cPuX/Sv/1ChFng+xh2tChQ2X4bB2HeK+rra/bmJ3xGntCcjhOqIzSDG6Id7e8RJ9QPXLEQ==
dependencies:
prosemirror-state "^1.2.2"
prosemirror-transform "^1.0.0"
prosemirror-view "^1.31.0"
rope-sequence "^1.3.0"

prosemirror-inputrules@^1.1.3:
version "1.4.0"
resolved "https://registry.yarnpkg.com/prosemirror-inputrules/-/prosemirror-inputrules-1.4.0.tgz#ef1519bb2cb0d1e0cec74bad1a97f1c1555068bb"
integrity sha512-6ygpPRuTJ2lcOXs9JkefieMst63wVJBgHZGl5QOytN7oSZs3Co/BYbc3Yx9zm9H37Bxw8kVzCnDsihsVsL4yEg==
dependencies:
prosemirror-state "^1.0.0"
prosemirror-transform "^1.0.0"

prosemirror-keymap@^1.1.4:
version "1.2.2"
resolved "https://registry.yarnpkg.com/prosemirror-keymap/-/prosemirror-keymap-1.2.2.tgz#14a54763a29c7b2704f561088ccf3384d14eb77e"
integrity sha512-EAlXoksqC6Vbocqc0GtzCruZEzYgrn+iiGnNjsJsH4mrnIGex4qbLdWWNza3AW5W36ZRrlBID0eM6bdKH4OStQ==
dependencies:
prosemirror-state "^1.0.0"
w3c-keyname "^2.2.0"

prosemirror-model@^1.0.0, prosemirror-model@^1.14.1, prosemirror-model@^1.20.0, prosemirror-model@^1.21.0:
version "1.24.0"
resolved "https://registry.yarnpkg.com/prosemirror-model/-/prosemirror-model-1.24.0.tgz#01fd4fdfd32b196d2a073066b25c232bcf946aa4"
integrity sha512-Ft7epNnycoQSM+2ObF35SBbBX+5WY39v8amVlrtlAcpglhlHs2tCTnWl7RX5tbp/PsMKcRcWV9cXPuoBWq0AIQ==
dependencies:
orderedmap "^2.0.0"

prosemirror-state@^1.0.0, prosemirror-state@^1.2.2, prosemirror-state@^1.3.4:
version "1.4.3"
resolved "https://registry.yarnpkg.com/prosemirror-state/-/prosemirror-state-1.4.3.tgz#94aecf3ffd54ec37e87aa7179d13508da181a080"
integrity sha512-goFKORVbvPuAQaXhpbemJFRKJ2aixr+AZMGiquiqKxaucC6hlpHNZHWgz5R7dS4roHiwq9vDctE//CZ++o0W1Q==
dependencies:
prosemirror-model "^1.0.0"
prosemirror-transform "^1.0.0"
prosemirror-view "^1.27.0"

prosemirror-transform@^1.0.0, prosemirror-transform@^1.1.0, prosemirror-transform@^1.10.2:
version "1.10.2"
resolved "https://registry.yarnpkg.com/prosemirror-transform/-/prosemirror-transform-1.10.2.tgz#8ebac4e305b586cd96595aa028118c9191bbf052"
integrity sha512-2iUq0wv2iRoJO/zj5mv8uDUriOHWzXRnOTVgCzSXnktS/2iQRa3UUQwVlkBlYZFtygw6Nh1+X4mGqoYBINn5KQ==
dependencies:
prosemirror-model "^1.21.0"

prosemirror-view@^1.18.7, prosemirror-view@^1.27.0, prosemirror-view@^1.31.0:
version "1.37.0"
resolved "https://registry.yarnpkg.com/prosemirror-view/-/prosemirror-view-1.37.0.tgz#4bc5486d70c546490733197d4bbf4579bfc3d84d"
integrity sha512-z2nkKI1sJzyi7T47Ji/ewBPuIma1RNvQCCYVdV+MqWBV7o4Sa1n94UJCJJ1aQRF/xRkFfyqLGlGFWitIcCOtbg==
dependencies:
prosemirror-model "^1.20.0"
prosemirror-state "^1.0.0"
prosemirror-transform "^1.1.0"

rope-sequence@^1.3.0:
version "1.3.4"
resolved "https://registry.yarnpkg.com/rope-sequence/-/rope-sequence-1.3.4.tgz#df85711aaecd32f1e756f76e43a415171235d425"
integrity sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==

w3c-keyname@^2.2.0:
version "2.2.8"
resolved "https://registry.yarnpkg.com/w3c-keyname/-/w3c-keyname-2.2.8.tgz#7b17c8c6883d4e8b86ac8aba79d39e880f8869c5"
integrity sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==
2 changes: 1 addition & 1 deletion frontend_src/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default defineConfig({
dts({
insertTypesEntry: true,
exclude: ['**/__tests__', '**/*.test.ts', '**/dist', 'unittests', '**/vite.config.ts'],
tsconfigPath: join(frontendSrc, 'tsconfig.json'),
tsconfigPath: join(frontendSrc, 'tsconfig.app.json'),
rollupTypes: true,
}),
],
Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
"devBuild": "vite build -c frontend_src/spa/vite.config.ts --mode development",
"build-lib": "tsx frontend_src/build-package.ts",
"lint:code": "eslint --ext .js,.vue,.ts frontend_src/",
"lint:types": "vue-tsc --noEmit -p ./frontend_src/tsconfig.json",
"lint": "conc --group --timings npm:lint:*",
"test": "vitest -c frontend_src/vite.config.ts run"
"lint:types:app": "vue-tsc --noEmit -p ./frontend_src/tsconfig.app.json",
"lint:types:node": "vue-tsc --noEmit -p ./frontend_src/tsconfig.node.json",
"test": "vitest -c frontend_src/vite.config.ts run",
"prepare-package-test": "cd frontend_src/package-test && yarn install --pure-lockfile --mutex network",
"ci": "yarn build-lib && yarn prepare-package-test && conc --group --timings \"yarn:lint:*\" \"yarn:test\" "
},
"dependencies": {
"@toast-ui/vue-editor": "^3.2.3"
Expand All @@ -47,7 +49,8 @@
"admin-lte/jquery-validation": "^1.19.5",
"admin-lte/jszip": "^3.10.1",
"admin-lte/**/jquery": "3.7.1",
"admin-lte/sweetalert2": "10.16.9"
"admin-lte/sweetalert2": "10.16.9",
"vitest/**/vite": "^6.0.3"
},
"devDependencies": {
"@fortawesome/fontawesome-free": "^5.15.4",
Expand Down Expand Up @@ -105,10 +108,10 @@
"tsx": "^4.19.2",
"typescript": "~5.6.2",
"visibilityjs": "^2.0.2",
"vite": "^6.0.1",
"vite": "^6.0.3",
"vite-plugin-dts": "^4.3.0",
"vite-tsconfig-paths": "^5.1.3",
"vitest": "^2.1.2",
"vitest": "^2.1.8",
"vitest-fetch-mock": "^0.4.2",
"vue": "^2.7.16",
"vue-i18n": "^8.28.2",
Expand Down
2 changes: 1 addition & 1 deletion vstutils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# pylint: disable=django-not-available
__version__: str = '5.11.17'
__version__: str = '5.11.18'
Loading

0 comments on commit bd091ef

Please sign in to comment.