windowpp 0.1.4 → 0.1.5
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/lib/create.js +2 -10
- package/package.json +1 -1
package/lib/create.js
CHANGED
|
@@ -89,7 +89,7 @@ async function create(name, options = {}) {
|
|
|
89
89
|
const cliDir = path.resolve(__dirname, '..');
|
|
90
90
|
const templates = listTemplates(cliDir);
|
|
91
91
|
|
|
92
|
-
// Resolve template — prompt if none given
|
|
92
|
+
// Resolve template — prompt if none given
|
|
93
93
|
let template = options.template;
|
|
94
94
|
if (!template) {
|
|
95
95
|
if (templates.length === 0) {
|
|
@@ -103,18 +103,12 @@ async function create(name, options = {}) {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
if (!name || !/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name)) {
|
|
107
|
-
console.error('Error: app name must start with a letter and contain only letters, digits, hyphens or underscores.');
|
|
108
|
-
process.exit(1);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
106
|
const appDir = path.join(outDir, name);
|
|
112
107
|
if (fs.existsSync(appDir)) {
|
|
113
108
|
console.error(`Error: directory "${appDir}" already exists.`);
|
|
114
109
|
process.exit(1);
|
|
115
110
|
}
|
|
116
111
|
|
|
117
|
-
const cliDir = path.resolve(__dirname, '..');
|
|
118
112
|
const templateDir = path.join(cliDir, 'templates', template);
|
|
119
113
|
if (!fs.existsSync(templateDir)) {
|
|
120
114
|
console.error(`Error: template "${template}" not found in ${path.join(cliDir, 'templates')}`);
|
|
@@ -131,9 +125,7 @@ async function create(name, options = {}) {
|
|
|
131
125
|
'{{APP_NAME}}': name,
|
|
132
126
|
'{{APP_TITLE}}': appTitle,
|
|
133
127
|
'{{CMAKE_TARGET}}': cmakeTarget,
|
|
134
|
-
|
|
135
|
-
// installed framework's src/ tree via the @wpp alias.
|
|
136
|
-
'{{REPO_ROOT}}': path.join(cliDir, 'framework').replace(/\\/g, '/'),
|
|
128
|
+
'{{REPO_ROOT}}': path.join(cliDir, 'framework').replace(/\\/g, '/'),
|
|
137
129
|
};
|
|
138
130
|
|
|
139
131
|
console.log(`\n=== WindowPP Create --- ${name} (template: ${template}) ===\n`);
|