chore: add build tools for strapi backend

feature/blog
Näser 3 years ago
parent 2266345b56
commit 2009608698

@ -1,21 +1,15 @@
# NxGuitarSchool
<a href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>
### Comptes
**This workspace has been generated by [Nx, a Smart, fast and extensible build system.](https://nx.dev)**
#### FTP
## Development server
Username : superadmin@naserloud.fr
mot de passe : =H*S9g**=S$s*(.S5g
host : node143-eu.n0c.com
Run `nx serve client` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
### SSH
command : ssh dpxtrufj@node143-eu.n0c.com -port 5502
mdp : xVarAG3bsEJe8T
## Understand this workspace
Run `nx graph` to see a diagram of the dependencies of the projects.
## Remote caching
Run `npx nx connect-to-nx-cloud` to enable [remote caching](https://nx.app) and make CI faster.
## Further help
Visit the [Nx Documentation](https://nx.dev) to learn more.

@ -1,6 +0,0 @@
HOST=0.0.0.0
PORT=1337
APP_KEYS="toBeModified1,toBeModified2"
API_TOKEN_SALT=tobemodified
ADMIN_JWT_SECRET=tobemodified
JWT_SECRET=tobemodified

@ -0,0 +1,28 @@
HOST=0.0.0.0
PORT=1337
APP_KEYS=chUnDYzQYwe0TBtXVv4sPg==,fVrGPGw5Xd4UdPisWHOHxQ==,Qre2n8wneae2BrXOotmagw==,B3suExWQFpyJS9mhqNcOLg==
API_TOKEN_SALT=tyYia7Nui8Y0lM0IRTDjmg==
ADMIN_JWT_SECRET=q1dnfyvh3K7yhTYbYNS7jw==
JWT_SECRET=nc8prafomnDTfDdS00OqTQ==
PG_DATABASE_HOST=localhost
PG_DATABASE_PORT=5432
PG_DATABASE_NAME=gs_database
PG_DATABASE_USERNAME=gs_username
PG_DATABASE_ROOT_PASSWORD=gs_root_username
PG_DATABASE_PASSWORD=gs_password
PG_DATABASE_SCHEMA=public
MYSQL_DATABASE_HOST=localhost
MYSQL_DATABASE_PORT=3307
MYSQL_DATABASE_NAME=gs_database
MYSQL_DATABASE_USERNAME=gs_username
MYSQL_DATABASE_ROOT_PASSWORD=gs_root_username
MYSQL_DATABASE_PASSWORD=gs_password
SMTP_HOST=mail.infomaniak.com
SMTP_PORT=587
SMTP_USERNAME=synology@naser.fr
SMTP_PASSWORD=Em18071988!
SMTP_DEFAULT_FROM=no-reply@strapi.io
SMTP_DEFAULT_REPLY=synology@naser.fr

@ -24,3 +24,5 @@ SMTP_HOST=node143-eu.n0c.com
SMTP_PORT=587
SMTP_USERNAME=no-reply@nasercloud.fr
SMTP_PASSWORD=GuitarSchool123!
SMTP_DEFAULT_FROM=no-reply@strapi.io
SMTP_DEFAULT_REPLY=synology@naser.fr

@ -16,7 +16,7 @@ PG_DATABASE_SCHEMA=public
MYSQL_DATABASE_HOST=localhost
MYSQL_DATABASE_PORT=3306
MYSQL_DATABASE_NAME=dpxtrufj_gs_database
MYSQL_DATABASE_USERNAME=dpxtrufj_gs_username
MYSQL_DATABASE_USERNAME=dpxtrufj_gs_user
MYSQL_DATABASE_ROOT_PASSWORD=gs_root_username
MYSQL_DATABASE_PASSWORD=q7=@oa*F*s4?8*Hq4H
@ -24,3 +24,5 @@ SMTP_HOST=node143-eu.n0c.com
SMTP_PORT=587
SMTP_USERNAME=no-reply@nasercloud.fr
SMTP_PASSWORD=GuitarSchool123!
SMTP_DEFAULT_FROM=no-reply@nasercloud.fr
SMTP_DEFAULT_REPLY=contact@nasercloud.fr

@ -2,12 +2,11 @@ export default ({env}) => ({
connection: {
client: 'mysql',
connection: {
host: env('DATABASE_HOST', 'localhost'),
port: env.int('DATABASE_PORT', 3306),
database: env('DATABASE_NAME', 'bank'),
user: env('DATABASE_USERNAME', 'postgres'),
password: env('DATABASE_PASSWORD', '0000'),
ssl: false,
host: env('MYSQL_DATABASE_HOST', 'localhost'),
port: env.int('MYSQL_DATABASE_PORT', 3306),
database: env('MYSQL_DATABASE_NAME', 'bank'),
user: env('MYSQL_DATABASE_USERNAME', 'postgres'),
password: env('MYSQL_DATABASE_PASSWORD', '0000'),
},
debug: false,
},

@ -13,8 +13,8 @@ module.exports = ({env}) => ({
// ... any custom nodemailer options
},
settings: {
defaultFrom: 'no-reply@strapi.io',
defaultReplyTo: 'synology@naser.fr',
defaultFrom: env('SMTP_DEFAULT_FROM', 'no-reply@strapi.io'),
defaultReplyTo: env('SMTP_DEFAULT_REPLY', 'synology@naser.fr'),
},
},
},

@ -2,19 +2,19 @@ services:
gs_mysql:
image: 'mariadb:10.3'
environment:
MYSQL_DATABASE: ${DATABASE_NAME}
MYSQL_DATABASE: ${MYSQL_DATABASE_NAME}
# So you don't have to use root, but you can if you like
MYSQL_USER: ${DATABASE_USERNAME}
MYSQL_USER: ${MYSQL_DATABASE_USERNAME}
# You can use whatever password you like
MYSQL_PASSWORD: ${DATABASE_PASSWORD}
MYSQL_PASSWORD: ${MYSQL_DATABASE_PASSWORD}
# Password for root access
MYSQL_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_DATABASE_ROOT_PASSWORD}
ports:
# <Port exposed> : < MySQL Port running inside container>
- '3307:3306'
- '${MYSQL_DATABASE_PORT}:3306'
expose:
# Opens port 3306 on the container
- '3307'
- '${MYSQL_DATABASE_PORT}'
# Where our data will be persisted
volumes:
- gs_mariadb-master:/var/lib/mysql

@ -16,15 +16,15 @@
"dependencies": {
"@strapi/plugin-i18n": "4.5.4",
"@strapi/plugin-users-permissions": "4.5.4",
"@strapi/provider-email-nodemailer": "^4.5.6",
"@strapi/provider-email-nodemailer": "4.5.6",
"@strapi/strapi": "4.5.4",
"@strapi/utils": "^4.5.6",
"@strapi/utils": "4.5.6",
"better-sqlite3": "7.4.6",
"mysql": "^2.18.1",
"pg": "^8.8.0",
"strapi-plugin-import-export-entries": "^1.18.0",
"strapi-plugin-menus": "^1.2.1",
"strapi-plugin-populate-deep": "^1.1.2"
"mysql": "2.18.1",
"pg": "8.8.0",
"strapi-plugin-import-export-entries": "1.18.0",
"strapi-plugin-menus": "1.2.1",
"strapi-plugin-populate-deep": "1.1.2"
},
"author": {
"name": "A Strapi developer"

@ -1,7 +1,7 @@
{
"extends": "@strapi/typescript-utils/tsconfigs/server",
"compilerOptions": {
"outDir": "../../dist/backend/dist",
"outDir": "../../dist/apps/backend/dist",
"rootDir": "."
},
"include": [

@ -0,0 +1,10 @@
{
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
}
]
}

@ -0,0 +1,6 @@
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: nxE2EPreset(__dirname),
});

@ -0,0 +1,30 @@
{
"name": "website-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/website-e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/website-e2e/cypress.config.ts",
"devServerTarget": "website:serve:development",
"testingType": "e2e"
},
"configurations": {
"production": {
"devServerTarget": "website:serve:production"
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/website-e2e/**/*.{js,ts}"]
}
}
},
"tags": [],
"implicitDependencies": ["website"]
}

@ -0,0 +1,13 @@
import { getGreeting } from '../support/app.po';
describe('website', () => {
beforeEach(() => cy.visit('/'));
it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('my-email@something.com', 'myPassword');
// Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome website');
});
});

