@zeedhi/teknisa-cli 1.107.2 → 1.108.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +5 -5
- package/bin/teknisa.js +117 -117
- package/package.json +2 -2
- package/src/create.js +118 -118
- package/src/generate.js +20 -20
- package/src/util/component/createEmptyComponent.js +145 -145
- package/src/util/component/createJest.js +19 -19
- package/src/util/component/createNpmignore.js +14 -14
- package/src/util/component/createPackage.js +52 -52
- package/src/util/component/createReadme.js +15 -15
- package/src/util/component/createRollup.js +15 -15
- package/src/util/component/createTsConfig.js +24 -24
- package/src/util/component/createTsLint.js +18 -18
- package/src/util/component/run.js +54 -54
- package/src/util/enhanceErrorMessages.js +13 -13
- package/src/util/project/editCliVersion.js +17 -17
- package/src/util/project/editPackageJson.js +19 -19
- package/src/util/project/module/.env.development +1 -1
- package/src/util/project/module/.env.production +1 -1
- package/src/util/project/module/.eslintrc.js +40 -40
- package/src/util/project/module/GruntFile.js +15 -15
- package/src/util/project/module/README.md +22 -22
- package/src/util/project/module/cliVersion.json +2 -2
- package/src/util/project/module/gitignore.template +21 -21
- package/src/util/project/module/package.json +68 -68
- package/src/util/project/module/postcss.config.js +5 -5
- package/src/util/project/module/public/index.html +17 -17
- package/src/util/project/module/public/metadata/notfound.json +14 -14
- package/src/util/project/module/public/metadata/unauthorized.json +14 -14
- package/src/util/project/module/public/robots.txt +2 -2
- package/src/util/project/module/src/App.vue +134 -134
- package/src/util/project/module/src/config/config.ts +17 -17
- package/src/util/project/module/src/config/devEnvironment.json +4 -4
- package/src/util/project/module/src/config/prodEnvironment.json +3 -3
- package/src/util/project/module/src/controllers/AppController.ts +5 -5
- package/src/util/project/module/src/controllers/index.ts +5 -5
- package/src/util/project/module/src/main.ts +17 -17
- package/src/util/project/module/src/plugins/index.ts +6 -6
- package/src/util/project/module/src/plugins/vuetify.ts +11 -11
- package/src/util/project/module/src/plugins/zeedhi.ts +50 -50
- package/src/util/project/module/src/registerServiceWorker.ts +32 -32
- package/src/util/project/module/src/shims-tsx.d.ts +13 -13
- package/src/util/project/module/src/shims-vue.d.ts +5 -5
- package/src/util/project/module/src/theme/index.ts +12 -12
- package/src/util/project/module/tsconfig.json +45 -45
- package/src/util/project/module/vue.config.js +107 -107
- package/src/util/project/product/.env.development +3 -3
- package/src/util/project/product/.env.production +2 -2
- package/src/util/project/product/.eslintrc.js +41 -41
- package/src/util/project/product/GruntFile.js +15 -15
- package/src/util/project/product/README.md +22 -22
- package/src/util/project/product/cliVersion.json +2 -2
- package/src/util/project/product/gitignore.template +21 -21
- package/src/util/project/product/package.json +69 -69
- package/src/util/project/product/postcss.config.js +5 -5
- package/src/util/project/product/public/assets/img/icons/safari-pinned-tab.svg +33 -33
- package/src/util/project/product/public/assets/img/image-not-found.svg +3 -3
- package/src/util/project/product/public/index.html +19 -19
- package/src/util/project/product/public/metadata/home.json +63 -63
- package/src/util/project/product/public/metadata/login.json +6 -6
- package/src/util/project/product/public/metadata/menu.json +28 -28
- package/src/util/project/product/public/metadata/notfound.json +14 -14
- package/src/util/project/product/public/robots.txt +2 -2
- package/src/util/project/product/src/App.vue +192 -192
- package/src/util/project/product/src/components/img-link/ImgLink.ts +17 -17
- package/src/util/project/product/src/components/img-link/ImgLink.vue +7 -7
- package/src/util/project/product/src/components/img-link/common/ImgLink.ts +32 -32
- package/src/util/project/product/src/components/index.ts +4 -4
- package/src/util/project/product/src/config/config.ts +22 -22
- package/src/util/project/product/src/config/devEnvironment.json +22 -22
- package/src/util/project/product/src/config/prodEnvironment.json +22 -22
- package/src/util/project/product/src/controllers/AppController.ts +119 -119
- package/src/util/project/product/src/controllers/LoginController.ts +17 -17
- package/src/util/project/product/src/controllers/index.ts +7 -7
- package/src/util/project/product/src/main.ts +22 -22
- package/src/util/project/product/src/plugins/index.ts +11 -11
- package/src/util/project/product/src/plugins/vuetify.ts +11 -11
- package/src/util/project/product/src/plugins/zeedhi.ts +72 -72
- package/src/util/project/product/src/registerServiceWorker.ts +32 -32
- package/src/util/project/product/src/router/index.ts +76 -76
- package/src/util/project/product/src/router/routes.ts +37 -37
- package/src/util/project/product/src/shims-tsx.d.ts +13 -13
- package/src/util/project/product/src/shims-vue.d.ts +5 -5
- package/src/util/project/product/src/store.ts +26 -26
- package/src/util/project/product/src/theme/index.ts +10 -10
- package/src/util/project/product/src/views/Microservice.ts +57 -57
- package/src/util/project/product/src/views/Microservice.vue +13 -13
- package/src/util/project/product/tsconfig.json +46 -46
- package/src/util/project/product/vue.config.js +107 -107
- package/src/util/project/renameGitIgnore.js +14 -14
- package/src/util/project/run.js +15 -15
- package/src/util/validateName.js +21 -21
|
@@ -1,146 +1,146 @@
|
|
|
1
|
-
const fs = require('fs-extra')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
|
|
4
|
-
snakeToCamelCase = (str) => {
|
|
5
|
-
let pieces = str.split('-')
|
|
6
|
-
let result = ''
|
|
7
|
-
pieces.forEach((piece) => {
|
|
8
|
-
piece = piece.charAt(0).toUpperCase() + piece.slice(1)
|
|
9
|
-
result += piece
|
|
10
|
-
})
|
|
11
|
-
return result
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
getBaseComponentContent = (name, dir) => {
|
|
15
|
-
let className = `${name}Base`
|
|
16
|
-
let content = `<template>\n <div>This template should not be here!</div>\n</template>\n\n`
|
|
17
|
-
content += `<script lang="ts">\nimport { ${className} } from '${dir}${className}';\n`
|
|
18
|
-
content += "import { zdComponent } from '@zeedhi/vue';\n\n"
|
|
19
|
-
content += "@zdComponent\n"
|
|
20
|
-
content += `export default class ${name} extends ${className} {}\n</script>\n`
|
|
21
|
-
return content
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
getBaseClassContent = (name) => {
|
|
25
|
-
let content = `import { I${name} } from './I${name}';\n`
|
|
26
|
-
content += `import { Component } from '@zeedhi/core';\n\n`
|
|
27
|
-
content += `export class ${name}Class extends Component implements I${name} {}\n`
|
|
28
|
-
return content
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
getBaseClassVueContent = (sigleName, name) => {
|
|
32
|
-
let content = "import { Vue, zdComponent, zdProp } from '@zeedhi/vue';\n"
|
|
33
|
-
content += `import { ${name}Class } from '@zeedhi-components/${sigleName}';\n\n`
|
|
34
|
-
content += "@zdComponent\n"
|
|
35
|
-
content += `export class ${name}Base extends Vue {\n\n`
|
|
36
|
-
content += ` @zdProp() component!: ${name}Class;\n\n`
|
|
37
|
-
content += "}\n"
|
|
38
|
-
return content
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
getBaseInterfaceContent = (name) => {
|
|
42
|
-
let content = "import { IComponent } from '@zeedhi/core';\n\n"
|
|
43
|
-
content += `export interface I${name} extends IComponent {}\n`
|
|
44
|
-
return content
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
baseIndex = (name) => {
|
|
48
|
-
const camelCased = snakeToCamelCase(name)
|
|
49
|
-
let content = `import { VersionService } from '@zeedhi/core';\n`
|
|
50
|
-
content += `import { ${camelCased}Class } from './components/${camelCased}Class';\n`
|
|
51
|
-
content += `import { I${camelCased} } from './components/I${camelCased}';\n\n`
|
|
52
|
-
content += `export { ${camelCased}Class, I${camelCased} };\n\n`
|
|
53
|
-
content += `const packageContent = require('../package.json');\n\n`
|
|
54
|
-
content += `VersionService.addPackageVersion(packageContent.name, packageContent.version);\n`
|
|
55
|
-
|
|
56
|
-
return content
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
baseIndexVue = (name) => {
|
|
60
|
-
const singleName = 'MainComp'
|
|
61
|
-
const camelCased = snakeToCamelCase(name)
|
|
62
|
-
let content = `import * as ${singleName} from './components/${camelCased}.vue';\n`
|
|
63
|
-
content += `import ${camelCased}Vuetify from './components/vuetify/${camelCased}.vue';\n`
|
|
64
|
-
content += `import { ${camelCased}Class } from '@zeedhi-components/${name}';\n`
|
|
65
|
-
content += "import { config, VersionService } from '@zeedhi/core';\n"
|
|
66
|
-
content += "import { registerComponent } from '@zeedhi/vue';\n\n"
|
|
67
|
-
content += "// tslint:disable-next-line:variable-name\n"
|
|
68
|
-
content += `const ${camelCased} = {\n`
|
|
69
|
-
content += " install () {\n"
|
|
70
|
-
content += ` let component = ${singleName}.default;\n`
|
|
71
|
-
content += " if (config.frameworkUi === 'vuetify') {\n"
|
|
72
|
-
content += ` component = ${camelCased}Vuetify;\n`
|
|
73
|
-
content += " }\n"
|
|
74
|
-
content += ` registerComponent('${camelCased}', component, ${camelCased}Class);\n`
|
|
75
|
-
content += " },\n"
|
|
76
|
-
content += "};\n\n"
|
|
77
|
-
content += "if (typeof window !== 'undefined' && window.Vue) {\n"
|
|
78
|
-
content += ` window.Vue.use(${camelCased});\n`
|
|
79
|
-
content += "}\n\n"
|
|
80
|
-
content += `const packageContent = require('../package.json');\n\n`
|
|
81
|
-
content += `VersionService.addPackageVersion(packageContent.name, packageContent.version);\n\n`
|
|
82
|
-
content += `export default ${camelCased};\n`
|
|
83
|
-
|
|
84
|
-
return content
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
getBaseGlobalsContent = () => {
|
|
88
|
-
let content = "import { VueConstructor } from '@zeedhi/vue'\n\n"
|
|
89
|
-
content += "declare global {\n"
|
|
90
|
-
content += " interface Window {\n"
|
|
91
|
-
content += " Vue: VueConstructor\n }\n}\n"
|
|
92
|
-
return content
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
getBaseVueShimsContent = () => {
|
|
96
|
-
let content = "declare module '*.vue' {\n"
|
|
97
|
-
content += " import Vue from 'vue';\n"
|
|
98
|
-
content += " export default Vue;\n}\n"
|
|
99
|
-
return content
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
createEmptyFolder = (dir) => {
|
|
103
|
-
fs.ensureDirSync(dir)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
createEmptyFile = (dir, content) => {
|
|
107
|
-
fs.writeFile(dir, content, (err) => {
|
|
108
|
-
if(err) console.log(err)
|
|
109
|
-
})
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
createSrc = (dir, name, isVue) => {
|
|
113
|
-
let folderPath = path.resolve(dir, 'src/')
|
|
114
|
-
let content = baseIndex(name)
|
|
115
|
-
|
|
116
|
-
createEmptyFolder(folderPath)
|
|
117
|
-
|
|
118
|
-
if (isVue) {
|
|
119
|
-
content = baseIndexVue(name)
|
|
120
|
-
createEmptyFile(path.resolve(folderPath, 'globals.d.ts'), getBaseGlobalsContent())
|
|
121
|
-
createEmptyFile(path.resolve(folderPath, 'vue-shims.ts'), getBaseVueShimsContent())
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
createEmptyFile(path.resolve(folderPath, 'index.ts'), content)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
createComponents = (dir, name, isVue) => {
|
|
128
|
-
const folderPath = path.resolve(dir, 'src/components/')
|
|
129
|
-
const camelCased = snakeToCamelCase(name)
|
|
130
|
-
createEmptyFolder(folderPath)
|
|
131
|
-
if (isVue) {
|
|
132
|
-
createEmptyFolder(path.resolve(folderPath, 'vuetify'))
|
|
133
|
-
createEmptyFile(path.resolve(folderPath, `vuetify/${camelCased}.vue`), getBaseComponentContent(camelCased, '../'))
|
|
134
|
-
createEmptyFile(path.resolve(folderPath, `${camelCased}.vue`), getBaseComponentContent(camelCased, './'))
|
|
135
|
-
createEmptyFile(path.resolve(folderPath, `${camelCased}Base.ts`), getBaseClassVueContent(name, camelCased))
|
|
136
|
-
} else {
|
|
137
|
-
createEmptyFile(path.resolve(folderPath, `${camelCased}Class.ts`), getBaseClassContent(camelCased))
|
|
138
|
-
createEmptyFile(path.resolve(folderPath, `I${camelCased}.ts`), getBaseInterfaceContent(camelCased))
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
module.exports = (name, dir, isVue) => {
|
|
143
|
-
createEmptyFolder(dir)
|
|
144
|
-
createSrc(dir, name, isVue)
|
|
145
|
-
createComponents(dir, name, isVue)
|
|
1
|
+
const fs = require('fs-extra')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
snakeToCamelCase = (str) => {
|
|
5
|
+
let pieces = str.split('-')
|
|
6
|
+
let result = ''
|
|
7
|
+
pieces.forEach((piece) => {
|
|
8
|
+
piece = piece.charAt(0).toUpperCase() + piece.slice(1)
|
|
9
|
+
result += piece
|
|
10
|
+
})
|
|
11
|
+
return result
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
getBaseComponentContent = (name, dir) => {
|
|
15
|
+
let className = `${name}Base`
|
|
16
|
+
let content = `<template>\n <div>This template should not be here!</div>\n</template>\n\n`
|
|
17
|
+
content += `<script lang="ts">\nimport { ${className} } from '${dir}${className}';\n`
|
|
18
|
+
content += "import { zdComponent } from '@zeedhi/vue';\n\n"
|
|
19
|
+
content += "@zdComponent\n"
|
|
20
|
+
content += `export default class ${name} extends ${className} {}\n</script>\n`
|
|
21
|
+
return content
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getBaseClassContent = (name) => {
|
|
25
|
+
let content = `import { I${name} } from './I${name}';\n`
|
|
26
|
+
content += `import { Component } from '@zeedhi/core';\n\n`
|
|
27
|
+
content += `export class ${name}Class extends Component implements I${name} {}\n`
|
|
28
|
+
return content
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getBaseClassVueContent = (sigleName, name) => {
|
|
32
|
+
let content = "import { Vue, zdComponent, zdProp } from '@zeedhi/vue';\n"
|
|
33
|
+
content += `import { ${name}Class } from '@zeedhi-components/${sigleName}';\n\n`
|
|
34
|
+
content += "@zdComponent\n"
|
|
35
|
+
content += `export class ${name}Base extends Vue {\n\n`
|
|
36
|
+
content += ` @zdProp() component!: ${name}Class;\n\n`
|
|
37
|
+
content += "}\n"
|
|
38
|
+
return content
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getBaseInterfaceContent = (name) => {
|
|
42
|
+
let content = "import { IComponent } from '@zeedhi/core';\n\n"
|
|
43
|
+
content += `export interface I${name} extends IComponent {}\n`
|
|
44
|
+
return content
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
baseIndex = (name) => {
|
|
48
|
+
const camelCased = snakeToCamelCase(name)
|
|
49
|
+
let content = `import { VersionService } from '@zeedhi/core';\n`
|
|
50
|
+
content += `import { ${camelCased}Class } from './components/${camelCased}Class';\n`
|
|
51
|
+
content += `import { I${camelCased} } from './components/I${camelCased}';\n\n`
|
|
52
|
+
content += `export { ${camelCased}Class, I${camelCased} };\n\n`
|
|
53
|
+
content += `const packageContent = require('../package.json');\n\n`
|
|
54
|
+
content += `VersionService.addPackageVersion(packageContent.name, packageContent.version);\n`
|
|
55
|
+
|
|
56
|
+
return content
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
baseIndexVue = (name) => {
|
|
60
|
+
const singleName = 'MainComp'
|
|
61
|
+
const camelCased = snakeToCamelCase(name)
|
|
62
|
+
let content = `import * as ${singleName} from './components/${camelCased}.vue';\n`
|
|
63
|
+
content += `import ${camelCased}Vuetify from './components/vuetify/${camelCased}.vue';\n`
|
|
64
|
+
content += `import { ${camelCased}Class } from '@zeedhi-components/${name}';\n`
|
|
65
|
+
content += "import { config, VersionService } from '@zeedhi/core';\n"
|
|
66
|
+
content += "import { registerComponent } from '@zeedhi/vue';\n\n"
|
|
67
|
+
content += "// tslint:disable-next-line:variable-name\n"
|
|
68
|
+
content += `const ${camelCased} = {\n`
|
|
69
|
+
content += " install () {\n"
|
|
70
|
+
content += ` let component = ${singleName}.default;\n`
|
|
71
|
+
content += " if (config.frameworkUi === 'vuetify') {\n"
|
|
72
|
+
content += ` component = ${camelCased}Vuetify;\n`
|
|
73
|
+
content += " }\n"
|
|
74
|
+
content += ` registerComponent('${camelCased}', component, ${camelCased}Class);\n`
|
|
75
|
+
content += " },\n"
|
|
76
|
+
content += "};\n\n"
|
|
77
|
+
content += "if (typeof window !== 'undefined' && window.Vue) {\n"
|
|
78
|
+
content += ` window.Vue.use(${camelCased});\n`
|
|
79
|
+
content += "}\n\n"
|
|
80
|
+
content += `const packageContent = require('../package.json');\n\n`
|
|
81
|
+
content += `VersionService.addPackageVersion(packageContent.name, packageContent.version);\n\n`
|
|
82
|
+
content += `export default ${camelCased};\n`
|
|
83
|
+
|
|
84
|
+
return content
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
getBaseGlobalsContent = () => {
|
|
88
|
+
let content = "import { VueConstructor } from '@zeedhi/vue'\n\n"
|
|
89
|
+
content += "declare global {\n"
|
|
90
|
+
content += " interface Window {\n"
|
|
91
|
+
content += " Vue: VueConstructor\n }\n}\n"
|
|
92
|
+
return content
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
getBaseVueShimsContent = () => {
|
|
96
|
+
let content = "declare module '*.vue' {\n"
|
|
97
|
+
content += " import Vue from 'vue';\n"
|
|
98
|
+
content += " export default Vue;\n}\n"
|
|
99
|
+
return content
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
createEmptyFolder = (dir) => {
|
|
103
|
+
fs.ensureDirSync(dir)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
createEmptyFile = (dir, content) => {
|
|
107
|
+
fs.writeFile(dir, content, (err) => {
|
|
108
|
+
if(err) console.log(err)
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
createSrc = (dir, name, isVue) => {
|
|
113
|
+
let folderPath = path.resolve(dir, 'src/')
|
|
114
|
+
let content = baseIndex(name)
|
|
115
|
+
|
|
116
|
+
createEmptyFolder(folderPath)
|
|
117
|
+
|
|
118
|
+
if (isVue) {
|
|
119
|
+
content = baseIndexVue(name)
|
|
120
|
+
createEmptyFile(path.resolve(folderPath, 'globals.d.ts'), getBaseGlobalsContent())
|
|
121
|
+
createEmptyFile(path.resolve(folderPath, 'vue-shims.ts'), getBaseVueShimsContent())
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
createEmptyFile(path.resolve(folderPath, 'index.ts'), content)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
createComponents = (dir, name, isVue) => {
|
|
128
|
+
const folderPath = path.resolve(dir, 'src/components/')
|
|
129
|
+
const camelCased = snakeToCamelCase(name)
|
|
130
|
+
createEmptyFolder(folderPath)
|
|
131
|
+
if (isVue) {
|
|
132
|
+
createEmptyFolder(path.resolve(folderPath, 'vuetify'))
|
|
133
|
+
createEmptyFile(path.resolve(folderPath, `vuetify/${camelCased}.vue`), getBaseComponentContent(camelCased, '../'))
|
|
134
|
+
createEmptyFile(path.resolve(folderPath, `${camelCased}.vue`), getBaseComponentContent(camelCased, './'))
|
|
135
|
+
createEmptyFile(path.resolve(folderPath, `${camelCased}Base.ts`), getBaseClassVueContent(name, camelCased))
|
|
136
|
+
} else {
|
|
137
|
+
createEmptyFile(path.resolve(folderPath, `${camelCased}Class.ts`), getBaseClassContent(camelCased))
|
|
138
|
+
createEmptyFile(path.resolve(folderPath, `I${camelCased}.ts`), getBaseInterfaceContent(camelCased))
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
module.exports = (name, dir, isVue) => {
|
|
143
|
+
createEmptyFolder(dir)
|
|
144
|
+
createSrc(dir, name, isVue)
|
|
145
|
+
createComponents(dir, name, isVue)
|
|
146
146
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
|
|
4
|
-
createTestFolder = (dir) => {
|
|
5
|
-
fs.mkdirSync(path.resolve(dir, 'tests'))
|
|
6
|
-
fs.mkdirSync(path.resolve(dir, 'tests/unit'))
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
createConfigFile = (dir) => {
|
|
10
|
-
const config = "module.exports = require('../../jest.config.js')"
|
|
11
|
-
const configPath = path.resolve(dir, 'jest.config.js')
|
|
12
|
-
fs.writeFile(configPath, config, (err) => {
|
|
13
|
-
if(err) console.log(err)
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
module.exports = (dir) => {
|
|
18
|
-
createTestFolder(dir)
|
|
19
|
-
createConfigFile(dir)
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
createTestFolder = (dir) => {
|
|
5
|
+
fs.mkdirSync(path.resolve(dir, 'tests'))
|
|
6
|
+
fs.mkdirSync(path.resolve(dir, 'tests/unit'))
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
createConfigFile = (dir) => {
|
|
10
|
+
const config = "module.exports = require('../../jest.config.js')"
|
|
11
|
+
const configPath = path.resolve(dir, 'jest.config.js')
|
|
12
|
+
fs.writeFile(configPath, config, (err) => {
|
|
13
|
+
if(err) console.log(err)
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = (dir) => {
|
|
18
|
+
createTestFolder(dir)
|
|
19
|
+
createConfigFile(dir)
|
|
20
20
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const fs = require('fs')
|
|
3
|
-
|
|
4
|
-
createNpmIgnore = (dir) => {
|
|
5
|
-
let config = `src\njest.config.js\npackage-lock.json\nrollup.config.js\ntsconfig.json\ntslint.json`
|
|
6
|
-
const configPath = path.resolve(dir, '.npmignore')
|
|
7
|
-
|
|
8
|
-
fs.writeFile(configPath, config, (err) => {
|
|
9
|
-
if(err) console.log(err)
|
|
10
|
-
})
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
module.exports = (component, dir) => {
|
|
14
|
-
createNpmIgnore(component, dir)
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
|
|
4
|
+
createNpmIgnore = (dir) => {
|
|
5
|
+
let config = `src\njest.config.js\npackage-lock.json\nrollup.config.js\ntsconfig.json\ntslint.json`
|
|
6
|
+
const configPath = path.resolve(dir, '.npmignore')
|
|
7
|
+
|
|
8
|
+
fs.writeFile(configPath, config, (err) => {
|
|
9
|
+
if(err) console.log(err)
|
|
10
|
+
})
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = (component, dir) => {
|
|
14
|
+
createNpmIgnore(component, dir)
|
|
15
15
|
}
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const fs = require('fs')
|
|
3
|
-
|
|
4
|
-
createPackageConfig = (component, dir, isVue) => {
|
|
5
|
-
let name = isVue ? component + '-vue' : component
|
|
6
|
-
let config = {
|
|
7
|
-
name: `@zeedhi-components/${name}`,
|
|
8
|
-
version: '0.1.0',
|
|
9
|
-
description: name,
|
|
10
|
-
author: "Zeedhi <zeedhi@teknisa.com>",
|
|
11
|
-
homepage: `https://bitbucket.org/zeedhi/zeedhi-components/src/master/packages/${name}#readme`,
|
|
12
|
-
license: "ISC",
|
|
13
|
-
main: `dist/${name}.umd.js`,
|
|
14
|
-
module: `dist/${name}.esm.js`,
|
|
15
|
-
typings: "types/index.d.ts",
|
|
16
|
-
scripts: {
|
|
17
|
-
build: "rollup -c",
|
|
18
|
-
lint: "tslint -p tsconfig.json -c tslint.json",
|
|
19
|
-
test: 'jest',
|
|
20
|
-
watch: "rollup -cw"
|
|
21
|
-
},
|
|
22
|
-
repository: {
|
|
23
|
-
type: "git",
|
|
24
|
-
url: "git@bitbucket.org:zeedhi/zeedhi-components.git"
|
|
25
|
-
},
|
|
26
|
-
publishConfig: {
|
|
27
|
-
access: "restricted"
|
|
28
|
-
},
|
|
29
|
-
dependencies: getDependencies(isVue, component)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
let configPath = path.resolve(dir, 'package.json')
|
|
33
|
-
config = JSON.stringify(config, null, 2)
|
|
34
|
-
|
|
35
|
-
fs.writeFile(configPath, config, (err) => {
|
|
36
|
-
if(err) console.log(err)
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
getDependencies = (isVue, component) => {
|
|
41
|
-
let dependencies = { "@zeedhi/core": "^1.96.0" }
|
|
42
|
-
if (isVue) {
|
|
43
|
-
Object.assign(dependencies, {
|
|
44
|
-
[`@zeedhi-components/${component}`]: "*",
|
|
45
|
-
"@zeedhi/vue": "^1.96.0"
|
|
46
|
-
})
|
|
47
|
-
}
|
|
48
|
-
return dependencies
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
module.exports = (component, dir, isVue) => {
|
|
52
|
-
createPackageConfig(component, dir, isVue)
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
|
|
4
|
+
createPackageConfig = (component, dir, isVue) => {
|
|
5
|
+
let name = isVue ? component + '-vue' : component
|
|
6
|
+
let config = {
|
|
7
|
+
name: `@zeedhi-components/${name}`,
|
|
8
|
+
version: '0.1.0',
|
|
9
|
+
description: name,
|
|
10
|
+
author: "Zeedhi <zeedhi@teknisa.com>",
|
|
11
|
+
homepage: `https://bitbucket.org/zeedhi/zeedhi-components/src/master/packages/${name}#readme`,
|
|
12
|
+
license: "ISC",
|
|
13
|
+
main: `dist/${name}.umd.js`,
|
|
14
|
+
module: `dist/${name}.esm.js`,
|
|
15
|
+
typings: "types/index.d.ts",
|
|
16
|
+
scripts: {
|
|
17
|
+
build: "rollup -c",
|
|
18
|
+
lint: "tslint -p tsconfig.json -c tslint.json",
|
|
19
|
+
test: 'jest',
|
|
20
|
+
watch: "rollup -cw"
|
|
21
|
+
},
|
|
22
|
+
repository: {
|
|
23
|
+
type: "git",
|
|
24
|
+
url: "git@bitbucket.org:zeedhi/zeedhi-components.git"
|
|
25
|
+
},
|
|
26
|
+
publishConfig: {
|
|
27
|
+
access: "restricted"
|
|
28
|
+
},
|
|
29
|
+
dependencies: getDependencies(isVue, component)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let configPath = path.resolve(dir, 'package.json')
|
|
33
|
+
config = JSON.stringify(config, null, 2)
|
|
34
|
+
|
|
35
|
+
fs.writeFile(configPath, config, (err) => {
|
|
36
|
+
if(err) console.log(err)
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
getDependencies = (isVue, component) => {
|
|
41
|
+
let dependencies = { "@zeedhi/core": "^1.96.0" }
|
|
42
|
+
if (isVue) {
|
|
43
|
+
Object.assign(dependencies, {
|
|
44
|
+
[`@zeedhi-components/${component}`]: "*",
|
|
45
|
+
"@zeedhi/vue": "^1.96.0"
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
return dependencies
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module.exports = (component, dir, isVue) => {
|
|
52
|
+
createPackageConfig(component, dir, isVue)
|
|
53
53
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const fs = require('fs')
|
|
3
|
-
|
|
4
|
-
createReadme = (component, dir, isVue) => {
|
|
5
|
-
let name = isVue ? component + '-vue' : component
|
|
6
|
-
let config = `# ${name}`
|
|
7
|
-
const configPath = path.resolve(dir, 'README.md')
|
|
8
|
-
|
|
9
|
-
fs.writeFile(configPath, config, (err) => {
|
|
10
|
-
if(err) console.log(err)
|
|
11
|
-
})
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = (component, dir, isVue) => {
|
|
15
|
-
createReadme(component, dir, isVue)
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
|
|
4
|
+
createReadme = (component, dir, isVue) => {
|
|
5
|
+
let name = isVue ? component + '-vue' : component
|
|
6
|
+
let config = `# ${name}`
|
|
7
|
+
const configPath = path.resolve(dir, 'README.md')
|
|
8
|
+
|
|
9
|
+
fs.writeFile(configPath, config, (err) => {
|
|
10
|
+
if(err) console.log(err)
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = (component, dir, isVue) => {
|
|
15
|
+
createReadme(component, dir, isVue)
|
|
16
16
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const fs = require('fs')
|
|
3
|
-
|
|
4
|
-
createRollupConfig = (dir) => {
|
|
5
|
-
let config = 'import { getDefaultConfig } from "../../rollup.config.js";\nimport pkg from "./package.json"\n'
|
|
6
|
-
config += '\nexport default getDefaultConfig(pkg);\n'
|
|
7
|
-
const configPath = path.resolve(dir, 'rollup.config.js')
|
|
8
|
-
|
|
9
|
-
fs.writeFile(configPath, config, (err) => {
|
|
10
|
-
if(err) console.log(err)
|
|
11
|
-
})
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = (dir) => {
|
|
15
|
-
createRollupConfig(dir)
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
|
|
4
|
+
createRollupConfig = (dir) => {
|
|
5
|
+
let config = 'import { getDefaultConfig } from "../../rollup.config.js";\nimport pkg from "./package.json"\n'
|
|
6
|
+
config += '\nexport default getDefaultConfig(pkg);\n'
|
|
7
|
+
const configPath = path.resolve(dir, 'rollup.config.js')
|
|
8
|
+
|
|
9
|
+
fs.writeFile(configPath, config, (err) => {
|
|
10
|
+
if(err) console.log(err)
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = (dir) => {
|
|
15
|
+
createRollupConfig(dir)
|
|
16
16
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
|
|
4
|
-
createTsConfig = (dir) => {
|
|
5
|
-
let config = {
|
|
6
|
-
extends: '../../tsconfig.json',
|
|
7
|
-
include: [ './src/**/*' ],
|
|
8
|
-
exclude: [ 'node_modules' ],
|
|
9
|
-
compilerOptions: {
|
|
10
|
-
declarationDir: "./types",
|
|
11
|
-
outDir: './dist'
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
let configPath = path.resolve(dir, 'tsconfig.json')
|
|
16
|
-
config = JSON.stringify(config, null, 2)
|
|
17
|
-
|
|
18
|
-
fs.writeFile(configPath, config, (err) => {
|
|
19
|
-
if(err) console.log(err)
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = (dir) => {
|
|
24
|
-
createTsConfig(dir)
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
createTsConfig = (dir) => {
|
|
5
|
+
let config = {
|
|
6
|
+
extends: '../../tsconfig.json',
|
|
7
|
+
include: [ './src/**/*' ],
|
|
8
|
+
exclude: [ 'node_modules' ],
|
|
9
|
+
compilerOptions: {
|
|
10
|
+
declarationDir: "./types",
|
|
11
|
+
outDir: './dist'
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let configPath = path.resolve(dir, 'tsconfig.json')
|
|
16
|
+
config = JSON.stringify(config, null, 2)
|
|
17
|
+
|
|
18
|
+
fs.writeFile(configPath, config, (err) => {
|
|
19
|
+
if(err) console.log(err)
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = (dir) => {
|
|
24
|
+
createTsConfig(dir)
|
|
25
25
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
|
|
4
|
-
createTslint = (dir) => {
|
|
5
|
-
let config = {
|
|
6
|
-
extends: '../../tslint.json'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
let configPath = path.resolve(dir, 'tslint.json')
|
|
10
|
-
config = JSON.stringify(config, null, 2)
|
|
11
|
-
|
|
12
|
-
fs.writeFile(configPath, config, (err) => {
|
|
13
|
-
if(err) console.log(err)
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
module.exports = (dir) => {
|
|
18
|
-
createTslint(dir)
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
createTslint = (dir) => {
|
|
5
|
+
let config = {
|
|
6
|
+
extends: '../../tslint.json'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let configPath = path.resolve(dir, 'tslint.json')
|
|
10
|
+
config = JSON.stringify(config, null, 2)
|
|
11
|
+
|
|
12
|
+
fs.writeFile(configPath, config, (err) => {
|
|
13
|
+
if(err) console.log(err)
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = (dir) => {
|
|
18
|
+
createTslint(dir)
|
|
19
19
|
}
|