Move template into packages/scripts

This commit is contained in:
Jerko Steiner 2019-09-14 11:27:07 +07:00
parent 103f6d1e7a
commit 1eafdf7fd8
10 changed files with 24 additions and 3 deletions

View File

@ -13,5 +13,6 @@
"dependencies": {},
"types": "lib/index.d.ts",
"devDependencies": {},
"module": "lib/index.js"
"module": "lib/index.js",
"main": "lib/index.js"
}

View File

@ -8,6 +8,11 @@ export async function add(...argv: string[]) {
const {parse} = argparse({
name: arg('string', {positional: true, required: true}),
namespace: arg('string', {default: '@rondo.dev'}),
template: arg('string', {
default: path.join(__dirname, '..', '..', 'template'),
alias: 't',
description: 'Path to project template directory',
}),
help: arg('boolean', {
alias: 'h',
description: 'Print help message',
@ -23,7 +28,7 @@ export async function add(...argv: string[]) {
const libraryName = `${args.namespace}/${args.name}`
const templateDir = path.join('.', 'template')
const templateDir = args.template
for (const file of await walk(templateDir)) {
const src = file
const dest = path.join(destDir, path.relative(templateDir, file))

View File

@ -10,5 +10,6 @@
"dependencies": {
},
"main": "lib/index.js",
"module": "esm/index.js",
"types": "lib/index.d.ts"
}

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "esm"
},
"references": [
]
}

View File

@ -4,6 +4,12 @@
"outDir": "lib",
"rootDir": "src"
},
"exclude": [
"node_modules",
"template",
"lib",
"esm"
],
"references": [
{"path": "../argparse"}
]