@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io"
}

@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');

@ -0,0 +1,33 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Cypress {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Chainable<Subject> {
login(email: string, password: string): void;
}
}
//
// -- This is a parent command --
Cypress.Commands.add('login', (email, password) => {
console.log('Custom command example: Login', email, password);
});
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

@ -0,0 +1,17 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands';

@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node"]
},
"include": ["src/**/*.ts", "src/**/*.js", "cypress.config.ts"]
}

File diff suppressed because one or more lines are too long

607
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -7,9 +7,18 @@
"install:backend": "cd apps/backend && npm install",
"generate:backend": "cd apps/backend && npm run generate",
"build:backend": "cd apps/backend && npm run build",
"build:backend:staging": "cd apps/backend && npm run build",
"postbuild:backend:staging": "node scripts/strapi/build-staging.js",
"predevelop:backend": "npm run start:docker && npm run build:backend",
"develop:backend": "cd apps/backend && npm run develop",
"start:client": "nx serve client",
"build:client:development": "npm run build client -- --configuration development --verbose",
"build:client:staging": "npm run build client -- --configuration staging",
"build:client:production": "npm run build client -- --configuration production",
"start:website": "nx serve website",
"build:website:development": "npm run build website -- --configuration development --verbose",
"build:website:staging": "npm run build website -- --configuration staging",
"build:website:production": "npm run build website -- --configuration production",
"start": "nx serve",
"build": "nx build",
"test": "nx test"
@ -44,7 +53,7 @@
"@nx-extend/strapi": "^3.2.0",
"@testing-library/react": "13.4.0",
"@types/jest": "28.1.1",
"@types/node": "16.11.7",
"@types/node": "18.11.9",
"@types/react": "18.0.25",
"@types/react-dom": "18.0.9",
"@typescript-eslint/eslint-plugin": "^5.36.1",

