Socket
Socket
Sign inDemoInstall

@wixc3/docs

Package Overview
Dependencies
Maintainers
65
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wixc3/docs - npm Package Compare versions

Comparing version 3.0.7 to 3.1.0

8

dist/cjs/build-docs/build-steps.js

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

const builtinMacros = __importStar(require("../macros"));
const prettier_1 = require("prettier");
const child_process_1 = require("child_process");
function analyze(config) {

@@ -96,7 +96,3 @@ console.time('Analyzing APIs...');

console.time('Prettifying');
(0, fs_1.readdirSync)((0, common_1._docs)(config), { withFileTypes: true })
.filter((f) => f.isFile())
.map(({ name }) => {
(0, fs_1.writeFileSync)((0, common_1._docs)(config, name), (0, prettier_1.format)((0, fs_1.readFileSync)((0, common_1._docs)(config, name), 'utf8'), { parser: 'markdown' }));
});
(0, child_process_1.spawnSync)('npx', ['prettier', (0, common_1._docs)(config), '--write']);
console.timeEnd('Prettifying');

@@ -103,0 +99,0 @@ }

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

const cli_options_1 = require("./cli.options");
const prettier_1 = require("prettier");
const child_process_1 = require("child_process");
function createReadme(config, siteUrl = cli_options_1.siteUrl.default) {

@@ -20,4 +20,4 @@ if (siteUrl === cli_options_1.siteUrl.default) {

}
content = (0, prettier_1.format)(content, { parser: 'markdown' });
(0, fs_1.writeFileSync)((0, common_1._packages)(config, pkg.dir, 'README.md'), content, 'utf8');
(0, child_process_1.spawnSync)('npx', ['prettier', (0, common_1._packages)(config, pkg.dir, 'README.md'), '--write']);
};

@@ -24,0 +24,0 @@ (0, common_1.listPackages)(config).map((pkg) => copyWithSiteUrlLinks(pkg));

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

const api_extractor_model_1 = require("@microsoft/api-extractor-model");
const prettier_1 = require("prettier");
const glob_1 = require("glob");

@@ -11,2 +10,3 @@ const common_1 = require("./common");

