create-packer 1.17.30 → 1.17.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.17.30",
3
+ "version": "1.17.31",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -15,6 +15,7 @@
15
15
  }
16
16
  },
17
17
  "scripts": {
18
+ "postinstall": "node ./scripts/patch-nx-dep-graph.js",
18
19
  "prepare": "husky install",
19
20
  "storybook:dev": "nx storybook",
20
21
  "storybook:build": "nx build-storybook",
@@ -58,7 +59,7 @@
58
59
  "@nrwl/react": "16.3.2",
59
60
  "@nrwl/storybook": "16.3.2",
60
61
  "@nrwl/workspace": "16.3.2",
61
- "@nx-plus/vue": "14.1.0",
62
+ "@nx-plus/vue": "15.0.0-rc.0",
62
63
  "@types/node": "20.3.1",
63
64
  "commitizen": "4.3.0",
64
65
  "eslint": "8.42.0",
@@ -0,0 +1,40 @@
1
+ const fs = require('fs')
2
+ const path = require('path')
3
+
4
+ /**
5
+ * Patch dep-graph builder function to support Vue files.
6
+ * @see https://github.com/nrwl/nx/issues/2960
7
+ */
8
+ function patchNxDepGraph() {
9
+ try {
10
+ const filePath = getFilePath()
11
+ const fileContent = fs.readFileSync(filePath).toString('utf-8')
12
+ const replacement = "extension !== '.ts' && extension !== '.vue'"
13
+ if (fileContent.includes(replacement)) {
14
+ return
15
+ }
16
+ fs.writeFileSync(filePath, fileContent.replace("extension !== '.ts'", replacement))
17
+ console.log('Successfully patched Nx dep-graph for Vue support.')
18
+ } catch (err) {
19
+ console.error('Failed to patch Nx dep-graph for Vue support.', err)
20
+ }
21
+ }
22
+
23
+ function getFilePath() {
24
+ const possiblePaths = [
25
+ 'node_modules/nx/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js',
26
+ 'node_modules/nx/src/project-graph/build-dependencies/typescript-import-locator.js', // for Nx >= 13.10.3
27
+ 'node_modules/@nrwl/workspace/src/core/project-graph/build-dependencies/typescript-import-locator.js' // for older versions of Nx
28
+ ]
29
+
30
+ for (const p of possiblePaths) {
31
+ const fullPath = path.join(process.env.INIT_CWD || '', p)
32
+ if (fs.existsSync(fullPath)) {
33
+ return fullPath
34
+ }
35
+ }
36
+
37
+ throw new Error("Could not find Nx's dep-graph builder in node_modules")
38
+ }
39
+
40
+ patchNxDepGraph()