Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 5 additions & 8 deletions src/commands/apply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import chalk from 'chalk'
import * as path from 'pathe'

import * as customFlags from '../flags/common.js'
import {BSL_LICENSE_CTA, BSL_LICENSE_HEADLINE, BSL_LICENSE_TEXT, DIRECTUS_PINK, DIRECTUS_PURPLE, SEPARATOR } from '../lib/constants.js'
import {DIRECTUS_PINK, DIRECTUS_PURPLE, SEPARATOR } from '../lib/constants.js'
import { displayLicenseBanner } from '../lib/license/index.js'
import {type ApplyFlags, validateInteractiveFlags, validateProgrammaticFlags} from '../lib/load/apply-flags.js'
import apply from '../lib/load/index.js'
import {animatedBunny} from '../lib/utils/animated-bunny.js'
Expand Down Expand Up @@ -244,9 +245,7 @@ static flags = {

ux.stdout(SEPARATOR)

log.warn(BSL_LICENSE_HEADLINE)
log.info(BSL_LICENSE_TEXT)
log.info(BSL_LICENSE_CTA)
await displayLicenseBanner()

ux.stdout('Template applied successfully.')
if (!validatedFlags.noExit) process.exit(0)
Expand Down Expand Up @@ -337,10 +336,8 @@ static flags = {
ux.stdout('Template applied successfully.')
if (!validatedFlags.noExit) process.exit(0)

// Hide BSL license info if running programatically for now
// log.warn(BSL_LICENSE_HEADLINE)
// log.info(BSL_LICENSE_TEXT)
// log.info(BSL_LICENSE_CTA)
// Hide license info if running programatically for now
// await displayLicenseBanner()
}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/commands/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import fs from 'node:fs'
import path from 'pathe'

import * as customFlags from '../flags/common.js'
import {BSL_LICENSE_CTA, BSL_LICENSE_HEADLINE, BSL_LICENSE_TEXT, DIRECTUS_PINK, DIRECTUS_PURPLE, SEPARATOR} from '../lib/constants.js'
import {DIRECTUS_PINK, DIRECTUS_PURPLE, SEPARATOR} from '../lib/constants.js'
import extract from '../lib/extract/index.js'
import {displayLicenseBanner} from '../lib/license/index.js'
import {animatedBunny} from '../lib/utils/animated-bunny.js'
import {getDirectusEmailAndPassword, getDirectusToken, getDirectusUrl, initializeDirectusApi, validateAuthFlags} from '../lib/utils/auth.js'
import catchError from '../lib/utils/catch-error.js'
Expand Down Expand Up @@ -129,9 +130,7 @@ static flags = {
await shutdown();
}

log.warn(BSL_LICENSE_HEADLINE)
log.info(BSL_LICENSE_TEXT)
log.info(BSL_LICENSE_CTA)
await displayLicenseBanner()

ux.stdout(SEPARATOR)
ux.stdout('Template extracted successfully.')
Expand Down
15 changes: 13 additions & 2 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,23 @@ export const POSTHOG_HOST = 'https://us.i.posthog.com'

export const DEFAULT_BRANCH = 'main'

export const MSCL_LICENSE_URL = 'https://directus.com/license'
export const MSCL_EMAIL = 'licensing@directus.com'

export const MSCL_LICENSE_HEADLINE =
"Directus is licensed under MSCL-1.0-GPL. A Competing Use—making the Software available in a way that competes with Directus's paid commercial offerings—is not permitted."
export const MSCL_LICENSE_TEXT =
'Permitted uses include internal use, non-commercial education and research, and professional services to deploy or host Directus for licensees. You must not disable or circumvent license key functionality. Four years after release, the Software is also available under GPL-3.0.'

export const MSCL_LICENSE_CTA = `Visit ${pinkText(MSCL_LICENSE_URL)} or reach out to us at ${pinkText(MSCL_EMAIL)} for the full license terms.`

export const BSL_LICENSE_URL = 'https://directus.io/bsl'
export const BSL_EMAIL = 'licensing@directus.io'

export const BSL_LICENSE_HEADLINE = 'You REQUIRE a license to use Directus if your organization has more than $5MM USD a year in revenue and/or funding.'
export const BSL_LICENSE_TEXT = 'For all organizations with less than $5MM USD a year in revenue and funding, Directus is free for personal projects, hobby projects and in production. This second group does not require a license. Directus is licensed under BSL 1.1.'
export const BSL_LICENSE_HEADLINE =
'You REQUIRE a license to use Directus if your organization has more than $5MM USD a year in revenue and/or funding.'
export const BSL_LICENSE_TEXT =
'For all organizations with less than $5MM USD a year in revenue and funding, Directus is free for personal projects, hobby projects and in production. This second group does not require a license. Directus is licensed under BSL 1.1.'

export const BSL_LICENSE_CTA = `Visit ${pinkText(BSL_LICENSE_URL)} for more information or reach out to us at ${pinkText(BSL_EMAIL)}.`

Expand Down
7 changes: 3 additions & 4 deletions src/lib/init/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import type {InitFlags} from '../../commands/init.js'

import ApplyCommand from '../../commands/apply.js'
import {createDocker} from '../../services/docker.js'
import {BSL_LICENSE_CTA, BSL_LICENSE_HEADLINE, BSL_LICENSE_TEXT, pinkText} from '../constants.js'
import {pinkText} from '../constants.js'
import {displayLicenseBanner} from '../license/index.js'
import catchError from '../utils/catch-error.js'
import {createGigetString, parseGitHubUrl} from '../utils/parse-github-url.js'
import {readTemplateConfig} from '../utils/template-config.js'
Expand Down Expand Up @@ -202,9 +203,7 @@ export async function init({dir, flags}: {dir: string, flags: InitFlags}) {

note(nextSteps, 'Next Steps')

clackLog.warn(BSL_LICENSE_HEADLINE)
clackLog.info(BSL_LICENSE_TEXT)
clackLog.info(BSL_LICENSE_CTA)
await displayLicenseBanner()

outro(`Problems or questions? Hop into the community at ${pinkText('https://directus.chat')}`)
} catch (error) {
Expand Down
29 changes: 29 additions & 0 deletions src/lib/license/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {serverHealth} from '@directus/sdk'

import {
BSL_LICENSE_CTA,
BSL_LICENSE_HEADLINE,
BSL_LICENSE_TEXT,
MSCL_LICENSE_CTA,
MSCL_LICENSE_HEADLINE,
MSCL_LICENSE_TEXT,
} from '../constants.js'
import {api} from '../sdk.js'

export const displayLicenseBanner = async () => {
const {releaseId} = await api.client.request(serverHealth())

const mainVersion = Number(releaseId.split('.')[0])

const isMSCL = mainVersion >= 12

if (isMSCL) {
console.warn(MSCL_LICENSE_HEADLINE)
console.info(MSCL_LICENSE_TEXT)
console.info(MSCL_LICENSE_CTA)
} else {
console.warn(BSL_LICENSE_HEADLINE)
console.info(BSL_LICENSE_TEXT)
console.info(BSL_LICENSE_CTA)
}
}