const chai_1 = require("chai");
const typescript_1 = require("@wixc3/typescript");
function validateExamples(config, apiJsons = '*.api.json') {

@@ -32,7 +32,9 @@ const glob = new glob_1.GlobSync((0, common_1._temp)(config, apiJsons));

function validateSameCode(a, b, message = '') {
const [ma, mb] = [a, b].map((code) => (0, prettier_1.format)((code || '')
.split(/\r?\n\s*\*?\s*/)
.filter((i) => i)
.join('\n') || '', { parser: 'typescript' }));
(0, chai_1.expect)(ma).to.equal(mb, message);
if (a !== b) {
const [ma, mb] = [a, b].map((code) => (code || '')
.split(/\r?\n\s*\*?\s*?/)
.filter((i) => i)
.join('\n'));
(0, typescript_1.isSame)((0, typescript_1.compileCode)(ma || ''), (0, typescript_1.compileCode)(mb || ''), () => false, (a, b) => (0, chai_1.expect)(a).to.equal(b, message));
}
}

@@ -39,0 +41,0 @@ function validateNode(config, item, pkg, examples) {

@@ -10,3 +10,3 @@ /* eslint-disable no-console */

import * as builtinMacros from '../macros';
import { format } from 'prettier';
import { spawnSync } from 'child_process';
export function analyze(config) {

@@ -67,9 +67,5 @@ console.time('Analyzing APIs...');

console.time('Prettifying');
readdirSync(_docs(config), { withFileTypes: true })
.filter((f) => f.isFile())
.map(({ name }) => {
writeFileSync(_docs(config, name), format(readFileSync(_docs(config, name), 'utf8'), { parser: 'markdown' }));
});
spawnSync('npx', ['prettier', _docs(config), '--write']);
console.timeEnd('Prettifying');
}
//# sourceMappingURL=build-steps.js.map

@@ -5,3 +5,3 @@ import { backSlash } from '@wixc3/fs-utils';

import { siteUrl as site } from './cli.options';
import { format } from 'prettier';
import { spawnSync } from 'child_process';
export function createReadme(config, siteUrl = site.default) {

@@ -17,4 +17,4 @@ if (siteUrl === site.default) {

}
content = format(content, { parser: 'markdown' });
writeFileSync(_packages(config, pkg.dir, 'README.md'), content, 'utf8');
spawnSync('npx', ['prettier', _packages(config, pkg.dir, 'README.md'), '--write']);
};

@@ -21,0 +21,0 @@ listPackages(config).map((pkg) => copyWithSiteUrlLinks(pkg));

import { ApiPackage } from '@microsoft/api-extractor-model';
import { format } from 'prettier';
import { GlobSync } from 'glob';

@@ -7,2 +6,3 @@ import { getPackageByName, _packages, _temp } from './common';

import { expect } from 'chai';
import { compileCode, isSame } from '@wixc3/typescript';
export function validateExamples(config, apiJsons = '*.api.json') {

@@ -27,7 +27,9 @@ const glob = new GlobSync(_temp(config, apiJsons));

function validateSameCode(a, b, message = '') {
const [ma, mb] = [a, b].map((code) => format((code || '')
.split(/\r?\n\s*\*?\s*/)
.filter((i) => i)
.join('\n') || '', { parser: 'typescript' }));
expect(ma).to.equal(mb, message);
if (a !== b) {
const [ma, mb] = [a, b].map((code) => (code || '')
.split(/\r?\n\s*\*?\s*?/)
.filter((i) => i)
.join('\n'));
isSame(compileCode(ma || ''), compileCode(mb || ''), () => false, (a, b) => expect(a).to.equal(b, message));
}
}

@@ -34,0 +36,0 @@ function validateNode(config, item, pkg, examples) {

{
"name": "@wixc3/docs",
"version": "3.0.7",
"version": "3.1.0",
"description": "API ",

@@ -30,6 +30,6 @@ "main": "dist/cjs/index.js",

"@wixc3/fs-utils": "^3.0.7",
"@wixc3/typescript": "^3.1.0",
"glob": "^8.0.3",
"prettier": "^2.8.0",
"yargs": "^17.6.2"
}
}

@@ -11,3 +11,3 @@ /* eslint-disable no-console */

import * as builtinMacros from '../macros';
import { format } from 'prettier';
import { spawnSync } from 'child_process';
export type { Macros };

@@ -73,11 +73,4 @@

console.time('Prettifying');
readdirSync(_docs(config), { withFileTypes: true })
.filter((f) => f.isFile())
.map(({ name }) => {
writeFileSync(
_docs(config, name),
format(readFileSync(_docs(config, name), 'utf8'), { parser: 'markdown' })
);
});
spawnSync('npx', ['prettier', _docs(config), '--write']);
console.timeEnd('Prettifying');
}

@@ -5,3 +5,3 @@ import { backSlash } from '@wixc3/fs-utils';

import { siteUrl as site } from './cli.options';
import { format } from 'prettier';
import { spawnSync } from 'child_process';

@@ -18,4 +18,4 @@ export function createReadme(config: Config, siteUrl: string = site.default) {

}
content = format(content, { parser: 'markdown' });
writeFileSync(_packages(config, pkg.dir, 'README.md'), content, 'utf8');
spawnSync('npx', ['prettier', _packages(config, pkg.dir, 'README.md'), '--write']);
};

@@ -22,0 +22,0 @@ listPackages(config).map((pkg) => copyWithSiteUrlLinks(pkg));

@@ -36,3 +36,3 @@ /* eslint-disable @typescript-eslint/no-unsafe-return */

it('builds readme files in the docs directory', function () {
buildDocs(config, { validateExamples: false, analyze: false });
buildDocs(config, { validateExamples: false, analyze: false, prettify: false });

@@ -39,0 +39,0 @@ expect(docExists('index.md')).to.equal(true);

@@ -58,10 +58,12 @@ import { expect } from 'chai';

it('validates examples', () => {
const exec = spawnSync('yarn', ['docs', 'build', ...args]);
expect(exec.status, exec.stderr.toString()).to.equal(1);
const execInvalid = spawnSync('yarn', ['docs', 'build', ...args]);
expect(execInvalid.status, execInvalid.stderr.toString()).to.equal(1);
removeFailingPackages();
const execValid = spawnSync('yarn', ['docs', 'build', '-a', ...args]);
expect(execValid.status, execValid.stderr.toString()).to.equal(0);
});
it('generates docs', () => {
rmSync(_packages(config, 'one'), { force: true, recursive: true });
rmSync(_packages(config, 'weird'), { force: true, recursive: true });
removeFailingPackages();
const exec = spawnSync('yarn', ['docs', 'build', '-b', config.base, '-c', config.conf]);
const exec = spawnSync('yarn', ['docs', 'build', ...args]);
expect(exec.status, exec.stderr.toString()).to.equal(0);

@@ -78,3 +80,3 @@ expect(existsSync(_docs(config, 'index.md'))).to.equal(true, 'failed docs build');

const exec = spawnSync('yarn', ['docs', 'build', '-b', config.base, '-c', config.conf]);
const exec = spawnSync('yarn', ['docs', 'build', ...args]);
expect(exec.status, exec.stderr.toString()).to.equal(0);

@@ -91,1 +93,7 @@ });

});
function removeFailingPackages() {
rmSync(_packages(config, 'one'), { force: true, recursive: true });
rmSync(_packages(config, 'weird'), { force: true, recursive: true });
rmSync(_temp(config, 'one.api.json'), { force: true });
rmSync(_temp(config, 'different-name.api.json'), { force: true });
}

@@ -5,4 +5,4 @@ /**

* ```ts (Example1)
* const value = test1();
* expect(value).to.equal(1);
* const value = test1();
* expect(value).to.equal(1);
* ```

@@ -9,0 +9,0 @@ */

@@ -8,4 +8,4 @@ "use strict";

* ```ts (Example1)
* const value = test1();
* expect(value).to.equal(1);
* const value = test1();
* expect(value).to.equal(1);
* ```

@@ -12,0 +12,0 @@ */

@@ -5,4 +5,4 @@ /**

* ```ts (Example1)
* const value = test1();
* expect(value).to.equal(1);
* const value = test1();
* expect(value).to.equal(1);
* ```

@@ -9,0 +9,0 @@ */

@@ -8,2 +8,3 @@ import { expect } from 'chai';

describe('validateExamples', function () {
this.timeout(5_000);
before(() => setup());

@@ -10,0 +11,0 @@ before(function () {

@@ -7,3 +7,3 @@ {

},
"references": [{ "path": "../../common/src" }, { "path": "../../fs-utils/src" }]
"references": [{ "path": "../../common/src" }, { "path": "../../fs-utils/src" }, { "path": "../../typescript/src" }]
}
import { ApiPackage, ApiDeclaredItem, ApiItem } from '@microsoft/api-extractor-model';
import { format } from 'prettier';
import { GlobSync } from 'glob';

@@ -7,2 +6,3 @@ import { UserConfig, getPackageByName, Package, _packages, _temp, Config } from './common';

import { expect } from 'chai';
import { compileCode, isSame } from '@wixc3/typescript';

@@ -30,12 +30,16 @@ export function validateExamples(config: Config, apiJsons = '*.api.json') {

function validateSameCode(a?: string, b?: string, message = '') {
const [ma, mb] = [a, b].map((code) =>
format(
if (a !== b) {
const [ma, mb] = [a, b].map((code) =>
(code || '')
.split(/\r?\n\s*\*?\s*/)
.split(/\r?\n\s*\*?\s*?/)
.filter((i) => i)
.join('\n') || '',
{ parser: 'typescript' }
)
);
expect(ma).to.equal(mb, message);
.join('\n')
);
isSame(
compileCode(ma || ''),
compileCode(mb || ''),
() => false,
(a, b) => expect(a).to.equal(b, message)
);
}
}

@@ -42,0 +46,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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