create-rstack 1.0.8 → 1.0.9
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/README.md +5 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +15 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,13 +17,15 @@ A shared package for create-rspack, create-rsbuild, create-rspress and create-rs
|
|
|
17
17
|
npm add create-rstack -D
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
##
|
|
20
|
+
## Examples
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
| Project | Link |
|
|
23
|
+
| ------- | -------------------------------------------------------------------------------------------- |
|
|
24
|
+
| Rsbuild | [create-rsbuild](https://github.com/web-infra-dev/rsbuild/tree/main/packages/create-rsbuild) |
|
|
25
|
+
| Rslib | [create-rslib](https://github.com/web-infra-dev/rslib/tree/main/packages/create-rslib) |
|
|
23
26
|
|
|
24
27
|

|
|
25
28
|
|
|
26
|
-
|
|
27
29
|
## License
|
|
28
30
|
|
|
29
31
|
[MIT](./LICENSE).
|
package/dist/index.d.ts
CHANGED
|
@@ -12,15 +12,15 @@ export declare function checkCancel<T>(value: unknown): T;
|
|
|
12
12
|
* Copy files from one folder to another.
|
|
13
13
|
* @param from Source folder
|
|
14
14
|
* @param to Destination folder
|
|
15
|
-
* @param version
|
|
16
|
-
* @param
|
|
15
|
+
* @param version - Optional. The version to update in the package.json. If not provided, version will not be updated.
|
|
16
|
+
* @param name - Optional. The name to update in the package.json. If not provided, name will not be updated.
|
|
17
17
|
* @param isMergePackageJson Merge package.json files
|
|
18
18
|
* @param skipFiles Files to skip
|
|
19
19
|
*/
|
|
20
20
|
export declare function copyFolder({ from, to, version, packageName, isMergePackageJson, skipFiles, }: {
|
|
21
21
|
from: string;
|
|
22
22
|
to: string;
|
|
23
|
-
version
|
|
23
|
+
version?: string;
|
|
24
24
|
packageName?: string;
|
|
25
25
|
isMergePackageJson?: boolean;
|
|
26
26
|
skipFiles?: string[];
|
package/dist/index.js
CHANGED
|
@@ -1716,8 +1716,8 @@ function sortObjectKeys(obj) {
|
|
|
1716
1716
|
* Copy files from one folder to another.
|
|
1717
1717
|
* @param from Source folder
|
|
1718
1718
|
* @param to Destination folder
|
|
1719
|
-
* @param version
|
|
1720
|
-
* @param
|
|
1719
|
+
* @param version - Optional. The version to update in the package.json. If not provided, version will not be updated.
|
|
1720
|
+
* @param name - Optional. The name to update in the package.json. If not provided, name will not be updated.
|
|
1721
1721
|
* @param isMergePackageJson Merge package.json files
|
|
1722
1722
|
* @param skipFiles Files to skip
|
|
1723
1723
|
*/ function copyFolder({ from, to, version, packageName, isMergePackageJson, skipFiles = [] }) {
|
|
@@ -1761,13 +1761,21 @@ const isStableVersion = (version)=>[
|
|
|
1761
1761
|
'canary',
|
|
1762
1762
|
'nightly'
|
|
1763
1763
|
].every((tag)=>!version.includes(tag));
|
|
1764
|
-
|
|
1764
|
+
/**
|
|
1765
|
+
* Updates the package.json file at the specified path with the provided version and name.
|
|
1766
|
+
*
|
|
1767
|
+
* @param pkgJsonPath - The file path to the package.json file.
|
|
1768
|
+
* @param version - Optional. The version to update in the package.json. If not provided, version will not be updated.
|
|
1769
|
+
* @param name - Optional. The name to update in the package.json. If not provided, name will not be updated.
|
|
1770
|
+
*/ const updatePackageJson = (pkgJsonPath, version, name)=>{
|
|
1765
1771
|
let content = __WEBPACK_EXTERNAL_MODULE_node_fs__["default"].readFileSync(pkgJsonPath, 'utf-8');
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1772
|
+
if ('string' == typeof version) {
|
|
1773
|
+
// Lock the version if it is not stable
|
|
1774
|
+
const targetVersion = isStableVersion(version) ? `^${version}` : version;
|
|
1775
|
+
content = content.replace(/workspace:\*/g, targetVersion);
|
|
1776
|
+
}
|
|
1769
1777
|
const pkg = JSON.parse(content);
|
|
1770
1778
|
if (name && '.' !== name) pkg.name = name;
|
|
1771
|
-
__WEBPACK_EXTERNAL_MODULE_node_fs__["default"].writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2));
|
|
1779
|
+
__WEBPACK_EXTERNAL_MODULE_node_fs__["default"].writeFileSync(pkgJsonPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
1772
1780
|
};
|
|
1773
1781
|
export { checkCancel, copyFolder, create, mergePackageJson, ae as multiselect, ie as select, te as text };
|