@slicemachine/adapter-next 0.0.12 → 0.0.13-dev-plugins-validation.1
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/LICENSE +1 -1
- package/dist/{node_modules → _node_modules}/data-uri-to-buffer/dist/index.cjs +1 -1
- package/dist/_node_modules/data-uri-to-buffer/dist/index.cjs.map +1 -0
- package/dist/{node_modules → _node_modules}/data-uri-to-buffer/dist/index.js +1 -1
- package/dist/_node_modules/data-uri-to-buffer/dist/index.js.map +1 -0
- package/dist/_node_modules/fetch-blob/file.cjs.map +1 -0
- package/dist/_node_modules/fetch-blob/file.js.map +1 -0
- package/dist/_node_modules/fetch-blob/index.cjs.map +1 -0
- package/dist/_node_modules/fetch-blob/index.js.map +1 -0
- package/dist/_node_modules/fetch-blob/streams.cjs.map +1 -0
- package/dist/_node_modules/fetch-blob/streams.js.map +1 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.cjs.map +1 -0
- package/dist/_node_modules/formdata-polyfill/esm.min.js.map +1 -0
- package/dist/_node_modules/node-domexception/index.cjs.map +1 -0
- package/dist/_node_modules/node-domexception/index.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/body.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/body.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/abort-error.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/abort-error.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/base.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/base.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/headers.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/headers.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/index.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/index.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/request.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/request.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/response.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/response.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/get-search.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/get-search.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/is.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/referrer.cjs.map +1 -0
- package/dist/_node_modules/node-fetch/src/utils/referrer.js.map +1 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +1 -0
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -0
- package/dist/hooks/customType-asset-delete.cjs +6 -1
- package/dist/hooks/customType-asset-delete.cjs.map +1 -1
- package/dist/hooks/customType-asset-delete.js +6 -1
- package/dist/hooks/customType-asset-delete.js.map +1 -1
- package/dist/hooks/customType-asset-read.cjs +6 -1
- package/dist/hooks/customType-asset-read.cjs.map +1 -1
- package/dist/hooks/customType-asset-read.js +6 -1
- package/dist/hooks/customType-asset-read.js.map +1 -1
- package/dist/hooks/customType-asset-update.cjs +6 -1
- package/dist/hooks/customType-asset-update.cjs.map +1 -1
- package/dist/hooks/customType-asset-update.js +6 -1
- package/dist/hooks/customType-asset-update.js.map +1 -1
- package/dist/hooks/customType-create.cjs +5 -1
- package/dist/hooks/customType-create.cjs.map +1 -1
- package/dist/hooks/customType-create.js +5 -1
- package/dist/hooks/customType-create.js.map +1 -1
- package/dist/hooks/customType-delete.cjs +5 -1
- package/dist/hooks/customType-delete.cjs.map +1 -1
- package/dist/hooks/customType-delete.js +5 -1
- package/dist/hooks/customType-delete.js.map +1 -1
- package/dist/hooks/customType-read.cjs +20 -1
- package/dist/hooks/customType-read.cjs.map +1 -1
- package/dist/hooks/customType-read.js +3 -1
- package/dist/hooks/customType-read.js.map +1 -1
- package/dist/hooks/customTypeLibrary-read.cjs +2 -1
- package/dist/hooks/customTypeLibrary-read.cjs.map +1 -1
- package/dist/hooks/customTypeLibrary-read.js +2 -1
- package/dist/hooks/customTypeLibrary-read.js.map +1 -1
- package/dist/hooks/{command-init.cjs → project-init.cjs} +3 -3
- package/dist/hooks/{command-init.cjs.map → project-init.cjs.map} +1 -1
- package/dist/hooks/project-init.d.ts +3 -0
- package/dist/hooks/{command-init.js → project-init.js} +3 -3
- package/dist/hooks/{command-init.js.map → project-init.js.map} +1 -1
- package/dist/hooks/slice-asset-delete.cjs +8 -2
- package/dist/hooks/slice-asset-delete.cjs.map +1 -1
- package/dist/hooks/slice-asset-delete.js +8 -2
- package/dist/hooks/slice-asset-delete.js.map +1 -1
- package/dist/hooks/slice-asset-read.cjs +8 -2
- package/dist/hooks/slice-asset-read.cjs.map +1 -1
- package/dist/hooks/slice-asset-read.js +8 -2
- package/dist/hooks/slice-asset-read.js.map +1 -1
- package/dist/hooks/slice-asset-update.cjs +8 -2
- package/dist/hooks/slice-asset-update.cjs.map +1 -1
- package/dist/hooks/slice-asset-update.js +8 -2
- package/dist/hooks/slice-asset-update.js.map +1 -1
- package/dist/hooks/slice-create.cjs +12 -10
- package/dist/hooks/slice-create.cjs.map +1 -1
- package/dist/hooks/slice-create.js +12 -10
- package/dist/hooks/slice-create.js.map +1 -1
- package/dist/hooks/slice-delete.cjs +6 -2
- package/dist/hooks/slice-delete.cjs.map +1 -1
- package/dist/hooks/slice-delete.js +6 -2
- package/dist/hooks/slice-delete.js.map +1 -1
- package/dist/hooks/slice-read.cjs +5 -1
- package/dist/hooks/slice-read.cjs.map +1 -1
- package/dist/hooks/slice-read.js +5 -1
- package/dist/hooks/slice-read.js.map +1 -1
- package/dist/hooks/slice-rename.cjs +10 -2
- package/dist/hooks/slice-rename.cjs.map +1 -1
- package/dist/hooks/slice-rename.js +10 -2
- package/dist/hooks/slice-rename.js.map +1 -1
- package/dist/hooks/sliceLibrary-read.cjs +5 -1
- package/dist/hooks/sliceLibrary-read.cjs.map +1 -1
- package/dist/hooks/sliceLibrary-read.js +5 -1
- package/dist/hooks/sliceLibrary-read.js.map +1 -1
- package/dist/hooks/sliceSimulator-setup-read.cjs +1 -1
- package/dist/hooks/sliceSimulator-setup-read.js +1 -1
- package/dist/lib/buildCustomTypeAssetPath.cjs +29 -0
- package/dist/lib/buildCustomTypeAssetPath.cjs.map +1 -0
- package/dist/lib/buildCustomTypeAssetPath.d.ts +9 -0
- package/dist/lib/buildCustomTypeAssetPath.js +12 -0
- package/dist/lib/buildCustomTypeAssetPath.js.map +1 -0
- package/dist/lib/buildCustomTypeDirectoryPath.cjs +26 -0
- package/dist/lib/buildCustomTypeDirectoryPath.cjs.map +1 -0
- package/dist/lib/buildCustomTypeDirectoryPath.d.ts +8 -0
- package/dist/lib/buildCustomTypeDirectoryPath.js +9 -0
- package/dist/lib/buildCustomTypeDirectoryPath.js.map +1 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.cjs +7 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.cjs.map +1 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.d.ts +7 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.js +7 -0
- package/dist/lib/buildCustomTypeLibraryDirectoryPath.js.map +1 -0
- package/dist/lib/buildSliceAssetPath.cjs +34 -0
- package/dist/lib/buildSliceAssetPath.cjs.map +1 -0
- package/dist/lib/buildSliceAssetPath.d.ts +11 -0
- package/dist/lib/buildSliceAssetPath.js +17 -0
- package/dist/lib/buildSliceAssetPath.js.map +1 -0
- package/dist/lib/buildSliceDirectoryPath.cjs +30 -0
- package/dist/lib/buildSliceDirectoryPath.cjs.map +1 -0
- package/dist/lib/buildSliceDirectoryPath.d.ts +10 -0
- package/dist/lib/buildSliceDirectoryPath.js +13 -0
- package/dist/lib/buildSliceDirectoryPath.js.map +1 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.cjs +7 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.cjs.map +1 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.d.ts +8 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.js +7 -0
- package/dist/lib/buildSliceLibraryDirectoryPath.js.map +1 -0
- package/dist/lib/updateSliceModelFile.cjs +4 -2
- package/dist/lib/updateSliceModelFile.cjs.map +1 -1
- package/dist/lib/updateSliceModelFile.js +3 -2
- package/dist/lib/updateSliceModelFile.js.map +1 -1
- package/dist/lib/upsertSliceLibraryIndexFile.cjs +7 -1
- package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -1
- package/dist/lib/upsertSliceLibraryIndexFile.js +6 -1
- package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -1
- package/dist/plugin.cjs +3 -3
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +3 -3
- package/dist/plugin.js.map +1 -1
- package/package.json +18 -14
- package/src/hooks/customType-asset-delete.ts +7 -5
- package/src/hooks/customType-asset-read.ts +7 -5
- package/src/hooks/customType-asset-update.ts +7 -5
- package/src/hooks/customType-create.ts +5 -1
- package/src/hooks/customType-delete.ts +5 -1
- package/src/hooks/customType-read.ts +4 -3
- package/src/hooks/customTypeLibrary-read.ts +2 -1
- package/src/hooks/{command-init.ts → project-init.ts} +4 -4
- package/src/hooks/slice-asset-delete.ts +8 -6
- package/src/hooks/slice-asset-read.ts +8 -6
- package/src/hooks/slice-asset-update.ts +8 -6
- package/src/hooks/slice-create.ts +12 -17
- package/src/hooks/slice-delete.ts +6 -5
- package/src/hooks/slice-read.ts +5 -1
- package/src/hooks/slice-rename.ts +11 -9
- package/src/hooks/sliceLibrary-read.ts +5 -1
- package/src/lib/buildCustomTypeAssetPath.ts +24 -0
- package/src/lib/buildCustomTypeDirectoryPath.ts +20 -0
- package/src/lib/buildCustomTypeLibraryDirectoryPath.ts +13 -0
- package/src/lib/buildSliceAssetPath.ts +32 -0
- package/src/lib/buildSliceDirectoryPath.ts +26 -0
- package/src/lib/buildSliceLibraryDirectoryPath.ts +14 -0
- package/src/lib/updateSliceModelFile.ts +5 -4
- package/src/lib/upsertSliceLibraryIndexFile.ts +7 -2
- package/src/plugin.ts +2 -2
- package/dist/hooks/command-init.d.ts +0 -3
- package/dist/node_modules/data-uri-to-buffer/dist/index.cjs.map +0 -1
- package/dist/node_modules/data-uri-to-buffer/dist/index.js.map +0 -1
- package/dist/node_modules/fetch-blob/file.cjs.map +0 -1
- package/dist/node_modules/fetch-blob/file.js.map +0 -1
- package/dist/node_modules/fetch-blob/index.cjs.map +0 -1
- package/dist/node_modules/fetch-blob/index.js.map +0 -1
- package/dist/node_modules/fetch-blob/streams.cjs.map +0 -1
- package/dist/node_modules/fetch-blob/streams.js.map +0 -1
- package/dist/node_modules/formdata-polyfill/esm.min.cjs.map +0 -1
- package/dist/node_modules/formdata-polyfill/esm.min.js.map +0 -1
- package/dist/node_modules/node-domexception/index.cjs.map +0 -1
- package/dist/node_modules/node-domexception/index.js.map +0 -1
- package/dist/node_modules/node-fetch/src/body.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/body.js.map +0 -1
- package/dist/node_modules/node-fetch/src/errors/abort-error.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/errors/abort-error.js.map +0 -1
- package/dist/node_modules/node-fetch/src/errors/base.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/errors/base.js.map +0 -1
- package/dist/node_modules/node-fetch/src/errors/fetch-error.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/errors/fetch-error.js.map +0 -1
- package/dist/node_modules/node-fetch/src/headers.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/headers.js.map +0 -1
- package/dist/node_modules/node-fetch/src/index.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/index.js.map +0 -1
- package/dist/node_modules/node-fetch/src/request.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/request.js.map +0 -1
- package/dist/node_modules/node-fetch/src/response.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/response.js.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/get-search.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/get-search.js.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/is-redirect.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/is-redirect.js.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/is.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/is.js.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.js.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/referrer.cjs.map +0 -1
- package/dist/node_modules/node-fetch/src/utils/referrer.js.map +0 -1
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +0 -1
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +0 -1
- /package/dist/{node_modules → _node_modules}/fetch-blob/file.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/fetch-blob/file.js +0 -0
- /package/dist/{node_modules → _node_modules}/fetch-blob/index.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/fetch-blob/index.js +0 -0
- /package/dist/{node_modules → _node_modules}/fetch-blob/streams.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/fetch-blob/streams.js +0 -0
- /package/dist/{node_modules → _node_modules}/formdata-polyfill/esm.min.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/formdata-polyfill/esm.min.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-domexception/index.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-domexception/index.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/body.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/body.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/abort-error.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/abort-error.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/base.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/base.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/fetch-error.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/errors/fetch-error.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/headers.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/headers.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/index.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/index.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/request.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/request.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/response.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/response.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/get-search.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/get-search.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/is-redirect.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/is-redirect.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/is.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/is.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/multipart-parser.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/multipart-parser.js +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/referrer.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/node-fetch/src/utils/referrer.js +0 -0
- /package/dist/{node_modules → _node_modules}/web-streams-polyfill/dist/ponyfill.es2018.cjs +0 -0
- /package/dist/{node_modules → _node_modules}/web-streams-polyfill/dist/ponyfill.es2018.js +0 -0
- /package/dist/{package.json.cjs → packages/adapter-next/package.json.cjs} +0 -0
- /package/dist/{package.json.cjs.map → packages/adapter-next/package.json.cjs.map} +0 -0
- /package/dist/{package.json.js → packages/adapter-next/package.json.js} +0 -0
- /package/dist/{package.json.js.map → packages/adapter-next/package.json.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slicemachine/adapter-next",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13-dev-plugins-validation.1",
|
|
4
4
|
"description": "Slice Machine adapter for Next.js.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -52,17 +52,20 @@
|
|
|
52
52
|
"release:alpha:dry": "standard-version --release-as major --prerelease alpha --dry-run",
|
|
53
53
|
"release:dry": "standard-version --dry-run",
|
|
54
54
|
"size": "size-limit",
|
|
55
|
-
"test": "npm run lint && npm run unit && npm run build && npm run size",
|
|
55
|
+
"test": "npm run lint && npm run types && npm run unit && npm run build && npm run size",
|
|
56
|
+
"types": "tsc --noEmit",
|
|
56
57
|
"unit": "vitest run --coverage",
|
|
57
|
-
"unit:watch": "vitest watch"
|
|
58
|
+
"unit:watch": "vitest watch",
|
|
59
|
+
"depcheck": "depcheck --config=.depcheckrc",
|
|
60
|
+
"audit": "better-npm-audit audit -l high -p"
|
|
58
61
|
},
|
|
59
62
|
"dependencies": {
|
|
60
63
|
"@prismicio/slice-simulator-core": "^0.2.7",
|
|
61
64
|
"@prismicio/types": "^0.2.7",
|
|
62
|
-
"@slicemachine/plugin-kit": "0.1.8-dev-plugins.
|
|
65
|
+
"@slicemachine/plugin-kit": "0.1.8-dev-plugins-validation.1",
|
|
63
66
|
"common-tags": "^1.8.2",
|
|
64
67
|
"fs-extra": "^11.1.0",
|
|
65
|
-
"node-fetch": "^3.3.
|
|
68
|
+
"node-fetch": "^3.3.1",
|
|
66
69
|
"pascal-case": "^3.1.2",
|
|
67
70
|
"prismic-ts-codegen": "^0.1.5"
|
|
68
71
|
},
|
|
@@ -74,15 +77,15 @@
|
|
|
74
77
|
"@types/prettier": "^2.7.2",
|
|
75
78
|
"@types/react": "^18.0.28",
|
|
76
79
|
"@types/semver": "^7.3.13",
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
78
|
-
"@typescript-eslint/parser": "^5.
|
|
80
|
+
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
|
81
|
+
"@typescript-eslint/parser": "^5.55.0",
|
|
79
82
|
"@vitejs/plugin-react": "^3.1.0",
|
|
80
|
-
"@vitest/coverage-c8": "^0.
|
|
81
|
-
"
|
|
82
|
-
"eslint
|
|
83
|
+
"@vitest/coverage-c8": "^0.27.3",
|
|
84
|
+
"better-npm-audit": "^3.7.3",
|
|
85
|
+
"eslint": "^8.36.0",
|
|
86
|
+
"eslint-config-prettier": "^8.7.0",
|
|
83
87
|
"eslint-plugin-prettier": "^4.2.1",
|
|
84
88
|
"eslint-plugin-tsdoc": "^0.2.17",
|
|
85
|
-
"npm-run-all": "^4.1.5",
|
|
86
89
|
"prettier": "^2.8.4",
|
|
87
90
|
"prettier-plugin-jsdoc": "^0.4.2",
|
|
88
91
|
"react": "^18.2.0",
|
|
@@ -91,8 +94,8 @@
|
|
|
91
94
|
"ts-morph": "^17.0.1",
|
|
92
95
|
"typescript": "^4.9.5",
|
|
93
96
|
"vite": "^4.1.4",
|
|
94
|
-
"vite-plugin-sdk": "^0.1.
|
|
95
|
-
"vitest": "^0.
|
|
97
|
+
"vite-plugin-sdk": "^0.1.1",
|
|
98
|
+
"vitest": "^0.27.3"
|
|
96
99
|
},
|
|
97
100
|
"peerDependencies": {
|
|
98
101
|
"next": "^11 || ^12 || ^13",
|
|
@@ -103,5 +106,6 @@
|
|
|
103
106
|
},
|
|
104
107
|
"publishConfig": {
|
|
105
108
|
"access": "public"
|
|
106
|
-
}
|
|
109
|
+
},
|
|
110
|
+
"gitHead": "be509347c1cfaed23c9b9f714051a38436d4d9de"
|
|
107
111
|
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { CustomTypeAssetDeleteHook } from "@slicemachine/plugin-kit";
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
|
|
4
|
+
import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath";
|
|
5
|
+
|
|
4
6
|
import type { PluginOptions } from "../types";
|
|
5
7
|
|
|
6
8
|
export const customTypeAssetDelete: CustomTypeAssetDeleteHook<
|
|
7
9
|
PluginOptions
|
|
8
10
|
> = async (data, context) => {
|
|
9
|
-
const filePath =
|
|
10
|
-
|
|
11
|
-
data.
|
|
12
|
-
|
|
13
|
-
);
|
|
11
|
+
const filePath = buildCustomTypeAssetPath({
|
|
12
|
+
customTypeID: data.customTypeID,
|
|
13
|
+
assetID: data.assetID,
|
|
14
|
+
helpers: context.helpers,
|
|
15
|
+
});
|
|
14
16
|
|
|
15
17
|
await fs.rm(filePath);
|
|
16
18
|
};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { CustomTypeAssetReadHook } from "@slicemachine/plugin-kit";
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
|
|
4
|
+
import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath";
|
|
5
|
+
|
|
4
6
|
import type { PluginOptions } from "../types";
|
|
5
7
|
|
|
6
8
|
export const customTypeAssetRead: CustomTypeAssetReadHook<
|
|
7
9
|
PluginOptions
|
|
8
10
|
> = async (data, context) => {
|
|
9
|
-
const filePath =
|
|
10
|
-
|
|
11
|
-
data.
|
|
12
|
-
|
|
13
|
-
);
|
|
11
|
+
const filePath = buildCustomTypeAssetPath({
|
|
12
|
+
customTypeID: data.customTypeID,
|
|
13
|
+
assetID: data.assetID,
|
|
14
|
+
helpers: context.helpers,
|
|
15
|
+
});
|
|
14
16
|
|
|
15
17
|
const assetData = await fs.readFile(filePath);
|
|
16
18
|
|
|
@@ -2,16 +2,18 @@ import type { CustomTypeAssetUpdateHook } from "@slicemachine/plugin-kit";
|
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
|
|
5
|
+
import { buildCustomTypeAssetPath } from "../lib/buildCustomTypeAssetPath";
|
|
6
|
+
|
|
5
7
|
import type { PluginOptions } from "../types";
|
|
6
8
|
|
|
7
9
|
export const customTypeAssetUpdate: CustomTypeAssetUpdateHook<
|
|
8
10
|
PluginOptions
|
|
9
11
|
> = async (data, context) => {
|
|
10
|
-
const filePath =
|
|
11
|
-
|
|
12
|
-
data.
|
|
13
|
-
|
|
14
|
-
);
|
|
12
|
+
const filePath = buildCustomTypeAssetPath({
|
|
13
|
+
customTypeID: data.customTypeID,
|
|
14
|
+
assetID: data.asset.id,
|
|
15
|
+
helpers: context.helpers,
|
|
16
|
+
});
|
|
15
17
|
|
|
16
18
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
17
19
|
await fs.writeFile(filePath, data.asset.data);
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
import * as fs from "node:fs/promises";
|
|
7
7
|
import * as path from "node:path";
|
|
8
8
|
|
|
9
|
+
import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath";
|
|
9
10
|
import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes";
|
|
10
11
|
|
|
11
12
|
import type { PluginOptions } from "../types";
|
|
@@ -31,7 +32,10 @@ export const customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (
|
|
|
31
32
|
data,
|
|
32
33
|
context,
|
|
33
34
|
) => {
|
|
34
|
-
const dir =
|
|
35
|
+
const dir = buildCustomTypeDirectoryPath({
|
|
36
|
+
customTypeID: data.model.id,
|
|
37
|
+
helpers: context.helpers,
|
|
38
|
+
});
|
|
35
39
|
|
|
36
40
|
await fs.mkdir(dir, { recursive: true });
|
|
37
41
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CustomTypeDeleteHook } from "@slicemachine/plugin-kit";
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
|
|
4
|
+
import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath";
|
|
4
5
|
import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes";
|
|
5
6
|
|
|
6
7
|
import type { PluginOptions } from "../types";
|
|
@@ -9,7 +10,10 @@ export const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (
|
|
|
9
10
|
data,
|
|
10
11
|
context,
|
|
11
12
|
) => {
|
|
12
|
-
const dir =
|
|
13
|
+
const dir = buildCustomTypeDirectoryPath({
|
|
14
|
+
customTypeID: data.model.id,
|
|
15
|
+
helpers: context.helpers,
|
|
16
|
+
});
|
|
13
17
|
|
|
14
18
|
await fs.rm(dir, { recursive: true });
|
|
15
19
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { CustomTypeReadHook } from "@slicemachine/plugin-kit";
|
|
2
2
|
import * as prismicT from "@prismicio/types";
|
|
3
|
+
import * as path from "node:path";
|
|
3
4
|
|
|
5
|
+
import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath";
|
|
4
6
|
import { readJSONFile } from "../lib/readJSONFile";
|
|
5
7
|
|
|
6
8
|
import type { PluginOptions } from "../types";
|
|
@@ -9,9 +11,8 @@ export const customTypeRead: CustomTypeReadHook<PluginOptions> = async (
|
|
|
9
11
|
data,
|
|
10
12
|
{ helpers },
|
|
11
13
|
) => {
|
|
12
|
-
const filePath =
|
|
13
|
-
|
|
14
|
-
data.id,
|
|
14
|
+
const filePath = path.join(
|
|
15
|
+
buildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }),
|
|
15
16
|
"index.json",
|
|
16
17
|
);
|
|
17
18
|
|
|
@@ -3,6 +3,7 @@ import * as prismicT from "@prismicio/types";
|
|
|
3
3
|
import * as fs from "node:fs/promises";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
|
|
6
|
+
import { buildCustomTypeLibraryDirectoryPath } from "../lib/buildCustomTypeLibraryDirectoryPath";
|
|
6
7
|
import { readJSONFile } from "../lib/readJSONFile";
|
|
7
8
|
|
|
8
9
|
import type { PluginOptions } from "../types";
|
|
@@ -17,7 +18,7 @@ const isCustomTypeModel = (
|
|
|
17
18
|
export const customTypeLibraryRead: CustomTypeLibraryReadHook<
|
|
18
19
|
PluginOptions
|
|
19
20
|
> = async (_data, { helpers }) => {
|
|
20
|
-
const dirPath = helpers
|
|
21
|
+
const dirPath = buildCustomTypeLibraryDirectoryPath({ helpers });
|
|
21
22
|
|
|
22
23
|
// Ensure the directory exists.
|
|
23
24
|
await fs.mkdir(dirPath, { recursive: true });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import type {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
ProjectInitHook,
|
|
5
|
+
ProjectInitHookData,
|
|
6
6
|
SliceMachineContext,
|
|
7
7
|
} from "@slicemachine/plugin-kit";
|
|
8
8
|
import { stripIndent } from "common-tags";
|
|
@@ -15,7 +15,7 @@ import type { PluginOptions } from "../types";
|
|
|
15
15
|
import { checkIsTypeScriptProject } from "../lib/checkIsTypeScriptProject";
|
|
16
16
|
|
|
17
17
|
type InstallDependenciesArgs = {
|
|
18
|
-
installDependencies:
|
|
18
|
+
installDependencies: ProjectInitHookData["installDependencies"];
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const installDependencies = async ({
|
|
@@ -215,7 +215,7 @@ const createSliceSimulatorPage = async ({
|
|
|
215
215
|
await fs.writeFile(filePath, contents);
|
|
216
216
|
};
|
|
217
217
|
|
|
218
|
-
export const
|
|
218
|
+
export const projectInit: ProjectInitHook<PluginOptions> = async (
|
|
219
219
|
{ installDependencies: _installDependencies },
|
|
220
220
|
context,
|
|
221
221
|
) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SliceAssetDeleteHook } from "@slicemachine/plugin-kit";
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { buildSliceAssetPath } from "../lib/buildSliceAssetPath";
|
|
5
5
|
|
|
6
6
|
import type { PluginOptions } from "../types";
|
|
7
7
|
|
|
@@ -9,11 +9,13 @@ export const sliceAssetDelete: SliceAssetDeleteHook<PluginOptions> = async (
|
|
|
9
9
|
data,
|
|
10
10
|
context,
|
|
11
11
|
) => {
|
|
12
|
-
const filePath =
|
|
13
|
-
data.libraryID,
|
|
14
|
-
|
|
15
|
-
data.assetID,
|
|
16
|
-
|
|
12
|
+
const filePath = await buildSliceAssetPath({
|
|
13
|
+
libraryID: data.libraryID,
|
|
14
|
+
sliceID: data.sliceID,
|
|
15
|
+
assetID: data.assetID,
|
|
16
|
+
helpers: context.helpers,
|
|
17
|
+
actions: context.actions,
|
|
18
|
+
});
|
|
17
19
|
|
|
18
20
|
await fs.rm(filePath);
|
|
19
21
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SliceAssetReadHook } from "@slicemachine/plugin-kit";
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { buildSliceAssetPath } from "../lib/buildSliceAssetPath";
|
|
5
5
|
|
|
6
6
|
import type { PluginOptions } from "../types";
|
|
7
7
|
|
|
@@ -9,11 +9,13 @@ export const sliceAssetRead: SliceAssetReadHook<PluginOptions> = async (
|
|
|
9
9
|
data,
|
|
10
10
|
context,
|
|
11
11
|
) => {
|
|
12
|
-
const filePath =
|
|
13
|
-
data.libraryID,
|
|
14
|
-
|
|
15
|
-
data.assetID,
|
|
16
|
-
|
|
12
|
+
const filePath = await buildSliceAssetPath({
|
|
13
|
+
libraryID: data.libraryID,
|
|
14
|
+
sliceID: data.sliceID,
|
|
15
|
+
assetID: data.assetID,
|
|
16
|
+
helpers: context.helpers,
|
|
17
|
+
actions: context.actions,
|
|
18
|
+
});
|
|
17
19
|
|
|
18
20
|
const assetData = await fs.readFile(filePath);
|
|
19
21
|
|
|
@@ -2,7 +2,7 @@ import type { SliceAssetUpdateHook } from "@slicemachine/plugin-kit";
|
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { buildSliceAssetPath } from "../lib/buildSliceAssetPath";
|
|
6
6
|
|
|
7
7
|
import type { PluginOptions } from "../types";
|
|
8
8
|
|
|
@@ -10,11 +10,13 @@ export const sliceAssetUpdate: SliceAssetUpdateHook<PluginOptions> = async (
|
|
|
10
10
|
data,
|
|
11
11
|
context,
|
|
12
12
|
) => {
|
|
13
|
-
const filePath =
|
|
14
|
-
data.libraryID,
|
|
15
|
-
|
|
16
|
-
data.asset.id,
|
|
17
|
-
|
|
13
|
+
const filePath = await buildSliceAssetPath({
|
|
14
|
+
libraryID: data.libraryID,
|
|
15
|
+
sliceID: data.sliceID,
|
|
16
|
+
assetID: data.asset.id,
|
|
17
|
+
helpers: context.helpers,
|
|
18
|
+
actions: context.actions,
|
|
19
|
+
});
|
|
18
20
|
|
|
19
21
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
20
22
|
await fs.writeFile(filePath, data.asset.data);
|
|
@@ -7,10 +7,12 @@ import { stripIndent } from "common-tags";
|
|
|
7
7
|
import * as fs from "node:fs/promises";
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
|
|
10
|
+
import { buildSliceDirectoryPath } from "../lib/buildSliceDirectoryPath";
|
|
10
11
|
import { checkIsTypeScriptProject } from "../lib/checkIsTypeScriptProject";
|
|
11
12
|
import { getJSOrTSXFileExtension } from "../lib/getJSOrTSXFileExtension";
|
|
12
13
|
import { pascalCase } from "../lib/pascalCase";
|
|
13
14
|
import { rejectIfNecessary } from "../lib/rejectIfNecessary";
|
|
15
|
+
import { updateSliceModelFile } from "../lib/updateSliceModelFile";
|
|
14
16
|
import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes";
|
|
15
17
|
import { upsertSliceLibraryIndexFile } from "../lib/upsertSliceLibraryIndexFile";
|
|
16
18
|
|
|
@@ -21,18 +23,6 @@ type Args = {
|
|
|
21
23
|
data: SliceCreateHookData;
|
|
22
24
|
} & SliceMachineContext<PluginOptions>;
|
|
23
25
|
|
|
24
|
-
const createModelFile = async ({ dir, data, helpers, options }: Args) => {
|
|
25
|
-
const filePath = path.join(dir, "model.json");
|
|
26
|
-
|
|
27
|
-
let contents = JSON.stringify(data.model);
|
|
28
|
-
|
|
29
|
-
if (options.format) {
|
|
30
|
-
contents = await helpers.format(contents, filePath);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
await fs.writeFile(filePath, contents);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
26
|
const createComponentFile = async ({ dir, data, helpers, options }: Args) => {
|
|
37
27
|
const filePath = path.join(
|
|
38
28
|
dir,
|
|
@@ -107,16 +97,21 @@ export const sliceCreate: SliceCreateHook<PluginOptions> = async (
|
|
|
107
97
|
data,
|
|
108
98
|
context,
|
|
109
99
|
) => {
|
|
110
|
-
const dir =
|
|
111
|
-
data.libraryID,
|
|
112
|
-
|
|
113
|
-
|
|
100
|
+
const dir = buildSliceDirectoryPath({
|
|
101
|
+
libraryID: data.libraryID,
|
|
102
|
+
model: data.model,
|
|
103
|
+
helpers: context.helpers,
|
|
104
|
+
});
|
|
114
105
|
|
|
115
106
|
await fs.mkdir(dir, { recursive: true });
|
|
116
107
|
|
|
117
108
|
rejectIfNecessary(
|
|
118
109
|
await Promise.allSettled([
|
|
119
|
-
|
|
110
|
+
updateSliceModelFile({
|
|
111
|
+
libraryID: data.libraryID,
|
|
112
|
+
model: data.model,
|
|
113
|
+
...context,
|
|
114
|
+
}),
|
|
120
115
|
createComponentFile({ dir, data, ...context }),
|
|
121
116
|
]),
|
|
122
117
|
);
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
} from "@slicemachine/plugin-kit";
|
|
6
6
|
import * as fs from "node:fs/promises";
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { buildSliceDirectoryPath } from "../lib/buildSliceDirectoryPath";
|
|
9
9
|
import { rejectIfNecessary } from "../lib/rejectIfNecessary";
|
|
10
10
|
import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes";
|
|
11
11
|
import { upsertSliceLibraryIndexFile } from "../lib/upsertSliceLibraryIndexFile";
|
|
@@ -17,10 +17,11 @@ type Args = {
|
|
|
17
17
|
} & SliceMachineContext<PluginOptions>;
|
|
18
18
|
|
|
19
19
|
const deleteSliceDir = async ({ data, helpers }: Args) => {
|
|
20
|
-
const dir =
|
|
21
|
-
data.libraryID,
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const dir = buildSliceDirectoryPath({
|
|
21
|
+
libraryID: data.libraryID,
|
|
22
|
+
model: data.model,
|
|
23
|
+
helpers,
|
|
24
|
+
});
|
|
24
25
|
|
|
25
26
|
await fs.rm(dir, { recursive: true });
|
|
26
27
|
};
|
package/src/hooks/slice-read.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { SliceReadHook } from "@slicemachine/plugin-kit";
|
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
|
|
5
|
+
import { buildSliceLibraryDirectoryPath } from "../lib/buildSliceLibraryDirectoryPath";
|
|
5
6
|
import { isSharedSliceModel } from "../lib/isSharedSliceModel";
|
|
6
7
|
import { readJSONFile } from "../lib/readJSONFile";
|
|
7
8
|
|
|
@@ -11,7 +12,10 @@ export const sliceRead: SliceReadHook<PluginOptions> = async (
|
|
|
11
12
|
data,
|
|
12
13
|
{ helpers },
|
|
13
14
|
) => {
|
|
14
|
-
const libraryDir =
|
|
15
|
+
const libraryDir = buildSliceLibraryDirectoryPath({
|
|
16
|
+
libraryID: data.libraryID,
|
|
17
|
+
helpers,
|
|
18
|
+
});
|
|
15
19
|
|
|
16
20
|
// Ensure the directory exists.
|
|
17
21
|
await fs.mkdir(libraryDir, { recursive: true });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SliceRenameHook } from "@slicemachine/plugin-kit";
|
|
2
2
|
import * as fse from "fs-extra";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { buildSliceDirectoryPath } from "../lib/buildSliceDirectoryPath";
|
|
5
5
|
import { rejectIfNecessary } from "../lib/rejectIfNecessary";
|
|
6
6
|
import { updateSliceModelFile } from "../lib/updateSliceModelFile";
|
|
7
7
|
import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes";
|
|
@@ -19,14 +19,16 @@ export const sliceRename: SliceRenameHook<PluginOptions> = async (
|
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
await fse.move(
|
|
22
|
-
|
|
23
|
-
data.libraryID,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
buildSliceDirectoryPath({
|
|
23
|
+
libraryID: data.libraryID,
|
|
24
|
+
model: currentModel,
|
|
25
|
+
helpers: context.helpers,
|
|
26
|
+
}),
|
|
27
|
+
buildSliceDirectoryPath({
|
|
28
|
+
libraryID: data.libraryID,
|
|
29
|
+
model: data.model,
|
|
30
|
+
helpers: context.helpers,
|
|
31
|
+
}),
|
|
30
32
|
);
|
|
31
33
|
|
|
32
34
|
await updateSliceModelFile({
|
|
@@ -2,6 +2,7 @@ import type { SliceLibraryReadHook } from "@slicemachine/plugin-kit";
|
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
|
|
5
|
+
import { buildSliceLibraryDirectoryPath } from "../lib/buildSliceLibraryDirectoryPath";
|
|
5
6
|
import { isSharedSliceModel } from "../lib/isSharedSliceModel";
|
|
6
7
|
import { readJSONFile } from "../lib/readJSONFile";
|
|
7
8
|
|
|
@@ -11,7 +12,10 @@ export const sliceLibraryRead: SliceLibraryReadHook<PluginOptions> = async (
|
|
|
11
12
|
data,
|
|
12
13
|
{ helpers },
|
|
13
14
|
) => {
|
|
14
|
-
const dir =
|
|
15
|
+
const dir = buildSliceLibraryDirectoryPath({
|
|
16
|
+
libraryID: data.libraryID,
|
|
17
|
+
helpers,
|
|
18
|
+
});
|
|
15
19
|
|
|
16
20
|
// Ensure the directory exists.
|
|
17
21
|
await fs.mkdir(dir, { recursive: true });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SliceMachineContext } from "@slicemachine/plugin-kit";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
|
|
4
|
+
import { PluginOptions } from "../types";
|
|
5
|
+
|
|
6
|
+
import { buildCustomTypeDirectoryPath } from "./buildCustomTypeDirectoryPath";
|
|
7
|
+
|
|
8
|
+
type BuildCustomTypeAssetPathArgs = {
|
|
9
|
+
customTypeID: string;
|
|
10
|
+
assetID: string;
|
|
11
|
+
helpers: SliceMachineContext<PluginOptions>["helpers"];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const buildCustomTypeAssetPath = (
|
|
15
|
+
args: BuildCustomTypeAssetPathArgs,
|
|
16
|
+
): string => {
|
|
17
|
+
return path.join(
|
|
18
|
+
buildCustomTypeDirectoryPath({
|
|
19
|
+
customTypeID: args.customTypeID,
|
|
20
|
+
helpers: args.helpers,
|
|
21
|
+
}),
|
|
22
|
+
args.assetID,
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SliceMachineContext } from "@slicemachine/plugin-kit";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
|
|
4
|
+
import { PluginOptions } from "../types";
|
|
5
|
+
|
|
6
|
+
import { buildCustomTypeLibraryDirectoryPath } from "./buildCustomTypeLibraryDirectoryPath";
|
|
7
|
+
|
|
8
|
+
type BuildCustomTypeDirectoryPathArgs = {
|
|
9
|
+
customTypeID: string;
|
|
10
|
+
helpers: SliceMachineContext<PluginOptions>["helpers"];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const buildCustomTypeDirectoryPath = (
|
|
14
|
+
args: BuildCustomTypeDirectoryPathArgs,
|
|
15
|
+
): string => {
|
|
16
|
+
return path.join(
|
|
17
|
+
buildCustomTypeLibraryDirectoryPath({ helpers: args.helpers }),
|
|
18
|
+
args.customTypeID,
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SliceMachineContext } from "@slicemachine/plugin-kit";
|
|
2
|
+
|
|
3
|
+
import { PluginOptions } from "../types";
|
|
4
|
+
|
|
5
|
+
type BuildCustomTypeLibraryDirectoryPathArgs = {
|
|
6
|
+
helpers: SliceMachineContext<PluginOptions>["helpers"];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const buildCustomTypeLibraryDirectoryPath = (
|
|
10
|
+
args: BuildCustomTypeLibraryDirectoryPathArgs,
|
|
11
|
+
): string => {
|
|
12
|
+
return args.helpers.joinPathFromRoot("customtypes");
|
|
13
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SliceMachineContext } from "@slicemachine/plugin-kit";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
|
|
4
|
+
import { PluginOptions } from "../types";
|
|
5
|
+
|
|
6
|
+
import { buildSliceDirectoryPath } from "./buildSliceDirectoryPath";
|
|
7
|
+
|
|
8
|
+
type BuildSliceAssetPathArgs = {
|
|
9
|
+
libraryID: string;
|
|
10
|
+
sliceID: string;
|
|
11
|
+
assetID: string;
|
|
12
|
+
actions: SliceMachineContext<PluginOptions>["actions"];
|
|
13
|
+
helpers: SliceMachineContext<PluginOptions>["helpers"];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const buildSliceAssetPath = async (
|
|
17
|
+
args: BuildSliceAssetPathArgs,
|
|
18
|
+
): Promise<string> => {
|
|
19
|
+
const { model } = await args.actions.readSliceModel({
|
|
20
|
+
libraryID: args.libraryID,
|
|
21
|
+
sliceID: args.sliceID,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return path.join(
|
|
25
|
+
buildSliceDirectoryPath({
|
|
26
|
+
libraryID: args.libraryID,
|
|
27
|
+
model,
|
|
28
|
+
helpers: args.helpers,
|
|
29
|
+
}),
|
|
30
|
+
args.assetID,
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SharedSliceModel } from "@prismicio/types";
|
|
2
|
+
import { SliceMachineContext } from "@slicemachine/plugin-kit";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
|
|
5
|
+
import { PluginOptions } from "../types";
|
|
6
|
+
|
|
7
|
+
import { buildSliceLibraryDirectoryPath } from "./buildSliceLibraryDirectoryPath";
|
|
8
|
+
import { pascalCase } from "./pascalCase";
|
|
9
|
+
|
|
10
|
+
type BuildSliceDirectoryPathArgs = {
|
|
11
|
+
libraryID: string;
|
|
12
|
+
model: SharedSliceModel;
|
|
13
|
+
helpers: SliceMachineContext<PluginOptions>["helpers"];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const buildSliceDirectoryPath = (
|
|
17
|
+
args: BuildSliceDirectoryPathArgs,
|
|
18
|
+
): string => {
|
|
19
|
+
return path.join(
|
|
20
|
+
buildSliceLibraryDirectoryPath({
|
|
21
|
+
libraryID: args.libraryID,
|
|
22
|
+
helpers: args.helpers,
|
|
23
|
+
}),
|
|
24
|
+
pascalCase(args.model.name),
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SliceMachineContext } from "@slicemachine/plugin-kit";
|
|
2
|
+
|
|
3
|
+
import { PluginOptions } from "../types";
|
|
4
|
+
|
|
5
|
+
type BuildSliceLibraryDirectoryPathArgs = {
|
|
6
|
+
libraryID: string;
|
|
7
|
+
helpers: SliceMachineContext<PluginOptions>["helpers"];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const buildSliceLibraryDirectoryPath = (
|
|
11
|
+
args: BuildSliceLibraryDirectoryPathArgs,
|
|
12
|
+
): string => {
|
|
13
|
+
return args.helpers.joinPathFromRoot(args.libraryID);
|
|
14
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { SharedSliceModel } from "@prismicio/types";
|
|
2
2
|
import { SliceMachineContext } from "@slicemachine/plugin-kit";
|
|
3
3
|
import * as fs from "node:fs/promises";
|
|
4
|
+
import * as path from "node:path";
|
|
4
5
|
|
|
5
6
|
import type { PluginOptions } from "../types";
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
import { buildSliceDirectoryPath } from "./buildSliceDirectoryPath";
|
|
7
9
|
|
|
8
10
|
type UpdateSliceModelFileArgs = {
|
|
9
11
|
libraryID: string;
|
|
@@ -16,9 +18,8 @@ export const updateSliceModelFile = async ({
|
|
|
16
18
|
helpers,
|
|
17
19
|
options,
|
|
18
20
|
}: UpdateSliceModelFileArgs): Promise<void> => {
|
|
19
|
-
const filePath =
|
|
20
|
-
libraryID,
|
|
21
|
-
pascalCase(model.name),
|
|
21
|
+
const filePath = path.join(
|
|
22
|
+
buildSliceDirectoryPath({ libraryID, model, helpers }),
|
|
22
23
|
"model.json",
|
|
23
24
|
);
|
|
24
25
|
|