@ -0,0 +1,8 @@
const path = require('path');
const nextPath = path.join(__dirname, 'node_modules', '.bin', 'next');
process.argv.length = 1;
process.argv.push(nextPath, 'start');
require(nextPath);

@ -0,0 +1,9 @@
const fs = require('fs');
const fse = require('fs-extra');
const path = require('path');
fse.copySync(path.join(__dirname, '..', '..', 'apps/backend/public'), path.join(__dirname, '..', '..', 'dist/backend/public'));
fs.copyFileSync(path.join(__dirname, '..', '..', 'apps/backend/.env.staging'), path.join(__dirname, '..', '..', 'dist/backend/.env'));
fs.copyFileSync(path.join(__dirname, 'sources/server.js'), path.join(__dirname, '..', '..', 'dist/backend/server.js'));
fs.copyFileSync(path.join(__dirname, 'sources/package.json'), path.join(__dirname, '..', '..', 'dist/backend/package.json'));
fs.copyFileSync(path.join(__dirname, 'sources/.strapi-updater.json'), path.join(__dirname, '..', '..', 'dist/backend/.strapi-updater.json'));

@ -0,0 +1,4 @@
{
"latest": "4.5.6",
"lastUpdateCheck": 1674315789881
}

@ -0,0 +1,31 @@
{
"name": "nx-guitar-school",
"version": "0.0.0",
"overrides": {
"@strapi/strapi": "4.5.4"
},
"dependencies": {
"@strapi/plugin-i18n": "4.5.4",
"@strapi/plugin-users-permissions": "4.5.4",
"@strapi/provider-email-nodemailer": "4.5.6",
"@strapi/strapi": "4.5.4",
"@strapi/utils": "4.5.6",
"better-sqlite3": "7.4.6",
"mysql": "2.18.1",
"pg": "8.8.0",
"strapi-plugin-import-export-entries": "1.18.0",
"strapi-plugin-menus": "1.2.1",
"strapi-plugin-populate-deep": "1.1.2"
},
"author": {
"name": "A Strapi developer"
},
"strapi": {
"uuid": "d1de7a93-c68b-4597-80ee-b5b56ea4eb10"
},
"engines": {
"node": ">=14.19.1 <=18.x.x",
"npm": ">=6.0.0"
},
"license": "MIT"
}

@ -0,0 +1,3 @@
const strapi = require('@strapi/strapi');
const app = strapi({distDir: './dist'});
app.start();
Loading…
Cancel
Save