Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modules transition #1909

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "modules transition",
"packageName": "@ni/nimble-tokens",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "modules transition",
"packageName": "@ni/xliff-to-json-converter",
"email": "[email protected]",
"dependentChangeType": "none"
}
2,677 changes: 1,286 additions & 1,391 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"type": "git",
"url": "git+https://github.com/ni/nimble.git"
},
"type": "module",
"author": {
"name": "National Instruments"
},
Expand Down Expand Up @@ -48,5 +49,13 @@
"cross-env": "^7.0.3",
"patch-package": "^8.0.0",
"playwright": "1.40.0"
},
"peerDependencies": {
"svg-to-ts": "*"
},
"overrides": {
"svg-to-ts": {
"cosmiconfig": "^8.0.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
ecmaVersion: '2020'
},
files: [
'source/styledictionary/*.js',
'source/styledictionary/*.cjs',
],
rules: {
// Build scripts will not be in published package and are allowed to use devDependencies
Expand Down
9 changes: 5 additions & 4 deletions packages/nimble-tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"description": "Design tokens for the NI Nimble Design System",
"scripts": {
"build": "npm run build:svg-to-ts && npm run build:ts && npm run build:svg-to-ico && npm run build:generate-font-scss && npm run build:style-dictionary",
"build:svg-to-ts": "svg-to-ts-constants --config build/svg-to-ts-config.js",
"build:svg-to-ico": "node build/svg-to-ico.js",
"build:generate-font-scss": "node build/generate-font-scss.js",
"build:style-dictionary": "cd source/styledictionary && node build.js",
"build:svg-to-ts": "svg-to-ts-constants --config build/svg-to-ts-config.cjs",
"build:svg-to-ico": "node build/svg-to-ico.cjs",
"build:generate-font-scss": "node build/generate-font-scss.cjs",
"build:style-dictionary": "cd source/styledictionary && node build.cjs",
"build:ts": "tsc -p ./tsconfig.json",
"build:ts:watch": "tsc -p ./tsconfig.json -w",
"format": "eslint . --fix",
Expand All @@ -24,6 +24,7 @@
"type": "git",
"url": "git+https://github.com/ni/nimble.git"
},
"type": "module",
"publishConfig": {
"access": "public"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require('./config');
require('./nimble-extensions');
require('./config.cjs');
require('./nimble-extensions.cjs');
const StyleDictionary = require('style-dictionary');

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/xliff-to-json-converter/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*
!/dist/commonjs/**
!/dist/esm/**
*.spec.*
*.tsbuildinfo
3 changes: 2 additions & 1 deletion packages/xliff-to-json-converter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@ni/xliff-to-json-converter",
"version": "1.1.4",
"description": "A utility to convert translation files from XLIFF to JSON for Angular localization",
"main": "dist/commonjs/cli.js",
"main": "dist/esm/cli.js",
"bin": {
"xliff-to-json-converter": "./dist/commonjs/cli.js"
},
Expand All @@ -22,6 +22,7 @@
"url": "git+https://github.com/ni/nimble.git",
"directory": "packages/xliff-to-json-converter"
},
"type": "module",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/xliff-to-json-converter/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { convertXliff2Json } from './convert';
import { convertXliff2Json } from './convert.js';

// This is how yargs expects to be run at the entry point of a cli application
// eslint-disable-next-line @typescript-eslint/no-unused-expressions, @typescript-eslint/no-floating-promises
Expand Down
4 changes: 2 additions & 2 deletions packages/xliff-to-json-converter/src/convert.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { xliff2Json } from './convert';
import { parseXliff } from './xliff-file';
import { xliff2Json } from './convert.js';
import { parseXliff } from './xliff-file.js';

describe('xliff2Json', () => {
it('produces an object with language and translations', async () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/xliff-to-json-converter/src/convert.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { XliffFile, XliffTranslationArray, XliffTranslationObject, XliffTranslationString } from 'xliff';
import { JsonFile, saveJson, Translations } from './json-file';
import { Writeable } from './util';
import { loadXliff } from './xliff-file';
import { JsonFile, saveJson, Translations } from './json-file.js';
import { Writeable } from './util.js';
import { loadXliff } from './xliff-file.js';

export async function convertXliff2Json(src: string, dst: string): Promise<void> {
const xliff = await loadXliff(src);
Expand Down
2 changes: 1 addition & 1 deletion packages/xliff-to-json-converter/src/json-file.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { stringify, JsonFile } from './json-file';
import { stringify, JsonFile } from './json-file.js';

describe('JsonFile', () => {
it('can convert to string', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/xliff-to-json-converter/src/json-file.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { writeFileSync } from 'fs';
import { writeFileSync } from 'node:fs';

export interface Translations {
readonly [translationId: string]: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/xliff-to-json-converter/src/xliff-file.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readFileSync } from 'fs';
import { readFileSync } from 'node:fs';
import { xliff12ToJs, XliffFile } from 'xliff';

export async function loadXliff(path: string): Promise<XliffFile> {
Expand Down
4 changes: 2 additions & 2 deletions packages/xliff-to-json-converter/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
/* Visit https://www.typescriptlang.org/tsconfig to read more about this file */

"target": "ES2020",
"module": "commonjs",
"module": "ES2020",
"moduleResolution": "node",
"outDir": "./dist/commonjs",
"outDir": "./dist/esm",
"importHelpers": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
Expand Down
Loading