@slicemachine/init 2.1.0 → 2.1.1-dev-hotfixes.0
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/SliceMachineInitProcess.cjs +16 -3
- package/dist/SliceMachineInitProcess.cjs.map +1 -1
- package/dist/SliceMachineInitProcess.d.ts +2 -1
- package/dist/SliceMachineInitProcess.js +16 -3
- package/dist/SliceMachineInitProcess.js.map +1 -1
- package/dist/_node_modules/@babel/code-frame/lib/index.cjs +2 -2
- package/dist/_node_modules/@babel/code-frame/lib/index.js +2 -2
- package/dist/_node_modules/@babel/helper-validator-identifier/lib/index.cjs +1 -1
- package/dist/_node_modules/@babel/helper-validator-identifier/lib/index.js +1 -1
- package/dist/_node_modules/@babel/highlight/lib/index.cjs +3 -3
- package/dist/_node_modules/@babel/highlight/lib/index.js +3 -3
- package/dist/_node_modules/@nodelib/fs.scandir/out/providers/async.cjs +1 -1
- package/dist/_node_modules/@nodelib/fs.scandir/out/providers/async.js +1 -1
- package/dist/_node_modules/@nodelib/fs.scandir/out/providers/sync.cjs +1 -1
- package/dist/_node_modules/@nodelib/fs.scandir/out/providers/sync.js +1 -1
- package/dist/_node_modules/@nodelib/fs.scandir/out/settings.cjs +1 -1
- package/dist/_node_modules/@nodelib/fs.scandir/out/settings.js +1 -1
- package/dist/_node_modules/@nodelib/fs.stat/out/index.cjs +1 -1
- package/dist/_node_modules/@nodelib/fs.stat/out/index.js +1 -1
- package/dist/_node_modules/@nodelib/fs.walk/out/index.cjs +1 -1
- package/dist/_node_modules/@nodelib/fs.walk/out/index.js +1 -1
- package/dist/_node_modules/camelcase-keys/index.cjs +1 -1
- package/dist/_node_modules/camelcase-keys/index.js +1 -1
- package/dist/_node_modules/dir-glob/index.cjs +2 -2
- package/dist/_node_modules/dir-glob/index.js +2 -2
- package/dist/_node_modules/fast-glob/out/index.cjs +1 -1
- package/dist/_node_modules/fast-glob/out/index.js +1 -1
- package/dist/_node_modules/fast-glob/out/managers/tasks.cjs +1 -1
- package/dist/_node_modules/fast-glob/out/managers/tasks.js +1 -1
- package/dist/_node_modules/fast-glob/out/providers/filters/deep.cjs +1 -1
- package/dist/_node_modules/fast-glob/out/providers/filters/deep.js +1 -1
- package/dist/_node_modules/fast-glob/out/providers/filters/entry.cjs +1 -1
- package/dist/_node_modules/fast-glob/out/providers/filters/entry.js +1 -1
- package/dist/_node_modules/fast-glob/out/providers/filters/error.cjs +1 -1
- package/dist/_node_modules/fast-glob/out/providers/filters/error.js +1 -1
- package/dist/_node_modules/fast-glob/out/providers/matchers/matcher.cjs +1 -1
- package/dist/_node_modules/fast-glob/out/providers/matchers/matcher.js +1 -1
- package/dist/_node_modules/fast-glob/out/providers/transformers/entry.cjs +1 -1
- package/dist/_node_modules/fast-glob/out/providers/transformers/entry.js +1 -1
- package/dist/_node_modules/fast-glob/out/readers/async.cjs +1 -1
- package/dist/_node_modules/fast-glob/out/readers/async.js +1 -1
- package/dist/_node_modules/fast-glob/out/readers/reader.cjs +2 -2
- package/dist/_node_modules/fast-glob/out/readers/reader.js +2 -2
- package/dist/_node_modules/fast-glob/out/readers/stream.cjs +2 -2
- package/dist/_node_modules/fast-glob/out/readers/stream.js +2 -2
- package/dist/_node_modules/fast-glob/out/readers/sync.cjs +2 -2
- package/dist/_node_modules/fast-glob/out/readers/sync.js +2 -2
- package/dist/_node_modules/fast-glob/out/utils/index.cjs +1 -1
- package/dist/_node_modules/fast-glob/out/utils/index.js +1 -1
- package/dist/_node_modules/js-tokens/index.cjs +1 -1
- package/dist/_node_modules/js-tokens/index.js +1 -1
- package/dist/_node_modules/lines-and-columns/build/index.cjs +1 -1
- package/dist/_node_modules/lines-and-columns/build/index.js +1 -1
- package/dist/_node_modules/map-obj/index.cjs +1 -1
- package/dist/_node_modules/map-obj/index.js +1 -1
- package/dist/_node_modules/meow/_node_modules/hosted-git-info/lib/index.cjs +1 -1
- package/dist/_node_modules/meow/_node_modules/hosted-git-info/lib/index.js +1 -1
- package/dist/_node_modules/meow/_node_modules/normalize-package-data/lib/fixer.cjs +1 -1
- package/dist/_node_modules/meow/_node_modules/normalize-package-data/lib/fixer.js +1 -1
- package/dist/_node_modules/meow/_node_modules/read-pkg/_node_modules/hosted-git-info/index.cjs +1 -1
- package/dist/_node_modules/meow/_node_modules/read-pkg/_node_modules/hosted-git-info/index.js +1 -1
- package/dist/_node_modules/meow/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/fixer.cjs +1 -1
- package/dist/_node_modules/meow/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/fixer.js +1 -1
- package/dist/_node_modules/micromatch/index.cjs +1 -1
- package/dist/_node_modules/micromatch/index.js +1 -1
- package/dist/_node_modules/parse-json/index.cjs +2 -2
- package/dist/_node_modules/parse-json/index.js +2 -2
- package/dist/_node_modules/path-type/index.cjs +1 -1
- package/dist/_node_modules/path-type/index.js +1 -1
- package/dist/_node_modules/picomatch/index.cjs +1 -1
- package/dist/_node_modules/picomatch/index.js +1 -1
- package/dist/_virtual/index10.cjs +2 -2
- package/dist/_virtual/index10.js +2 -2
- package/dist/_virtual/index11.cjs +2 -2
- package/dist/_virtual/index11.js +2 -2
- package/dist/_virtual/index12.cjs +10 -2
- package/dist/_virtual/index12.cjs.map +1 -1
- package/dist/_virtual/index12.js +11 -2
- package/dist/_virtual/index12.js.map +1 -1
- package/dist/_virtual/index14.cjs +10 -2
- package/dist/_virtual/index14.cjs.map +1 -1
- package/dist/_virtual/index14.js +11 -2
- package/dist/_virtual/index14.js.map +1 -1
- package/dist/_virtual/index15.cjs +2 -2
- package/dist/_virtual/index15.js +2 -2
- package/dist/_virtual/index16.cjs +2 -10
- package/dist/_virtual/index16.cjs.map +1 -1
- package/dist/_virtual/index16.js +2 -11
- package/dist/_virtual/index16.js.map +1 -1
- package/dist/_virtual/index3.cjs +2 -2
- package/dist/_virtual/index3.js +6 -6
- package/dist/_virtual/index4.cjs +2 -2
- package/dist/_virtual/index4.js +6 -6
- package/dist/_virtual/index5.cjs +2 -2
- package/dist/_virtual/index5.js +2 -2
- package/dist/_virtual/index6.cjs +2 -2
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.cjs +2 -2
- package/dist/_virtual/index7.js +6 -6
- package/dist/_virtual/index8.cjs +2 -2
- package/dist/_virtual/index8.js +2 -2
- package/dist/_virtual/index9.cjs +2 -10
- package/dist/_virtual/index9.cjs.map +1 -1
- package/dist/_virtual/index9.js +2 -11
- package/dist/_virtual/index9.js.map +1 -1
- package/dist/lib/framework.cjs +8 -4
- package/dist/lib/framework.cjs.map +1 -1
- package/dist/lib/framework.d.ts +7 -2
- package/dist/lib/framework.js +8 -4
- package/dist/lib/framework.js.map +1 -1
- package/dist/lib/starters.cjs +23 -0
- package/dist/lib/starters.cjs.map +1 -0
- package/dist/lib/starters.d.ts +2 -0
- package/dist/lib/starters.js +23 -0
- package/dist/lib/starters.js.map +1 -0
- package/dist/packages/init/_node_modules/globby/index.cjs +1 -1
- package/dist/packages/init/_node_modules/globby/index.js +1 -1
- package/dist/packages/init/package.json.cjs +4 -4
- package/dist/packages/init/package.json.js +4 -4
- package/package.json +4 -4
- package/src/SliceMachineInitProcess.ts +23 -3
- package/src/lib/framework.ts +17 -7
- package/src/lib/starters.ts +30 -0
package/dist/_virtual/index6.js
CHANGED
package/dist/_virtual/index7.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
exports.exports = {};
|
|
4
|
-
var
|
|
4
|
+
var lib = {
|
|
5
5
|
get exports() {
|
|
6
6
|
return exports.exports;
|
|
7
7
|
},
|
|
@@ -9,5 +9,5 @@ var dirGlob = {
|
|
|
9
9
|
exports.exports = v;
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
exports.__module =
|
|
12
|
+
exports.__module = lib;
|
|
13
13
|
//# sourceMappingURL=index7.cjs.map
|
package/dist/_virtual/index7.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var libExports = {};
|
|
2
|
+
var lib = {
|
|
3
3
|
get exports() {
|
|
4
|
-
return
|
|
4
|
+
return libExports;
|
|
5
5
|
},
|
|
6
6
|
set exports(v) {
|
|
7
|
-
|
|
7
|
+
libExports = v;
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
lib as __module,
|
|
12
|
+
libExports as exports
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=index7.js.map
|
package/dist/_virtual/index8.cjs
CHANGED
package/dist/_virtual/index8.js
CHANGED
package/dist/_virtual/index9.cjs
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
get exports() {
|
|
6
|
-
return exports.exports;
|
|
7
|
-
},
|
|
8
|
-
set exports(v) {
|
|
9
|
-
exports.exports = v;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
exports.__module = hostedGitInfo;
|
|
3
|
+
var lib = {};
|
|
4
|
+
exports.__exports = lib;
|
|
13
5
|
//# sourceMappingURL=index9.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index9.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index9.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/_virtual/index9.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
var hostedGitInfo = {
|
|
3
|
-
get exports() {
|
|
4
|
-
return hostedGitInfoExports;
|
|
5
|
-
},
|
|
6
|
-
set exports(v) {
|
|
7
|
-
hostedGitInfoExports = v;
|
|
8
|
-
}
|
|
9
|
-
};
|
|
1
|
+
var lib = {};
|
|
10
2
|
export {
|
|
11
|
-
|
|
12
|
-
hostedGitInfoExports as exports
|
|
3
|
+
lib as __exports
|
|
13
4
|
};
|
|
14
5
|
//# sourceMappingURL=index9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index9.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index9.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/lib/framework.cjs
CHANGED
|
@@ -11,7 +11,8 @@ const DEFAULT_DEV_DEPENDENCIES = {
|
|
|
11
11
|
const FRAMEWORKS = {
|
|
12
12
|
"nuxt-2": {
|
|
13
13
|
name: "Nuxt 2",
|
|
14
|
-
|
|
14
|
+
sliceMachineTelemetryID: "nuxt-2",
|
|
15
|
+
wroomTelemetryID: "nuxt",
|
|
15
16
|
prismicDocumentation: "https://prismic.dev/init/nuxt-2",
|
|
16
17
|
adapterName: "@slicemachine/adapter-nuxt2",
|
|
17
18
|
compatibility: {
|
|
@@ -24,7 +25,8 @@ const FRAMEWORKS = {
|
|
|
24
25
|
},
|
|
25
26
|
"nuxt-3": {
|
|
26
27
|
name: "Nuxt 3",
|
|
27
|
-
|
|
28
|
+
sliceMachineTelemetryID: "nuxt-3",
|
|
29
|
+
wroomTelemetryID: "nuxt",
|
|
28
30
|
prismicDocumentation: "https://prismic.dev/init/nuxt-3",
|
|
29
31
|
adapterName: "@slicemachine/adapter-nuxt",
|
|
30
32
|
compatibility: {
|
|
@@ -37,7 +39,8 @@ const FRAMEWORKS = {
|
|
|
37
39
|
},
|
|
38
40
|
"next-11-13": {
|
|
39
41
|
name: "Next.js 11-13",
|
|
40
|
-
|
|
42
|
+
sliceMachineTelemetryID: "next-11-13",
|
|
43
|
+
wroomTelemetryID: "next",
|
|
41
44
|
prismicDocumentation: "https://prismic.dev/init/next-11-13",
|
|
42
45
|
adapterName: "@slicemachine/adapter-next",
|
|
43
46
|
compatibility: {
|
|
@@ -51,7 +54,8 @@ const FRAMEWORKS = {
|
|
|
51
54
|
};
|
|
52
55
|
const UNIVERSAL = {
|
|
53
56
|
name: "universal (no framework)",
|
|
54
|
-
|
|
57
|
+
sliceMachineTelemetryID: "universal",
|
|
58
|
+
wroomTelemetryID: "other",
|
|
55
59
|
prismicDocumentation: "https://prismic.dev/init/universal",
|
|
56
60
|
adapterName: "@slicemachine/adapter-universal",
|
|
57
61
|
compatibility: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework.cjs","sources":["../../../src/lib/framework.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\
|
|
1
|
+
{"version":3,"file":"framework.cjs","sources":["../../../src/lib/framework.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport semver from \"semver\";\n\nimport { FrameworkWroomTelemetryID } from \"@slicemachine/manager\";\n\nimport { version as pkgVersion } from \"../../package.json\";\n\nexport type Framework = {\n\t/**\n\t * Framework's human readable name.\n\t */\n\tname: string;\n\n\t/**\n\t * Framework 's id sent to Segment from Slice Machine\n\t */\n\tsliceMachineTelemetryID: \"next-11-13\" | \"nuxt-2\" | \"nuxt-3\" | \"universal\";\n\n\t/**\n\t * Framework's id sent to Segment from wroom.\n\t */\n\twroomTelemetryID: FrameworkWroomTelemetryID;\n\n\t/**\n\t * A link to the Prismic documentation for the framework\n\t */\n\tprismicDocumentation: string;\n\n\t/**\n\t * Package name of the adapter responsible for this framework\n\t */\n\tadapterName: string;\n\n\t/**\n\t * A package name/semver range map defining framework compatibility\n\t * requirements.\n\t *\n\t * Project should match all entries to be considered compatible.\n\t */\n\tcompatibility: Record<string, string>;\n\n\t/**\n\t * A package name/semver range map defining development dependencies to be\n\t * installed. Typically Slice Machine and the framework's adapter.\n\t *\n\t * @remarks\n\t * Dependencies required to work with the framework (e.g. `@prismicio/next`\n\t * for Next.js) should not be defined here. Those are to be defined by the\n\t * adapter.\n\t */\n\tdevDependencies: Record<string, string>;\n};\n\nconst isPrerelease =\n\tsemver.prerelease(pkgVersion) !== null && process.env.NODE_ENV !== \"test\";\n\nconst DEFAULT_DEV_DEPENDENCIES: Record<string, string> = {\n\t\"slice-machine-ui\": isPrerelease ? \"alpha\" : \"latest\",\n};\n\n/**\n * Frameworks we support, orders shouldn't matter much but is respected (the\n * higher it is the more priority it has in case multiple matches)\n */\nexport const FRAMEWORKS: Record<string, Framework> = {\n\t\"nuxt-2\": {\n\t\tname: \"Nuxt 2\",\n\t\tsliceMachineTelemetryID: \"nuxt-2\",\n\t\twroomTelemetryID: \"nuxt\",\n\t\tprismicDocumentation: \"https://prismic.dev/init/nuxt-2\",\n\t\tadapterName: \"@slicemachine/adapter-nuxt2\",\n\t\tcompatibility: {\n\t\t\tnuxt: \"^2.0.0\",\n\t\t},\n\t\tdevDependencies: {\n\t\t\t...DEFAULT_DEV_DEPENDENCIES,\n\t\t\t\"@slicemachine/adapter-nuxt2\": isPrerelease ? \"alpha\" : \"latest\",\n\t\t},\n\t},\n\t\"nuxt-3\": {\n\t\tname: \"Nuxt 3\",\n\t\tsliceMachineTelemetryID: \"nuxt-3\",\n\t\twroomTelemetryID: \"nuxt\",\n\t\tprismicDocumentation: \"https://prismic.dev/init/nuxt-3\",\n\t\tadapterName: \"@slicemachine/adapter-nuxt\",\n\t\tcompatibility: {\n\t\t\tnuxt: \"^3.0.0\",\n\t\t},\n\t\tdevDependencies: {\n\t\t\t...DEFAULT_DEV_DEPENDENCIES,\n\t\t\t\"@slicemachine/adapter-nuxt\": isPrerelease ? \"alpha\" : \"latest\",\n\t\t},\n\t},\n\t\"next-11-13\": {\n\t\tname: \"Next.js 11-13\",\n\t\tsliceMachineTelemetryID: \"next-11-13\",\n\t\twroomTelemetryID: \"next\",\n\t\tprismicDocumentation: \"https://prismic.dev/init/next-11-13\",\n\t\tadapterName: \"@slicemachine/adapter-next\",\n\t\tcompatibility: {\n\t\t\tnext: \"^11.0.0 || ^12.0.0 || ^13.0.0\",\n\t\t},\n\t\tdevDependencies: {\n\t\t\t...DEFAULT_DEV_DEPENDENCIES,\n\t\t\t\"@slicemachine/adapter-next\": isPrerelease ? \"alpha\" : \"latest\",\n\t\t},\n\t},\n} as const;\n\n/**\n * Universal package used when framework is not supported.\n */\nexport const UNIVERSAL: Framework = {\n\tname: \"universal (no framework)\",\n\tsliceMachineTelemetryID: \"universal\",\n\twroomTelemetryID: \"other\",\n\tprismicDocumentation: \"https://prismic.dev/init/universal\",\n\tadapterName: \"@slicemachine/adapter-universal\",\n\tcompatibility: {},\n\tdevDependencies: {\n\t\t...DEFAULT_DEV_DEPENDENCIES,\n\t\t\"@slicemachine/adapter-universal\": isPrerelease ? \"alpha\" : \"latest\",\n\t},\n};\n\nexport const detectFramework = async (cwd: string): Promise<Framework> => {\n\tconst path = join(cwd, \"package.json\");\n\n\tlet allDependencies: Record<string, string>;\n\ttry {\n\t\tconst pkg = JSON.parse(await readFile(path, \"utf-8\"));\n\n\t\tallDependencies = {\n\t\t\t...pkg.dependencies,\n\t\t\t...pkg.devDependencies,\n\t\t};\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Failed to read project's \\`package.json\\` at \\`${path}\\``,\n\t\t\t{ cause: error },\n\t\t);\n\t}\n\n\treturn (\n\t\tObject.values(FRAMEWORKS).find((framework) => {\n\t\t\treturn Object.entries(framework.compatibility).every(([pkg, range]) => {\n\t\t\t\tif (pkg in allDependencies) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Determine lowest version possibly in use\n\t\t\t\t\t\tconst minimumVersion = semver.minVersion(allDependencies[pkg]);\n\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\treturn semver.satisfies(minimumVersion!, range);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t// We assume unconventional tags, `latest`, `beta`, `dev` matches the framework\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t});\n\t\t}) || UNIVERSAL\n\t);\n};\n"],"names":["pkgVersion","path","join","readFile"],"mappings":";;;;;;AAsDA,MAAM,eACL,OAAO,WAAWA,gBAAU,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEpE,MAAM,2BAAmD;AAAA,EACxD,oBAAoB,eAAe,UAAU;;AAOvC,MAAM,aAAwC;AAAA,EACpD,UAAU;AAAA,IACT,MAAM;AAAA,IACN,yBAAyB;AAAA,IACzB,kBAAkB;AAAA,IAClB,sBAAsB;AAAA,IACtB,aAAa;AAAA,IACb,eAAe;AAAA,MACd,MAAM;AAAA,IACN;AAAA,IACD,iBAAiB;AAAA,MAChB,GAAG;AAAA,MACH,+BAA+B,eAAe,UAAU;AAAA,IACxD;AAAA,EACD;AAAA,EACD,UAAU;AAAA,IACT,MAAM;AAAA,IACN,yBAAyB;AAAA,IACzB,kBAAkB;AAAA,IAClB,sBAAsB;AAAA,IACtB,aAAa;AAAA,IACb,eAAe;AAAA,MACd,MAAM;AAAA,IACN;AAAA,IACD,iBAAiB;AAAA,MAChB,GAAG;AAAA,MACH,8BAA8B,eAAe,UAAU;AAAA,IACvD;AAAA,EACD;AAAA,EACD,cAAc;AAAA,IACb,MAAM;AAAA,IACN,yBAAyB;AAAA,IACzB,kBAAkB;AAAA,IAClB,sBAAsB;AAAA,IACtB,aAAa;AAAA,IACb,eAAe;AAAA,MACd,MAAM;AAAA,IACN;AAAA,IACD,iBAAiB;AAAA,MAChB,GAAG;AAAA,MACH,8BAA8B,eAAe,UAAU;AAAA,IACvD;AAAA,EACD;;AAMK,MAAM,YAAuB;AAAA,EACnC,MAAM;AAAA,EACN,yBAAyB;AAAA,EACzB,kBAAkB;AAAA,EAClB,sBAAsB;AAAA,EACtB,aAAa;AAAA,EACb,eAAe,CAAE;AAAA,EACjB,iBAAiB;AAAA,IAChB,GAAG;AAAA,IACH,mCAAmC,eAAe,UAAU;AAAA,EAC5D;;AAGW,MAAA,kBAAkB,OAAO,QAAmC;AAClE,QAAAC,SAAOC,KAAAA,KAAK,KAAK,cAAc;AAEjC,MAAA;AACA,MAAA;AACH,UAAM,MAAM,KAAK,MAAM,MAAMC,GAAAA,SAASF,QAAM,OAAO,CAAC;AAElC,sBAAA;AAAA,MACjB,GAAG,IAAI;AAAA,MACP,GAAG,IAAI;AAAA,IAAA;AAAA,WAEA;AACR,UAAM,IAAI,MACT,kDAAkDA,YAClD,EAAE,OAAO,OAAO;AAAA,EAEjB;AAED,SACC,OAAO,OAAO,UAAU,EAAE,KAAK,CAAC,cAAa;AACrC,WAAA,OAAO,QAAQ,UAAU,aAAa,EAAE,MAAM,CAAC,CAAC,KAAK,KAAK,MAAK;AACrE,UAAI,OAAO,iBAAiB;AACvB,YAAA;AAEH,gBAAM,iBAAiB,OAAO,WAAW,gBAAgB,GAAG,CAAC;AAGtD,iBAAA,OAAO,UAAU,gBAAiB,KAAK;AAAA,iBACtC;AAED,iBAAA;AAAA,QACP;AAAA,MACD;AAEM,aAAA;AAAA,IAAA,CACP;AAAA,EACD,CAAA,KAAK;AAER;;;;"}
|
package/dist/lib/framework.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import { FrameworkWroomTelemetryID } from "@slicemachine/manager";
|
|
1
2
|
export type Framework = {
|
|
2
3
|
/**
|
|
3
4
|
* Framework's human readable name.
|
|
4
5
|
*/
|
|
5
6
|
name: string;
|
|
6
7
|
/**
|
|
7
|
-
* Framework's
|
|
8
|
+
* Framework 's id sent to Segment from Slice Machine
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
+
sliceMachineTelemetryID: "next-11-13" | "nuxt-2" | "nuxt-3" | "universal";
|
|
11
|
+
/**
|
|
12
|
+
* Framework's id sent to Segment from wroom.
|
|
13
|
+
*/
|
|
14
|
+
wroomTelemetryID: FrameworkWroomTelemetryID;
|
|
10
15
|
/**
|
|
11
16
|
* A link to the Prismic documentation for the framework
|
|
12
17
|
*/
|
package/dist/lib/framework.js
CHANGED
|
@@ -9,7 +9,8 @@ const DEFAULT_DEV_DEPENDENCIES = {
|
|
|
9
9
|
const FRAMEWORKS = {
|
|
10
10
|
"nuxt-2": {
|
|
11
11
|
name: "Nuxt 2",
|
|
12
|
-
|
|
12
|
+
sliceMachineTelemetryID: "nuxt-2",
|
|
13
|
+
wroomTelemetryID: "nuxt",
|
|
13
14
|
prismicDocumentation: "https://prismic.dev/init/nuxt-2",
|
|
14
15
|
adapterName: "@slicemachine/adapter-nuxt2",
|
|
15
16
|
compatibility: {
|
|
@@ -22,7 +23,8 @@ const FRAMEWORKS = {
|
|
|
22
23
|
},
|
|
23
24
|
"nuxt-3": {
|
|
24
25
|
name: "Nuxt 3",
|
|
25
|
-
|
|
26
|
+
sliceMachineTelemetryID: "nuxt-3",
|
|
27
|
+
wroomTelemetryID: "nuxt",
|
|
26
28
|
prismicDocumentation: "https://prismic.dev/init/nuxt-3",
|
|
27
29
|
adapterName: "@slicemachine/adapter-nuxt",
|
|
28
30
|
compatibility: {
|
|
@@ -35,7 +37,8 @@ const FRAMEWORKS = {
|
|
|
35
37
|
},
|
|
36
38
|
"next-11-13": {
|
|
37
39
|
name: "Next.js 11-13",
|
|
38
|
-
|
|
40
|
+
sliceMachineTelemetryID: "next-11-13",
|
|
41
|
+
wroomTelemetryID: "next",
|
|
39
42
|
prismicDocumentation: "https://prismic.dev/init/next-11-13",
|
|
40
43
|
adapterName: "@slicemachine/adapter-next",
|
|
41
44
|
compatibility: {
|
|
@@ -49,7 +52,8 @@ const FRAMEWORKS = {
|
|
|
49
52
|
};
|
|
50
53
|
const UNIVERSAL = {
|
|
51
54
|
name: "universal (no framework)",
|
|
52
|
-
|
|
55
|
+
sliceMachineTelemetryID: "universal",
|
|
56
|
+
wroomTelemetryID: "other",
|
|
53
57
|
prismicDocumentation: "https://prismic.dev/init/universal",
|
|
54
58
|
adapterName: "@slicemachine/adapter-universal",
|
|
55
59
|
compatibility: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework.js","sources":["../../../src/lib/framework.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\
|
|
1
|
+
{"version":3,"file":"framework.js","sources":["../../../src/lib/framework.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport semver from \"semver\";\n\nimport { FrameworkWroomTelemetryID } from \"@slicemachine/manager\";\n\nimport { version as pkgVersion } from \"../../package.json\";\n\nexport type Framework = {\n\t/**\n\t * Framework's human readable name.\n\t */\n\tname: string;\n\n\t/**\n\t * Framework 's id sent to Segment from Slice Machine\n\t */\n\tsliceMachineTelemetryID: \"next-11-13\" | \"nuxt-2\" | \"nuxt-3\" | \"universal\";\n\n\t/**\n\t * Framework's id sent to Segment from wroom.\n\t */\n\twroomTelemetryID: FrameworkWroomTelemetryID;\n\n\t/**\n\t * A link to the Prismic documentation for the framework\n\t */\n\tprismicDocumentation: string;\n\n\t/**\n\t * Package name of the adapter responsible for this framework\n\t */\n\tadapterName: string;\n\n\t/**\n\t * A package name/semver range map defining framework compatibility\n\t * requirements.\n\t *\n\t * Project should match all entries to be considered compatible.\n\t */\n\tcompatibility: Record<string, string>;\n\n\t/**\n\t * A package name/semver range map defining development dependencies to be\n\t * installed. Typically Slice Machine and the framework's adapter.\n\t *\n\t * @remarks\n\t * Dependencies required to work with the framework (e.g. `@prismicio/next`\n\t * for Next.js) should not be defined here. Those are to be defined by the\n\t * adapter.\n\t */\n\tdevDependencies: Record<string, string>;\n};\n\nconst isPrerelease =\n\tsemver.prerelease(pkgVersion) !== null && process.env.NODE_ENV !== \"test\";\n\nconst DEFAULT_DEV_DEPENDENCIES: Record<string, string> = {\n\t\"slice-machine-ui\": isPrerelease ? \"alpha\" : \"latest\",\n};\n\n/**\n * Frameworks we support, orders shouldn't matter much but is respected (the\n * higher it is the more priority it has in case multiple matches)\n */\nexport const FRAMEWORKS: Record<string, Framework> = {\n\t\"nuxt-2\": {\n\t\tname: \"Nuxt 2\",\n\t\tsliceMachineTelemetryID: \"nuxt-2\",\n\t\twroomTelemetryID: \"nuxt\",\n\t\tprismicDocumentation: \"https://prismic.dev/init/nuxt-2\",\n\t\tadapterName: \"@slicemachine/adapter-nuxt2\",\n\t\tcompatibility: {\n\t\t\tnuxt: \"^2.0.0\",\n\t\t},\n\t\tdevDependencies: {\n\t\t\t...DEFAULT_DEV_DEPENDENCIES,\n\t\t\t\"@slicemachine/adapter-nuxt2\": isPrerelease ? \"alpha\" : \"latest\",\n\t\t},\n\t},\n\t\"nuxt-3\": {\n\t\tname: \"Nuxt 3\",\n\t\tsliceMachineTelemetryID: \"nuxt-3\",\n\t\twroomTelemetryID: \"nuxt\",\n\t\tprismicDocumentation: \"https://prismic.dev/init/nuxt-3\",\n\t\tadapterName: \"@slicemachine/adapter-nuxt\",\n\t\tcompatibility: {\n\t\t\tnuxt: \"^3.0.0\",\n\t\t},\n\t\tdevDependencies: {\n\t\t\t...DEFAULT_DEV_DEPENDENCIES,\n\t\t\t\"@slicemachine/adapter-nuxt\": isPrerelease ? \"alpha\" : \"latest\",\n\t\t},\n\t},\n\t\"next-11-13\": {\n\t\tname: \"Next.js 11-13\",\n\t\tsliceMachineTelemetryID: \"next-11-13\",\n\t\twroomTelemetryID: \"next\",\n\t\tprismicDocumentation: \"https://prismic.dev/init/next-11-13\",\n\t\tadapterName: \"@slicemachine/adapter-next\",\n\t\tcompatibility: {\n\t\t\tnext: \"^11.0.0 || ^12.0.0 || ^13.0.0\",\n\t\t},\n\t\tdevDependencies: {\n\t\t\t...DEFAULT_DEV_DEPENDENCIES,\n\t\t\t\"@slicemachine/adapter-next\": isPrerelease ? \"alpha\" : \"latest\",\n\t\t},\n\t},\n} as const;\n\n/**\n * Universal package used when framework is not supported.\n */\nexport const UNIVERSAL: Framework = {\n\tname: \"universal (no framework)\",\n\tsliceMachineTelemetryID: \"universal\",\n\twroomTelemetryID: \"other\",\n\tprismicDocumentation: \"https://prismic.dev/init/universal\",\n\tadapterName: \"@slicemachine/adapter-universal\",\n\tcompatibility: {},\n\tdevDependencies: {\n\t\t...DEFAULT_DEV_DEPENDENCIES,\n\t\t\"@slicemachine/adapter-universal\": isPrerelease ? \"alpha\" : \"latest\",\n\t},\n};\n\nexport const detectFramework = async (cwd: string): Promise<Framework> => {\n\tconst path = join(cwd, \"package.json\");\n\n\tlet allDependencies: Record<string, string>;\n\ttry {\n\t\tconst pkg = JSON.parse(await readFile(path, \"utf-8\"));\n\n\t\tallDependencies = {\n\t\t\t...pkg.dependencies,\n\t\t\t...pkg.devDependencies,\n\t\t};\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Failed to read project's \\`package.json\\` at \\`${path}\\``,\n\t\t\t{ cause: error },\n\t\t);\n\t}\n\n\treturn (\n\t\tObject.values(FRAMEWORKS).find((framework) => {\n\t\t\treturn Object.entries(framework.compatibility).every(([pkg, range]) => {\n\t\t\t\tif (pkg in allDependencies) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Determine lowest version possibly in use\n\t\t\t\t\t\tconst minimumVersion = semver.minVersion(allDependencies[pkg]);\n\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\treturn semver.satisfies(minimumVersion!, range);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t// We assume unconventional tags, `latest`, `beta`, `dev` matches the framework\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t});\n\t\t}) || UNIVERSAL\n\t);\n};\n"],"names":["pkgVersion"],"mappings":";;;;AAsDA,MAAM,eACL,OAAO,WAAWA,OAAU,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEpE,MAAM,2BAAmD;AAAA,EACxD,oBAAoB,eAAe,UAAU;;AAOvC,MAAM,aAAwC;AAAA,EACpD,UAAU;AAAA,IACT,MAAM;AAAA,IACN,yBAAyB;AAAA,IACzB,kBAAkB;AAAA,IAClB,sBAAsB;AAAA,IACtB,aAAa;AAAA,IACb,eAAe;AAAA,MACd,MAAM;AAAA,IACN;AAAA,IACD,iBAAiB;AAAA,MAChB,GAAG;AAAA,MACH,+BAA+B,eAAe,UAAU;AAAA,IACxD;AAAA,EACD;AAAA,EACD,UAAU;AAAA,IACT,MAAM;AAAA,IACN,yBAAyB;AAAA,IACzB,kBAAkB;AAAA,IAClB,sBAAsB;AAAA,IACtB,aAAa;AAAA,IACb,eAAe;AAAA,MACd,MAAM;AAAA,IACN;AAAA,IACD,iBAAiB;AAAA,MAChB,GAAG;AAAA,MACH,8BAA8B,eAAe,UAAU;AAAA,IACvD;AAAA,EACD;AAAA,EACD,cAAc;AAAA,IACb,MAAM;AAAA,IACN,yBAAyB;AAAA,IACzB,kBAAkB;AAAA,IAClB,sBAAsB;AAAA,IACtB,aAAa;AAAA,IACb,eAAe;AAAA,MACd,MAAM;AAAA,IACN;AAAA,IACD,iBAAiB;AAAA,MAChB,GAAG;AAAA,MACH,8BAA8B,eAAe,UAAU;AAAA,IACvD;AAAA,EACD;;AAMK,MAAM,YAAuB;AAAA,EACnC,MAAM;AAAA,EACN,yBAAyB;AAAA,EACzB,kBAAkB;AAAA,EAClB,sBAAsB;AAAA,EACtB,aAAa;AAAA,EACb,eAAe,CAAE;AAAA,EACjB,iBAAiB;AAAA,IAChB,GAAG;AAAA,IACH,mCAAmC,eAAe,UAAU;AAAA,EAC5D;;AAGW,MAAA,kBAAkB,OAAO,QAAmC;AAClE,QAAA,OAAO,KAAK,KAAK,cAAc;AAEjC,MAAA;AACA,MAAA;AACH,UAAM,MAAM,KAAK,MAAM,MAAM,SAAS,MAAM,OAAO,CAAC;AAElC,sBAAA;AAAA,MACjB,GAAG,IAAI;AAAA,MACP,GAAG,IAAI;AAAA,IAAA;AAAA,WAEA;AACR,UAAM,IAAI,MACT,kDAAkD,UAClD,EAAE,OAAO,OAAO;AAAA,EAEjB;AAED,SACC,OAAO,OAAO,UAAU,EAAE,KAAK,CAAC,cAAa;AACrC,WAAA,OAAO,QAAQ,UAAU,aAAa,EAAE,MAAM,CAAC,CAAC,KAAK,KAAK,MAAK;AACrE,UAAI,OAAO,iBAAiB;AACvB,YAAA;AAEH,gBAAM,iBAAiB,OAAO,WAAW,gBAAgB,GAAG,CAAC;AAGtD,iBAAA,OAAO,UAAU,gBAAiB,KAAK;AAAA,iBACtC;AAED,iBAAA;AAAA,QACP;AAAA,MACD;AAEM,aAAA;AAAA,IAAA,CACP;AAAA,EACD,CAAA,KAAK;AAER;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fs = require("node:fs/promises");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
const STARTERS_REPOSITORY_NAME_TO_ID = {
|
|
6
|
+
"nextjs-starter-prismic-multi-page": "next_multi_page",
|
|
7
|
+
"nextjs-starter-prismic-blog": "next_blog",
|
|
8
|
+
"nextjs-starter-prismic-multi-language": "next_multi_lang",
|
|
9
|
+
"nuxt-starter-prismic-multi-page": "nuxt_multi_page",
|
|
10
|
+
"nuxt-starter-prismic-blog": "nuxt_blog",
|
|
11
|
+
"nuxt-starter-prismic-multi-language": "nuxt_multi_lang"
|
|
12
|
+
};
|
|
13
|
+
const detectStarterId = async (cwd) => {
|
|
14
|
+
const path$1 = path.join(cwd, "package.json");
|
|
15
|
+
try {
|
|
16
|
+
const pkg = JSON.parse(await fs.readFile(path$1, "utf-8"));
|
|
17
|
+
return STARTERS_REPOSITORY_NAME_TO_ID[pkg.name];
|
|
18
|
+
} catch (error) {
|
|
19
|
+
throw new Error(`Failed to read project's \`package.json\` at \`${path$1}\``, { cause: error });
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.detectStarterId = detectStarterId;
|
|
23
|
+
//# sourceMappingURL=starters.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"starters.cjs","sources":["../../../src/lib/starters.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport { StarterID } from \"@slicemachine/manager\";\n\nconst STARTERS_REPOSITORY_NAME_TO_ID: Record<string, StarterID> = {\n\t\"nextjs-starter-prismic-multi-page\": \"next_multi_page\",\n\t\"nextjs-starter-prismic-blog\": \"next_blog\",\n\t\"nextjs-starter-prismic-multi-language\": \"next_multi_lang\",\n\t\"nuxt-starter-prismic-multi-page\": \"nuxt_multi_page\",\n\t\"nuxt-starter-prismic-blog\": \"nuxt_blog\",\n\t\"nuxt-starter-prismic-multi-language\": \"nuxt_multi_lang\",\n};\n\nexport const detectStarterId = async (\n\tcwd: string,\n): Promise<StarterID | undefined> => {\n\tconst path = join(cwd, \"package.json\");\n\n\ttry {\n\t\tconst pkg = JSON.parse(await readFile(path, \"utf-8\"));\n\n\t\treturn STARTERS_REPOSITORY_NAME_TO_ID[pkg.name];\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Failed to read project's \\`package.json\\` at \\`${path}\\``,\n\t\t\t{ cause: error },\n\t\t);\n\t}\n};\n"],"names":["path","join","readFile"],"mappings":";;;;AAKA,MAAM,iCAA4D;AAAA,EACjE,qCAAqC;AAAA,EACrC,+BAA+B;AAAA,EAC/B,yCAAyC;AAAA,EACzC,mCAAmC;AAAA,EACnC,6BAA6B;AAAA,EAC7B,uCAAuC;;AAG3B,MAAA,kBAAkB,OAC9B,QACmC;AAC7B,QAAAA,SAAOC,KAAAA,KAAK,KAAK,cAAc;AAEjC,MAAA;AACH,UAAM,MAAM,KAAK,MAAM,MAAMC,GAAAA,SAASF,QAAM,OAAO,CAAC;AAE7C,WAAA,+BAA+B,IAAI,IAAI;AAAA,WACtC;AACR,UAAM,IAAI,MACT,kDAAkDA,YAClD,EAAE,OAAO,OAAO;AAAA,EAEjB;AACF;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
const STARTERS_REPOSITORY_NAME_TO_ID = {
|
|
4
|
+
"nextjs-starter-prismic-multi-page": "next_multi_page",
|
|
5
|
+
"nextjs-starter-prismic-blog": "next_blog",
|
|
6
|
+
"nextjs-starter-prismic-multi-language": "next_multi_lang",
|
|
7
|
+
"nuxt-starter-prismic-multi-page": "nuxt_multi_page",
|
|
8
|
+
"nuxt-starter-prismic-blog": "nuxt_blog",
|
|
9
|
+
"nuxt-starter-prismic-multi-language": "nuxt_multi_lang"
|
|
10
|
+
};
|
|
11
|
+
const detectStarterId = async (cwd) => {
|
|
12
|
+
const path = join(cwd, "package.json");
|
|
13
|
+
try {
|
|
14
|
+
const pkg = JSON.parse(await readFile(path, "utf-8"));
|
|
15
|
+
return STARTERS_REPOSITORY_NAME_TO_ID[pkg.name];
|
|
16
|
+
} catch (error) {
|
|
17
|
+
throw new Error(`Failed to read project's \`package.json\` at \`${path}\``, { cause: error });
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
detectStarterId
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=starters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"starters.js","sources":["../../../src/lib/starters.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport { StarterID } from \"@slicemachine/manager\";\n\nconst STARTERS_REPOSITORY_NAME_TO_ID: Record<string, StarterID> = {\n\t\"nextjs-starter-prismic-multi-page\": \"next_multi_page\",\n\t\"nextjs-starter-prismic-blog\": \"next_blog\",\n\t\"nextjs-starter-prismic-multi-language\": \"next_multi_lang\",\n\t\"nuxt-starter-prismic-multi-page\": \"nuxt_multi_page\",\n\t\"nuxt-starter-prismic-blog\": \"nuxt_blog\",\n\t\"nuxt-starter-prismic-multi-language\": \"nuxt_multi_lang\",\n};\n\nexport const detectStarterId = async (\n\tcwd: string,\n): Promise<StarterID | undefined> => {\n\tconst path = join(cwd, \"package.json\");\n\n\ttry {\n\t\tconst pkg = JSON.parse(await readFile(path, \"utf-8\"));\n\n\t\treturn STARTERS_REPOSITORY_NAME_TO_ID[pkg.name];\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Failed to read project's \\`package.json\\` at \\`${path}\\``,\n\t\t\t{ cause: error },\n\t\t);\n\t}\n};\n"],"names":[],"mappings":";;AAKA,MAAM,iCAA4D;AAAA,EACjE,qCAAqC;AAAA,EACrC,+BAA+B;AAAA,EAC/B,yCAAyC;AAAA,EACzC,mCAAmC;AAAA,EACnC,6BAA6B;AAAA,EAC7B,uCAAuC;;AAG3B,MAAA,kBAAkB,OAC9B,QACmC;AAC7B,QAAA,OAAO,KAAK,KAAK,cAAc;AAEjC,MAAA;AACH,UAAM,MAAM,KAAK,MAAM,MAAM,SAAS,MAAM,OAAO,CAAC;AAE7C,WAAA,+BAA+B,IAAI,IAAI;AAAA,WACtC;AACR,UAAM,IAAI,MACT,kDAAkD,UAClD,EAAE,OAAO,OAAO;AAAA,EAEjB;AACF;"}
|
|
@@ -7,7 +7,7 @@ const index = require('./../../../../_node_modules/fast-glob/out/index.cjs');
|
|
|
7
7
|
require('./../../../../_node_modules/dir-glob/index.cjs');
|
|
8
8
|
const ignore = require("./ignore.cjs");
|
|
9
9
|
const utilities = require("./utilities.cjs");
|
|
10
|
-
const index$1 = require("../../../../_virtual/
|
|
10
|
+
const index$1 = require("../../../../_virtual/index3.cjs");
|
|
11
11
|
const assertPatternsInput = (patterns) => {
|
|
12
12
|
if (patterns.some((pattern) => typeof pattern !== "string")) {
|
|
13
13
|
throw new TypeError("Patterns must be a string or an array of strings");
|
|
@@ -5,7 +5,7 @@ import out from './../../../../_node_modules/fast-glob/out/index.js';
|
|
|
5
5
|
import './../../../../_node_modules/dir-glob/index.js';
|
|
6
6
|
import { isIgnoredByIgnoreFiles, GITIGNORE_FILES_PATTERN } from "./ignore.js";
|
|
7
7
|
import { toPath, isNegativePattern } from "./utilities.js";
|
|
8
|
-
import { exports as dirGlobExports } from "../../../../_virtual/
|
|
8
|
+
import { exports as dirGlobExports } from "../../../../_virtual/index3.js";
|
|
9
9
|
const assertPatternsInput = (patterns) => {
|
|
10
10
|
if (patterns.some((pattern) => typeof pattern !== "string")) {
|
|
11
11
|
throw new TypeError("Patterns must be a string or an array of strings");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const name = "@slicemachine/init";
|
|
4
|
-
const version = "2.1.0";
|
|
4
|
+
const version = "2.1.1-dev-hotfixes.0";
|
|
5
5
|
const description = "Init Prismic Slice Machine in your project";
|
|
6
6
|
const keywords = [
|
|
7
7
|
"typescript",
|
|
@@ -54,7 +54,7 @@ const scripts = {
|
|
|
54
54
|
const dependencies = {
|
|
55
55
|
"@antfu/ni": "^0.20.0",
|
|
56
56
|
"@lihbr/listr-update-renderer": "^0.5.3",
|
|
57
|
-
"@slicemachine/manager": "0.3.0",
|
|
57
|
+
"@slicemachine/manager": "0.3.1-dev-hotfixes.0",
|
|
58
58
|
chalk: "^4.1.2",
|
|
59
59
|
globby: "^13.1.3",
|
|
60
60
|
listr: "^0.14.3",
|
|
@@ -66,7 +66,7 @@ const dependencies = {
|
|
|
66
66
|
};
|
|
67
67
|
const devDependencies = {
|
|
68
68
|
"@size-limit/preset-small-lib": "^8.2.4",
|
|
69
|
-
"@slicemachine/plugin-kit": "0.3.0",
|
|
69
|
+
"@slicemachine/plugin-kit": "0.3.1-dev-hotfixes.0",
|
|
70
70
|
"@types/listr": "^0.14.4",
|
|
71
71
|
"@types/prompts": "^2.4.3",
|
|
72
72
|
"@types/semver": "^7.3.13",
|
|
@@ -92,7 +92,7 @@ const devDependencies = {
|
|
|
92
92
|
"vite-plugin-sdk": "^0.1.1",
|
|
93
93
|
vitest: "^0.27.3"
|
|
94
94
|
};
|
|
95
|
-
const gitHead = "
|
|
95
|
+
const gitHead = "6848f985678827765b6d7e0eca2d844b887376ee";
|
|
96
96
|
const pkg = {
|
|
97
97
|
name,
|
|
98
98
|
version,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const name = "@slicemachine/init";
|
|
2
|
-
const version = "2.1.0";
|
|
2
|
+
const version = "2.1.1-dev-hotfixes.0";
|
|
3
3
|
const description = "Init Prismic Slice Machine in your project";
|
|
4
4
|
const keywords = [
|
|
5
5
|
"typescript",
|
|
@@ -52,7 +52,7 @@ const scripts = {
|
|
|
52
52
|
const dependencies = {
|
|
53
53
|
"@antfu/ni": "^0.20.0",
|
|
54
54
|
"@lihbr/listr-update-renderer": "^0.5.3",
|
|
55
|
-
"@slicemachine/manager": "0.3.0",
|
|
55
|
+
"@slicemachine/manager": "0.3.1-dev-hotfixes.0",
|
|
56
56
|
chalk: "^4.1.2",
|
|
57
57
|
globby: "^13.1.3",
|
|
58
58
|
listr: "^0.14.3",
|
|
@@ -64,7 +64,7 @@ const dependencies = {
|
|
|
64
64
|
};
|
|
65
65
|
const devDependencies = {
|
|
66
66
|
"@size-limit/preset-small-lib": "^8.2.4",
|
|
67
|
-
"@slicemachine/plugin-kit": "0.3.0",
|
|
67
|
+
"@slicemachine/plugin-kit": "0.3.1-dev-hotfixes.0",
|
|
68
68
|
"@types/listr": "^0.14.4",
|
|
69
69
|
"@types/prompts": "^2.4.3",
|
|
70
70
|
"@types/semver": "^7.3.13",
|
|
@@ -90,7 +90,7 @@ const devDependencies = {
|
|
|
90
90
|
"vite-plugin-sdk": "^0.1.1",
|
|
91
91
|
vitest: "^0.27.3"
|
|
92
92
|
};
|
|
93
|
-
const gitHead = "
|
|
93
|
+
const gitHead = "6848f985678827765b6d7e0eca2d844b887376ee";
|
|
94
94
|
const pkg = {
|
|
95
95
|
name,
|
|
96
96
|
version,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slicemachine/init",
|
|
3
|
-
"version": "2.1.0",
|
|
3
|
+
"version": "2.1.1-dev-hotfixes.0",
|
|
4
4
|
"description": "Init Prismic Slice Machine in your project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@antfu/ni": "^0.20.0",
|
|
55
55
|
"@lihbr/listr-update-renderer": "^0.5.3",
|
|
56
|
-
"@slicemachine/manager": "0.3.0",
|
|
56
|
+
"@slicemachine/manager": "0.3.1-dev-hotfixes.0",
|
|
57
57
|
"chalk": "^4.1.2",
|
|
58
58
|
"globby": "^13.1.3",
|
|
59
59
|
"listr": "^0.14.3",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@size-limit/preset-small-lib": "^8.2.4",
|
|
68
|
-
"@slicemachine/plugin-kit": "0.3.0",
|
|
68
|
+
"@slicemachine/plugin-kit": "0.3.1-dev-hotfixes.0",
|
|
69
69
|
"@types/listr": "^0.14.4",
|
|
70
70
|
"@types/prompts": "^2.4.3",
|
|
71
71
|
"@types/semver": "^7.3.13",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"vite-plugin-sdk": "^0.1.1",
|
|
92
92
|
"vitest": "^0.27.3"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "6848f985678827765b6d7e0eca2d844b887376ee"
|
|
95
95
|
}
|
|
@@ -13,10 +13,12 @@ import {
|
|
|
13
13
|
PrismicRepository,
|
|
14
14
|
SliceMachineManager,
|
|
15
15
|
PackageManager,
|
|
16
|
+
StarterID,
|
|
16
17
|
} from "@slicemachine/manager";
|
|
17
18
|
|
|
18
19
|
import pkg from "../package.json";
|
|
19
20
|
import { detectFramework, Framework } from "./lib/framework";
|
|
21
|
+
import { detectStarterId } from "./lib/starters";
|
|
20
22
|
import { getRunScriptCommand } from "./lib/getRunScriptCommand";
|
|
21
23
|
import { getExecuteCommand } from "./lib/getExecuteCommand";
|
|
22
24
|
import {
|
|
@@ -66,6 +68,7 @@ type SliceMachineInitProcessContext = {
|
|
|
66
68
|
projectInitialization?: {
|
|
67
69
|
patchedScript?: boolean;
|
|
68
70
|
};
|
|
71
|
+
starterID?: StarterID;
|
|
69
72
|
};
|
|
70
73
|
|
|
71
74
|
export class SliceMachineInitProcess {
|
|
@@ -149,7 +152,7 @@ export class SliceMachineInitProcess {
|
|
|
149
152
|
|
|
150
153
|
await this.manager.telemetry.track({
|
|
151
154
|
event: "command:init:end",
|
|
152
|
-
framework: this.context.framework.
|
|
155
|
+
framework: this.context.framework.sliceMachineTelemetryID,
|
|
153
156
|
repository: this.context.repository.domain,
|
|
154
157
|
success: true,
|
|
155
158
|
});
|
|
@@ -220,7 +223,7 @@ export class SliceMachineInitProcess {
|
|
|
220
223
|
|
|
221
224
|
return this.manager.telemetry.track({
|
|
222
225
|
event: "command:init:end",
|
|
223
|
-
framework: this.context.framework?.
|
|
226
|
+
framework: this.context.framework?.sliceMachineTelemetryID ?? "unknown",
|
|
224
227
|
repository: this.context.repository?.domain,
|
|
225
228
|
success: false,
|
|
226
229
|
error: safeError,
|
|
@@ -268,6 +271,22 @@ export class SliceMachineInitProcess {
|
|
|
268
271
|
)}`;
|
|
269
272
|
},
|
|
270
273
|
},
|
|
274
|
+
{
|
|
275
|
+
title: "Detecting starter...",
|
|
276
|
+
task: async (_, task) => {
|
|
277
|
+
this.context.starterID = await detectStarterId(
|
|
278
|
+
this.manager.cwd,
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
if (this.context.starterID) {
|
|
282
|
+
task.title = `Detected starter ${chalk.cyan(
|
|
283
|
+
this.context.starterID,
|
|
284
|
+
)}`;
|
|
285
|
+
} else {
|
|
286
|
+
task.title = "No starter detected";
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
},
|
|
271
290
|
]),
|
|
272
291
|
},
|
|
273
292
|
]);
|
|
@@ -683,7 +702,8 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""),
|
|
|
683
702
|
|
|
684
703
|
await this.manager.prismicRepository.create({
|
|
685
704
|
domain: this.context.repository.domain,
|
|
686
|
-
framework: this.context.framework.
|
|
705
|
+
framework: this.context.framework.wroomTelemetryID,
|
|
706
|
+
starterID: this.context.starterID,
|
|
687
707
|
});
|
|
688
708
|
|
|
689
709
|
this.context.repository.exists = true;
|
package/src/lib/framework.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
|
|
4
3
|
import semver from "semver";
|
|
5
4
|
|
|
5
|
+
import { FrameworkWroomTelemetryID } from "@slicemachine/manager";
|
|
6
|
+
|
|
6
7
|
import { version as pkgVersion } from "../../package.json";
|
|
7
8
|
|
|
8
9
|
export type Framework = {
|
|
@@ -12,9 +13,14 @@ export type Framework = {
|
|
|
12
13
|
name: string;
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
|
-
* Framework's
|
|
16
|
+
* Framework 's id sent to Segment from Slice Machine
|
|
17
|
+
*/
|
|
18
|
+
sliceMachineTelemetryID: "next-11-13" | "nuxt-2" | "nuxt-3" | "universal";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Framework's id sent to Segment from wroom.
|
|
16
22
|
*/
|
|
17
|
-
|
|
23
|
+
wroomTelemetryID: FrameworkWroomTelemetryID;
|
|
18
24
|
|
|
19
25
|
/**
|
|
20
26
|
* A link to the Prismic documentation for the framework
|
|
@@ -60,7 +66,8 @@ const DEFAULT_DEV_DEPENDENCIES: Record<string, string> = {
|
|
|
60
66
|
export const FRAMEWORKS: Record<string, Framework> = {
|
|
61
67
|
"nuxt-2": {
|
|
62
68
|
name: "Nuxt 2",
|
|
63
|
-
|
|
69
|
+
sliceMachineTelemetryID: "nuxt-2",
|
|
70
|
+
wroomTelemetryID: "nuxt",
|
|
64
71
|
prismicDocumentation: "https://prismic.dev/init/nuxt-2",
|
|
65
72
|
adapterName: "@slicemachine/adapter-nuxt2",
|
|
66
73
|
compatibility: {
|
|
@@ -73,7 +80,8 @@ export const FRAMEWORKS: Record<string, Framework> = {
|
|
|
73
80
|
},
|
|
74
81
|
"nuxt-3": {
|
|
75
82
|
name: "Nuxt 3",
|
|
76
|
-
|
|
83
|
+
sliceMachineTelemetryID: "nuxt-3",
|
|
84
|
+
wroomTelemetryID: "nuxt",
|
|
77
85
|
prismicDocumentation: "https://prismic.dev/init/nuxt-3",
|
|
78
86
|
adapterName: "@slicemachine/adapter-nuxt",
|
|
79
87
|
compatibility: {
|
|
@@ -86,7 +94,8 @@ export const FRAMEWORKS: Record<string, Framework> = {
|
|
|
86
94
|
},
|
|
87
95
|
"next-11-13": {
|
|
88
96
|
name: "Next.js 11-13",
|
|
89
|
-
|
|
97
|
+
sliceMachineTelemetryID: "next-11-13",
|
|
98
|
+
wroomTelemetryID: "next",
|
|
90
99
|
prismicDocumentation: "https://prismic.dev/init/next-11-13",
|
|
91
100
|
adapterName: "@slicemachine/adapter-next",
|
|
92
101
|
compatibility: {
|
|
@@ -104,7 +113,8 @@ export const FRAMEWORKS: Record<string, Framework> = {
|
|
|
104
113
|
*/
|
|
105
114
|
export const UNIVERSAL: Framework = {
|
|
106
115
|
name: "universal (no framework)",
|
|
107
|
-
|
|
116
|
+
sliceMachineTelemetryID: "universal",
|
|
117
|
+
wroomTelemetryID: "other",
|
|
108
118
|
prismicDocumentation: "https://prismic.dev/init/universal",
|
|
109
119
|
adapterName: "@slicemachine/adapter-universal",
|
|
110
120
|
compatibility: {},
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
import { StarterID } from "@slicemachine/manager";
|
|
5
|
+
|
|
6
|
+
const STARTERS_REPOSITORY_NAME_TO_ID: Record<string, StarterID> = {
|
|
7
|
+
"nextjs-starter-prismic-multi-page": "next_multi_page",
|
|
8
|
+
"nextjs-starter-prismic-blog": "next_blog",
|
|
9
|
+
"nextjs-starter-prismic-multi-language": "next_multi_lang",
|
|
10
|
+
"nuxt-starter-prismic-multi-page": "nuxt_multi_page",
|
|
11
|
+
"nuxt-starter-prismic-blog": "nuxt_blog",
|
|
12
|
+
"nuxt-starter-prismic-multi-language": "nuxt_multi_lang",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const detectStarterId = async (
|
|
16
|
+
cwd: string,
|
|
17
|
+
): Promise<StarterID | undefined> => {
|
|
18
|
+
const path = join(cwd, "package.json");
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
const pkg = JSON.parse(await readFile(path, "utf-8"));
|
|
22
|
+
|
|
23
|
+
return STARTERS_REPOSITORY_NAME_TO_ID[pkg.name];
|
|
24
|
+
} catch (error) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
`Failed to read project's \`package.json\` at \`${path}\``,
|
|
27
|
+
{ cause: error },
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
};
|