Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements/upgrades #76

Merged
merged 2 commits into from
Aug 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
upgrade to directus 11
  • Loading branch information
mattiaz9 committed Aug 10, 2024
commit 5bd8a634e61f8aa14f839d5ca0da0dea2e710de7
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -12,4 +12,5 @@ ENV ADMIN_EMAIL="admin@example.com"
ENV ADMIN_PASSWORD="d1r3ctu5"
COPY --from=build ./usr/src/app/apps/cms/snapshot.yaml ./snapshot.yaml
COPY --from=build ./usr/src/app/apps/cms/extensions ./extensions
COPY --from=build ./usr/src/app/apps/cms/migrations ./migrations
CMD node cli.js bootstrap && node cli.js database migrate:latest && node cli.js schema apply --yes ./snapshot.yaml && node cli.js start
1 change: 1 addition & 0 deletions apps/cms/.gitignore
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@

# Ignore the extensions folder
/extensions/*
/migrations/*
!/extensions/templates

# Yarn zero-install
54 changes: 27 additions & 27 deletions apps/cms/package.json
Original file line number Diff line number Diff line change
@@ -12,54 +12,54 @@
"migrate": "pnpm build --migrationsOnly && pnpm migrate-up",
"migrate-up": "directus database migrate:latest",
"migrate-down": "directus database migrate:down",
"snapshot": "directus schema snapshot ./snapshot.yaml",
"snapshot-apply": "directus schema apply ./snapshot.yaml",
"snapshot": "directus schema snapshot ./snapshot.yaml -y",
"snapshot-apply": "directus schema apply ./snapshot.yaml -y",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@directus/constants": "11.0.2",
"@directus/sdk": "14.0.0",
"@directus/types": "11.0.3",
"@octokit/rest": "20.0.2",
"@sendgrid/mail": "8.1.0",
"axios": "1.6.5",
"directus": "10.8.3",
"dotenv": "16.3.2",
"@directus/constants": "12.0.0",
"@directus/sdk": "17.0.0",
"@directus/types": "12.0.0",
"@octokit/rest": "21.0.1",
"@sendgrid/mail": "8.1.3",
"axios": "1.7.3",
"directus": "11.0.1",
"dotenv": "16.4.5",
"knex": "3.1.0",
"pg": "8.11.3",
"pg": "8.12.0",
"remark-parse": "11.0.0",
"remark-slate": "1.8.6",
"slate-blocks": "workspace:*",
"unified": "11.0.4",
"vue-i18n": "9.9.0"
"unified": "11.0.5",
"vue-i18n": "9.13.1"
},
"devDependencies": {
"@directus/extensions": "0.2.1",
"@directus/extensions-sdk": "10.3.0",
"@directus/extensions": "2.0.0",
"@directus/extensions-sdk": "12.0.0",
"@rollup/plugin-alias": "5.1.0",
"@rollup/plugin-commonjs": "25.0.7",
"@rollup/plugin-commonjs": "26.0.1",
"@rollup/plugin-json": "6.1.0",
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-replace": "5.0.5",
"@rollup/plugin-replace": "5.0.7",
"@rollup/plugin-terser": "0.4.4",
"@rollup/plugin-typescript": "11.1.6",
"@rollup/plugin-url": "8.0.2",
"@types/express": "4.17.21",
"@vitejs/plugin-vue": "5.0.3",
"@vue/compiler-sfc": "3.4.15",
"@vitejs/plugin-vue": "5.1.2",
"@vue/compiler-sfc": "3.4.37",
"concurrently": "8.2.2",
"eslint-config-custom": "workspace:*",
"from": "0.1.7",
"glob": "10.3.10",
"rollup": "4.9.6",
"rollup-plugin-dotenv": "0.5.0",
"rollup-plugin-esbuild": "5.0.0",
"glob": "11.0.0",
"rollup": "4.20.0",
"rollup-plugin-dotenv": "0.5.1",
"rollup-plugin-esbuild": "6.1.1",
"rollup-plugin-styles": "4.0.0",
"rollup-plugin-svg-import": "3.0.0",
"sass": "1.70.0",
"sass": "1.77.8",
"tsconfig": "workspace:*",
"tsx": "4.7.0",
"url": "0.11.3",
"vue": "3.4.15"
"tsx": "4.17.0",
"url": "0.11.4",
"vue": "3.4.37"
}
}
187 changes: 0 additions & 187 deletions apps/cms/rollup.config.ts

This file was deleted.

1 change: 1 addition & 0 deletions apps/cms/schema.ts
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@ declare global {
code: Locale
name: string
icon: DirectusFile<DirectusSchema> | null
direction: "ltr" | "rtl"
}

interface BlogArticle {
32 changes: 32 additions & 0 deletions apps/cms/scripts/builder.ts
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@ import { rollup, watch } from "rollup"

import "dotenv/config"

import { existsSync, mkdirSync, writeFileSync } from "node:fs"
import nodePath from "node:path"
import { gray, green, red } from "./console"
import { getExtensionsEntries } from "./entries.extensions"
import { getMigrationsEntries } from "./entries.migrations"
@@ -53,6 +55,36 @@ async function run() {
}),
)
}

// create package jsons
if (!migrationsOnly) {
await Promise.all(
entries.map((entry) => {
const outputFile = entry.rollupOptions.output.file
const outputFolder = nodePath.dirname(outputFile)
const packageJson = {
name: `directus-extension-${entry.name}`,
version: "1.0.0",
type: "module",
"directus:extension": {
type: entry.type,
path: `index.${entry.rollupOptions.output.format === "cjs" ? "cjs" : "mjs"}`,
source: `index.${entry.rollupOptions.output.format === "cjs" ? "cjs" : "mjs"}`,
host: "^11.0.0",
},
}

if (!existsSync(outputFolder)) {
mkdirSync(outputFolder, { recursive: true })
}

writeFileSync(
nodePath.resolve(outputFolder, "package.json"),
JSON.stringify(packageJson, null, 2),
)
}),
)
}
}

run()
2 changes: 1 addition & 1 deletion apps/cms/scripts/entries.extensions.ts
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ export function getExtensionsEntries() {
const format = isApiExtension ? "cjs" : "es"
const exports = isApiExtension ? "default" : undefined
const extension = format === "cjs" ? "cjs" : "mjs"
const file = path.resolve(`${folder}/${entry.type}s/${name}/${entry.output}.${extension}`)
const file = path.resolve(`${folder}/${name}/${entry.output}.${extension}`)

return {
type: entry.type,
10 changes: 5 additions & 5 deletions apps/cms/scripts/utils.ts
Original file line number Diff line number Diff line change
@@ -21,14 +21,14 @@ export function getExtensionsBaseFolder() {
}

export function getMigrationsFolder() {
return path.resolve(getExtensionsBaseFolder(), "migrations")
return path.resolve(process.env.MIGRATIONS_PATH || "./migrations")
}

export function getExtensionsFolders() {
const extensionsFolders = [...API_EXTENSION_TYPES, ...APP_EXTENSION_TYPES].map((type) =>
path.resolve(getExtensionsBaseFolder(), type.replace(/s?$/, "s")),
)

const extensionsFolders = glob
.sync(getExtensionsBaseFolder() + "/*/")
.filter((p) => !p.endsWith("migrations"))
.map((p) => path.resolve(p))
return extensionsFolders
}

Loading