create-simple-projects
Advanced tools
Comparing version
{ | ||
"name": "create-simple-projects", | ||
"version": "0.0.5", | ||
"version": "0.0.7", | ||
"description": "Create simple project with ts, jest, eslint, prettier and other stuff.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -30,1 +30,44 @@ # Inspired by: | ||
`npx csp --name test` | ||
## Placeholder | ||
Use [ejs](https://ejs.co/) as template placeholder. | ||
Any package.json files or \*.ejs.\* files will automatically transform the ejs tags within. | ||
### PROJECT_NAME | ||
```JSON | ||
"name": "<%= PROJECT_NAME %>" | ||
``` | ||
### AUTHOR | ||
```JSON | ||
"author": { | ||
"name": "<%= AUTHOR %>" | ||
} | ||
``` | ||
### KEYWORDS | ||
`KEYWORDS` template variable is an array of string. | ||
``` | ||
npx csp --keywords "react classnames style" | ||
``` | ||
Use in template file. | ||
xxx.ejs.ts | ||
```ts | ||
const keywords = JSON.parse(<%= JSON.stringify(KEYWORDS); %>); | ||
``` | ||
Use in package.json | ||
```JSON | ||
"keywords": "<%= KEYWORDS.join('", "') %>" | ||
``` |
@@ -24,3 +24,7 @@ import * as fs from 'fs'; | ||
function isPlaceholderFile(file: string): boolean { | ||
return file === 'package.json' || PlaceholderPattern.test(file); | ||
return ( | ||
file === 'package.json' || | ||
file.toUpperCase() === 'LICENSE' || | ||
PlaceholderPattern.test(file) | ||
); | ||
} | ||
@@ -27,0 +31,0 @@ |
@@ -8,3 +8,3 @@ import * as path from 'path'; | ||
AUTHOR?: string; | ||
KEYWORDS?: string; | ||
KEYWORDS?: string[]; | ||
} | ||
@@ -30,5 +30,5 @@ | ||
AUTHOR: author, | ||
KEYWORDS: keywords | ||
KEYWORDS: keywords?.split(/\s+/) | ||
} | ||
}; | ||
} |
@@ -18,3 +18,4 @@ module.exports = { | ||
'no-unused-vars': 'error' | ||
} | ||
}, | ||
ignorePatterns: ['dist/**/*'] | ||
}; |
@@ -5,2 +5,3 @@ /** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */ | ||
testEnvironment: 'node', | ||
}; | ||
coverageDirectory: '.coverage' | ||
}; |
@@ -11,13 +11,11 @@ { | ||
"scripts": { | ||
"test": "jest", | ||
"build": "run-s clean && run-p build:cjs build:esm", | ||
"test": "jest --coverage", | ||
"build": "run-s test clean && run-p build:cjs build:esm", | ||
"build:cjs": "tsc --module commonjs --declaration --outDir ./dist/lib", | ||
"build:esm": "tsc --module esnext --declaration --outDir ./dist/esm", | ||
"prepublishOnly": "npm run check:ci && npm run build", | ||
"prepublishOnly": "npm run build", | ||
"clean": "rm -rf dist" | ||
}, | ||
"keywords": [ | ||
"template", | ||
"typescript", | ||
"starter" | ||
"<%- KEYWORDS.join('\", \"') %>" | ||
], | ||
@@ -24,0 +22,0 @@ "license": "ISC", |
Sorry, the diff of this file is not supported yet
202199
0.37%370
1.93%73
143.33%