(opts: InitOptions = {})
| 44 | }; |
| 45 | |
| 46 | const createSourceFiles = async (opts: InitOptions = {}) => { |
| 47 | const rdmSrc = getTemplateFileContent('README.md'); |
| 48 | const rdmDst = resolveRoot('README.md'); |
| 49 | const indxSrc = getTemplateFileContent('src/index.js'); |
| 50 | const indxDst = resolveRoot('src/index.js'); |
| 51 | const indexCnt = getTemplateFileContent('_index.html'); |
| 52 | const indexDst = resolveRoot('_index.html'); |
| 53 | const license = spdxLicenseList[opts.license]; |
| 54 | const licenseTxt = |
| 55 | license && |
| 56 | (license.licenseText || '') |
| 57 | .replace('<year>', `${new Date().getFullYear()}-current`) |
| 58 | .replace('<copyright holders>', opts.name); |
| 59 | ensureDir(indxDst); |
| 60 | // write src/_index.html |
| 61 | fs.writeFileSync(indxDst, template(indxSrc)(opts).trim()); |
| 62 | // write _index.html |
| 63 | fs.writeFileSync(indexDst, template(indexCnt)(opts)); |
| 64 | // Write README.md |
| 65 | fs.writeFileSync(rdmDst, template(rdmSrc)(opts)); |
| 66 | // write LICENSE |
| 67 | licenseTxt && fs.writeFileSync(resolveRoot('LICENSE'), licenseTxt); |
| 68 | // Copy files |
| 69 | fs.copyFileSync(resolveLocal('.gitignore-t'), resolveRoot('.gitignore')); |
| 70 | fs.copyFileSync(resolveLocal('.npmignore-t'), resolveRoot('.npmignore')); |
| 71 | fs.copyFileSync(resolveLocal('tsconfig.json'), resolveRoot('tsconfig.json')); |
| 72 | }; |
| 73 | |
| 74 | const createFileComponents = (opts: InitOptions = {}) => { |
| 75 | const filepath = 'src/components.js'; |
no test coverage detected