Commit Graph

30 Commits

Author SHA1 Message Date
Rijk van Zanten
b8cc796f4c Upgrade Node.js runtime version to 22 (#24140)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2025-01-08 13:26:14 +01:00
Pascal Jufer
e583c6b6ea Add tsconfig for Vue & CJS (#19197)
* Add tsconfig for Vue

* Delete tsconfig.json

* Use vue tsconfig for composables

* Add changeset

* Update changeset

* Update changeset
2023-07-18 17:36:16 -04:00
Rijk van Zanten
2983e61870 The Great TypeScript Modernization Program Season 3 Episode 6: The Big One (#18014)
* Step 1

* Step 2

* False sense of confidence

* Couple more before dinner

* Update schema package

* Update format-title

* Upgrade specs file

* Close

* Replace ts-node-dev with tsx, and various others

* Replace lodash with lodash-es

* Add lodash-es types

* Update knex import

* More fun is had

* FSE

* Consolidate repos

* Various tweaks and fixes

* Fix specs

* Remove dependency on knex-schema-inspector

* Fix wrong imports of inspector

* Move shared exceptions to new package

* Move constants to separate module

* Move types to new types package

* Use directus/types

* I believe this is no longer needed

* [WIP] Start moving utils to esm

* ESMify Shared

* Move shared utils to  @directus/utils

* Use @directus/utils instead of @directus/shared/utils

* It runs!

* Use correct schemaoverview type

* Fix imports

* Fix the thing

* Start on new update-checker lib

* Use new update-check package

* Swap out directus/shared in app

* Pushing through the last bits now

* Dangerously make extensions SDK ESM

* Use @directus/types in tests

* Copy util function to test

* Fix linter config

* Add missing import

* Hot takes

* Fix build

* Curse these default exports

* No tests in constants

* Add tests

* Remove tests from types

* Add tests for exceptions

* Fix test

* Fix app tests

* Fix import in test

* Fix various tests

* Fix specs export

* Some more tests

* Remove broken integration tests

These were broken beyond repair.. They were also written before we really knew what we we're doing with tests, so I think it's better to say goodbye and start over with these

* Regenerate lockfile

* Fix imports from merge

* I create my own problems

* Make sharp play nice

* Add vitest config

* Install missing blackbox dep

* Consts shouldn't be in types

tsk tsk tsk tsk

* Fix type/const usage in extensions-sdk

* cursed.default

* Reduce circular deps

* Fix circular dep in items service

* vvv

* Trigger testing for all vendors

* Add workaround for rollup

* Prepend the file protocol for the ESM loader to be compatible with Windows
"WARN: Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'"

* Fix postgres

* Schema package updates

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>

* Resolve cjs/mjs extensions

* Clean-up eslint config

* fixed extension concatination

* using string interpolation for consistency

* Revert MySQL optimisation

* Revert testing for all vendors

* Replace tsx with esbuild-kit/esm-loader

Is a bit faster and we can rely on the built-in `watch` and `inspect`
functionalities of Node.js

Note: The possibility to watch other files (.env in our case) might be
added in the future, see https://github.com/nodejs/node/issues/45467

* Use exact version for esbuild-kit/esm-loader

* Fix import

---------

Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Brainslug <tim@brainslug.nl>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-04-04 17:41:56 -04:00
Rijk van Zanten
cb74665693 noUnusedParameters: true (#17935) 2023-03-24 16:56:18 -04:00
Rijk van Zanten
2bc039607b TS Config Modernization Program Part 4 of almost done (#17934)
* noUncheckedIndexedAccess: true !!!!!!!?!!!!!!!!!!?

* Fix duplicate non-null assertion
2023-03-24 16:43:54 -04:00
Rijk van Zanten
80f4807a09 TS Config Modernization Program Part 3 of many (#17904)
* noImplicitOverride: true

* noImplicitReturns: true

* noPropertyAccessFromIndexSignature: true
2023-03-23 16:47:55 -04:00
rijkvanzanten
e721e33c8b Enable exactOptionalPropertyTypes 2023-03-22 16:13:48 -04:00
Rijk van Zanten
806be3a193 TSConfig Modernization part 2: Enable non-breaking flags (#17889)
* Enable non-breaking flags

* Add explicit src
2023-03-22 15:58:44 -04:00
Rijk van Zanten
1a5f06c791 TSConfig Modernization: Set importsNotUsedAsValues (#17887)
* Set importsNotUsedAsValues

* Fix import
2023-03-22 14:51:27 -04:00
Rijk van Zanten
c249d58a8c Revert "Speed-up api dev scripts by using swc (#16609)" (#17064)
This reverts commit e9a2ce5a9e.
2023-01-09 16:57:03 -05:00
Pascal Jufer
e9a2ce5a9e Speed-up api dev scripts by using swc (#16609) 2023-01-09 15:47:41 -05:00
Rijk van Zanten
86dd593f91 Use node16 module-resolution (#16696)
* Use node16 module-resolution

* Lets not mess with apply-query rn

* I love CJS. Death to CJS.

* Use CJS require in hook import

* Fix type export in schema

* Clean up defaults usage

* Use require instead of import for migrations

* Use a vitest compatible dynamic import

* Uno mas

* Cleanup type export
2022-12-02 15:53:15 -05:00
Pascal Jufer
45eb4941fc Small clean-up after Jest to Vitest switch in API (#16462)
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-11-15 17:20:45 -05:00
Pascal Jufer
c303bdcf10 Finish switch from Jest to Vitest in API (#16263)
* build:  add vitest and update test scripts

* build: 🔧 add vitest config

* build:  Migrate tests to vitest

Remove jest references from test api test files and replace with vitest equivalents.

Tests: 13 tests are failing.

* build: 🚚 move vite.config.ts to api/src folder

* build: 🔥 remove unused vitest.config from api root

* build:  import vitest modules for tests

* build:  add type conversion for actual object

* Finish switch from Jest to Vitest in API

* Replace some leftovers

* Load "sharp" before tests

* Try with cjs

* Temporary enable verbose reporter

* Try with globalSetup

* Fix path to globalSetup

* Provide default export in globalSetup

* Final clean-up

* Remove @vitest/ui & update vitest to 0.25.0

* Add vitest c8 coverage dependency

* Update vitest to v0.25.1

* Replace unnecessary Vitest workaround

* Rework new tests

* Resolve build errors

Co-authored-by: Dorian C Brown <brown.3794@gmail.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-11-14 16:09:47 -05:00
Rijk van Zanten
27cc3e1bec Move repo to pnpm based workflow (#14350)
* Use pnpm instead of npm

* Setup workspace

* Replace scripts / lerna root stuff

* Add todo file

* Update lock, start updating packages

* Update todo

* [WIP] Keep going on module resolution in pnpm

* Fix final missing deps/types for complete build

* [WIP] Replace npm commands with pnpm alternatives

* Update jest config for v28

* Fix missing package under schema

* Update workflow

* Run CI on fork

* Use local reference

* Remove version from local workflow

* Add build to prepare

* Add Node's max old space size flag to linter

* Idemdito for codeql

* Hyphens? Underscores?

* Bang

* Only build one thing at a time

* Underscores after all?

* Match 7gb of GH

* Set env on prepare

* Jest is driving me nuts

* Downgrade jest

* Add root jest

* We'll get there, eventually.

* 🥳

* Het houdt niet op, niet vanzelf

* attempt to fix e2e

* fix unit test & shared import

* add `debug: true` to CodeQL action

* Fix dev call in shared

* Add missing cross-env

* Add missing geo-json dependency for app

* add flag to prepare action to skip build

* remove debug flag from codeql action

* fix invalid env syntax

* add tslib to app dependencies for tests

* another attempt

* Added missing rimraf dependency for the api prebuild/cleanup scripts

* Added missing ts-node dependency for the api cli script

* update E2E tests readme to use pnpm

* Undo move of extensions sdk

* Fixes nested groups in accordions not rendering fields (#14369)

* initial fix for nested groups in accordions

* removed debug code

* Fix strict relative dates showing "incorrect" (#14390)

* Set rounding method of relative formatted date to floor when strict option is selected

* Add round fn as an option

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>

* Don't use locales in generated camelCased values from env (#14401)

Ref https://github.com/directus/directus/discussions/14122

* Fix list panel descending sort (#14396)

* fix list panel descending sort

* Handle missing or explicit desc value

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>

* Fix query primary field for system tables (#14402)

* New Crowdin updates (#14403)

* Update source file en-US.yaml

* New translations en-US.yaml (Spanish, Chile)

* New translations en-US.yaml (Spanish, Latin America)

* New translations en-US.yaml (Greek)

* New translations en-US.yaml (Italian)

* New translations en-US.yaml (French, Canada)

* Fix/wysiwyg context menu (#14404)

* New translations en-US.yaml (Polish) (#14407)

* Encoded the url using encodeURIComponent, so that the url gets sanitzed and so, we did not get 404 error. (#14418)

* Encoded the url using encodeURIComponent, so that the url gets sanitized and we did not get 404 error.

* Added required changes as stated by the reviewer

* Used encodeURI instead of encodeURIComponent to encode the params only

* Solved linting error

* Solved linting errors

* checked with npm run lint, no linting errors found

* fix generateJoi error due to empty permissions when creating new role (#14416)

* fix empty permissions when creating new role

* basic test

* move logic up

* additional test

* Update api/tests/utils/filter-items.test.ts

Co-authored-by: ian <licitdev@gmail.com>

Co-authored-by: ian <licitdev@gmail.com>

* Recreate lockfile

* Fix build of extensions-sdk

* Add missing dependency

* Add some more missing deps

* Update blackbox to use pnpm

* Update workflow to use main

* Update pack to work with pnpm

* Simplify commands

* Remove todo file (completed)

* ADd missing types dep

* Use local test version

* Remove version from local reference

* Call super with context

* Add missing dep

* Simplify workflows

Ref https://github.com/directus/organization/issues/135

* Simplify some more

* Linter is on root

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: brainslug <tim@brainslug.nl>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Gerard Lamusse <gerardlamo@gmail.com>
Co-authored-by: José Varela <joselcvarela@gmail.com>
Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Zeel Pathak <60271095+zeel-pathak@users.noreply.github.com>
2022-07-15 17:41:49 -04:00
Jay Cammarano
ef9b30c0e1 Integration tests set up and examples (#10419)
* tsconfig loosened to match api

* integration test folder and script

* .env mock isn't needed

* mock-env, locations of tests

* I was wrong.

* Updated progress

* schemas => getSchema(), exported getColumnPreprocessor()

* change imports to allow build

* add MockClient as DB Client (should mock getDBClient())

* move authservice into. not used elsewhere

* test passing

* remove unneeded test for this PR

* removed unneded fields from rawItem

* formatting

* createOne test passing

* typo

* removed int specific jest.config

* use systemSchema over getSchema()

* this.knex over getDatabase()

* mock getDatabaseClient

* removed unused mock-env

* formatting

* removed unused collections from schema

* response => responseOnce

* more direct

* unused var

* more tests please!

* test for: createOne no permissions

* removed broken test for now

* clean up

* readOne tests what does into db and returned

* added bindings check

* added into db sql check

* moved tests outside src

* changed ts config

* cli test location changed

* removed looking for tests in src

* readding it for e2e tests? Seems fishy

* Integration tests for ItemsService user tables (#11208)

* renamed ItemsService test to match src file name

* add user table schema

* system/user tables use .each, formatting needed

* format system and user better in title

* tables/table=> schemas/schema

* filter _eq test passing

* comment for later and formatting

* everything in it's right place

* future proofing as more fields are added

* removed duplicate test

* formatting

* readMany() filter: _or

Co-authored-by: Jay Cammarano <jaycammarano@gmail.com>

* added knex check before getDatabase()

* Move util test to tests folder

Co-authored-by: Jay Cammarano <jaycammarano@gmail.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-01-24 19:55:08 +00:00
Oreille
5f43b20ebf Update geometric types and patch new field flow. (#9397)
* Update geometric types and patch new field flow.

* Add migration

* Fixed migrations

* Also fixed migrations

* Update migration ID

* Cleanup type selector a bit

* Add missing fallback interface/display for new types

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-11-04 21:47:54 -04:00
Saad Irfan ⚡️
afdeb980cb Support for notifying user if an update is available for Directus CLI (#6852)
* Notify user if an update is available

* Replaced console log with logger

* Fix lint error

* Update api/src/start.ts

* Make update check non-blocking

* Remove unused async call

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2021-07-26 19:36:16 -04:00
Rijk van Zanten
9ac9a8d44b Add JSON/CSV Import (#5660)
* Add async/destroy packages

* Target node 12+

* Return payload data in json export

* Import JSON from Stream

* Add CSV import support

* Add CSV Import

* Add docs

* Add missing types
2021-05-14 11:03:12 -04:00
Rijk van Zanten
c310afa846 Rely on npm Workspaces for module resolving (#4656)
* Move devDeps to API

* Move app to npm workspaces

* Tweaks / add lockfiles

* Add locks, fix devdeps across packages

* Move eslint config rootlevel

* Use eslint fix for vue files instead of vue-cli-service

* Add global prettier format option

* Create lockfiles for all packages

* Replace husky with simple-git-hooks
2021-03-24 16:01:49 -04:00
rijkvanzanten
eb306e91b1 Ignore dist in tsconfig 2020-11-27 20:58:25 -05:00
rijkvanzanten
39b71aa8bd Build typescript files for extension use 2020-10-14 17:25:15 -04:00
rijkvanzanten
08c003907a Use shared tsconfig for excluding node modules 2020-10-02 13:32:33 -04:00
rijkvanzanten
9f3e12f8f2 Run prettier 2020-09-08 16:03:38 -04:00
rijkvanzanten
98a51d6dd9 Remove thing that messed up tsconfig 2020-09-01 17:13:44 -04:00
rijkvanzanten
d7d3de86d2 Add server service, update returned info 2020-09-01 13:08:52 -04:00
rijkvanzanten
d3504b8c06 Prefer skipLibCheck over node modules exclusion 2020-08-12 14:24:16 -04:00
rijkvanzanten
21c2c56960 Exclude node modules in api build 2020-08-12 13:52:20 -04:00
rijkvanzanten
be5b4a67f5 Don't use hoisting (yet) (broke build) 2020-08-07 10:21:55 -04:00
rijkvanzanten
bde7069cce Move api into api subdirectory 2020-07-29 11:22:56 -04:00