New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

accent-cli

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accent-cli - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

2

.oclif.manifest.json

@@ -1,1 +0,1 @@

{"version":"0.9.1","commands":{"export":{"id":"export","description":"Export files from Accent and write them to your local filesystem","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent export"],"flags":{"order-by":{"name":"order-by","type":"option","description":"Will be used in the export call as the order of the keys","options":["index","key-asc"],"default":"index"}},"args":[]},"jipt":{"id":"jipt","description":"Export jipt files from Accent and write them to your local filesystem","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent jipt"],"flags":{},"args":[{"name":"pseudoLanguageName","description":"The pseudo language for in-place-translation-editing","required":true}]},"stats":{"id":"stats","description":"Fetch stats from the API and display it beautifully","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent stats"],"flags":{},"args":[]},"sync":{"id":"sync","description":"Sync files in Accent and write them to your local filesystem","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent sync"],"flags":{"add-translations":{"name":"add-translations","type":"boolean","description":"Add translations in Accent to help translators if you already have translated strings","allowNo":false},"dry-run":{"name":"dry-run","type":"boolean","description":"Do not write the file from the export _after_ the operation","allowNo":false},"merge-type":{"name":"merge-type","type":"option","description":"Will be used in the add translations call as the \"merge_type\" param","options":["smart","passive","force"],"default":"smart"},"order-by":{"name":"order-by","type":"option","description":"Will be used in the export call as the order of the keys","options":["index","key-asc"],"default":"index"},"sync-type":{"name":"sync-type","type":"option","description":"Will be used in the sync call as the \"sync_type\" param","options":["smart","passive"],"default":"smart"}},"args":[]}}}
{"version":"0.9.2","commands":{"export":{"id":"export","description":"Export files from Accent and write them to your local filesystem","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent export"],"flags":{"order-by":{"name":"order-by","type":"option","description":"Will be used in the export call as the order of the keys","options":["index","key-asc"],"default":"index"}},"args":[]},"jipt":{"id":"jipt","description":"Export jipt files from Accent and write them to your local filesystem","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent jipt"],"flags":{},"args":[{"name":"pseudoLanguageName","description":"The pseudo language for in-place-translation-editing","required":true}]},"stats":{"id":"stats","description":"Fetch stats from the API and display it beautifully","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent stats"],"flags":{},"args":[]},"sync":{"id":"sync","description":"Sync files in Accent and write them to your local filesystem","pluginName":"accent-cli","pluginType":"core","aliases":[],"examples":["$ accent sync"],"flags":{"add-translations":{"name":"add-translations","type":"boolean","description":"Add translations in Accent to help translators if you already have translated strings","allowNo":false},"dry-run":{"name":"dry-run","type":"boolean","description":"Do not write the file from the export _after_ the operation","allowNo":false},"merge-type":{"name":"merge-type","type":"option","description":"Will be used in the add translations call as the \"merge_type\" param","options":["smart","passive","force"],"default":"smart"},"order-by":{"name":"order-by","type":"option","description":"Will be used in the export call as the order of the keys","options":["index","key-asc"],"default":"index"},"sync-type":{"name":"sync-type","type":"option","description":"Will be used in the sync call as the \"sync_type\" param","options":["smart","passive"],"default":"smart"}},"args":[]}}}

@@ -11,3 +11,3 @@ "use strict";

