Compare commits
36 Commits
043759f707
...
master
Author | SHA1 | Date | |
---|---|---|---|
698674b46d
|
|||
eb1a668738
|
|||
95c90f2877
|
|||
5a3c7574aa
|
|||
11f8781a0d
|
|||
191cd90c2d | |||
b9bdd6bc9f | |||
3e4e5bba1c | |||
09530c439f | |||
702b2dae29 | |||
f38ff47fe2 | |||
da8c39c91b | |||
d3a568cfe4 | |||
3fac2ba503 | |||
b43bbe3459 | |||
58753bbd01 | |||
87995d515f | |||
0366226d79 | |||
636e32c64f | |||
db8f88047b | |||
64ed038b30 | |||
d097ba4ad7 | |||
530c215088 | |||
93f4592d16 | |||
0027bd9152 | |||
3a92db14de | |||
d76d0ad1fb | |||
b07be17744 | |||
a9b1052d9c | |||
bff56aa9d5 | |||
3ac16d0b16 | |||
64eafe7c20 | |||
813cda4183 | |||
20c3780f8e | |||
ba16c60168 | |||
46be34c4b0 |
14
.drone.yml
Normal file
14
.drone.yml
Normal file
@ -0,0 +1,14 @@
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: setup
|
||||
image: registry:5000/node-build
|
||||
commands:
|
||||
- yarn
|
||||
- curl https://git.scode.ovh/Timo/standard/raw/branch/master/ci.js > ci.js
|
||||
|
||||
- name: build
|
||||
image: registry:5000/node-build
|
||||
commands:
|
||||
- node ci.js
|
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,5 +1,15 @@
|
||||
# Changelog
|
||||
|
||||
## 1.5.0
|
||||
|
||||
Node template: use jasmine instead of ava
|
||||
|
||||
## 1.4.0
|
||||
|
||||
Drone template
|
||||
|
||||
Jenkins template: remove node specific template (replaced by drone)
|
||||
|
||||
## 1.3.0
|
||||
|
||||
Copyright function: carry previous creation date to prevent unnecessary modifications
|
||||
@ -7,7 +17,7 @@ Copyright function: carry previous creation date to prevent unnecessary modifica
|
||||
## 1.2.0
|
||||
|
||||
- Fully interactive snippets
|
||||
- db migration generator removed (new snipped in development)
|
||||
- db migration generator removed
|
||||
|
||||
## 1.1.0
|
||||
|
||||
|
23
Jenkinsfile
vendored
23
Jenkinsfile
vendored
@ -1,23 +0,0 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
VERSION = VersionNumber([
|
||||
versionNumberString:
|
||||
'${BUILDS_ALL_TIME}',
|
||||
versionPrefix: '1.3.',
|
||||
worstResultForIncrement: 'SUCCESS'
|
||||
])
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Building') {
|
||||
steps {
|
||||
script {
|
||||
currentBuild.displayName = env.VERSION
|
||||
}
|
||||
sh 'yarn ci ${VERSION}'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
# @sapphirecode/snippeteer
|
||||
|
||||
version: 1.3.x
|
||||
version: 1.5.x
|
||||
|
||||
macros for setting up projects or project parts
|
||||
|
||||
@ -31,8 +31,9 @@ license file and adding fields like author and license to the package.json
|
||||
|
||||
create a generic jenkinsfile
|
||||
|
||||
for node projects: automatically generates a jenkinsfile and jenkins.js for easy
|
||||
use in jenkins.
|
||||
#### drone
|
||||
|
||||
create a generic .drone.yml for deployment of node projects
|
||||
|
||||
necessary scripts in the package.json:
|
||||
|
||||
|
29
jenkins.js
29
jenkins.js
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Snippeteer which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, June 2020
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const https = require ('https');
|
||||
const fs = require ('fs');
|
||||
const { execSync: exec_sync } = require ('child_process');
|
||||
|
||||
const run_file = fs.createWriteStream ('.jenkins.run.js');
|
||||
|
||||
const [
|
||||
,, ...args
|
||||
] = process.argv;
|
||||
|
||||
run_file.on ('close', () => {
|
||||
exec_sync (`node .jenkins.run.js ${args.join (' ')}`, { stdio: 'inherit' });
|
||||
});
|
||||
|
||||
https.get (
|
||||
'https://git.scode.ovh/Timo/standard/raw/branch/master/jenkins.run.js',
|
||||
(msg) => {
|
||||
msg.pipe (run_file);
|
||||
}
|
||||
);
|
@ -13,7 +13,7 @@ export class FileMapper {
|
||||
public static async map_all_files (
|
||||
folder: string,
|
||||
mutator: (data: string, file: string, args: Array<unknown>) => string|null,
|
||||
args: Array<unknown> = []
|
||||
opts: Array<unknown> = []
|
||||
): Promise<void> {
|
||||
const files = await fs.readdir (folder);
|
||||
for (const file of files) {
|
||||
@ -21,11 +21,11 @@ export class FileMapper {
|
||||
continue;
|
||||
const abs_path = path.join (folder, file);
|
||||
if ((await fs.stat (abs_path)).isDirectory ()) {
|
||||
await FileMapper.map_all_files (abs_path, mutator, args);
|
||||
await FileMapper.map_all_files (abs_path, mutator, opts);
|
||||
continue;
|
||||
}
|
||||
const data = await fs.readFile (abs_path, 'utf-8');
|
||||
const res = mutator (data, file, args);
|
||||
const res = mutator (data, file, opts);
|
||||
if (res === null)
|
||||
continue;
|
||||
await fs.writeFile (abs_path, res, 'utf-8');
|
||||
|
@ -41,7 +41,7 @@ export default class Copyright implements Snippet {
|
||||
);
|
||||
|
||||
await modify_json ((json) => {
|
||||
json.author = `${options.author} <${options.email}>`;
|
||||
json.author = { name: options.author, email: options.email };
|
||||
json.license = options.has_license ? options.license : 'UNLICENSED';
|
||||
return json;
|
||||
});
|
||||
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Snippeteer which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
import { ColumnType } from './ColumnType';
|
||||
import { Relation } from './Relation';
|
||||
|
||||
export class Column {
|
||||
public name: string;
|
||||
public type: ColumnType;
|
||||
public relation?: Relation;
|
||||
|
||||
public constructor (name: string, type: ColumnType) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Snippeteer which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
export enum ColumnType {
|
||||
string = 'string',
|
||||
text = 'text',
|
||||
integer = 'integer',
|
||||
big_integer = 'bigInteger',
|
||||
float = 'float',
|
||||
decimal = 'decimal',
|
||||
increments = 'increments',
|
||||
big_increments = 'bigIncrements',
|
||||
boolean = 'boolean',
|
||||
date = 'date',
|
||||
date_time ='datetime',
|
||||
time = 'time',
|
||||
timestamp = 'timestamp',
|
||||
binary = 'binary',
|
||||
enum = 'enu',
|
||||
json='json',
|
||||
jsonb='jsonb',
|
||||
uuid='uuid'
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Snippeteer which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
import { Table } from './Table';
|
||||
|
||||
export class Database {
|
||||
public tables: Array<Table> = [];
|
||||
|
||||
public get_table (name: string): Table|null {
|
||||
for (const table of this.tables) {
|
||||
if (table.name === name)
|
||||
return table;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Snippeteer which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
import { Database } from './Database';
|
||||
|
||||
export interface PatchAction {
|
||||
apply(db: Database): void;
|
||||
assign_object(obj: Record<string, unknown>):void;
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Snippeteer which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
export class Relation {
|
||||
public column: string;
|
||||
public table: string;
|
||||
|
||||
public constructor (table: string, column: string) {
|
||||
this.column = column;
|
||||
this.table = table;
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Snippeteer which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
import { Column } from './Column';
|
||||
|
||||
export class Table {
|
||||
public name: string;
|
||||
public columns: Array<Column> = [];
|
||||
|
||||
public constructor (name: string) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public get_column (name: string): Column|null {
|
||||
for (const col of this.columns) {
|
||||
if (col.name === name)
|
||||
return col;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Snippeteer which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, June 2020
|
||||
*/
|
||||
|
||||
import { Database } from '../classes/Database';
|
||||
import { Menu } from './Menu';
|
||||
|
||||
export class MainMenu extends Menu {
|
||||
public constructor (db: Database) {
|
||||
super ('Snippeteer Database');
|
||||
this.register_option ('quit', () => {
|
||||
// noop
|
||||
});
|
||||
this.register_option ('create table', () => {
|
||||
console.log ('table');
|
||||
});
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Snippeteer which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, June 2020
|
||||
*/
|
||||
|
||||
import { StringOption } from '@sapphirecode/console-app';
|
||||
|
||||
export class Menu {
|
||||
private _options: Record<string, ()=>void|Promise<void>> = {};
|
||||
private _title: string;
|
||||
|
||||
public constructor (title: string) {
|
||||
this._title = title;
|
||||
}
|
||||
|
||||
public async run (): Promise<void> {
|
||||
const options = Object.keys (this._options);
|
||||
const selected = await (new StringOption ({
|
||||
name: 'menu_select',
|
||||
message: this._title,
|
||||
sources: { console: false },
|
||||
exit_on_interrupt: true,
|
||||
preset: options
|
||||
}))
|
||||
.parse ();
|
||||
if (typeof this._options[selected] !== 'undefined')
|
||||
await new Promise (this._options[selected]);
|
||||
}
|
||||
|
||||
public register_option (name:string, callback:()=>void|Promise<void>): void {
|
||||
this._options[name] = callback;
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
import { PatchAction } from '../classes/PatchAction';
|
||||
|
||||
export class ActionFactory {
|
||||
private static _actions: Record<string, (json:string)=>PatchAction> = {};
|
||||
|
||||
public static get (name:string, json:string): PatchAction {
|
||||
return this._actions[name] (json);
|
||||
}
|
||||
|
||||
public static register (
|
||||
name:string,
|
||||
constr: (json:string)=>PatchAction
|
||||
):void {
|
||||
this._actions[name] = constr;
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
import { Persistent } from '@sapphirecode/modelling';
|
||||
import { PatchAction } from '../classes/PatchAction';
|
||||
import { Database } from '../classes/Database';
|
||||
import { Table } from '../classes/Table';
|
||||
import { Column } from '../classes/Column';
|
||||
import { ColumnType } from '../classes/ColumnType';
|
||||
|
||||
export class AddTable extends Persistent implements PatchAction {
|
||||
public get name ():string {
|
||||
return this.get ('name') as string;
|
||||
}
|
||||
|
||||
public constructor (name:string) {
|
||||
super ();
|
||||
this.properties.name = 'string';
|
||||
|
||||
this.set ('name', name);
|
||||
}
|
||||
|
||||
public apply (db: Database):void {
|
||||
if (typeof db.get_table (this.name) !== 'undefined')
|
||||
throw new Error ('table already exists');
|
||||
|
||||
const table = new Table (this.name);
|
||||
table.columns.push (new Column ('id', ColumnType.increments));
|
||||
|
||||
db.tables.push (table);
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Snippeteer which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, June 2020
|
||||
*/
|
||||
|
||||
import { PatchAction } from '../classes/PatchAction';
|
||||
import { ActionFactory } from './ActionFactory';
|
||||
import { RenameColumn } from './RenameColumn';
|
||||
import { AddTable } from './AddTable';
|
||||
|
||||
|
||||
/*
|
||||
* export { AddColumn } from './AddColumn';
|
||||
* export { DropColumn } from './DropColumn';
|
||||
* export { AddRelation } from './AddRelation';
|
||||
* export { DropRelation } from './DropRelation';
|
||||
* export { SetColumnType } from './SetColumnType';
|
||||
* export { DropTable } from './DropTable';
|
||||
* export { RenameTable } from './RenameTable';
|
||||
* export { InsertData } from './InsertData';
|
||||
* export { UpdateData } from './UpdateData';
|
||||
* export { MutateDate } from './MutateDate';
|
||||
* export { DeleteData } from './DeleteData';
|
||||
*/
|
||||
|
||||
function assign_json (patch:PatchAction, json:string):PatchAction {
|
||||
const obj = JSON.parse (json);
|
||||
patch.assign_object (obj);
|
||||
return patch;
|
||||
}
|
||||
|
||||
function init ():void {
|
||||
ActionFactory.register (
|
||||
'rename_column',
|
||||
(json:string) => assign_json (new RenameColumn ('', '', ''), json)
|
||||
);
|
||||
|
||||
ActionFactory.register (
|
||||
'add_table',
|
||||
(json:string) => assign_json (new AddTable (''), json)
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
init,
|
||||
RenameColumn,
|
||||
AddTable
|
||||
};
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Snippeteer which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
import { Persistent } from '@sapphirecode/modelling';
|
||||
import { PatchAction } from '../classes/PatchAction';
|
||||
import { Database } from '../classes/Database';
|
||||
|
||||
export class RenameColumn extends Persistent implements PatchAction {
|
||||
public get table (): string {
|
||||
return this.get ('table') as string;
|
||||
}
|
||||
|
||||
public get column (): string {
|
||||
return this.get ('column') as string;
|
||||
}
|
||||
|
||||
public get new_name (): string {
|
||||
return this.get ('new_name') as string;
|
||||
}
|
||||
|
||||
public constructor (
|
||||
column: string,
|
||||
new_name: string,
|
||||
table: string
|
||||
) {
|
||||
super ();
|
||||
this.properties.column = 'string';
|
||||
this.properties.table = 'string';
|
||||
this.properties.new_name = 'string';
|
||||
|
||||
this.set ('column', column);
|
||||
this.set ('new_name', new_name);
|
||||
this.set ('table', table);
|
||||
}
|
||||
|
||||
public apply (db: Database): void {
|
||||
const table = db.get_table (this.table);
|
||||
if (typeof table === 'undefined' || table === null) {
|
||||
throw new Error (
|
||||
`table ${this.table} not found`
|
||||
);
|
||||
}
|
||||
const column = table.get_column (this.column);
|
||||
if (typeof column === 'undefined' || column === null) {
|
||||
throw new Error (
|
||||
`column ${this.column} not found in table ${this.table}`
|
||||
);
|
||||
}
|
||||
|
||||
column.name = this.new_name;
|
||||
}
|
||||
}
|
@ -2,20 +2,19 @@
|
||||
* Copyright (C) SapphireCode - All Rights Reserved
|
||||
* This file is part of Snippeteer which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
||||
* Created by Timo Hocker <timo@scode.ovh>, July 2020
|
||||
*/
|
||||
|
||||
import { files } from '@sapphirecode/standard';
|
||||
import { Snippet } from '../../Snippet';
|
||||
import { MainMenu } from './menu/MainMenu';
|
||||
import { Database as DatabaseClass } from './classes/Database';
|
||||
import { apply_template } from '../../Helper';
|
||||
|
||||
export default class Database implements Snippet {
|
||||
export default class Drone implements Snippet {
|
||||
public is_active (): boolean {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public async start (): Promise<void> {
|
||||
await (new MainMenu (new DatabaseClass))
|
||||
.run ();
|
||||
await apply_template (files.drone, '.drone.yml');
|
||||
}
|
||||
}
|
@ -7,10 +7,7 @@
|
||||
|
||||
/* eslint-disable max-len */
|
||||
|
||||
import { files } from '@sapphirecode/standard';
|
||||
|
||||
const general = { jenkinsfile: '' };
|
||||
const node = { jenkinsfile: files.jenkinsfile, js: files.jenkins };
|
||||
|
||||
general.jenkinsfile = `pipeline {
|
||||
agent any
|
||||
@ -53,4 +50,4 @@ general.jenkinsfile = `pipeline {
|
||||
}
|
||||
`;
|
||||
|
||||
export { general, node };
|
||||
export { general };
|
||||
|
@ -5,11 +5,10 @@
|
||||
* Created by Timo Hocker <timo@scode.ovh>, May 2020
|
||||
*/
|
||||
|
||||
import { Confirm } from 'enquirer';
|
||||
import { Snippet } from '../../Snippet';
|
||||
import { apply_template, modify_json } from '../../Helper';
|
||||
import { apply_template } from '../../Helper';
|
||||
|
||||
import { general, node } from './Assets';
|
||||
import { general } from './Assets';
|
||||
|
||||
export default class Jenkins implements Snippet {
|
||||
public is_active (): boolean {
|
||||
@ -17,23 +16,6 @@ export default class Jenkins implements Snippet {
|
||||
}
|
||||
|
||||
public async start (): Promise<void> {
|
||||
const is_node = await new Confirm ({
|
||||
message: 'is the current project using nodejs?',
|
||||
initial: true
|
||||
})
|
||||
.run ();
|
||||
|
||||
if (is_node) {
|
||||
await apply_template (node.js, 'jenkins.js');
|
||||
await apply_template (node.jenkinsfile, 'Jenkinsfile');
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
await modify_json ((obj: any): any => {
|
||||
obj.scripts.ci = 'yarn && node jenkins.js';
|
||||
return obj;
|
||||
});
|
||||
}
|
||||
else {
|
||||
await apply_template (general.jenkinsfile, 'Jenkinsfile');
|
||||
}
|
||||
await apply_template (general.jenkinsfile, 'Jenkinsfile');
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,11 @@
|
||||
|
||||
import path from 'path';
|
||||
import { Input, Confirm } from 'enquirer';
|
||||
import { scripts as standard_scripts } from '@sapphirecode/standard';
|
||||
import {
|
||||
scripts as standard_scripts,
|
||||
files as standard_files
|
||||
} from '@sapphirecode/standard';
|
||||
import fs from 'fs-extra';
|
||||
import { Snippet } from '../../Snippet';
|
||||
import { apply_template, modify_json, run_command } from '../../Helper';
|
||||
|
||||
@ -16,6 +20,22 @@ import {
|
||||
tsconfig, eslintrc_ts, eslintignore
|
||||
} from './Assets';
|
||||
|
||||
|
||||
const packages = {
|
||||
common: [ 'eslint' ],
|
||||
js: [ '@sapphirecode/eslint-config' ],
|
||||
ts: [
|
||||
'typescript',
|
||||
'@sapphirecode/eslint-config-ts'
|
||||
],
|
||||
test: [
|
||||
'nyc',
|
||||
'jasmine',
|
||||
'@types/jasmine'
|
||||
],
|
||||
test_ts: [ 'ts-node' ]
|
||||
};
|
||||
|
||||
/**
|
||||
* initialize the package.json
|
||||
*
|
||||
@ -28,8 +48,22 @@ async function init_package (
|
||||
use_ts: boolean,
|
||||
use_tests: boolean
|
||||
): Promise<void> {
|
||||
run_command ('yarn init -y', folder);
|
||||
|
||||
const bundle = [
|
||||
...packages.common,
|
||||
...(use_ts ? packages.ts : packages.js),
|
||||
...(use_tests ? packages.test : []),
|
||||
...(use_ts && use_tests ? packages.test_ts : [])
|
||||
];
|
||||
|
||||
run_command (
|
||||
`yarn add --dev ${bundle.join (' ')}`,
|
||||
folder
|
||||
);
|
||||
|
||||
await modify_json ((obj: Record<string, unknown>) => {
|
||||
const scripts
|
||||
const scripts: Record<string, string>
|
||||
= {
|
||||
lint: standard_scripts.lint,
|
||||
test: standard_scripts.test.common,
|
||||
@ -39,7 +73,9 @@ async function init_package (
|
||||
|
||||
if (use_ts) {
|
||||
scripts.compile = standard_scripts.compile.ts;
|
||||
scripts.pretest = standard_scripts.test.ts_pre;
|
||||
scripts.test = standard_scripts.test.ts;
|
||||
scripts.posttest = standard_scripts.test.ts_post;
|
||||
files.push ('/dist/');
|
||||
}
|
||||
else {
|
||||
@ -92,13 +128,14 @@ export default class Node implements Snippet {
|
||||
);
|
||||
}
|
||||
run_command ('git init', folder);
|
||||
run_command ('yarn init -y', folder);
|
||||
run_command (
|
||||
`yarn add --dev @sapphirecode/eslint-config${use_ts
|
||||
? '-ts typescript @ava/typescript'
|
||||
: ''} eslint nyc ava`,
|
||||
folder
|
||||
);
|
||||
|
||||
if (use_tests) {
|
||||
await apply_template (
|
||||
standard_files.jasmine,
|
||||
path.join (folder, 'jasmine.json')
|
||||
);
|
||||
await fs.mkdirp (path.join (folder, 'test/spec'));
|
||||
}
|
||||
|
||||
await init_package (folder, use_ts, use_tests);
|
||||
}
|
||||
|
@ -31,7 +31,10 @@ export default class Readme implements Snippet {
|
||||
package_data.software = json.name;
|
||||
package_data.description = json.description;
|
||||
package_data.license = json.license;
|
||||
package_data.author = json.author;
|
||||
if (typeof json.author === 'object')
|
||||
package_data.author = `${json.author.name} <${json.author.email}>`;
|
||||
else
|
||||
package_data.author = json.author;
|
||||
});
|
||||
const readme = get_readme (
|
||||
package_data.software,
|
||||
|
29
package.json
29
package.json
@ -1,44 +1,49 @@
|
||||
{
|
||||
"name": "@sapphirecode/snippeteer",
|
||||
"version": "1.0.0",
|
||||
"version": "1.5.6",
|
||||
"description": "macros for setting up projects or project parts",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
"snippeteer": "./index.js"
|
||||
},
|
||||
"bugs": "https://redmine.scode.ovh/projects/snippeteer",
|
||||
"scripts": {
|
||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue,.mjs",
|
||||
"ci": "yarn --frozen-lockfile && node jenkins.js",
|
||||
"test": "echo \"no test\"",
|
||||
"compile": "tsc"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@git.scode.ovh:timo/snippeteer"
|
||||
"url": "https://git.scode.ovh:timo/snippeteer.git"
|
||||
},
|
||||
"files": [
|
||||
"/dist/",
|
||||
"/lib/",
|
||||
"LICENSE"
|
||||
],
|
||||
"author": "Timo Hocker <timo@scode.ovh>",
|
||||
"author": {
|
||||
"name": "Timo Hocker",
|
||||
"email": "timo@scode.ovh"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"devDependencies": {
|
||||
"@sapphirecode/eslint-config-ts": "^1.0.22",
|
||||
"@types/fs-extra": "^9.0.0",
|
||||
"@types/node": "^14.0.1",
|
||||
"eslint": "^7.0.0",
|
||||
"typescript": "^3.8.3"
|
||||
"@types/node": "^17.0.2",
|
||||
"eslint": "^8.5.0",
|
||||
"typescript": "^4.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sapphirecode/console-app": "^2.0.6",
|
||||
"@sapphirecode/modelling": "^1.1.6",
|
||||
"@sapphirecode/standard": "^1.0.1",
|
||||
"@sapphirecode/standard": "^1.5.5",
|
||||
"enquirer": "^2.3.5",
|
||||
"fs-extra": "^9.0.0",
|
||||
"fs-extra": "^10.0.0",
|
||||
"license": "^1.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"snippet",
|
||||
"template"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user