@o3co/create-auth-provider 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -1
- package/templates/standalone/Dockerfile +16 -3
- package/templates/standalone/README.md +49 -0
- package/templates/standalone/config/application.conf +175 -3
- package/templates/standalone/config/clients.yaml.example +17 -1
- package/templates/standalone/docker-compose.test.yml +1 -1
- package/templates/standalone/docker-compose.yml +1 -1
- package/templates/standalone/package.json +12 -3
- package/templates/standalone/src/__tests__/refresh-token-family-client-module.test.mts +180 -0
- package/templates/standalone/src/__tests__/smoke.test.mts +252 -8
- package/templates/standalone/src/app.mts +13 -40
- package/templates/standalone/src/buildModules.mts +120 -5
- package/templates/standalone/src/modules.mts +239 -24
- package/templates/versions.json +8 -8
- package/dist/__tests__/index.test.d.mts +0 -2
- package/dist/__tests__/index.test.d.mts.map +0 -1
- package/dist/__tests__/index.test.mjs +0 -281
- package/dist/__tests__/published-package.test.d.mts +0 -2
- package/dist/__tests__/published-package.test.d.mts.map +0 -1
- package/dist/__tests__/published-package.test.mjs +0 -73
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026 1o1 Co. Ltd.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*/
|
|
10
|
-
import { execFileSync } from "node:child_process";
|
|
11
|
-
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
12
|
-
import { tmpdir } from "node:os";
|
|
13
|
-
import { dirname, join, resolve } from "node:path";
|
|
14
|
-
import { fileURLToPath } from "node:url";
|
|
15
|
-
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
16
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
|
-
const CREATE_APP_DIR = resolve(__dirname, "../..");
|
|
18
|
-
describe("published-package install context (e2e)", () => {
|
|
19
|
-
let workspace;
|
|
20
|
-
let tarballPath;
|
|
21
|
-
beforeAll(() => {
|
|
22
|
-
workspace = mkdtempSync(join(tmpdir(), "create-auth-provider-e2e-"));
|
|
23
|
-
// Isolate npm's cache to a per-run directory so a polluted developer
|
|
24
|
-
// `~/.npm/_cacache/` (e.g. root-owned files left by a sudo install) cannot
|
|
25
|
-
// fail the test with EPERM. The prepack hook only needs to read the
|
|
26
|
-
// workspace, but `npm pack` itself touches the cache regardless.
|
|
27
|
-
const npmCache = join(workspace, "npm-cache");
|
|
28
|
-
// `npm pack` runs the `prepack` script (rimraf dist + copy-templates + tsc),
|
|
29
|
-
// so this exercises the same artifact npm publishes to the registry.
|
|
30
|
-
const stdout = execFileSync("npm", ["pack", "--pack-destination", workspace, "--json"], {
|
|
31
|
-
cwd: CREATE_APP_DIR,
|
|
32
|
-
encoding: "utf-8",
|
|
33
|
-
env: { ...process.env, npm_config_cache: npmCache },
|
|
34
|
-
});
|
|
35
|
-
const [packed] = JSON.parse(stdout);
|
|
36
|
-
tarballPath = join(workspace, packed.filename);
|
|
37
|
-
}, 120_000);
|
|
38
|
-
afterAll(() => {
|
|
39
|
-
if (workspace)
|
|
40
|
-
rmSync(workspace, { recursive: true, force: true });
|
|
41
|
-
});
|
|
42
|
-
it("scaffolds successfully when installed under a path containing 'node_modules'", () => {
|
|
43
|
-
// Regression for v0.5.0 npx bug: simulate the actual install layout
|
|
44
|
-
// (~/.npm/_npx/<hash>/node_modules/@o3co/create-auth-provider/) so the
|
|
45
|
-
// cpSync filter sees an absolute source path whose ancestors include
|
|
46
|
-
// 'node_modules'. Before the fix, the filter excluded every file and
|
|
47
|
-
// `cpSync` left the target directory empty.
|
|
48
|
-
const installRoot = join(workspace, "node_modules", "@o3co", "create-auth-provider");
|
|
49
|
-
mkdirSync(installRoot, { recursive: true });
|
|
50
|
-
execFileSync("tar", ["-xzf", tarballPath, "--strip-components=1", "-C", installRoot]);
|
|
51
|
-
const projectCwd = join(workspace, "scaffold-cwd");
|
|
52
|
-
mkdirSync(projectCwd);
|
|
53
|
-
execFileSync("node", [join(installRoot, "dist", "cli.mjs"), "my-test-project"], {
|
|
54
|
-
cwd: projectCwd,
|
|
55
|
-
encoding: "utf-8",
|
|
56
|
-
});
|
|
57
|
-
const targetDir = join(projectCwd, "my-test-project");
|
|
58
|
-
expect(existsSync(targetDir)).toBe(true);
|
|
59
|
-
expect(existsSync(join(targetDir, "package.json"))).toBe(true);
|
|
60
|
-
expect(existsSync(join(targetDir, "src", "app.mts"))).toBe(true);
|
|
61
|
-
expect(existsSync(join(targetDir, "config", "application.conf"))).toBe(true);
|
|
62
|
-
const pkg = JSON.parse(readFileSync(join(targetDir, "package.json"), "utf-8"));
|
|
63
|
-
expect(pkg.name).toBe("my-test-project");
|
|
64
|
-
for (const section of ["dependencies", "devDependencies", "peerDependencies"]) {
|
|
65
|
-
const deps = pkg[section];
|
|
66
|
-
if (!deps)
|
|
67
|
-
continue;
|
|
68
|
-
for (const [, version] of Object.entries(deps)) {
|
|
69
|
-
expect(version).not.toBe("workspace:*");
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}, 30_000);
|
|
73
|
-
});
|