chore: remworking some files after PR comment
This commit is contained in:
@@ -15,3 +15,4 @@
|
||||
*/
|
||||
|
||||
export { router } from './plugin';
|
||||
export const createScaffolder = () => {};
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2020 Spotify AB
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import * as winston from 'winston';
|
||||
|
||||
export const logger = winston.createLogger({
|
||||
level: 'info',
|
||||
format: winston.format.json(),
|
||||
transports: [
|
||||
//
|
||||
// - Write all logs with level `error` and below to `error.log`
|
||||
// - Write all logs with level `info` and below to `combined.log`
|
||||
//
|
||||
new winston.transports.File({ filename: 'error.log', level: 'error' }),
|
||||
new winston.transports.File({ filename: 'combined.log' }),
|
||||
],
|
||||
});
|
||||
|
||||
//
|
||||
// If we're not in production then log to the `console` with the format:
|
||||
// `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
|
||||
//
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
logger.add(
|
||||
new winston.transports.Console({
|
||||
format: winston.format.simple(),
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import glob from 'glob';
|
||||
import * as fs from 'fs-extra';
|
||||
import fs from 'fs-extra';
|
||||
import { logger } from 'lib/logger';
|
||||
import { Template, RepositoryBase as Base } from '.';
|
||||
|
||||
@@ -28,11 +28,12 @@ export class DiskRepository implements Base {
|
||||
private repository: Template[] = [];
|
||||
private localIndex: DiskIndexEntry[] = [];
|
||||
|
||||
constructor(private repoDir = `${__dirname}/templates`) {
|
||||
this.reindex();
|
||||
}
|
||||
|
||||
constructor(private repoDir = `${__dirname}/templates`) {}
|
||||
public async list(): Promise<Template[]> {
|
||||
if (this.repository.length === 0) {
|
||||
await this.reindex();
|
||||
}
|
||||
|
||||
return this.repository;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import { TemplaterBase, TemplaterRunOptions } from '.';
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import * as fs from 'fs-extra';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
class CookieCutter implements TemplaterBase {
|
||||
public async run(options: TemplaterRunOptions): Promise<string> {
|
||||
|
||||
Reference in New Issue
Block a user