create-lwr 0.6.1 → 0.6.2
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/build/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import minimist from 'minimist';
|
|
5
|
-
import { emptyDir, copy, pkgFromUserAgent, promptForAnswers } from './utils.js';
|
|
5
|
+
import { emptyDir, copy, pkgFromUserAgent, promptForAnswers, updateLwrVersion } from './utils.js';
|
|
6
6
|
import { dirname } from 'path';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -67,6 +67,8 @@ function writePackageFile(projectRoot, templateDir, packageName, metadata) {
|
|
|
67
67
|
// modify package json name
|
|
68
68
|
const pkg = JSON.parse(fs.readFileSync(path.join(templateDir, `package.json`), 'utf-8'));
|
|
69
69
|
pkg.name = packageName || metadata.targetDir;
|
|
70
|
+
// Set the target lwr package version equal to this create-lwr package version
|
|
71
|
+
updateLwrVersion(templateDir, pkg);
|
|
70
72
|
write(projectRoot, templateDir, 'package.json', JSON.stringify(pkg, null, 2));
|
|
71
73
|
const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent);
|
|
72
74
|
const pkgManager = pkgInfo ? pkgInfo.name : 'npm';
|
package/build/es/utils.d.ts
CHANGED
|
@@ -6,5 +6,10 @@ export declare function pkgFromUserAgent(userAgent: string | undefined): {
|
|
|
6
6
|
name: string;
|
|
7
7
|
version: string;
|
|
8
8
|
} | undefined;
|
|
9
|
+
export declare function updateLwrVersion(templateDir: string, pkg: {
|
|
10
|
+
dependencies?: {
|
|
11
|
+
lwr?: string;
|
|
12
|
+
};
|
|
13
|
+
}): void;
|
|
9
14
|
export declare function promptForAnswers(metadata: ProjectMetadata): Promise<AnswersWithMetadata>;
|
|
10
15
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/es/utils.js
CHANGED
|
@@ -85,6 +85,16 @@ export function pkgFromUserAgent(userAgent) {
|
|
|
85
85
|
version: pkgSpecArr[1],
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
+
export function updateLwrVersion(templateDir, pkg) {
|
|
89
|
+
const createLwrPkg = JSON.parse(fs.readFileSync(path.join(templateDir, `../package.json`), 'utf-8'));
|
|
90
|
+
const version = createLwrPkg.version;
|
|
91
|
+
if (!pkg.dependencies) {
|
|
92
|
+
pkg.dependencies = { lwr: version };
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
pkg.dependencies.lwr = version;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
88
98
|
// Gather project information from the user in the terminal
|
|
89
99
|
export async function promptForAnswers(metadata) {
|
|
90
100
|
const results = await prompts([
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"type": "module",
|
|
23
23
|
"types": "build/es/index.d.ts",
|
|
24
|
-
"version": "0.6.
|
|
24
|
+
"version": "0.6.2",
|
|
25
25
|
"module": "build/es/index.js",
|
|
26
26
|
"main": "build/cjs/index.cjs",
|
|
27
27
|
"files": [
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"minimist": "^1.2.5",
|
|
40
40
|
"prompts": "^2.4.1"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "ef85bdc48adde58b7c648561d67acbb408bbe189"
|
|
43
43
|
}
|