Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@napi-rs/cli

Package Overview
Dependencies
Maintainers
1
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@napi-rs/cli - npm Package Compare versions

Comparing version 1.0.0-alpha.3 to 1.0.0-alpha.4

2

package.json
{
"name": "@napi-rs/cli",
"version": "1.0.0-alpha.3",
"version": "1.0.0-alpha.4",
"description": "Cli tools for napi-rs",

@@ -5,0 +5,0 @@ "keywords": [

import { Command } from 'clipanion';
export declare class ArtifactsCommand extends Command {
sourceDir: string;
targetDir: string;
distDir: string;
configFileName?: string;
execute(): Promise<void>;
}

@@ -9,2 +9,3 @@ "use strict";

const fdir_1 = require("fdir");
const consts_1 = require("./consts");
const debug_1 = require("./debug");

@@ -17,37 +18,17 @@ const utils_1 = require("./utils");

this.sourceDir = 'artifacts';
this.targetDir = '.';
this.distDir = 'npm';
}
execute() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const api = new fdir_1.fdir()
.withFullPaths()
.exclude((dirPath) => dirPath.includes('node_modules'))
.filter((filePath) => filePath.endsWith('package.json'))
.crawl(path_1.join(process.cwd(), this.targetDir));
const { platforms } = consts_1.getNapiConfig(this.configFileName);
const sourceApi = new fdir_1.fdir()
.withFullPaths()
.crawl(path_1.join(process.cwd(), this.sourceDir));
const distDirs = yield api.withPromise().then((output) => output
.map((packageJsonPath) => {
var _a;
const { dir } = path_1.parse(packageJsonPath);
const { napi } = require(packageJsonPath);
if (!napi) {
return null;
}
const napiName = (_a = napi === null || napi === void 0 ? void 0 : napi.name) !== null && _a !== void 0 ? _a : 'index';
debug(`Scan dir: [${chalk_1.default.yellowBright(dir)}], napi name: ${chalk_1.default.greenBright(napiName)}`);
return {
dir,
name: napiName,
};
})
.filter(Boolean));
const distDirs = platforms.map((platform) => path_1.join(process.cwd(), this.distDir, platform.platformArchABI));
yield sourceApi.withPromise().then((output) => Promise.all(output.map((filePath) => tslib_1.__awaiter(this, void 0, void 0, function* () {
var _a;
debug(`Read [${chalk_1.default.yellowBright(filePath)}]`);
const sourceContent = yield utils_1.readFileAsync(filePath);
const parsedName = path_1.parse(filePath);
const [fileName] = parsedName.name.split('.');
const { dir } = (_a = distDirs.find(({ name }) => name === fileName)) !== null && _a !== void 0 ? _a : {};
const [, platformArchABI] = parsedName.name.split('.');
const dir = distDirs.find((dir) => dir.includes(platformArchABI));
if (!dir) {

@@ -68,6 +49,10 @@ throw new TypeError(`No dist dir found for ${filePath}`);

tslib_1.__decorate([
clipanion_1.Command.String('-t,--target'),
clipanion_1.Command.String('--dist'),
tslib_1.__metadata("design:type", Object)
], ArtifactsCommand.prototype, "targetDir", void 0);
], ArtifactsCommand.prototype, "distDir", void 0);
tslib_1.__decorate([
clipanion_1.Command.String('-c,--config'),
tslib_1.__metadata("design:type", String)
], ArtifactsCommand.prototype, "configFileName", void 0);
tslib_1.__decorate([
clipanion_1.Command.Path('artifacts'),

@@ -74,0 +59,0 @@ tslib_1.__metadata("design:type", Function),

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc