@pactflow/drift 0.0.1 → 2603.0.1-beta

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/README.md CHANGED
@@ -1,45 +1,21 @@
1
- # @pactflow/drift
1
+ # drift-npm
2
2
 
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
3
+ This package wraps the drift CLI for your platform. After installing, the `drift` command will be available in your local node_modules/.bin directory.
4
4
 
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
5
+ ## Usage
6
6
 
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
7
+ ```
8
+ npm install @pactflow/drift
9
+ npx drift --help
10
+ ```
8
11
 
9
- ## Purpose
12
+ ## How it works
13
+ - On install, downloads the correct binary for your OS/arch from https://download.pactflow.io/drift/{version}/
14
+ - No JS API is exported; only the CLI is available
10
15
 
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@pactflow/drift`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
15
-
16
- ## What is OIDC Trusted Publishing?
17
-
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
19
-
20
- ## Setup Instructions
21
-
22
- To properly configure OIDC trusted publishing for this package:
23
-
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
28
-
29
- ## DO NOT USE THIS PACKAGE
30
-
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
36
-
37
- ## More Information
38
-
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
42
-
43
- ---
44
-
45
- **Maintained for OIDC setup purposes only**
16
+ ## Supported platforms
17
+ - linux-aarch64
18
+ - linux-x86_64
19
+ - macos-aarch64
20
+ - macos-x86_64
21
+ - windows-x86_64
package/bin/drift ADDED
Binary file
Binary file
Binary file
package/bin/drift-repl ADDED
Binary file
Binary file
Binary file
@@ -0,0 +1,26 @@
1
+ # Drift config file
2
+
3
+ # Log level to default to
4
+ log_level = "info"
5
+
6
+ # Plugin directory override
7
+ #plugin_dir = "/home/user/.drift/plugins"
8
+
9
+ # Core plugins to always load
10
+ #core_plugins = [
11
+ # "oas",
12
+ # "json"
13
+ #]
14
+
15
+ # Log entries to exclude
16
+ [log_filters]
17
+ hyper_util = "info"
18
+ wasmtime_wasi = "info"
19
+ #"[plugin{name=oas}]" = "ERROR"
20
+
21
+ # Plugin specific config
22
+ #[plugin_config.json]
23
+ #content_types = ["application/thrift"]
24
+ #
25
+ # [plugin_config.http-dump]
26
+ # logLevel = "INFO"
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,10 +1,21 @@
1
1
  {
2
2
  "name": "@pactflow/drift",
3
- "version": "0.0.1",
4
- "description": "OIDC trusted publishing setup package for @pactflow/drift",
5
- "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
9
- ]
3
+ "version": "2603.0.1-beta",
4
+ "description": "Wraps the drift CLI for your platform.",
5
+ "bin": {
6
+ "drift": "bin/drift"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "node scripts/postinstall.js",
10
+ "test:smoke": "node tests/smoke.js"
11
+ },
12
+ "files": [
13
+ "bin/",
14
+ "scripts/"
15
+ ],
16
+ "author": "",
17
+ "license": "MIT",
18
+ "dependencies": {
19
+ "tar": "^7.5.9"
20
+ }
10
21
  }
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+ // postinstall.js: Download and extract the correct drift binary for the user's OS/arch
3
+ const https = require('https');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { execSync } = require('child_process');
7
+
8
+ const version = process.env.npm_package_version;
9
+ if (!version) {
10
+ console.error('Error: npm_package_version is not set');
11
+ process.exit(1);
12
+ }
13
+ const platform = process.platform;
14
+ const arch = process.arch;
15
+
16
+ function getOsArch() {
17
+ if (platform === 'darwin') {
18
+ if (arch === 'arm64') return 'macos-aarch64.tgz';
19
+ if (arch === 'x64') return 'macos-x86_64.tgz';
20
+ } else if (platform === 'linux') {
21
+ if (arch === 'arm64') return 'linux-aarch64.tgz';
22
+ if (arch === 'x64') return 'linux-x86_64.tgz';
23
+ } else if (platform === 'win32') {
24
+ if (arch === 'x64') return 'windows-x86_64.tgz';
25
+ }
26
+ throw new Error(`Unsupported platform/arch: ${platform}/${arch}`);
27
+ }
28
+
29
+ function downloadAndExtract(url, destDir) {
30
+ return new Promise((resolve, reject) => {
31
+ const tar = require('tar');
32
+ https.get(url, (res) => {
33
+ if (res.statusCode !== 200) {
34
+ reject(new Error(`Failed to download: ${url} (status ${res.statusCode})`));
35
+ return;
36
+ }
37
+ res.pipe(tar.x({ C: destDir }))
38
+ .on('finish', resolve)
39
+ .on('error', reject);
40
+ }).on('error', reject);
41
+ });
42
+ }
43
+
44
+ (async () => {
45
+ try {
46
+ const osArch = getOsArch();
47
+ const url = `https://download.pactflow.io/drift/${version}/${osArch}`;
48
+ const destDir = path.resolve(__dirname, '../bin');
49
+ if (!fs.existsSync(destDir)) fs.mkdirSync(destDir);
50
+ console.log(`Downloading drift CLI from ${url} ...`);
51
+ await downloadAndExtract(url, destDir);
52
+ // Make sure binary is executable (non-windows)
53
+ if (platform !== 'win32') {
54
+ execSync('chmod +x drift', { cwd: destDir });
55
+ }
56
+ console.log('drift CLI installed successfully.');
57
+ } catch (err) {
58
+ console.error('Failed to install drift CLI:', err);
59
+ process.exit(1);
60
+ }
61
+ })();