Skip to content

Commit e625736

Browse files
authored
Remove tutorials (#80)
* Remove tutorials endpoints * Remove tutorials property from libraries
1 parent afb952b commit e625736

File tree

5 files changed

+1
-261
lines changed

5 files changed

+1
-261
lines changed

src/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import indexRoutes from './routes/index.js';
1010
import librariesRoutes from './routes/libraries.js';
1111
import libraryRoutes from './routes/library.js';
1212
import statsRoutes from './routes/stats.js';
13-
import tutorialsRoutes from './routes/tutorials.js';
1413
import whitelistRoutes from './routes/whitelist.js';
1514
import corsOptions from './utils/cors.js';
1615

@@ -65,7 +64,6 @@ if (typeof SENTRY_DSN === 'string') {
6564
indexRoutes(app);
6665
statsRoutes(app);
6766
whitelistRoutes(app);
68-
tutorialsRoutes(app);
6967
libraryRoutes(app);
7068
librariesRoutes(app);
7169
errorRoutes(app);

src/routes/library.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default app => {
8181
});
8282
if (!lib) return notFound(ctx, 'Library');
8383

84-
// Generate the initial filtered response (without SRI, tutorials, versions or assets data)
84+
// Generate the initial filtered response (without SRI, versions or assets data)
8585
const requestedFields = queryArray(ctx.req.queries('fields'));
8686
const response = filter(
8787
{
@@ -92,7 +92,6 @@ export default app => {
9292
sri: null,
9393
// All other lib props
9494
...lib,
95-
tutorials: null,
9695
versions: null,
9796
assets: null,
9897
},
@@ -101,9 +100,6 @@ export default app => {
101100
!requestedFields.length || requestedFields.includes('*'),
102101
);
103102

104-
// Tutorials are deprecated, so return an empty array if requested
105-
if ('tutorials' in response) response.tutorials = [];
106-
107103
// Get versions if needed
108104
if ('versions' in response) response.versions = await libraryVersions(lib.name);
109105

src/routes/library.spec.js

-7
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ describe('/libraries/:library', () => {
320320
expect(response.body).to.have.property('autoupdate').that.is.an('object');
321321
expect(response.body).to.have.property('assets').that.is.an('array');
322322
expect(response.body).to.have.property('versions').that.is.an('array');
323-
expect(response.body).to.have.property('tutorials').that.is.an('array');
324323
});
325324
it('has a CDN url for the \'latest\' property', () => {
326325
expect(response.body.latest).to.match(/https:\/\/cdnjs\.cloudflare\.com\/ajax\/libs\/.+\/.+\/.*/);
@@ -347,11 +346,6 @@ describe('/libraries/:library', () => {
347346
}
348347
});
349348
});
350-
describe('Tutorials array', () => {
351-
it('is empty', () => {
352-
expect(response.body.tutorials).to.be.empty;
353-
});
354-
});
355349
});
356350
});
357351

@@ -521,7 +515,6 @@ describe('/libraries/:library', () => {
521515
expect(response.body).to.have.property('autoupdate').that.is.an('object');
522516
expect(response.body).to.have.property('assets').that.is.an('array');
523517
expect(response.body).to.have.property('versions').that.is.an('array');
524-
expect(response.body).to.have.property('tutorials').that.is.an('array');
525518
});
526519
});
527520
});

src/routes/tutorials.js

-40
This file was deleted.

src/routes/tutorials.spec.js

-207
This file was deleted.

0 commit comments

Comments
 (0)