Skip to content

Commit

Permalink
Rely on npm Workspaces for module resolving (directus#4656)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rijkvanzanten authored Mar 24, 2021
1 parent e9f1897 commit c310afa
Show file tree
Hide file tree
Showing 47 changed files with 47,552 additions and 76,906 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
env: {
node: true,
},
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier-vue/recommended', 'plugin:vue/essential'],
plugins: ['@typescript-eslint', 'prettier'],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
Expand All @@ -14,6 +14,7 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-var-requires': 0,
'prettier/prettier': ['error', { singleQuote: true }],
'vue/valid-v-slot': 0,
'comma-dangle': [
'error',
{
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
5 changes: 0 additions & 5 deletions api/.eslintrc.js

This file was deleted.

5 changes: 0 additions & 5 deletions api/.prettierrc.js

This file was deleted.

34 changes: 25 additions & 9 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@
"build": "rimraf dist && tsc --build && copyfiles \"src/**/*.*\" -e \"src/**/*.ts\" -u 1 dist",
"dev": "cross-env DIRECTUS_DEV=true NODE_ENV=development ts-node-dev --files --transpile-only --respawn --watch \".env\" --inspect -- src/start.ts",
"cli": "cross-env DIRECTUS_DEV=true NODE_ENV=development ts-node --script-mode --transpile-only src/cli/index.ts",
"lint": "eslint \"src/**/*.ts\" cli.js index.js",
"prepublishOnly": "npm run build",
"prettier": "prettier --write \"src/**/*.ts\" cli.js index.js"
"prepublishOnly": "npm run build"
},
"files": [
"dist",
Expand Down Expand Up @@ -102,13 +100,13 @@
"icc": "^2.0.0",
"inquirer": "^7.3.3",
"joi": "^17.3.0",
"js-yaml": "^3.14.0",
"js-yaml": "^4.0.0",
"json2csv": "^5.0.3",
"jsonwebtoken": "^8.5.1",
"keyv": "^4.0.3",
"knex": "^0.95.0",
"liquidjs": "^9.16.1",
"lodash": "^4.17.20",
"lodash": "^4.17.21",
"macos-release": "^2.4.1",
"mime-types": "^2.1.27",
"ms": "^2.1.2",
Expand Down Expand Up @@ -140,15 +138,33 @@
},
"gitHead": "71bf628955b5da15ce3070dc09478bc558f243a4",
"devDependencies": {
"@types/atob": "^2.1.2",
"@types/body-parser": "^1.19.0",
"@types/busboy": "^0.2.3",
"@types/cookie-parser": "^1.4.2",
"@types/cors": "^2.8.10",
"@types/express": "^4.17.11",
"@types/express-pino-logger": "^4.0.2",
"@types/express-session": "^1.17.3",
"@types/fs-extra": "^9.0.8",
"@types/inquirer": "^7.3.1",
"@types/js-yaml": "^4.0.0",
"@types/json2csv": "^5.0.1",
"@types/jsonwebtoken": "^8.5.1",
"@types/keyv": "^3.1.1",
"@types/lodash": "^4.14.168",
"@types/mime-types": "^2.1.0",
"@types/ms": "^0.7.31",
"@types/node": "^14.14.7",
"@types/nodemailer": "^6.4.1",
"@types/qs": "^6.9.6",
"@types/sharp": "^0.27.1",
"@types/uuid": "^8.3.0",
"@types/uuid-validate": "^0.0.1",
"@typescript-eslint/eslint-plugin": "^4.9.1",
"@typescript-eslint/parser": "^4.9.1",
"copyfiles": "^2.4.0",
"cross-env": "^7.0.2",
"eslint": "^7.15.0",
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-prettier": "^3.2.0",
"prettier": "^2.2.1",
"ts-node-dev": "^1.0.0",
"typescript": "^4.0.5"
}
Expand Down
2 changes: 1 addition & 1 deletion api/src/database/seeds/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default async function runSeed(database: Knex) {

const yamlRaw = await fse.readFile(path.resolve(__dirname, tableSeedFile), 'utf8');

const seedData = yaml.safeLoad(yamlRaw) as TableSeed;
const seedData = yaml.load(yamlRaw) as TableSeed;

await database.schema.createTable(seedData.table, (tableBuilder) => {
for (const [columnName, columnInfo] of Object.entries(seedData.columns)) {
Expand Down
2 changes: 1 addition & 1 deletion api/src/utils/require-yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import yaml from 'js-yaml';
export function requireYAML(filepath: string) {
const yamlRaw = fse.readFileSync(filepath, 'utf8');

return yaml.safeLoad(yamlRaw) as Record<string, any>;
return yaml.load(yamlRaw) as Record<string, any>;
}
6 changes: 1 addition & 5 deletions api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
Expand All @@ -13,8 +12,5 @@
"skipLibCheck": true,
"declaration": true
},
"exclude": [
"node_modules",
"dist"
]
"exclude": ["node_modules", "dist"]
}
11 changes: 0 additions & 11 deletions app/.eslintrc.js

This file was deleted.

5 changes: 0 additions & 5 deletions app/.prettierrc.js

This file was deleted.

70 changes: 54 additions & 16 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,69 @@
"prebuild": "npm run copy-docs-images",
"dev": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"lint:styles": "stylelint \"**/*.{vue,scss}\"",
"fix": "prettier --write \"src/**/*.{js,vue,ts}\"",
"fix:styles": "stylelint --fix \"**/*.{vue,scss}\"",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"prepublishOnly": "npm run build",
"prettier": "prettier --write \"src/**/*.ts\""
"prepublishOnly": "npm run build"
},
"gitHead": "71bf628955b5da15ce3070dc09478bc558f243a4",
"dependencies": {
"@directus/docs": "9.0.0-rc.51",
"@directus/format-title": "9.0.0-rc.51"
},
"devDependencies": {
"@directus/docs": "9.0.0-rc.51",
"@directus/format-title": "9.0.0-rc.51",
"@popperjs/core": "^2.9.1",
"@sindresorhus/slugify": "^1.1.0",
"@tinymce/tinymce-vue": "^3.2.8",
"@types/base-64": "^0.1.3",
"@types/bytes": "^3.1.0",
"@types/codemirror": "^0.0.108",
"@types/color": "^3.0.1",
"@types/diff": "^5.0.0",
"@types/dompurify": "^2.2.1",
"@types/lodash": "^4.14.168",
"@types/markdown-it": "^12.0.1",
"@types/marked": "^2.0.0",
"@types/mime-types": "^2.1.0",
"@types/ms": "^0.7.31",
"@types/qrcode": "^1.4.0",
"@vue/cli-plugin-babel": "^4.5.8",
"@vue/cli-plugin-eslint": "^4.5.8",
"@vue/cli-plugin-router": "^4.5.8",
"@vue/cli-plugin-typescript": "^4.5.8",
"@vue/cli-plugin-vuex": "^4.5.8",
"@vue/cli-service": "^4.5.8",
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-typescript": "^7.0.0",
"@vue/composition-api": "^0.6.7",
"@vue/test-utils": "^1.1.1",
"axios": "^0.21.1",
"base-64": "^1.0.0",
"codemirror": "^5.60.0",
"copyfiles": "^2.4.1",
"cropperjs": "^1.5.11",
"date-fns": "^2.19.0",
"dompurify": "^2.2.7",
"escape-string-regexp": "^4.0.0",
"front-matter": "^4.0.2",
"joi": "^17.4.0",
"jsonlint-mod": "^1.7.6",
"marked": "^2.0.1",
"micromustache": "^8.0.3",
"mitt": "^2.1.0",
"nanoid": "^3.1.22",
"pinia": "^0.0.7",
"portal-vue": "^2.1.7",
"prettier": "^2.2.1",
"vue-cli-plugin-yaml": "^1.0.2"
"pretty-ms": "^7.0.1",
"qrcode": "^1.4.4",
"raw-loader": "^4.0.2",
"resize-observer": "^1.0.0",
"rimraf": "^2.7.1",
"sass": "^1.26.10",
"sass-loader": "^9.0.2",
"stylelint": "^13.12.0",
"tinymce": "^5.5.1",
"vue": "^2.6.12",
"vue-cli-plugin-yaml": "^1.0.2",
"vue-i18n": "^8.22.1",
"vue-loader": "^15.9.3",
"vue-router": "^3.4.8",
"vue-template-compiler": "^2.6.10",
"vuedraggable": "^2.24.3",
"vuepress": "^1.5.2",
"webpack-assets-manifest": "^3.1.1"
}
}
2 changes: 1 addition & 1 deletion app/src/components/v-menu/use-popper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function usePopper(
observer.disconnect();
}

function getModifiers(callback: () => void = () => undefined) {
function getModifiers(callback: (value?: unknown) => void = () => undefined) {
const modifiers: Partial<Modifier<string, any>>[] = [
popperOffsets,
{
Expand Down
3 changes: 1 addition & 2 deletions app/src/components/v-slider/v-slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

<script lang="ts">
import { defineComponent, computed } from '@vue/composition-api';
import { ChangeEvent } from 'react';
export default defineComponent({
props: {
Expand Down Expand Up @@ -86,7 +85,7 @@ export default defineComponent({
onInput,
};
function onChange(event: ChangeEvent) {
function onChange(event: InputEvent) {
const target = event.target as HTMLInputElement;
emit('change', Number(target.value));
}
Expand Down
2 changes: 1 addition & 1 deletion app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"skipLibCheck": true,
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
Expand Down
5 changes: 0 additions & 5 deletions docs/.prettierrc.js

This file was deleted.

Loading

0 comments on commit c310afa

Please sign in to comment.