@cedarjs/cli 6.0.0-canary.2929 → 6.0.0-canary.2930
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/commands/generate/package/filesTask.js +12 -0
- package/dist/commands/generate/package/packageHandler.js +7 -2
- package/dist/commands/generate/package/templates/test.ts.template +2 -2
- package/dist/commands/generate/package/templates/vitest.config.ts.template +9 -0
- package/dist/commands/test/testHandlerEsm.js +1 -1
- package/package.json +13 -13
|
@@ -8,6 +8,7 @@ const files = async ({
|
|
|
8
8
|
fileName,
|
|
9
9
|
typescript,
|
|
10
10
|
tests: generateTests = true,
|
|
11
|
+
esm = false,
|
|
11
12
|
...rest
|
|
12
13
|
}) => {
|
|
13
14
|
const extension = typescript ? ".ts" : ".js";
|
|
@@ -58,6 +59,17 @@ const files = async ({
|
|
|
58
59
|
outputPath: path.join(folderName, "src", `${fileName}.test${extension}`)
|
|
59
60
|
});
|
|
60
61
|
outputFiles.push(testFile);
|
|
62
|
+
if (esm) {
|
|
63
|
+
const vitestConfigFile = await templateForFile({
|
|
64
|
+
name,
|
|
65
|
+
side: "packages",
|
|
66
|
+
generator: "package",
|
|
67
|
+
templatePath: "vitest.config.ts.template",
|
|
68
|
+
templateVars: { folderName, ...rest },
|
|
69
|
+
outputPath: path.join(folderName, `vitest.config${extension}`)
|
|
70
|
+
});
|
|
71
|
+
outputFiles.push(vitestConfigFile);
|
|
72
|
+
}
|
|
61
73
|
}
|
|
62
74
|
return outputFiles.reduce(async (accP, [outputPath, content]) => {
|
|
63
75
|
const acc = await accP;
|
|
@@ -11,7 +11,7 @@ import { workspacePackageSpecifier } from "@cedarjs/cli-helpers/packageManager";
|
|
|
11
11
|
import { runScript, runBinSync } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
12
12
|
import { installPackages } from "@cedarjs/cli-helpers/packageManager/packages";
|
|
13
13
|
import { addWorkspaceDir } from "@cedarjs/cli-helpers/packageManager/workspaces";
|
|
14
|
-
import { getConfig } from "@cedarjs/project-config";
|
|
14
|
+
import { getConfig, projectIsEsm } from "@cedarjs/project-config";
|
|
15
15
|
import { getPackageManager } from "@cedarjs/project-config/packageManager";
|
|
16
16
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
17
17
|
import { getPaths, writeFilesTask } from "../../../lib/index.js";
|
|
@@ -340,7 +340,12 @@ const handler = async ({
|
|
|
340
340
|
{
|
|
341
341
|
title: "Generating package files...",
|
|
342
342
|
task: async (ctx) => {
|
|
343
|
-
packageFiles = await files({
|
|
343
|
+
packageFiles = await files({
|
|
344
|
+
...ctx.nameVariants,
|
|
345
|
+
// Only Vitest projects get a config generated for them
|
|
346
|
+
esm: projectIsEsm(),
|
|
347
|
+
...rest
|
|
348
|
+
});
|
|
344
349
|
return writeFilesTask(packageFiles, { overwriteExisting: force });
|
|
345
350
|
}
|
|
346
351
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ${camelName} } from './index.js'
|
|
2
2
|
|
|
3
3
|
describe('${camelName}', () => {
|
|
4
|
-
it('should not throw any errors',
|
|
5
|
-
expect(${camelName}()).not.toThrow()
|
|
4
|
+
it('should not throw any errors', () => {
|
|
5
|
+
expect(() => ${camelName}()).not.toThrow()
|
|
6
6
|
})
|
|
7
7
|
})
|
|
@@ -59,10 +59,10 @@ const handler = async ({
|
|
|
59
59
|
vitestArgs.push("--run");
|
|
60
60
|
}
|
|
61
61
|
if (!others["config"]) {
|
|
62
|
+
sides.forEach((side) => vitestArgs.push("--project", side));
|
|
62
63
|
if (!sides.length) {
|
|
63
64
|
project.workspaces().forEach((side) => sides.push(side));
|
|
64
65
|
}
|
|
65
|
-
sides.forEach((side) => vitestArgs.push("--project", side));
|
|
66
66
|
}
|
|
67
67
|
try {
|
|
68
68
|
const cacheDirDb = `file:${ensurePosixPath(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "6.0.0-canary.
|
|
3
|
+
"version": "6.0.0-canary.2930",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"@babel/preset-typescript": "7.29.7",
|
|
37
37
|
"@babel/traverse": "7.29.7",
|
|
38
38
|
"@babel/types": "7.29.7",
|
|
39
|
-
"@cedarjs/api-server": "6.0.0-canary.
|
|
40
|
-
"@cedarjs/babel-config": "6.0.0-canary.
|
|
41
|
-
"@cedarjs/cli-helpers": "6.0.0-canary.
|
|
42
|
-
"@cedarjs/internal": "6.0.0-canary.
|
|
43
|
-
"@cedarjs/prerender": "6.0.0-canary.
|
|
44
|
-
"@cedarjs/project-config": "6.0.0-canary.
|
|
45
|
-
"@cedarjs/structure": "6.0.0-canary.
|
|
46
|
-
"@cedarjs/telemetry": "6.0.0-canary.
|
|
47
|
-
"@cedarjs/utils": "6.0.0-canary.
|
|
48
|
-
"@cedarjs/vite": "6.0.0-canary.
|
|
49
|
-
"@cedarjs/web-server": "6.0.0-canary.
|
|
39
|
+
"@cedarjs/api-server": "6.0.0-canary.2930",
|
|
40
|
+
"@cedarjs/babel-config": "6.0.0-canary.2930",
|
|
41
|
+
"@cedarjs/cli-helpers": "6.0.0-canary.2930",
|
|
42
|
+
"@cedarjs/internal": "6.0.0-canary.2930",
|
|
43
|
+
"@cedarjs/prerender": "6.0.0-canary.2930",
|
|
44
|
+
"@cedarjs/project-config": "6.0.0-canary.2930",
|
|
45
|
+
"@cedarjs/structure": "6.0.0-canary.2930",
|
|
46
|
+
"@cedarjs/telemetry": "6.0.0-canary.2930",
|
|
47
|
+
"@cedarjs/utils": "6.0.0-canary.2930",
|
|
48
|
+
"@cedarjs/vite": "6.0.0-canary.2930",
|
|
49
|
+
"@cedarjs/web-server": "6.0.0-canary.2930",
|
|
50
50
|
"@listr2/prompt-adapter-enquirer": "4.3.0",
|
|
51
51
|
"@opentelemetry/api": "1.9.1",
|
|
52
52
|
"@opentelemetry/core": "1.30.1",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"yargs": "17.7.3"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@cedarjs/framework-tools": "6.0.0-canary.
|
|
97
|
+
"@cedarjs/framework-tools": "6.0.0-canary.2930",
|
|
98
98
|
"@prisma/dmmf": "7.8.0",
|
|
99
99
|
"@types/archiver": "^7.0.0",
|
|
100
100
|
"memfs": "4.68.1",
|