const project_fetcher_1 = require("./services/project-fetcher");
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const sleep = async (ms) => new Promise((resolve) => setTimeout(resolve, ms));
class default_1 extends command_1.default {

@@ -14,0 +14,0 @@ constructor() {

@@ -24,6 +24,6 @@ "use strict";

const targets = new document_paths_fetcher_1.default().fetch(this.project, document);
await Promise.all(targets.map(({ path, language, documentPath }) => {
await Promise.all(targets.map(async ({ path, language, documentPath }) => {
const localFile = document.fetchLocalFile(documentPath, path);
if (!localFile)
return new Promise(resolve => resolve());
return new Promise((resolve) => resolve());
formatter.log(localFile);

@@ -43,5 +43,5 @@ return document.export(localFile, language, documentPath, flags);

description: 'Will be used in the export call as the order of the keys',
options: ['index', 'key-asc']
})
options: ['index', 'key-asc'],
}),
};
exports.default = Export;

@@ -23,3 +23,3 @@ "use strict";

const targets = new document_jipt_paths_fetcher_1.default().fetch(this.project, document, args.pseudoLanguageName);
await Promise.all(targets.map(({ path, documentPath }) => {
await Promise.all(targets.map(async ({ path, documentPath }) => {
formatter.log(path);

@@ -38,6 +38,6 @@ return document.exportJipt(path, documentPath);

name: 'pseudoLanguageName',
required: true
}
required: true,
},
];
Jipt.flags = {};
exports.default = Jipt;

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

class Stats extends base_1.default {
/* eslint-disable @typescript-eslint/require-await */
async run() {

@@ -10,0 +11,0 @@ const formatter = new project_stats_1.default(this.project);

@@ -49,6 +49,6 @@ "use strict";

const targets = new document_paths_fetcher_1.default().fetch(this.project, document);
await Promise.all(targets.map(({ path, language, documentPath }) => {
await Promise.all(targets.map(async ({ path, language, documentPath }) => {
const localFile = document.fetchLocalFile(documentPath, path);
if (!localFile)
return new Promise(resolve => resolve());
return new Promise((resolve) => resolve());
formatter.log(localFile);

@@ -107,7 +107,7 @@ return document.export(localFile, language, documentPath, flags);

'add-translations': command_1.flags.boolean({
description: 'Add translations in Accent to help translators if you already have translated strings'
description: 'Add translations in Accent to help translators if you already have translated strings',
}),
'dry-run': command_1.flags.boolean({
default: false,
description: 'Do not write the file from the export _after_ the operation'
description: 'Do not write the file from the export _after_ the operation',
}),

@@ -117,3 +117,3 @@ 'merge-type': command_1.flags.string({

description: 'Will be used in the add translations call as the "merge_type" param',
options: ['smart', 'passive', 'force']
options: ['smart', 'passive', 'force'],
}),

@@ -123,3 +123,3 @@ 'order-by': command_1.flags.string({

description: 'Will be used in the export call as the order of the keys',
options: ['index', 'key-asc']
options: ['index', 'key-asc'],
}),

@@ -129,5 +129,5 @@ 'sync-type': command_1.flags.string({

description: 'Will be used in the sync call as the "sync_type" param',
options: ['smart', 'passive']
})
options: ['smart', 'passive'],
}),
};
exports.default = Sync;

@@ -24,5 +24,5 @@ "use strict";

files() {
return this.config.files.map(documentConfig => new document_1.default(documentConfig, this.config));
return this.config.files.map((documentConfig) => new document_1.default(documentConfig, this.config));
}
}
exports.default = ConfigFetcher;

@@ -7,3 +7,3 @@ "use strict";

.map(({ path }) => path)
.map(path => {
.map((path) => {
const parsedTarget = document.target

@@ -15,3 +15,3 @@ .replace('%slug%', pseudoLanguageName)

language: pseudoLanguageName,
path: parsedTarget
path: parsedTarget,
};

@@ -18,0 +18,0 @@ });

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

return languageSlugs.reduce((memo, slug) => {
documentPaths.forEach(path => {
documentPaths.forEach((path) => {
const parsedTarget = document.target

@@ -12,0 +12,0 @@ .replace('%slug%', slug)

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

const document_config_1 = require("../types/document-config");
const ERROR_THRESHOLD_STATUS_CODE = 400;
class Document {

@@ -41,3 +42,3 @@ constructor(documentConfig, config) {

headers: this.authorizationHeader(),
method: 'POST'
method: 'POST',
});

@@ -61,3 +62,3 @@ return this.handleResponse(response, options, "sync" /* Sync */);

headers: this.authorizationHeader(),
method: 'POST'
method: 'POST',
});

@@ -81,7 +82,7 @@ return this.handleResponse(response, options, "addTranslations" /* AddTranslation */);

['order_by', options['order-by']],
['language', language]
['language', language],
];
const url = `${this.apiUrl}/export?${this.encodeQuery(query)}`;
const response = await node_fetch_1.default(url, {
headers: this.authorizationHeader()
headers: this.authorizationHeader(),
});

@@ -93,7 +94,7 @@ return this.writeResponseToFile(response, file);

['document_path', documentPath],
['document_format', this.config.format]
['document_format', this.config.format],
];
const url = `${this.apiUrl}/jipt-export?${this.encodeQuery(query)}`;
const response = await node_fetch_1.default(url, {
headers: this.authorizationHeader()
headers: this.authorizationHeader(),
});

@@ -139,3 +140,3 @@ return this.writeResponseToFile(response, file);

}
writeResponseToFile(response, file) {
async writeResponseToFile(response, file) {
return new Promise((resolve, reject) => {

@@ -151,3 +152,3 @@ mkdirp.sync(path.dirname(file));

if (!options['dry-run']) {
if (response.status >= 400) {
if (response.status >= ERROR_THRESHOLD_STATUS_CODE) {
return { [operationName]: { success: false }, peek: false };

@@ -154,0 +155,0 @@ }

@@ -11,3 +11,3 @@ "use strict";

console.log(chalk_1.default.yellow('➤ '), chalk_1.default.bold(chalk_1.default.yellow(`${operation}:`)));
commands.forEach(command => {
commands.forEach((command) => {
console.log(' ', chalk_1.default.yellow(command));

@@ -14,0 +14,0 @@ });

@@ -10,3 +10,3 @@ "use strict";

const languages = project.revisions
.filter(revision => revision_slug_fetcher_1.fetchFromRevision(revision) !==
.filter((revision) => revision_slug_fetcher_1.fetchFromRevision(revision) !==
revision_slug_fetcher_1.fetchFromRevision(project.masterRevision))

@@ -13,0 +13,0 @@ .map(revision_slug_fetcher_1.fetchFromRevision)

@@ -30,3 +30,3 @@ "use strict";

if (this.project.revisions.length > 1) {
console.log(chalk_1.default.magenta(`Translations (${this.project.revisions.length - 1})`));
console.log(chalk_1.default.magenta('Translations', `(${this.project.revisions.length - 1})`));
this.project.revisions.forEach((revision) => {

@@ -39,4 +39,4 @@ if (this.project.masterRevision.id !== revision.id) {

}
if (this.project.documents.entries.length !== 0) {
console.log(chalk_1.default.magenta('Documents'));
if (this.project.documents.meta.totalEntries !== 0) {
console.log(chalk_1.default.magenta('Documents', `(${this.project.documents.meta.totalEntries})`));
this.project.documents.entries.forEach((document) => {

@@ -43,0 +43,0 @@ console.log(' ', chalk_1.default.gray('Format:'), chalk_1.default.white.bold(document.format));

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

}
/* eslint-disable @typescript-eslint/require-await */
async run(name) {

@@ -14,0 +15,0 @@ if (!this.hooks)

@@ -15,3 +15,3 @@ "use strict";

}
graphql(config) {
async graphql(config) {
const query = `query ProjectDetails($project_id: ID!) {

@@ -36,3 +36,6 @@ viewer {

documents {
documents(pageSize: 1000) {
meta {
totalEntries
}
entries {

@@ -62,9 +65,9 @@ id

}`;
return node_fetch_1.default(`${config.apiUrl}/graphql`, {
return await node_fetch_1.default(`${config.apiUrl}/graphql`, {
body: JSON.stringify({ query }),
headers: {
'Content-Type': 'application/json',
authorization: `Bearer ${config.apiKey}`
authorization: `Bearer ${config.apiKey}`,
},
method: 'POST'
method: 'POST',
});

@@ -71,0 +74,0 @@ }

export interface OperationResponse {
[x: string]: any;
peek: any;
[x: string]: any;
}

@@ -20,4 +20,8 @@ export interface Language {

}
interface DocumentsMeta {
totalEntries: number;
}
export interface PaginatedDocuments {
entries: Document[];
meta: DocumentsMeta;
}

@@ -32,1 +36,2 @@ export interface Project {

}
export {};
{
"name": "accent-cli",
"version": "0.9.1",
"version": "0.9.2",
"author": "Simon Prévost",

@@ -26,4 +26,3 @@ "description": "Accent CLI",

"node-fetch": "2.3.0",
"tslib": "1.9.3",
"tslint-config-prettier": "1.17.0"
"tslib": "1.9.3"
},

@@ -33,3 +32,2 @@ "devDependencies": {

"@oclif/test": "1.0.1",
"@oclif/tslint": "3.1.1",
"@types/chai": "4.1.2",

@@ -43,3 +41,2 @@ "@types/mkdirp": "0.5.2",

"ts-node": "7.0.1",
"tslint": "5.11.0",
"typescript": "3.2.2"

@@ -46,0 +43,0 @@ },

@@ -22,3 +22,3 @@ Accent CLI

$ accent (-v|--version|version)
accent-cli/0.9.1 darwin-x64 node-v10.14.2
accent-cli/0.9.2 darwin-x64 node-v10.16.3
$ accent --help [COMMAND]

@@ -96,3 +96,3 @@ USAGE

_See code: [src/commands/export.ts](https://github.com/mirego/accent/blob/v0.9.1/src/commands/export.ts)_
_See code: [src/commands/export.ts](https://github.com/mirego/accent/blob/v0.9.2/src/commands/export.ts)_

@@ -131,3 +131,3 @@ ## `accent help [COMMAND]`

_See code: [src/commands/jipt.ts](https://github.com/mirego/accent/blob/v0.9.1/src/commands/jipt.ts)_
_See code: [src/commands/jipt.ts](https://github.com/mirego/accent/blob/v0.9.2/src/commands/jipt.ts)_

@@ -146,3 +146,3 @@ ## `accent stats`

_See code: [src/commands/stats.ts](https://github.com/mirego/accent/blob/v0.9.1/src/commands/stats.ts)_
_See code: [src/commands/stats.ts](https://github.com/mirego/accent/blob/v0.9.2/src/commands/stats.ts)_

@@ -173,3 +173,3 @@ ## `accent sync`

_See code: [src/commands/sync.ts](https://github.com/mirego/accent/blob/v0.9.1/src/commands/sync.ts)_
_See code: [src/commands/sync.ts](https://github.com/mirego/accent/blob/v0.9.2/src/commands/sync.ts)_
<!-- commandsstop -->

@@ -176,0 +176,0 @@

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