pika-ux 1.0.0-beta.4 → 1.0.0-beta.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/dist/cli/index.js +17 -6
- package/package.json +1 -1
- package/readme.md +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { promisify } from 'util';
|
|
|
11
11
|
import ora from 'ora';
|
|
12
12
|
import semver from 'semver';
|
|
13
13
|
import { glob } from 'glob';
|
|
14
|
+
import { createRequire } from 'module';
|
|
14
15
|
|
|
15
16
|
var Logger = class {
|
|
16
17
|
spinner = null;
|
|
@@ -120,11 +121,10 @@ async function copyAndProcessTemplate(templateDir, targetDir, variables) {
|
|
|
120
121
|
await fs.ensureDir(targetDir);
|
|
121
122
|
await processTemplateFiles(templateDir, targetDir, variables);
|
|
122
123
|
}
|
|
123
|
-
|
|
124
|
-
// tools/cli/commands/create.ts
|
|
125
124
|
var execAsync2 = promisify(exec);
|
|
126
125
|
var __filename = fileURLToPath(import.meta.url);
|
|
127
126
|
var __dirname = path2.dirname(__filename);
|
|
127
|
+
var require2 = createRequire(import.meta.url);
|
|
128
128
|
async function createCommand(options = {}) {
|
|
129
129
|
try {
|
|
130
130
|
logger.newLine();
|
|
@@ -180,10 +180,21 @@ async function createCommand(options = {}) {
|
|
|
180
180
|
}
|
|
181
181
|
const spinner = logger.startSpinner("Creating project...");
|
|
182
182
|
try {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
let pikaUxVersion = "1.0.0-beta.4";
|
|
184
|
+
try {
|
|
185
|
+
const pikaUxPackageJsonPath = require2.resolve("pika-ux/package.json");
|
|
186
|
+
const pikaUxPackageJson = await fs.readJson(pikaUxPackageJsonPath);
|
|
187
|
+
pikaUxVersion = pikaUxPackageJson.version;
|
|
188
|
+
} catch (error) {
|
|
189
|
+
logger.debug("Could not determine pika-ux version, using fallback");
|
|
190
|
+
}
|
|
191
|
+
let templateDir;
|
|
192
|
+
try {
|
|
193
|
+
const pikaUxRoot = path2.dirname(require2.resolve("pika-ux/package.json"));
|
|
194
|
+
templateDir = path2.join(pikaUxRoot, "dist/cli/template-files");
|
|
195
|
+
} catch (error) {
|
|
196
|
+
templateDir = path2.join(__dirname, "../template-files");
|
|
197
|
+
}
|
|
187
198
|
logger.updateSpinner("Processing template files...");
|
|
188
199
|
await copyAndProcessTemplate(templateDir, targetPath, {
|
|
189
200
|
projectName,
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -7,7 +7,7 @@ UI Components library for the Pika project. This package contains both custom Pi
|
|
|
7
7
|
The fastest way to create a new webcomponent project with Pika UX:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
pnpm dlx pika-ux create my-webcomponent
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
### Global Installation (Optional)
|