mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
Move to strapi package directly
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
parent
86312ecbaf
commit
a3d22e3f59
96
packages/strapi-telemetry/.gitignore
vendored
96
packages/strapi-telemetry/.gitignore
vendored
@ -1,96 +0,0 @@
|
||||
############################
|
||||
# OS X
|
||||
############################
|
||||
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
Icon
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
._*
|
||||
|
||||
|
||||
############################
|
||||
# Linux
|
||||
############################
|
||||
|
||||
*~
|
||||
|
||||
|
||||
############################
|
||||
# Windows
|
||||
############################
|
||||
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
$RECYCLE.BIN/
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
|
||||
############################
|
||||
# Packages
|
||||
############################
|
||||
|
||||
*.7z
|
||||
*.csv
|
||||
*.dat
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.seed
|
||||
*.so
|
||||
*.swo
|
||||
*.swp
|
||||
*.swn
|
||||
*.swm
|
||||
*.out
|
||||
*.pid
|
||||
|
||||
|
||||
############################
|
||||
# Logs and databases
|
||||
############################
|
||||
|
||||
.tmp
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
|
||||
############################
|
||||
# Misc.
|
||||
############################
|
||||
|
||||
*#
|
||||
.idea
|
||||
nbproject
|
||||
|
||||
|
||||
############################
|
||||
# Node.js
|
||||
############################
|
||||
|
||||
lib-cov
|
||||
lcov.info
|
||||
pids
|
||||
logs
|
||||
results
|
||||
build
|
||||
node_modules
|
||||
.node_history
|
||||
package-lock.json
|
||||
|
@ -1,7 +0,0 @@
|
||||
Copyright (c) 2015-2020 Strapi Solutions.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -1,33 +0,0 @@
|
||||
{
|
||||
"name": "strapi-telemetry",
|
||||
"version": "3.0.0-beta.19.3",
|
||||
"description": "Strapi telemetry",
|
||||
"keywords": [
|
||||
"telemetry"
|
||||
],
|
||||
"homepage": "http://strapi.io",
|
||||
"bugs": {
|
||||
"url": "https://github.com/strapi/strapi/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/strapi/strapi.git",
|
||||
"directory": "packages/strapi-telemetry"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"ci-info": "2.0.0",
|
||||
"is-docker": "2.0.0",
|
||||
"node-fetch": "2.6.0",
|
||||
"node-machine-id": "1.1.12",
|
||||
"node-schedule": "1.3.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0",
|
||||
"npm": ">=6.0.0"
|
||||
}
|
||||
}
|
@ -7,9 +7,10 @@ const fse = require('fs-extra');
|
||||
const Koa = require('koa');
|
||||
const Router = require('koa-router');
|
||||
const _ = require('lodash');
|
||||
const { logger, models } = require('strapi-utils');
|
||||
const chalk = require('chalk');
|
||||
const CLITable = require('cli-table3');
|
||||
const { logger, models } = require('strapi-utils');
|
||||
const { createDatabaseManager } = require('strapi-database');
|
||||
|
||||
const utils = require('./utils');
|
||||
const loadModules = require('./core/load-modules');
|
||||
@ -18,15 +19,13 @@ const initializeMiddlewares = require('./middlewares');
|
||||
const initializeHooks = require('./hooks');
|
||||
const createStrapiFs = require('./core/fs');
|
||||
const getPrefixedDeps = require('./utils/get-prefixed-dependencies');
|
||||
|
||||
const createEventHub = require('./services/event-hub');
|
||||
const createWebhookRunner = require('./services/webhook-runner');
|
||||
const { webhookModel, createWebhookStore } = require('./services/webhook-store');
|
||||
const { createCoreStore, coreStoreModel } = require('./services/core-store');
|
||||
const createEntityService = require('./services/entity-service');
|
||||
const createEntityValidator = require('./services/entity-validator');
|
||||
const { createDatabaseManager } = require('strapi-database');
|
||||
const createStrapiTelemetry = require('strapi-telemetry');
|
||||
const createTelemetry = require('./services/metrics');
|
||||
|
||||
const CONFIG_PATHS = {
|
||||
admin: 'admin',
|
||||
@ -348,9 +347,7 @@ class Strapi {
|
||||
entityValidator: this.entityValidator,
|
||||
});
|
||||
|
||||
this.telemetry = createStrapiTelemetry(this);
|
||||
this.telemetry.initPing();
|
||||
this.app.use(this.telemetry.middleware);
|
||||
this.telemetry = createTelemetry(this);
|
||||
|
||||
// Initialize hooks and middlewares.
|
||||
await initializeMiddlewares.call(this);
|
||||
|
@ -58,18 +58,13 @@ const createTelemetryInstance = strapi => {
|
||||
}
|
||||
};
|
||||
|
||||
const initPing = () => {
|
||||
if (isDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isDisabled) {
|
||||
scheduleJob('0 0 12 * * *', () => sendEvent('ping'));
|
||||
};
|
||||
strapi.app.use(createMiddleware({ sendEvent }));
|
||||
}
|
||||
|
||||
return {
|
||||
initPing,
|
||||
send: sendEvent,
|
||||
middleware: createMiddleware({ sendEvent, isDisabled }),
|
||||
};
|
||||
};
|
||||
|
@ -1,16 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
const createMiddleware = ({ sendEvent, isDisabled }) => {
|
||||
const createMiddleware = ({ sendEvent }) => {
|
||||
const _state = {
|
||||
currentDay: null,
|
||||
counter: 0,
|
||||
};
|
||||
|
||||
return async (ctx, next) => {
|
||||
if (isDisabled) {
|
||||
return next();
|
||||
}
|
||||
|
||||
const { url, method } = ctx.request;
|
||||
|
||||
if (!url.includes('.') && ['GET', 'PUT', 'POST', 'DELETE'].includes(method)) {
|
@ -17,6 +17,7 @@
|
||||
"boom": "^7.3.0",
|
||||
"chalk": "^2.4.1",
|
||||
"chokidar": "3.3.1",
|
||||
"ci-info": "2.0.0",
|
||||
"cli-table3": "^0.5.1",
|
||||
"commander": "^2.20.0",
|
||||
"cross-spawn": "^6.0.5",
|
||||
@ -26,6 +27,7 @@
|
||||
"fs-extra": "^7.0.0",
|
||||
"glob": "^7.1.2",
|
||||
"inquirer": "^6.2.1",
|
||||
"is-docker": "2.0.0",
|
||||
"koa": "^2.8.0",
|
||||
"koa-body": "^4.1.0",
|
||||
"koa-compose": "^4.1.0",
|
||||
@ -42,9 +44,9 @@
|
||||
"koa-static": "^5.0.0",
|
||||
"lodash": "^4.17.5",
|
||||
"minimatch": "^3.0.4",
|
||||
"node-fetch": "^1.7.3",
|
||||
"node-machine-id": "^1.1.10",
|
||||
"node-schedule": "^1.2.0",
|
||||
"node-fetch": "2.6.0",
|
||||
"node-machine-id": "1.1.12",
|
||||
"node-schedule": "1.3.2",
|
||||
"opn": "^5.3.0",
|
||||
"ora": "^3.0.0",
|
||||
"resolve-cwd": "^3.0.0",
|
||||
|
@ -12389,7 +12389,7 @@ node-releases@^1.1.49:
|
||||
dependencies:
|
||||
semver "^6.3.0"
|
||||
|
||||
node-schedule@1.3.2, node-schedule@^1.2.0:
|
||||
node-schedule@1.3.2:
|
||||
version "1.3.2"
|
||||
resolved "https://registry.yarnpkg.com/node-schedule/-/node-schedule-1.3.2.tgz#d774b383e2a6f6ade59eecc62254aea07cd758cb"
|
||||
integrity sha512-GIND2pHMHiReSZSvS6dpZcDH7pGPGFfWBIEud6S00Q8zEIzAs9ommdyRK1ZbQt8y1LyZsJYZgPnyi7gpU2lcdw==
|
||||
|
Loading…
x
Reference in New Issue
Block a user